|
25 | 25 | import javax.naming.ConfigurationException; |
26 | 26 |
|
27 | 27 | import org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority; |
| 28 | +import org.apache.cloudstack.engine.subsystem.api.storage.VMSnapshotOptions; |
28 | 29 | import org.apache.cloudstack.engine.subsystem.api.storage.VMSnapshotStrategy; |
29 | 30 | import org.apache.cloudstack.framework.config.dao.ConfigurationDao; |
30 | 31 | import org.apache.cloudstack.storage.to.VolumeObjectTO; |
@@ -111,8 +112,12 @@ public VMSnapshot takeVMSnapshot(VMSnapshot vmSnapshot) { |
111 | 112 | VMSnapshotVO currentSnapshot = vmSnapshotDao.findCurrentSnapshotByVmId(userVm.getId()); |
112 | 113 | if (currentSnapshot != null) |
113 | 114 | current = vmSnapshotHelper.getSnapshotWithParents(currentSnapshot); |
| 115 | + VMSnapshotOptions options = ((VMSnapshotVO) vmSnapshot).getOptions(); |
| 116 | + boolean quiescevm = true; |
| 117 | + if (options != null) |
| 118 | + quiescevm = options.needQuiesceVM(); |
114 | 119 | VMSnapshotTO target = new VMSnapshotTO(vmSnapshot.getId(), vmSnapshot.getName(), vmSnapshot.getType(), null, vmSnapshot.getDescription(), false, |
115 | | - current); |
| 120 | + current, quiescevm); |
116 | 121 | if (current == null) |
117 | 122 | vmSnapshotVO.setParent(null); |
118 | 123 | else |
@@ -174,7 +179,7 @@ public boolean deleteVMSnapshot(VMSnapshot vmSnapshot) { |
174 | 179 | String vmInstanceName = userVm.getInstanceName(); |
175 | 180 | VMSnapshotTO parent = vmSnapshotHelper.getSnapshotWithParents(vmSnapshotVO).getParent(); |
176 | 181 | VMSnapshotTO vmSnapshotTO = new VMSnapshotTO(vmSnapshot.getId(), vmSnapshot.getName(), vmSnapshot.getType(), |
177 | | - vmSnapshot.getCreated().getTime(), vmSnapshot.getDescription(), vmSnapshot.getCurrent(), parent); |
| 182 | + vmSnapshot.getCreated().getTime(), vmSnapshot.getDescription(), vmSnapshot.getCurrent(), parent, true); |
178 | 183 | GuestOSVO guestOS = guestOSDao.findById(userVm.getGuestOSId()); |
179 | 184 | DeleteVMSnapshotCommand deleteSnapshotCommand = new DeleteVMSnapshotCommand(vmInstanceName, vmSnapshotTO, volumeTOs,guestOS.getDisplayName()); |
180 | 185 |
|
@@ -330,7 +335,7 @@ public boolean revertVMSnapshot(VMSnapshot vmSnapshot) { |
330 | 335 | VMSnapshotTO parent = vmSnapshotHelper.getSnapshotWithParents(snapshot).getParent(); |
331 | 336 |
|
332 | 337 | VMSnapshotTO vmSnapshotTO = new VMSnapshotTO(snapshot.getId(), snapshot.getName(), snapshot.getType(), |
333 | | - snapshot.getCreated().getTime(), snapshot.getDescription(), snapshot.getCurrent(), parent); |
| 338 | + snapshot.getCreated().getTime(), snapshot.getDescription(), snapshot.getCurrent(), parent, true); |
334 | 339 | Long hostId = vmSnapshotHelper.pickRunningHost(vmSnapshot.getVmId()); |
335 | 340 | GuestOSVO guestOS = guestOSDao.findById(userVm.getGuestOSId()); |
336 | 341 | RevertToVMSnapshotCommand revertToSnapshotCommand = new RevertToVMSnapshotCommand(vmInstanceName, vmSnapshotTO, volumeTOs, guestOS.getDisplayName()); |
|
0 commit comments