incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [16/44] git commit: VPC: replaced vmTo object with vmName parameter in plug/unplugNic commands
Date Thu, 02 Aug 2012 02:08:32 GMT
VPC: replaced vmTo object with vmName parameter in plug/unplugNic commands


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/e0c85c0d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/e0c85c0d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/e0c85c0d

Branch: refs/heads/vpc
Commit: e0c85c0d41bac690c074f6ef799b3a4232c15953
Parents: d497769
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Fri Jul 27 10:32:53 2012 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Wed Aug 1 18:19:03 2012 -0700

----------------------------------------------------------------------
 api/src/com/cloud/agent/api/PlugNicCommand.java    |   16 ++++++--------
 api/src/com/cloud/agent/api/UnPlugNicCommand.java  |   15 ++++++-------
 .../hypervisor/vmware/resource/VmwareResource.java |    4 +-
 .../xen/resource/CitrixResourceBase.java           |    6 +---
 .../src/com/cloud/network/NetworkManagerImpl.java  |   13 +----------
 .../VpcVirtualNetworkApplianceManagerImpl.java     |    8 +++---
 6 files changed, 24 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e0c85c0d/api/src/com/cloud/agent/api/PlugNicCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/PlugNicCommand.java b/api/src/com/cloud/agent/api/PlugNicCommand.java
index 51f6dfc..aa5141e 100644
--- a/api/src/com/cloud/agent/api/PlugNicCommand.java
+++ b/api/src/com/cloud/agent/api/PlugNicCommand.java
@@ -17,16 +17,11 @@
 package com.cloud.agent.api;
 
 import com.cloud.agent.api.to.NicTO;
-import com.cloud.agent.api.to.VirtualMachineTO;
 
 public class PlugNicCommand extends Command {
     
-    VirtualMachineTO vm;
-    NicTO nic;    
-    
-    public VirtualMachineTO getVirtualMachine() {
-        return vm;
-    }
+    NicTO nic;
+    String instanceName;
     
     public NicTO getNic() {
         return nic;
@@ -40,9 +35,12 @@ public class PlugNicCommand extends Command {
     protected PlugNicCommand() {
     }
     
-    public PlugNicCommand(VirtualMachineTO vm, NicTO nic) {
-        this.vm = vm;
+    public PlugNicCommand(NicTO nic, String instanceName) {
         this.nic = nic;
+        this.instanceName = instanceName;
     }
 
+    public String getVmName() {
+        return instanceName;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e0c85c0d/api/src/com/cloud/agent/api/UnPlugNicCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/UnPlugNicCommand.java b/api/src/com/cloud/agent/api/UnPlugNicCommand.java
index ef0bd03..0530527 100644
--- a/api/src/com/cloud/agent/api/UnPlugNicCommand.java
+++ b/api/src/com/cloud/agent/api/UnPlugNicCommand.java
@@ -17,15 +17,10 @@
 package com.cloud.agent.api;
 
 import com.cloud.agent.api.to.NicTO;
-import com.cloud.agent.api.to.VirtualMachineTO;
 
 public class UnPlugNicCommand extends Command{
-    VirtualMachineTO vm;
     NicTO nic;
-    
-    public VirtualMachineTO getVirtualMachine() {
-        return vm;
-    }
+    String instanceName;
     
     public NicTO getNic() {
         return nic;
@@ -39,8 +34,12 @@ public class UnPlugNicCommand extends Command{
     protected UnPlugNicCommand() {
     }
     
-    public UnPlugNicCommand(VirtualMachineTO vm, NicTO nic) {
-        this.vm = vm;
+    public UnPlugNicCommand(NicTO nic, String instanceName) {
         this.nic = nic;
+        this.instanceName = instanceName;
+    }
+
+    public String getInstanceName() {
+        return instanceName;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e0c85c0d/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index cb9832e..f74be8f 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -1064,7 +1064,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
         try {
             VmwareHypervisorHost hyperHost = getHyperHost(context);
 
-            String vmName = cmd.getVirtualMachine().getName();
+            String vmName = cmd.getVmName();
             VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(vmName);
 
             if(vmMo == null) {
@@ -1138,7 +1138,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
         try {
             VmwareHypervisorHost hyperHost = getHyperHost(context);
 
-            String vmName = cmd.getVirtualMachine().getName();
+            String vmName = cmd.getInstanceName();
             VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(vmName);
 
             if(vmMo == null) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e0c85c0d/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 8f3ca0b..f6e9540 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -7252,8 +7252,7 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
      */
     private UnPlugNicAnswer execute(UnPlugNicCommand cmd) {
         Connection conn = getConnection();
-        VirtualMachineTO vmto = cmd.getVirtualMachine();
-        String vmName = vmto.getName();
+        String vmName = cmd.getInstanceName();
         try {
             Set<VM> vms = VM.getByNameLabel(conn, vmName);
             if ( vms == null || vms.isEmpty() ) {
@@ -7288,8 +7287,7 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
      */
     private PlugNicAnswer execute(PlugNicCommand cmd) {
         Connection conn = getConnection();
-        VirtualMachineTO vmto = cmd.getVirtualMachine();
-        String vmName = vmto.getName();
+        String vmName = cmd.getVmName();
         try {
             Set<VM> vms = VM.getByNameLabel(conn, vmName);
             if ( vms == null || vms.isEmpty() ) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e0c85c0d/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index 6403140..880466c 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -2537,17 +2537,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService,
Manag
             _nicDao.expunge(nic.getId());
         }
     }
-
-    private String getCidrAddress(String cidr) {
-        String[] cidrPair = cidr.split("\\/");
-        return cidrPair[0];
-    }
-
-    private int getCidrSize(String cidr) {
-        String[] cidrPair = cidr.split("\\/");
-        return Integer.parseInt(cidrPair[1]);
-    }
-
+    
+    
     @Override
     public void checkVirtualNetworkCidrOverlap(Long zoneId, String cidr) {
         if (zoneId == null) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e0c85c0d/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index 5da7534..d070a0a 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -325,7 +325,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
         DomainRouterVO router = _routerDao.findById(vm.getId());
         if (router.getState() == State.Running) {
             try {
-                PlugNicCommand plugNicCmd = new PlugNicCommand(vm, nic);
+                PlugNicCommand plugNicCmd = new PlugNicCommand(nic, vm.getName());
                 
                 Commands cmds = new Commands(OnError.Stop);
                 cmds.addCommand("plugnic", plugNicCmd);
@@ -360,7 +360,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
         
         if (router.getState() == State.Running) {
             try {
-                UnPlugNicCommand unplugNicCmd = new UnPlugNicCommand(vm, nic);
+                UnPlugNicCommand unplugNicCmd = new UnPlugNicCommand(nic, vm.getName());
                 Commands cmds = new Commands(OnError.Stop);
                 cmds.addCommand("unplugnic", unplugNicCmd);
                 _agentMgr.send(dest.getHost().getId(), cmds);
@@ -783,7 +783,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
                     }
                 }
                 
-                PlugNicCommand plugNicCmd = new PlugNicCommand(_itMgr.toVmTO(profile), getNicTO(router,
publicNic.getNetworkId(), publicNic.getBroadcastUri().toString()));
+                PlugNicCommand plugNicCmd = new PlugNicCommand(getNicTO(router, publicNic.getNetworkId(),
publicNic.getBroadcastUri().toString()), router.getInstanceName());
                 cmds.addCommand(plugNicCmd); 
             }
             
@@ -796,7 +796,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
             for (Pair<Nic, Network> nicNtwk : guestNics) {
                 Nic guestNic = nicNtwk.first();
                 //plug guest nic 
-                PlugNicCommand plugNicCmd = new PlugNicCommand(_itMgr.toVmTO(profile), getNicTO(router,
guestNic.getNetworkId(), null));
+                PlugNicCommand plugNicCmd = new PlugNicCommand(getNicTO(router, guestNic.getNetworkId(),
null), router.getInstanceName());
                 cmds.addCommand(plugNicCmd);
                 
                 if (!_networkMgr.isPrivateGateway(guestNic)) {


Mime
View raw message