You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2014/07/14 15:37:06 UTC
[02/44] git commit: updated refs/heads/vpc-toolkit-hugo to 1ad1883
CLOUDSTACK-7072. Volume attachment fails with 'A specified parameter was not correct' error.
[VMware] While attaching a new disk to an instance, the unit number on the controller key should be the lowest unit number on the key that is not in use.
Instead of a number that is 1 digit higher the highest unit number that is currently in use.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4be369c9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4be369c9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4be369c9
Branch: refs/heads/vpc-toolkit-hugo
Commit: 4be369c94c4c9a2609f922fa414178191753c8bd
Parents: 8e11285
Author: Likitha Shetty <li...@citrix.com>
Authored: Mon Jun 23 15:30:37 2014 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Mon Jul 7 17:40:06 2014 +0530
----------------------------------------------------------------------
.../cloud/hypervisor/vmware/mo/VirtualMachineMO.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4be369c9/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
index 263c656..b5b9a5e 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
@@ -2295,17 +2295,22 @@ public class VirtualMachineMO extends BaseMO {
public int getNextDeviceNumber(int controllerKey) throws Exception {
List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
- int deviceNumber = -1;
+ List<Integer> existingUnitNumbers = new ArrayList<Integer>();
+ int deviceNumber = 0;
if (devices != null && devices.size() > 0) {
for (VirtualDevice device : devices) {
if (device.getControllerKey() != null && device.getControllerKey().intValue() == controllerKey) {
- if (device.getUnitNumber() != null && device.getUnitNumber().intValue() > deviceNumber) {
- deviceNumber = device.getUnitNumber().intValue();
- }
+ existingUnitNumbers.add(device.getUnitNumber());
}
}
}
- return ++deviceNumber;
+ while (true) {
+ if (!existingUnitNumbers.contains(Integer.valueOf(deviceNumber))) {
+ break;
+ }
+ ++deviceNumber;
+ }
+ return deviceNumber;
}
private List<VirtualDevice> getNicDevices(boolean sorted) throws Exception {