use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class VmDeviceCommonUtils method addVirtIoScsiDevice.
public static void addVirtIoScsiDevice(VmBase vmBase) {
VmDevice vmDevice = new VmDevice();
vmDevice.setId(new VmDeviceId(Guid.newGuid(), vmBase.getId()));
vmDevice.setType(VmDeviceGeneralType.CONTROLLER);
vmDevice.setDevice(VmDeviceType.VIRTIOSCSI.getName());
vmDevice.setManaged(true);
vmDevice.setPlugged(true);
vmDevice.setReadOnly(false);
vmDevice.setAddress("");
vmBase.getManagedDeviceMap().put(vmDevice.getDeviceId(), vmDevice);
}
use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class UpdateVmCommand method updateVmPayload.
protected void updateVmPayload() {
VmPayload payload = getParameters().getVmPayload();
if (payload != null || getParameters().isClearPayload()) {
List<VmDevice> disks = vmDeviceDao.getVmDeviceByVmIdAndType(getVmId(), VmDeviceGeneralType.DISK);
VmDevice oldPayload = null;
for (VmDevice disk : disks) {
if (VmPayload.isPayload(disk.getSpecParams())) {
oldPayload = disk;
break;
}
}
if (oldPayload != null) {
List<VmDeviceId> devs = new ArrayList<>();
devs.add(oldPayload.getId());
vmDeviceDao.removeAll(devs);
}
if (!getParameters().isClearPayload()) {
getVmDeviceUtils().addManagedDevice(new VmDeviceId(Guid.newGuid(), getVmId()), VmDeviceGeneralType.DISK, payload.getDeviceType(), payload.getSpecParams(), true, true);
}
}
}
use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class VmTemplateManagementCommand method removeNetwork.
protected void removeNetwork() {
List<VmNic> list = vmNicDao.getAllForTemplate(getVmTemplateId());
for (VmNic iface : list) {
vmDeviceDao.remove(new VmDeviceId(iface.getId(), getVmTemplateId()));
vmNicDao.remove(iface.getId());
}
}
use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class AddVmTemplateCommand method addTemplateDiskVmElement.
private void addTemplateDiskVmElement(Guid newDiskId, Guid oldDiskId) {
DiskVmElement oldDve = diskVmElementDao.get(new VmDeviceId(oldDiskId, getVmId()));
DiskVmElement newDve = DiskVmElement.copyOf(oldDve);
newDve.setId(new VmDeviceId(newDiskId, getVmTemplateId()));
diskVmElementDao.save(newDve);
}
use of org.ovirt.engine.core.common.businessentities.VmDeviceId in project ovirt-engine by oVirt.
the class HotSetAmountOfMemoryCommand method createMemoryDevice.
private VmDevice createMemoryDevice() {
Map<String, Object> specParams = new HashMap<>();
specParams.put(DEVICE_SIZE_FIELD_KEY, String.valueOf(getParameters().getMemoryDeviceSizeMb()));
specParams.put(DEVICE_NODE_FIELD_KEY, String.valueOf(getParameters().getNumaNode()));
return new VmDevice(new VmDeviceId(Guid.newGuid(), getVmId()), VmDeviceGeneralType.MEMORY, VmDeviceType.MEMORY.getName(), "", specParams, true, true, false, "", null, null, null);
}
Aggregations