CLOUDSTACK-8830: Fix for vm snapshots in Vmware, could not create vm snapshot until 12 minutes after vm creation due to vCenter sent null name on snpashot recent task

This commit is contained in:
nvazquez 2016-09-21 10:55:51 -07:00
parent 72612f79cd
commit 94222b1356
1 changed files with 4 additions and 2 deletions

View File

@ -1184,7 +1184,8 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
for (ManagedObjectReference taskMor : tasks) {
TaskInfo info = (TaskInfo)(context.getVimClient().getDynamicProperty(taskMor, "info"));
if (info.getEntityName().equals(cmd.getVmName()) && info.getName().equalsIgnoreCase("CreateSnapshot_Task")) {
if (info.getEntityName().equals(cmd.getVmName()) && StringUtils.isNotBlank(info.getName()) &&
info.getName().equalsIgnoreCase("CreateSnapshot_Task")) {
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);
@ -1403,7 +1404,8 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
for (ManagedObjectReference taskMor : tasks) {
TaskInfo info = (TaskInfo)(context.getVimClient().getDynamicProperty(taskMor, "info"));
if (info.getEntityName().equals(cmd.getVmName()) && info.getName().equalsIgnoreCase("RevertToSnapshot_Task")) {
if (info.getEntityName().equals(cmd.getVmName()) && StringUtils.isNotBlank(info.getName()) &&
info.getName().equalsIgnoreCase("RevertToSnapshot_Task")) {
s_logger.debug("There is already a VM snapshot task running, wait for it");
context.getVimClient().waitForTask(taskMor);
}