use of org.ovirt.engine.core.common.businessentities.storage.Disk in project ovirt-engine by oVirt.
the class CreateSnapshotForVmCommand method buildLiveSnapshotParameters.
private SnapshotVDSCommandParameters buildLiveSnapshotParameters(Snapshot snapshot) {
List<Disk> pluggedDisksForVm = diskDao.getAllForVm(getVm().getId(), true);
List<DiskImage> filteredPluggedDisksForVm = DisksFilter.filterImageDisks(pluggedDisksForVm, ONLY_SNAPABLE, ONLY_ACTIVE);
// 'filteredPluggedDisks' should contain only disks from 'getDisksList()' that are plugged to the VM.
List<DiskImage> filteredPluggedDisks = ImagesHandler.imagesIntersection(filteredPluggedDisksForVm, getDisksList());
SnapshotVDSCommandParameters parameters = new SnapshotVDSCommandParameters(getVm().getRunOnVds(), getVm().getId(), filteredPluggedDisks);
if (isMemorySnapshotSupported() && snapshot.containsMemory()) {
parameters.setMemoryDump((DiskImage) diskDao.get(snapshot.getMemoryDiskId()));
parameters.setMemoryConf((DiskImage) diskDao.get(snapshot.getMetadataDiskId()));
}
// In case the snapshot is auto-generated for live storage migration,
// we do not want to issue an FS freeze thus setting vmFrozen to true
// so a freeze will not be issued by Vdsm
parameters.setVmFrozen(shouldFreezeOrThawVm() || getParameters().getParentCommand() == ActionType.LiveMigrateDisk);
return parameters;
}
use of org.ovirt.engine.core.common.businessentities.storage.Disk in project ovirt-engine by oVirt.
the class SnapshotsManager method removeDisksNotInSnapshot.
/**
* Remove all the disks which are allowed to be snapshot but not exist in the snapshot and are not disk snapshots
* @param vmId - The vm id which is being snapshot.
* @param diskIdsFromSnapshot - An image group id list for images which are part of the VM.
*/
private void removeDisksNotInSnapshot(Guid vmId, List<Guid> diskIdsFromSnapshot) {
for (VmDevice vmDevice : vmDeviceDao.getVmDeviceByVmIdTypeAndDevice(vmId, VmDeviceGeneralType.DISK, VmDeviceType.DISK)) {
if (!diskIdsFromSnapshot.contains(vmDevice.getDeviceId()) && vmDevice.getSnapshotId() == null) {
Disk disk = diskDao.get(vmDevice.getDeviceId());
if (disk != null && disk.isAllowSnapshot()) {
baseDiskDao.remove(vmDevice.getDeviceId());
vmDeviceDao.remove(vmDevice.getId());
}
}
}
}
use of org.ovirt.engine.core.common.businessentities.storage.Disk in project ovirt-engine by oVirt.
the class DiskDaoTest method testGetFilteredWithPermissionsNoFilter.
@Test
public void testGetFilteredWithPermissionsNoFilter() {
Disk result = dao.get(getExistingEntityId(), PRIVILEGED_USER_ID, false);
assertNotNull(result);
assertEquals(getExistingEntityId().toString(), result.getId().toString());
}
use of org.ovirt.engine.core.common.businessentities.storage.Disk in project ovirt-engine by oVirt.
the class DiskDaoTest method testGetFilteredWithoutPermissions.
@Test
public void testGetFilteredWithoutPermissions() {
Disk result = dao.get(getExistingEntityId(), UNPRIVILEGED_USER_ID, true);
assertNull(result);
}
use of org.ovirt.engine.core.common.businessentities.storage.Disk in project ovirt-engine by oVirt.
the class DiskDaoTest method testGetVmBootActiveDisk.
@Test
public void testGetVmBootActiveDisk() {
Disk bootDisk = dao.getVmBootActiveDisk(FixturesTool.VM_RHEL5_POOL_57);
assertNotNull("VM should have a boot disk attached", bootDisk);
assertEquals("Wrong boot disk for VM", FixturesTool.BOOTABLE_DISK_ID, bootDisk.getId());
}
Aggregations