Search in sources :

Example 1 with ModifyVmNicConfigCommand

use of com.cloud.agent.api.ModifyVmNicConfigCommand in project cloudstack by apache.

the class HypervDirectConnectResource method modifyNicVlan.

protected void modifyNicVlan(final String vmName, final String vlanId, final int pos, final boolean enable, final String switchLabelName) {
    final ModifyVmNicConfigCommand modifyNic = new ModifyVmNicConfigCommand(vmName, vlanId, pos, enable);
    modifyNic.setSwitchLableName(switchLabelName);
    URI agentUri = null;
    try {
        final String cmdName = ModifyVmNicConfigCommand.class.getName();
        agentUri = new URI("https", null, _agentIp, _port, "/api/HypervResource/" + cmdName, null, null);
    } catch (final URISyntaxException e) {
        final String errMsg = "Could not generate URI for Hyper-V agent";
        s_logger.error(errMsg, e);
    }
    final String ansStr = postHttpRequest(s_gson.toJson(modifyNic), agentUri);
    final Answer[] result = s_gson.fromJson(ansStr, Answer[].class);
    s_logger.debug("executeRequest received response " + s_gson.toJson(result));
    if (result.length > 0) {
    }
}
Also used : ModifyVmNicConfigCommand(com.cloud.agent.api.ModifyVmNicConfigCommand) UnsupportedAnswer(com.cloud.agent.api.UnsupportedAnswer) CheckSshAnswer(com.cloud.agent.api.check.CheckSshAnswer) GetDomRVersionAnswer(com.cloud.agent.api.GetDomRVersionAnswer) CheckS2SVpnConnectionsAnswer(com.cloud.agent.api.CheckS2SVpnConnectionsAnswer) SetPortForwardingRulesAnswer(com.cloud.agent.api.routing.SetPortForwardingRulesAnswer) SetSourceNatAnswer(com.cloud.agent.api.routing.SetSourceNatAnswer) PlugNicAnswer(com.cloud.agent.api.PlugNicAnswer) GetVmConfigAnswer(com.cloud.agent.api.GetVmConfigAnswer) NetworkUsageAnswer(com.cloud.agent.api.NetworkUsageAnswer) Answer(com.cloud.agent.api.Answer) UnPlugNicAnswer(com.cloud.agent.api.UnPlugNicAnswer) SetStaticNatRulesAnswer(com.cloud.agent.api.routing.SetStaticNatRulesAnswer) IpAssocAnswer(com.cloud.agent.api.routing.IpAssocAnswer) SetFirewallRulesAnswer(com.cloud.agent.api.routing.SetFirewallRulesAnswer) CheckRouterAnswer(com.cloud.agent.api.CheckRouterAnswer) SetStaticRouteAnswer(com.cloud.agent.api.routing.SetStaticRouteAnswer) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI)

Example 2 with ModifyVmNicConfigCommand

use of com.cloud.agent.api.ModifyVmNicConfigCommand in project cloudstack by apache.

the class HypervDirectConnectResource method modifyNicVlan.

protected void modifyNicVlan(final String vmName, final String vlanId, final String macAddress) {
    final ModifyVmNicConfigCommand modifynic = new ModifyVmNicConfigCommand(vmName, vlanId, macAddress);
    URI agentUri = null;
    try {
        final String cmdName = ModifyVmNicConfigCommand.class.getName();
        agentUri = new URI("https", null, _agentIp, _port, "/api/HypervResource/" + cmdName, null, null);
    } catch (final URISyntaxException e) {
        final String errMsg = "Could not generate URI for Hyper-V agent";
        s_logger.error(errMsg, e);
    }
    final String ansStr = postHttpRequest(s_gson.toJson(modifynic), agentUri);
    final Answer[] result = s_gson.fromJson(ansStr, Answer[].class);
    s_logger.debug("executeRequest received response " + s_gson.toJson(result));
    if (result.length > 0) {
    }
}
Also used : ModifyVmNicConfigCommand(com.cloud.agent.api.ModifyVmNicConfigCommand) UnsupportedAnswer(com.cloud.agent.api.UnsupportedAnswer) CheckSshAnswer(com.cloud.agent.api.check.CheckSshAnswer) GetDomRVersionAnswer(com.cloud.agent.api.GetDomRVersionAnswer) CheckS2SVpnConnectionsAnswer(com.cloud.agent.api.CheckS2SVpnConnectionsAnswer) SetPortForwardingRulesAnswer(com.cloud.agent.api.routing.SetPortForwardingRulesAnswer) SetSourceNatAnswer(com.cloud.agent.api.routing.SetSourceNatAnswer) PlugNicAnswer(com.cloud.agent.api.PlugNicAnswer) GetVmConfigAnswer(com.cloud.agent.api.GetVmConfigAnswer) NetworkUsageAnswer(com.cloud.agent.api.NetworkUsageAnswer) Answer(com.cloud.agent.api.Answer) UnPlugNicAnswer(com.cloud.agent.api.UnPlugNicAnswer) SetStaticNatRulesAnswer(com.cloud.agent.api.routing.SetStaticNatRulesAnswer) IpAssocAnswer(com.cloud.agent.api.routing.IpAssocAnswer) SetFirewallRulesAnswer(com.cloud.agent.api.routing.SetFirewallRulesAnswer) CheckRouterAnswer(com.cloud.agent.api.CheckRouterAnswer) SetStaticRouteAnswer(com.cloud.agent.api.routing.SetStaticRouteAnswer) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI)

Aggregations

Answer (com.cloud.agent.api.Answer)2 CheckRouterAnswer (com.cloud.agent.api.CheckRouterAnswer)2 CheckS2SVpnConnectionsAnswer (com.cloud.agent.api.CheckS2SVpnConnectionsAnswer)2 GetDomRVersionAnswer (com.cloud.agent.api.GetDomRVersionAnswer)2 GetVmConfigAnswer (com.cloud.agent.api.GetVmConfigAnswer)2 ModifyVmNicConfigCommand (com.cloud.agent.api.ModifyVmNicConfigCommand)2 NetworkUsageAnswer (com.cloud.agent.api.NetworkUsageAnswer)2 PlugNicAnswer (com.cloud.agent.api.PlugNicAnswer)2 UnPlugNicAnswer (com.cloud.agent.api.UnPlugNicAnswer)2 UnsupportedAnswer (com.cloud.agent.api.UnsupportedAnswer)2 CheckSshAnswer (com.cloud.agent.api.check.CheckSshAnswer)2 IpAssocAnswer (com.cloud.agent.api.routing.IpAssocAnswer)2 SetFirewallRulesAnswer (com.cloud.agent.api.routing.SetFirewallRulesAnswer)2 SetPortForwardingRulesAnswer (com.cloud.agent.api.routing.SetPortForwardingRulesAnswer)2 SetSourceNatAnswer (com.cloud.agent.api.routing.SetSourceNatAnswer)2 SetStaticNatRulesAnswer (com.cloud.agent.api.routing.SetStaticNatRulesAnswer)2 SetStaticRouteAnswer (com.cloud.agent.api.routing.SetStaticRouteAnswer)2 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)2