cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sate...@apache.org
Subject [24/50] [abbrv] git commit: updated refs/heads/vmware-storage-motion to 406785b
Date Thu, 30 May 2013 11:22:55 GMT
unitNumber is per adapter/controller not per VM in wmware, after this patch, you can plug in
up to 10 NICs to vmware VM


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

Branch: refs/heads/vmware-storage-motion
Commit: ddba994a97ac96fff674ec8248168e9b60351ab7
Parents: a8bb62c
Author: Anthony Xu <anthony.xu@citrix.com>
Authored: Wed May 29 15:57:25 2013 -0700
Committer: Anthony Xu <anthony.xu@citrix.com>
Committed: Wed May 29 15:57:25 2013 -0700

----------------------------------------------------------------------
 .../hypervisor/vmware/resource/VmwareResource.java |   26 ++++++++------
 1 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ddba994a/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 630d1b4..0a15d4b 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
@@ -2405,6 +2405,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
 
             VirtualDeviceConfigSpec[] deviceConfigSpecArray = new VirtualDeviceConfigSpec[totalChangeDevices];
             int i = 0;
+            int ideUnitNumber = 0;
+            int scsiUnitNumber =0;
+            int nicUnitNumber = 0;
             int ideControllerKey = vmMo.getIDEDeviceControllerKey();
             int scsiControllerKey = vmMo.getScsiDeviceControllerKey();
             int controllerKey;
@@ -2429,7 +2432,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
 
                 deviceConfigSpecArray[i] = new VirtualDeviceConfigSpec();
                 Pair<VirtualDevice, Boolean> isoInfo = VmwareHelper.prepareIsoDevice(vmMo,
String.format("[%s] systemvm/%s", secDsMo.getName(), mgr.getSystemVMIsoFileNameOnDatastore()),
-                        secDsMo.getMor(), true, true, i, i + 1);
+                        secDsMo.getMor(), true, true, ideUnitNumber++, i + 1);
                 deviceConfigSpecArray[i].setDevice(isoInfo.first());
                 if (isoInfo.second()) {
                     if(s_logger.isDebugEnabled())
@@ -2440,7 +2443,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                         s_logger.debug("Prepare ISO volume at existing device " + _gson.toJson(isoInfo.first()));
                     deviceConfigSpecArray[i].setOperation(VirtualDeviceConfigSpecOperation.EDIT);
                 }
-                i++;
             } else {
                 // we will always plugin a CDROM device
                 if (volIso != null && volIso.getPath() != null && !volIso.getPath().isEmpty())
{
@@ -2449,7 +2451,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                     assert (isoDatastoreInfo.second() != null);
 
                     deviceConfigSpecArray[i] = new VirtualDeviceConfigSpec();
-                    Pair<VirtualDevice, Boolean> isoInfo = VmwareHelper.prepareIsoDevice(vmMo,
isoDatastoreInfo.first(), isoDatastoreInfo.second(), true, true, i, i + 1);
+                    Pair<VirtualDevice, Boolean> isoInfo = VmwareHelper.prepareIsoDevice(vmMo,
isoDatastoreInfo.first(), isoDatastoreInfo.second(), true, true, ideUnitNumber++, i + 1);
                     deviceConfigSpecArray[i].setDevice(isoInfo.first());
                     if (isoInfo.second()) {
                         if(s_logger.isDebugEnabled())
@@ -2462,7 +2464,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                     }
                 } else {
                     deviceConfigSpecArray[i] = new VirtualDeviceConfigSpec();
-                    Pair<VirtualDevice, Boolean> isoInfo = VmwareHelper.prepareIsoDevice(vmMo,
null, null, true, true, i, i + 1);
+                    Pair<VirtualDevice, Boolean> isoInfo = VmwareHelper.prepareIsoDevice(vmMo,
null, null, true, true, ideUnitNumber++, i + 1);
                     deviceConfigSpecArray[i].setDevice(isoInfo.first());
                     if (isoInfo.second()) {
                         if(s_logger.isDebugEnabled())
@@ -2476,9 +2478,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                         deviceConfigSpecArray[i].setOperation(VirtualDeviceConfigSpecOperation.EDIT);
                     }
                 }
-                i++;
             }
-
+            i++;
             for (VolumeTO vol : sortVolumesByDeviceId(disks)) {
                 deviceConfigSpecArray[i] = new VirtualDeviceConfigSpec();
 
@@ -2512,17 +2513,20 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                         String[] diskChain = _gson.fromJson(chainInfo, String[].class);
                         if (diskChain == null || diskChain.length < 1) {
                             s_logger.warn("Empty previously-saved chain info, fall back to
the original");
-                            device = VmwareHelper.prepareDiskDevice(vmMo, controllerKey,
new String[] { datastoreDiskPath }, volumeDsDetails.first(), i, i + 1);
+                            device = VmwareHelper.prepareDiskDevice(vmMo, controllerKey,
new String[] { datastoreDiskPath }, volumeDsDetails.first(), 
+                            		(controllerKey==ideControllerKey)?ideUnitNumber++:scsiUnitNumber++,
i + 1);
                         } else {
                             s_logger.info("Attach the disk with stored chain info: " + chainInfo);
                             for (int j = 0; j < diskChain.length; j++) {
                                 diskChain[j] = String.format("[%s] %s", volumeDsDetails.second().getName(),
diskChain[j]);
                             }
 
-                            device = VmwareHelper.prepareDiskDevice(vmMo, controllerKey,
diskChain, volumeDsDetails.first(), i, i + 1);
+                            device = VmwareHelper.prepareDiskDevice(vmMo, controllerKey,
diskChain, volumeDsDetails.first(), 
+                            		(controllerKey==ideControllerKey)?ideUnitNumber++:scsiUnitNumber++,
i + 1);
                         }
                     } else {
-                        device = VmwareHelper.prepareDiskDevice(vmMo, controllerKey, new
String[] { datastoreDiskPath }, volumeDsDetails.first(), i, i + 1);
+                        device = VmwareHelper.prepareDiskDevice(vmMo, controllerKey, new
String[] { datastoreDiskPath }, volumeDsDetails.first(),
+                        		(controllerKey==ideControllerKey)?ideUnitNumber++:scsiUnitNumber++,
i + 1);
                     }
                     deviceConfigSpecArray[i].setDevice(device);
                     deviceConfigSpecArray[i].setOperation(VirtualDeviceConfigSpecOperation.ADD);
@@ -2551,10 +2555,10 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                     ManagedObjectReference dvsMor = dataCenterMo.getDvSwitchMor(networkInfo.first());
                     dvSwitchUuid = dataCenterMo.getDvSwitchUuid(dvsMor);
                     s_logger.info("Preparing NIC device on dvSwitch : " + dvSwitchUuid);
-                    nic = VmwareHelper.prepareDvNicDevice(vmMo, networkInfo.first(), nicDeviceType,
networkInfo.second(), dvSwitchUuid, nicTo.getMac(), i, i + 1, true, true);
+                    nic = VmwareHelper.prepareDvNicDevice(vmMo, networkInfo.first(), nicDeviceType,
networkInfo.second(), dvSwitchUuid, nicTo.getMac(), nicUnitNumber++, i + 1, true, true);
                 } else {
                     s_logger.info("Preparing NIC device on network " + networkInfo.second());
-                    nic = VmwareHelper.prepareNicDevice(vmMo, networkInfo.first(), nicDeviceType,
networkInfo.second(), nicTo.getMac(), i, i + 1, true, true);
+                    nic = VmwareHelper.prepareNicDevice(vmMo, networkInfo.first(), nicDeviceType,
networkInfo.second(), nicTo.getMac(), nicUnitNumber++, i + 1, true, true);
                 }
 
                 deviceConfigSpecArray[i] = new VirtualDeviceConfigSpec();


Mime
View raw message