rhtyd commented on a change in pull request #4294:
URL: https://github.com/apache/cloudstack/pull/4294#discussion_r478859112
##########
File path:
plugins/hypervisors/vmware/src/main/java/com/cloud/storage/resource/VmwareStorageProcessor.java
##########
@@ -1186,31 +1186,42 @@ public Answer createTemplateFromVolume(CopyCommand cmd)
{
String volumePath = volume.getPath();
String details = null;
-
+ VirtualMachineMO vmMo = null;
VmwareContext context = hostService.getServiceContext(cmd);
try {
VmwareHypervisorHost hyperHost = hostService.getHyperHost(context,
cmd);
-
- VirtualMachineMO vmMo =
hyperHost.findVmOnHyperHost(volume.getVmName());
- if (vmMo == null) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Unable to find the owner VM for
CreatePrivateTemplateFromVolumeCommand on host " + hyperHost.getHyperHostName()
+
- ", try within datacenter");
- }
- vmMo = hyperHost.findVmOnPeerHyperHost(volume.getVmName());
-
+ if (volume.getVmName() == null) {
+ ManagedObjectReference secMorDs =
HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost,
volume.getDataStore().getUuid());
+ DatastoreMO dsMo = new DatastoreMO(hyperHost.getContext(),
secMorDs);
+ VirtualMachineMO workerVmMo =
HypervisorHostHelper.createWorkerVM(hyperHost, dsMo,
"workervm"+volume.getUuid());
+ if (workerVmMo == null) {
+ throw new Exception("Unable to find created worker VM");
+ }
+ vmMo = workerVmMo;
Review comment:
@Pearl1594 where are we destroying the worker VM?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]