mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-8136. [VMware] Create VM snapshot fails if a previous attempt to take the snapshot failed.
While looking for an ongoing VM snapshot task, check the task status to identify if the task is still running.
This commit is contained in:
parent
13bdc1cef4
commit
25a4f0dc53
@ -37,6 +37,7 @@ import com.vmware.vim25.HostDatastoreBrowserSearchResults;
|
||||
import com.vmware.vim25.HostDatastoreBrowserSearchSpec;
|
||||
import com.vmware.vim25.ManagedObjectReference;
|
||||
import com.vmware.vim25.TaskInfo;
|
||||
import com.vmware.vim25.TaskInfoState;
|
||||
import com.vmware.vim25.VirtualDisk;
|
||||
|
||||
import org.apache.cloudstack.storage.to.TemplateObjectTO;
|
||||
@ -1181,8 +1182,10 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
||||
TaskInfo info = (TaskInfo)(context.getVimClient().getDynamicProperty(taskMor, "info"));
|
||||
|
||||
if (info.getEntityName().equals(cmd.getVmName()) && info.getName().equalsIgnoreCase("CreateSnapshot_Task")) {
|
||||
s_logger.debug("There is already a VM snapshot task running, wait for it");
|
||||
context.getVimClient().waitForTask(taskMor);
|
||||
if (!(info.getState().equals(TaskInfoState.SUCCESS) || info.getState().equals(TaskInfoState.ERROR))) {
|
||||
s_logger.debug("There is already a VM snapshot task running, wait for it");
|
||||
context.getVimClient().waitForTask(taskMor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user