').addClass('name').html(_s(this[fields.label])))
+ .append(propertyField)
+ .append($('
').addClass('desc').html(_s(this[fields.description])))
+ .data('json-obj', this)
+ );
+ $selects.append($select);
+ });
+
+ cloudStack.evenOdd($selects, 'div.select', {
+ even: function($elem) {
+ $elem.addClass('even');
+ },
+ odd: function($elem) {
+ $elem.addClass('odd');
+ }
+ });
+
+ return $selects.children();
+ };
+
var makeSelects = function(name, data, fields, options, selectedObj, selectedObjNonEditable) {
var $selects = $('
');
options = options ? options : {};
@@ -1233,10 +1325,31 @@
};
},
+ 'ovfProperties': function($step, formData) {
+ return {
+ response: {
+ success: function(args) {
+ $step.find('.content .select-container').append(
+ makeSelectsOvfProperties(args.data.ovfProperties, {
+ key: 'key',
+ type: 'type',
+ value: 'value',
+ qualifiers: 'qualifiers',
+ label: 'label',
+ description : 'description',
+ password : 'password'
+ })
+ );
+ }
+ }
+ };
+ },
+
'review': function($step, formData) {
$step.find('[wizard-field]').each(function() {
var field = $(this).attr('wizard-field');
var fieldName;
+
var $input = $wizard.find('[wizard-field=' + field + ']').filter(function() {
return ($(this).is(':selected') ||
$(this).is(':checked') ||
@@ -1425,6 +1538,37 @@
}
}
+ // Step 7 - Skip OVF properties tab if there are no OVF properties for the template
+ if ($activeStep.hasClass('sshkeyPairs')) {
+ if ($activeStep.hasClass('next-skip-ovf-properties')) {
+ showStep(8);
+ }
+ }
+
+ // Optional Step - Pre-step 8
+ if ($activeStep.hasClass('ovf-properties')) {
+ var ok = true;
+ if ($activeStep.find('input').length > 0) { //if no checkbox is checked
+ $.each($activeStep.find('input'), function(index, item) {
+ var item = $activeStep.find('input#' + item.id);
+ var internalCheck = true;
+ if (this.maxLength && this.maxLength !== -1) {
+ internalCheck = item.val().length <= this.maxLength;
+ } else if (this.min && this.max) {
+ var numberValue = parseFloat(item.val());
+ internalCheck = numberValue >= this.min && numberValue <= this.max;
+ }
+ ok = ok && internalCheck;
+ });
+ }
+ if (!ok) {
+ cloudStack.dialog.notice({
+ message: 'Please enter valid values for every property'
+ });
+ return false;
+ }
+ }
+
if (!$form.valid()) {
if ($form.find('input.error:visible, select.error:visible').length) {
return false;
@@ -1459,6 +1603,12 @@
}
}
+ if ($activeStep.hasClass('review')) {
+ if ($activeStep.hasClass('previous-skip-ovf-properties')) {
+ showStep(7);
+ }
+ }
+
return false;
}
diff --git a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/ClusterMO.java b/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/ClusterMO.java
index a6e42850c5e..ce9e9816280 100644
--- a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/ClusterMO.java
+++ b/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/ClusterMO.java
@@ -391,7 +391,7 @@ public class ClusterMO extends BaseMO implements VmwareHypervisorHost {
@Override
public boolean createBlankVm(String vmName, String vmInternalCSName, int cpuCount, int cpuSpeedMHz, int cpuReservedMHz, boolean limitCpuUse, int memoryMB,
- int memoryReserveMB, String guestOsIdentifier, ManagedObjectReference morDs, boolean snapshotDirToParent, Pair controllerInfo, Boolean systemVm) throws Exception {
+ int memoryReserveMB, String guestOsIdentifier, ManagedObjectReference morDs, boolean snapshotDirToParent, Pair controllerInfo, Boolean systemVm) throws Exception {
if (s_logger.isTraceEnabled())
s_logger.trace("vCenter API trace - createBlankVm(). target MOR: " + _mor.getValue() + ", vmName: " + vmName + ", cpuCount: " + cpuCount + ", cpuSpeedMhz: " +
diff --git a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/HostMO.java b/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/HostMO.java
index 74cef80dbe5..cc50b3d5bc1 100644
--- a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/HostMO.java
+++ b/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/HostMO.java
@@ -771,7 +771,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost {
@Override
public boolean createBlankVm(String vmName, String vmInternalCSName, int cpuCount, int cpuSpeedMHz, int cpuReservedMHz, boolean limitCpuUse, int memoryMB,
- int memoryReserveMB, String guestOsIdentifier, ManagedObjectReference morDs, boolean snapshotDirToParent, Pair controllerInfo, Boolean systemVm) throws Exception {
+ int memoryReserveMB, String guestOsIdentifier, ManagedObjectReference morDs, boolean snapshotDirToParent, Pair controllerInfo, Boolean systemVm) throws Exception {
if (s_logger.isTraceEnabled())
s_logger.trace("vCenter API trace - createBlankVm(). target MOR: " + _mor.getValue() + ", vmName: " + vmName + ", cpuCount: " + cpuCount + ", cpuSpeedMhz: " +
diff --git a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java b/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
index f003d6a9f0f..2eaa55a5768 100644
--- a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
+++ b/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
@@ -1439,8 +1439,8 @@ public class HypervisorHostHelper {
}
public static boolean createBlankVm(VmwareHypervisorHost host, String vmName, String vmInternalCSName, int cpuCount, int cpuSpeedMHz, int cpuReservedMHz,
- boolean limitCpuUse, int memoryMB, int memoryReserveMB, String guestOsIdentifier, ManagedObjectReference morDs, boolean snapshotDirToParent,
- Pair controllerInfo, Boolean systemVm) throws Exception {
+ boolean limitCpuUse, int memoryMB, int memoryReserveMB, String guestOsIdentifier, ManagedObjectReference morDs, boolean snapshotDirToParent,
+ Pair controllerInfo, Boolean systemVm) throws Exception {
if (s_logger.isInfoEnabled())
s_logger.info("Create blank VM. cpuCount: " + cpuCount + ", cpuSpeed(MHz): " + cpuSpeedMHz + ", mem(Mb): " + memoryMB);
@@ -1508,6 +1508,7 @@ public class HypervisorHostHelper {
videoDeviceSpec.setOperation(VirtualDeviceConfigSpecOperation.ADD);
vmConfig.getDeviceChange().add(videoDeviceSpec);
+
if (host.createVm(vmConfig)) {
// Here, when attempting to find the VM, we need to use the name
// with which we created it. This is the only such place where
diff --git a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java b/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
index 6a42f7f9aea..a1205c258ee 100644
--- a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
+++ b/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
@@ -2963,10 +2963,18 @@ public class VirtualMachineMO extends BaseMO {
List devices = (List)_context.getVimClient().
getDynamicProperty(_mor, "config.hardware.device");
if(devices != null && devices.size() > 0) {
+ long isoDevices = devices.stream()
+ .filter(x -> x instanceof VirtualCdrom && x.getBacking() instanceof VirtualCdromIsoBackingInfo)
+ .count();
for(VirtualDevice device : devices) {
- if(device instanceof VirtualCdrom && device.getBacking() instanceof VirtualCdromIsoBackingInfo &&
- ((VirtualCdromIsoBackingInfo)device.getBacking()).getFileName().equals(filename)) {
- return device;
+ if(device instanceof VirtualCdrom && device.getBacking() instanceof VirtualCdromIsoBackingInfo) {
+ if (((VirtualCdromIsoBackingInfo)device.getBacking()).getFileName().equals(filename)) {
+ return device;
+ } else if (isoDevices == 1L){
+ s_logger.warn(String.format("VM ISO filename %s differs from the expected filename %s",
+ ((VirtualCdromIsoBackingInfo)device.getBacking()).getFileName(), filename));
+ return device;
+ }
}
}
}
diff --git a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VmwareHypervisorHost.java b/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VmwareHypervisorHost.java
index 0767ec09f9a..6f0cd2291b4 100644
--- a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VmwareHypervisorHost.java
+++ b/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VmwareHypervisorHost.java
@@ -58,8 +58,8 @@ public interface VmwareHypervisorHost {
boolean createVm(VirtualMachineConfigSpec vmSpec) throws Exception;
boolean createBlankVm(String vmName, String vmInternalCSName, int cpuCount, int cpuSpeedMHz, int cpuReservedMHz, boolean limitCpuUse, int memoryMB,
- int memoryReserveMB, String guestOsIdentifier, ManagedObjectReference morDs, boolean snapshotDirToParent,
- Pair controllerInfo, Boolean systemVm) throws Exception;
+ int memoryReserveMB, String guestOsIdentifier, ManagedObjectReference morDs, boolean snapshotDirToParent,
+ Pair controllerInfo, Boolean systemVm) throws Exception;
void importVmFromOVF(String ovfFilePath, String vmName, DatastoreMO dsMo, String diskOption) throws Exception;