mirror of https://github.com/apache/cloudstack.git
Unable to create snapshot from vm snapshot (#4432)
Co-authored-by: Rakesh Venkatesh <r.venkatesh@global.leaseweb.com>
This commit is contained in:
parent
dbb66850b2
commit
b266c757d2
|
|
@ -464,7 +464,7 @@ public class SnapshotManagerImpl extends MutualExclusiveIdsManagerBase implement
|
|||
}
|
||||
SnapshotInfo snapshotInfo = this.snapshotFactory.getSnapshot(snapshotId, store);
|
||||
snapshotInfo = (SnapshotInfo)store.create(snapshotInfo);
|
||||
SnapshotDataStoreVO snapshotOnPrimaryStore = this._snapshotStoreDao.findBySnapshot(snapshot.getId(), store.getRole());
|
||||
SnapshotDataStoreVO snapshotOnPrimaryStore = this._snapshotStoreDao.findByStoreSnapshot(store.getRole(), store.getId(), snapshot.getId());
|
||||
snapshotOnPrimaryStore.setState(ObjectInDataStoreStateMachine.State.Ready);
|
||||
snapshotOnPrimaryStore.setInstallPath(vmSnapshot.getName());
|
||||
_snapshotStoreDao.update(snapshotOnPrimaryStore.getId(), snapshotOnPrimaryStore);
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ public class SnapshotManagerTest {
|
|||
when(snapshotStoreDao.findParent(any(DataStoreRole.class), nullable(Long.class), nullable(Long.class))).thenReturn(null);
|
||||
when(snapshotFactory.getSnapshot(nullable(Long.class), nullable(DataStore.class))).thenReturn(snapshotInfoMock);
|
||||
when(storeMock.create(snapshotInfoMock)).thenReturn(snapshotInfoMock);
|
||||
when(snapshotStoreDao.findBySnapshot(nullable(Long.class), nullable(DataStoreRole.class))).thenReturn(snapshotStoreMock);
|
||||
when(snapshotStoreDao.findByStoreSnapshot(nullable(DataStoreRole.class), nullable(Long.class), nullable(Long.class))).thenReturn(snapshotStoreMock);
|
||||
when(snapshotStoreDao.update(nullable(Long.class), nullable(SnapshotDataStoreVO.class))).thenReturn(true);
|
||||
when(_snapshotDao.update(nullable(Long.class), nullable(SnapshotVO.class))).thenReturn(true);
|
||||
when(vmMock.getAccountId()).thenReturn(2L);
|
||||
|
|
@ -333,7 +333,7 @@ public class SnapshotManagerTest {
|
|||
when(vmMock.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.KVM);
|
||||
when(_vmSnapshotDao.findById(nullable(Long.class))).thenReturn(vmSnapshotMock);
|
||||
when(snapshotStoreDao.findParent(any(DataStoreRole.class), nullable(Long.class), nullable(Long.class))).thenReturn(snapshotStoreMock);
|
||||
when(snapshotStoreDao.findBySnapshot(nullable(Long.class), nullable(DataStoreRole.class))).thenReturn(snapshotStoreMock);
|
||||
when(snapshotStoreDao.findByStoreSnapshot(nullable(DataStoreRole.class), nullable(Long.class), nullable(Long.class))).thenReturn(snapshotStoreMock);
|
||||
when(snapshotStoreMock.getInstallPath()).thenReturn("VM_SNAPSHOT_NAME");
|
||||
when(vmSnapshotMock.getName()).thenReturn("VM_SNAPSHOT_NAME");
|
||||
Snapshot snapshot = _snapshotMgr.backupSnapshotFromVmSnapshot(TEST_SNAPSHOT_ID, TEST_VM_ID, TEST_VOLUME_ID, TEST_VM_SNAPSHOT_ID);
|
||||
|
|
|
|||
Loading…
Reference in New Issue