use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class MigrateVDSCommand method executeVmCommand.
@Override
protected void executeVmCommand() {
VDSReturnValue vdsReturnValue = resourceManager.runVdsCommand(VDSCommandType.MigrateBroker, getParameters());
VmDynamic vmDynamic = vmDynamicDao.get(getParameters().getVmId());
if (vdsReturnValue.getSucceeded()) {
resourceManager.addAsyncRunningVm(getParameters().getVmId());
vmDynamic.setStatus(VMStatus.MigratingFrom);
vmDynamic.setMigratingToVds(getParameters().getDstVdsId());
vmManager.update(vmDynamic);
getVDSReturnValue().setReturnValue(VMStatus.MigratingFrom);
} else {
log.error("Failed to migrate VM '{}' in VDS = '{}' , error = '{}'", getParameters().getVmId(), getParameters().getVdsId(), vdsReturnValue.getExceptionString());
getVDSReturnValue().setSucceeded(false);
getVDSReturnValue().setReturnValue(vmDynamic.getStatus());
getVDSReturnValue().setVdsError(vdsReturnValue.getVdsError());
getVDSReturnValue().setExceptionString(vdsReturnValue.getExceptionString());
getVDSReturnValue().setExceptionObject(vdsReturnValue.getExceptionObject());
}
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class BackendVmSessionsResourceTest method getEntity.
@Override
protected VM getEntity(int index) {
org.ovirt.engine.core.common.businessentities.VM vm = new org.ovirt.engine.core.common.businessentities.VM();
VmDynamic vmDynamic = new VmDynamic();
vmDynamic.setConsoleCurrentUserName("admin@internal");
vmDynamic.setClientIp("1.1.1.1");
vmDynamic.setGuestCurrentUserName("Ori");
vm.setDynamicData(vmDynamic);
return vm;
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class VmManager method estimateOverhead.
private int estimateOverhead(VmStatic vmStatic) {
// Prepare VM object using the available bits and pieces
VM compose = new VM(vmStatic, new VmDynamic(), new VmStatistics(), clusterArchitecture, clusterCompatibilityVersion);
// Load device list, TODO ignores unmanaged devices for now
Map<Guid, VmDevice> devices = vmDeviceDao.getVmDeviceByVmId(vmId).stream().filter(VmDevice::isManaged).collect(Collectors.toMap(d -> d.getId().getDeviceId(), Function.identity()));
vmStatic.setManagedDeviceMap(devices);
return vmOverheadCalculator.getTotalRequiredMemoryInMb(compose);
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class VdsBrokerObjectsBuilder method buildVmsDataFromExternalProvider.
public static VM buildVmsDataFromExternalProvider(Map<String, Object> struct) {
VmStatic vmStatic = buildVmStaticDataFromExternalProvider(struct);
if (vmStatic == null) {
return null;
}
VmDynamic vmDynamic = buildVMDynamicDataFromList(struct);
VM vm = new VM(vmStatic, vmDynamic, new VmStatistics());
for (DiskImage image : vm.getImages()) {
vm.getDiskMap().put(Guid.newGuid(), image);
}
try {
vm.setClusterArch(parseArchitecture(struct));
} catch (IllegalArgumentException ex) {
log.warn("Illegal architecture type: {}, replacing with x86_64", struct.get(VdsProperties.vm_arch));
vm.setClusterArch(ArchitectureType.x86_64);
} catch (NullPointerException ex) {
log.warn("null architecture type, replacing with x86_64, {}", vm);
vm.setClusterArch(ArchitectureType.x86_64);
}
return vm;
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class ListVDSCommand method executeVdsBrokerCommand.
@Override
protected void executeVdsBrokerCommand() {
vmListReturn = getBroker().list();
proceedProxyReturnValue();
Map<Guid, VdsmVm> returnVMs = new HashMap<>();
for (int idx = 0; idx < vmListReturn.vmList.length; ++idx) {
Map<String, Object> vm = vmListReturn.vmList[idx];
VmDynamic dynamicData = buildVMDynamicDataFromList(vm);
VdsmVm vdsmVm = new VdsmVm(getVdsmCallTimestamp(vm)).setVmDynamic(dynamicData).setDevicesHash(getVmDevicesHash(vm));
returnVMs.put(dynamicData.getId(), vdsmVm);
}
setReturnValue(returnVMs);
}
Aggregations