Search in sources :

Example 6 with VmDeviceId

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;
}
Also used : VmDevice(org.ovirt.engine.core.common.businessentities.VmDevice) VmDeviceId(org.ovirt.engine.core.common.businessentities.VmDeviceId)

Example 7 with VmDeviceId

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());
}
Also used : VmDeviceId(org.ovirt.engine.core.common.businessentities.VmDeviceId) Test(org.junit.Test)

Example 8 with VmDeviceId

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())));
}
Also used : DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) VmDeviceId(org.ovirt.engine.core.common.businessentities.VmDeviceId)

Example 9 with VmDeviceId

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);
        }
    }
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) Network(org.ovirt.engine.core.common.businessentities.network.Network) VnicProfile(org.ovirt.engine.core.common.businessentities.network.VnicProfile) NetworkProviderProxy(org.ovirt.engine.core.bll.provider.network.NetworkProviderProxy) VmDeviceId(org.ovirt.engine.core.common.businessentities.VmDeviceId)

Example 10 with VmDeviceId

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);
}
Also used : VmDevice(org.ovirt.engine.core.common.businessentities.VmDevice) VmDeviceId(org.ovirt.engine.core.common.businessentities.VmDeviceId) HashSet(java.util.HashSet)

Aggregations

VmDeviceId (org.ovirt.engine.core.common.businessentities.VmDeviceId)75 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)40 DiskVmElement (org.ovirt.engine.core.common.businessentities.storage.DiskVmElement)21 Guid (org.ovirt.engine.core.compat.Guid)19 HashMap (java.util.HashMap)13 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)12 Test (org.junit.Test)10 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)9 ArrayList (java.util.ArrayList)7 Map (java.util.Map)5 GraphicsType (org.ovirt.engine.core.common.businessentities.GraphicsType)5 VM (org.ovirt.engine.core.common.businessentities.VM)5 VmPayload (org.ovirt.engine.core.common.businessentities.VmPayload)4 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)4 VmNic (org.ovirt.engine.core.common.businessentities.network.VmNic)4 Collection (java.util.Collection)3 HashSet (java.util.HashSet)3 DisplayType (org.ovirt.engine.core.common.businessentities.DisplayType)3 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)3 LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)3