Search in sources :

Example 1 with XmlTextWriter

use of org.ovirt.engine.core.utils.ovf.xml.XmlTextWriter in project ovirt-engine by oVirt.

the class LibvirtVmXmlBuilder method init.

private void init(VM vm, VmInfoBuildUtils vmInfoBuildUtils, Guid hostId) {
    this.vm = vm;
    this.vmInfoBuildUtils = vmInfoBuildUtils;
    payloadIndex = -1;
    cdRomIndex = -1;
    vnicMetadata = new HashMap<>();
    diskMetadata = new HashMap<>();
    hypervEnabled = vmInfoBuildUtils.isHypervEnabled(vm.getVmOsId(), vm.getCompatibilityVersion());
    emulatedMachine = vm.getEmulatedMachine() != null ? vm.getEmulatedMachine() : vmInfoBuildUtils.getEmulatedMachineByClusterArch(vm.getClusterArch());
    cdInterface = vmInfoBuildUtils.getCdInterface(vm.getOs(), vm.getCompatibilityVersion(), ChipsetType.fromMachineType(emulatedMachine));
    writer = new XmlTextWriter();
    qosCache = new HashMap<>();
    vmCustomProperties = VmPropertiesUtils.getInstance().getVMProperties(vm.getCompatibilityVersion(), vm.getStaticData());
    if (hostId != null) {
        hostDevicesSupplier = new MemoizingSupplier<>(() -> vmInfoBuildUtils.getHostDevices(hostId));
        hostStatisticsSupplier = new MemoizingSupplier<>(() -> vmInfoBuildUtils.getVdsStatistics(hostId));
        hostNumaNodesSupplier = new MemoizingSupplier<>(() -> vmInfoBuildUtils.getVdsNumaNodes(hostId));
    } else {
        hostDevicesSupplier = new MemoizingSupplier<>(() -> Collections.emptyMap());
        hostStatisticsSupplier = new MemoizingSupplier<>(() -> null);
        hostNumaNodesSupplier = new MemoizingSupplier<>(() -> Collections.emptyList());
    }
    vmNumaNodesSupplier = new MemoizingSupplier<>(() -> vmInfoBuildUtils.getVmNumaNodes(vm));
}
Also used : XmlTextWriter(org.ovirt.engine.core.utils.ovf.xml.XmlTextWriter)

Aggregations

XmlTextWriter (org.ovirt.engine.core.utils.ovf.xml.XmlTextWriter)1