Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1242,20 +1242,7 @@ private Ternary<String, Long, Long> createTemplateFromVolume(VmwareContext conte
vmMo.createFullCloneWithSpecificDisk(templateUniqueName, dcMo.getVmFolder(), morPool, VmwareHelper.getDiskDeviceDatastore(volumeDeviceInfo.first()), volumeDeviceInfo);
clonedVm = dcMo.findVm(templateUniqueName);

/* FR41 THIS IS OLD way of creating template using snapshot
if (!vmMo.createSnapshot(templateUniqueName, "Temporary snapshot for template creation", false, false)) {
String msg = "Unable to take snapshot for creating template from volume. volume path: " + volumePath;
s_logger.error(msg);
throw new Exception(msg);
}

String hardwareVersion = String.valueOf(vmMo.getVirtualHardwareVersion());

// 4 MB is the minimum requirement for VM memory in VMware
Pair<VirtualMachineMO, String[]> cloneResult =
vmMo.cloneFromCurrentSnapshot(workerVmName, 0, 4, volumeDeviceInfo.second(), VmwareHelper.getDiskDeviceDatastore(volumeDeviceInfo.first()), hardwareVersion);
clonedVm = cloneResult.first();
* */
clonedVm.tagAsWorkerVM();
clonedVm.exportVm(secondaryMountPoint + "/" + installPath, templateUniqueName, false, false);

// Get VMDK filename
Expand Down Expand Up @@ -1848,6 +1835,7 @@ private Pair<String, String[]> exportVolumeToSecondaryStorage(VmwareContext cont
s_logger.error(msg);
throw new Exception(msg);
}
clonedVm.tagAsWorkerVM();
vmMo = clonedVm;
}
vmMo.exportVm(exportPath, exportName, false, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1727,9 +1727,7 @@ public static VirtualMachineMO createWorkerVM(VmwareHypervisorHost hyperHost, Da
}

if (workingVM != null) {
workingVM.setCustomFieldValue(CustomFieldConstants.CLOUD_WORKER, "true");
String workerTag = String.format("%d-%s", System.currentTimeMillis(), hyperHost.getContext().getStockObject("noderuninfo"));
workingVM.setCustomFieldValue(CustomFieldConstants.CLOUD_WORKER_TAG, workerTag);
workingVM.tagAsWorkerVM();
}
return workingVM;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3553,4 +3553,10 @@ public String acquireVncTicket() throws InvalidStateFaultMsg, RuntimeFaultFaultM
VirtualMachineTicket ticket = _context.getService().acquireTicket(_mor, "webmks");
return ticket.getTicket();
}

public void tagAsWorkerVM() throws Exception {
setCustomFieldValue(CustomFieldConstants.CLOUD_WORKER, "true");
String workerTag = String.format("%d-%s", System.currentTimeMillis(), getContext().getStockObject("noderuninfo"));
setCustomFieldValue(CustomFieldConstants.CLOUD_WORKER_TAG, workerTag);
}
}