use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class DiskValidatorTest method createVmDeviceForDisk.
private VmDevice createVmDeviceForDisk(VM vm, Disk disk) {
VmDevice device = new VmDevice();
device.setId(new VmDeviceId(vm.getId(), disk.getId()));
device.setSnapshotId(null);
device.setPlugged(true);
return device;
}
use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class VmDevicesMonitoringTest method testRemoveDevice.
@Test
public void testRemoveDevice() {
initDevices(getVmDevice(CDROM_DEVICE_ID, VM_ID, VmDeviceGeneralType.DISK, "cdrom", true));
initDumpXmls();
vmDevicesMonitoring.initDevicesStatuses(1L);
VmDevicesMonitoring.Change change = vmDevicesMonitoring.createChange(2L);
change.removeDevice(new VmDeviceId(CDROM_DEVICE_ID, VM_ID));
change.flush();
verify(resourceManager, never()).runVdsCommand(eq(VDSCommandType.DumpXmls), any());
verify(vmDeviceDao, never()).updateAllInBatch(any());
verify(vmDeviceDao, times(1)).removeAll(any());
verify(vmDeviceDao, never()).saveAll(any());
verify(vmDynamicDao, never()).updateDevicesHashes(any());
}
use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class NewDiskModel method initialize.
@Override
public void initialize(List<DiskModel> currentDisks) {
super.initialize(currentDisks);
setDiskVmElement(new DiskVmElement(new VmDeviceId(null, getIsFloating() ? null : getVm().getId())));
}
use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class RunVmCommandBase method initParametersForExternalNetworks.
protected void initParametersForExternalNetworks(VDS vds, boolean isMigration) {
for (VmNetworkInterface iface : getVm().getInterfaces()) {
VnicProfile vnicProfile = vnicProfileDao.get(iface.getVnicProfileId());
Network network = networkHelper.getNetworkByVnicProfile(vnicProfile);
if (network != null && network.isExternal() && iface.isPlugged()) {
Provider<?> provider = providerDao.get(network.getProvidedBy().getProviderId());
NetworkProviderProxy providerProxy = providerProxyFactory.create(provider);
Map<String, String> deviceProperties = providerProxy.allocate(network, vnicProfile, iface, vds, isMigration);
getVm().getRuntimeDeviceCustomProperties().put(new VmDeviceId(iface.getId(), getVmId()), deviceProperties);
}
}
}
use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class RemoveRngDeviceCommand method executeCommand.
@Override
protected void executeCommand() {
List<VmDevice> rngDevices = getRngDevices();
Set<VmDeviceId> idsToRemove = new HashSet<>();
for (VmDevice dev : rngDevices) {
idsToRemove.add(dev.getId());
}
vmDeviceDao.removeAll(idsToRemove);
setSucceeded(true);
}
Aggregations