You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2013/06/27 22:57:39 UTC
[37/50] [abbrv] git commit: updated refs/heads/vmsync to 3c2aa18
CLOUDSTACK-728 Set vmspec extra config for the Nicira NVP vApp
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/53d1ce75
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/53d1ce75
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/53d1ce75
Branch: refs/heads/vmsync
Commit: 53d1ce75a19a15f6f588c5c17970d081368fd1d8
Parents: 98dc68d
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Wed Jun 19 17:03:35 2013 -0700
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Wed Jun 26 15:41:52 2013 -0700
----------------------------------------------------------------------
.../vmware/resource/VmwareResource.java | 56 ++++++++++++++------
1 file changed, 39 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/53d1ce75/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 80e87e9..5c51585 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
@@ -2750,28 +2750,50 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
// pass boot arguments through machine.id & perform customized options to VMX
- Map<String, String> vmDetailOptions = validateVmDetails(vmSpec.getDetails());
- OptionValue[] extraOptions = new OptionValue[2 + vmDetailOptions.size()];
- extraOptions[0] = new OptionValue();
- extraOptions[0].setKey("machine.id");
- extraOptions[0].setValue(vmSpec.getBootArgs());
-
- extraOptions[1] = new OptionValue();
- extraOptions[1].setKey("devices.hotplug");
- extraOptions[1].setValue("true");
-
- int j = 2;
- for(Map.Entry<String, String> entry : vmDetailOptions.entrySet()) {
- extraOptions[j] = new OptionValue();
- extraOptions[j].setKey(entry.getKey());
- extraOptions[j].setValue(entry.getValue());
- j++;
+ ArrayList<OptionValue> extraOptions = new ArrayList<OptionValue>();
+ OptionValue newVal = new OptionValue();
+ newVal.setKey("machine.id");
+ newVal.setValue(vmSpec.getBootArgs());
+ extraOptions.add(newVal);
+
+ newVal = new OptionValue();
+ newVal.setKey("devices.hotplug");
+ newVal.setValue("true");
+ extraOptions.add(newVal);
+
+ /**
+ * Extra Config : nvp.vm-uuid = uuid
+ * - Required for Nicira NVP integration
+ */
+ newVal = new OptionValue();
+ newVal.setKey("nvp.vm-uuid");
+ newVal.setValue(vmSpec.getUuid());
+ extraOptions.add(newVal);
+
+ /**
+ * Extra Config : nvp.iface-id<num> = uuid
+ * - Required for Nicira NVP integration
+ */
+ int nicNum = 0;
+ for (NicTO nicTo : sortNicsByDeviceId(nics)) {
+ newVal = new OptionValue();
+ newVal.setKey("nvp.iface-id" + nicNum);
+ newVal.setValue(nicTo.getUuid());
+ extraOptions.add(newVal);
+ nicNum++;
+ }
+
+ for(Map.Entry<String, String> entry : validateVmDetails(vmSpec.getDetails()).entrySet()) {
+ newVal = new OptionValue();
+ newVal.setKey(entry.getKey());
+ newVal.setValue(entry.getValue());
+ extraOptions.add(newVal);
}
String keyboardLayout = null;
if(vmSpec.getDetails() != null)
keyboardLayout = vmSpec.getDetails().get(VmDetailConstants.KEYBOARD);
- vmConfigSpec.getExtraConfig().addAll(Arrays.asList(configureVnc(extraOptions, hyperHost, vmName, vmSpec.getVncPassword(), keyboardLayout)));
+ vmConfigSpec.getExtraConfig().addAll(Arrays.asList(configureVnc(extraOptions.toArray(new OptionValue[0]), hyperHost, vmName, vmSpec.getVncPassword(), keyboardLayout)));
if (!vmMo.configureVm(vmConfigSpec)) {
throw new Exception("Failed to configure VM before start. vmName: " + vmName);