use of org.ovirt.engine.core.common.businessentities.ArchitectureType in project ovirt-engine by oVirt.
the class OvfUtils method analyzeOvfFile.
private void analyzeOvfFile(List<UnregisteredDisk> unregisteredDisks, Guid storageDomainId, List<OvfEntityData> ovfEntityDataFromTar, Entry<String, ByteBuffer> fileEntry) {
String ovfData = new String(fileEntry.getValue().array());
VmEntityType vmType = getVmEntityType(ovfData);
ArchitectureType archType = null;
Guid entityId = getEntityId(fileEntry.getKey());
String vmName = getEntityName(ovfData);
try {
XmlDocument xmlDocument = new XmlDocument(ovfData);
archType = getOsSection(xmlDocument);
if (isExternalVM(xmlDocument)) {
log.warn("Retrieve an external OVF Entity from storage domain ID '{}' for entity ID '{}'," + " entity name '{}' and VM Type of '{}'." + " This OVF will be ignored since external VMs should not be restored.", storageDomainId, getEntityId(fileEntry.getKey()), getEntityName(ovfData), vmType.name());
return;
}
updateUnregisteredDisksWithVMs(unregisteredDisks, entityId, vmName, xmlDocument);
} catch (Exception e) {
log.error("Could not parse VM's disks or architecture, file name: {}, content size: {}, error: {}", fileEntry.getKey(), ovfData.length(), e.getMessage());
log.debug("Exception", e);
return;
}
// Creates an OVF entity data.
OvfEntityData ovfEntityData = createOvfEntityData(storageDomainId, ovfData, vmType, vmName, archType, entityId);
log.info("Retrieve OVF Entity from storage domain ID '{}' for entity ID '{}', entity name '{}' and VM Type of '{}'", storageDomainId, getEntityId(fileEntry.getKey()), getEntityName(ovfData), vmType.name());
ovfEntityDataFromTar.add(ovfEntityData);
}
use of org.ovirt.engine.core.common.businessentities.ArchitectureType in project ovirt-engine by oVirt.
the class OvfUtils method getOsSection.
private ArchitectureType getOsSection(XmlDocument xmlDocument) {
ArchitectureType archType = null;
XmlNode content = xmlDocument.selectSingleNode("//*/Content");
XmlNodeList nodeList = content.selectNodes("Section");
XmlNode selectedSection = null;
if (nodeList != null) {
for (XmlNode section : nodeList) {
String value = section.attributes.get("xsi:type").getValue();
if (value.equals("ovf:OperatingSystemSection_Type")) {
selectedSection = section;
break;
}
}
if (selectedSection != null) {
int osId = osRepository.getOsIdByUniqueName(selectedSection.innerText);
archType = osRepository.getArchitectureFromOS(osId);
}
}
return archType;
}
use of org.ovirt.engine.core.common.businessentities.ArchitectureType in project ovirt-engine by oVirt.
the class VmOverheadCalculatorImpl method getStaticOverheadInMb.
/**
* Get the memory overhead QEMU imposes on the VM immediately.
* The value contains the needed memory size for page tables and
* memory hotplug structures + expected fixed overhead (shared libraries
* and internal QEMU structures).
*
* @param vm the relevant VM
* @return required amount of memory in MiB
* @throws RuntimeException
* thrown in case the cluster architecture cannot be identified
*/
@Override
public int getStaticOverheadInMb(VM vm) {
int vmRam = vm.getVmMemSizeMb();
ArchitectureType architecture = vm.getClusterArch().getFamily();
boolean onPpc = architecture == ArchitectureType.ppc;
int fixedOverhead = onPpc ? 100 : 64;
int pageTable;
if (onPpc) {
int maxRam = vmRam;
if (FeatureSupported.hotPlugMemory(vm.getCompatibilityVersion(), vm.getClusterArch())) {
maxRam = vm.getMaxMemorySizeMb();
}
int powerOf2 = Integer.highestOneBit(maxRam);
pageTable = (maxRam > powerOf2 ? powerOf2 * 2 : powerOf2) / 64;
} else {
pageTable = vmRam / 512;
}
return pageTable + fixedOverhead;
}
use of org.ovirt.engine.core.common.businessentities.ArchitectureType in project ovirt-engine by oVirt.
the class HandleVdsCpuFlagsOrClusterChangedCommand method updateMigrateOnError.
private void updateMigrateOnError(Cluster group) {
ArchitectureType arch = getArchitecture(group);
boolean isMigrationSupported = FeatureSupported.isMigrationSupported(arch, group.getCompatibilityVersion());
if (!isMigrationSupported) {
group.setMigrateOnError(MigrateOnErrorOptions.NO);
}
}
use of org.ovirt.engine.core.common.businessentities.ArchitectureType in project ovirt-engine by oVirt.
the class ClusterModel method populateCPUList.
private void populateCPUList(List<ServerCpu> cpus, boolean canChangeArchitecture) {
// disable CPU Architecture-Type filtering
getArchitecture().getSelectedItemChangedEvent().removeListener(this);
ServerCpu oldSelectedCpu = getCPU().getSelectedItem();
ArchitectureType oldSelectedArch = getArchitecture().getSelectedItem();
getCPU().setItems(cpus);
initSupportedArchitectures();
getCPU().setSelectedItem(oldSelectedCpu != null ? Linq.firstOrNull(cpus, new Linq.ServerCpuPredicate(oldSelectedCpu.getCpuName())) : null);
if (getCPU().getSelectedItem() == null || !isCPUinitialized) {
initCPU();
}
if (getIsEdit()) {
if (!canChangeArchitecture) {
getArchitecture().setItems(new ArrayList<>(Collections.singletonList(getEntity().getArchitecture())));
}
if (oldSelectedArch != null) {
getArchitecture().setSelectedItem(oldSelectedArch);
} else {
if (getEntity() != null) {
getArchitecture().setSelectedItem(getEntity().getArchitecture());
} else {
getArchitecture().setSelectedItem(ArchitectureType.undefined);
}
}
} else {
getArchitecture().setSelectedItem(ArchitectureType.undefined);
}
// enable CPU Architecture-Type filtering
initCpuArchTypeFiltering();
}
Aggregations