|
16 | 16 | // under the License. |
17 | 17 | package com.cloud.hypervisor.vmware.manager; |
18 | 18 |
|
| 19 | +import java.io.BufferedWriter; |
| 20 | +import java.io.File; |
| 21 | +import java.io.FileInputStream; |
| 22 | +import java.io.FileOutputStream; |
| 23 | +import java.io.OutputStreamWriter; |
| 24 | +import java.rmi.RemoteException; |
| 25 | +import java.util.ArrayList; |
| 26 | +import java.util.HashMap; |
| 27 | +import java.util.List; |
| 28 | +import java.util.Map; |
| 29 | +import java.util.Properties; |
| 30 | +import java.util.UUID; |
| 31 | + |
| 32 | +import org.apache.cloudstack.storage.to.TemplateObjectTO; |
| 33 | +import org.apache.cloudstack.storage.to.VolumeObjectTO; |
| 34 | +import org.apache.log4j.Logger; |
| 35 | + |
19 | 36 | import com.cloud.agent.api.Answer; |
20 | 37 | import com.cloud.agent.api.BackupSnapshotAnswer; |
21 | 38 | import com.cloud.agent.api.BackupSnapshotCommand; |
|
70 | 87 | import com.vmware.vim25.ManagedObjectReference; |
71 | 88 | import com.vmware.vim25.TaskInfo; |
72 | 89 | import com.vmware.vim25.VirtualDisk; |
73 | | -import org.apache.cloudstack.storage.to.TemplateObjectTO; |
74 | | -import org.apache.cloudstack.storage.to.VolumeObjectTO; |
75 | | -import org.apache.log4j.Logger; |
76 | | - |
77 | | -import java.io.BufferedWriter; |
78 | | -import java.io.File; |
79 | | -import java.io.FileInputStream; |
80 | | -import java.io.FileOutputStream; |
81 | | -import java.io.OutputStreamWriter; |
82 | | -import java.rmi.RemoteException; |
83 | | -import java.util.ArrayList; |
84 | | -import java.util.HashMap; |
85 | | -import java.util.List; |
86 | | -import java.util.Map; |
87 | | -import java.util.Properties; |
88 | | -import java.util.UUID; |
89 | 90 |
|
90 | 91 | public class VmwareStorageManagerImpl implements VmwareStorageManager { |
91 | 92 | @Override |
@@ -332,7 +333,7 @@ public Answer execute(VmwareHostService hostService, BackupSnapshotCommand cmd) |
332 | 333 |
|
333 | 334 | workerVMName = hostService.getWorkerName(context, cmd, 0); |
334 | 335 | vmMo = HypervisorHostHelper.createWorkerVM(hyperHost, dsMo, workerVMName); |
335 | | - |
| 336 | + |
336 | 337 | if (vmMo == null) { |
337 | 338 | throw new Exception("Failed to find the newly create or relocated VM. vmName: " + workerVMName); |
338 | 339 | } |
@@ -1056,7 +1057,7 @@ private Pair<String, String> copyVolumeToSecStorage(VmwareHostService hostServic |
1056 | 1057 | // create a dummy worker vm for attaching the volume |
1057 | 1058 | DatastoreMO dsMo = new DatastoreMO(hyperHost.getContext(), morDs); |
1058 | 1059 | workerVm = HypervisorHostHelper.createWorkerVM(hyperHost, dsMo, workerVmName); |
1059 | | - |
| 1060 | + |
1060 | 1061 | if (workerVm == null) { |
1061 | 1062 | String msg = "Unable to create worker VM to execute CopyVolumeCommand"; |
1062 | 1063 | s_logger.error(msg); |
@@ -1449,6 +1450,9 @@ public RevertToVMSnapshotAnswer execute(VmwareHostService hostService, RevertToV |
1449 | 1450 | s_logger.debug(msg); |
1450 | 1451 | return new RevertToVMSnapshotAnswer(cmd, false, msg); |
1451 | 1452 | } else { |
| 1453 | + if (cmd.isReloadVm()) { |
| 1454 | + vmMo.reload(); |
| 1455 | + } |
1452 | 1456 | boolean result = false; |
1453 | 1457 | if (snapshotName != null) { |
1454 | 1458 | ManagedObjectReference morSnapshot = vmMo.getSnapshotMor(snapshotName); |
|
0 commit comments