use of org.ovirt.engine.core.utils.ovf.xml.XmlNode in project ovirt-engine by oVirt.
the class OvfOvaReader method readCpuItem.
@Override
protected void readCpuItem(XmlNode node) {
XmlNode virtualQuantity = selectSingleNode(node, "rasd:VirtualQuantity", _xmlNS);
if (virtualQuantity != null) {
vm.setNumOfSockets(Integer.parseInt(virtualQuantity.innerText));
vm.setCpuPerSocket(1);
vm.setThreadsPerCpu(1);
} else {
super.readCpuItem(node);
}
}
use of org.ovirt.engine.core.utils.ovf.xml.XmlNode in project ovirt-engine by oVirt.
the class OvfOvirtReader method buildNicReference.
protected void buildNicReference() {
XmlNodeList list = selectNodes(_document, "//*/Nic", _xmlNS);
for (XmlNode node : list) {
VmNetworkInterface iface = new VmNetworkInterface();
iface.setId(new Guid(node.attributes.get("ovf:id").getValue()));
interfaces.add(iface);
}
if (!list.iterator().hasNext()) {
String pattern = "//*/Item[" + VMD_RESOURCE_TYPE + "=" + OvfHardware.Network + "]";
list = selectNodes(_document, pattern, _xmlNS);
int nicIdx = 0;
for (XmlNode node : list) {
VmNetworkInterface iface = new VmNetworkInterface();
iface.setId(Guid.newGuid());
updateSingleNic(node, iface, ++nicIdx);
interfaces.add(iface);
}
}
}
use of org.ovirt.engine.core.utils.ovf.xml.XmlNode in project ovirt-engine by oVirt.
the class OvfOvirtReader method readLunDisk.
@Override
protected void readLunDisk(XmlNode node, LunDisk lun) {
lun.setDiskVmElements(Collections.singletonList(new DiskVmElement(lun.getId(), fullEntityOvfData.getVmBase().getId())));
LUNs luns = new LUNs();
consumeReadXmlAttribute(node, OVF_PREFIX + COLON + LUN_ID, val -> luns.setLUNId(val));
ArrayList<StorageServerConnections> lunConnections = new ArrayList<>();
for (XmlNode connNode : selectNodes(node, LUN_CONNECTION)) {
StorageServerConnections conn = new StorageServerConnections();
consumeReadXmlAttribute(connNode, OVF_PREFIX + COLON + LUNS_CONNECTION, val -> conn.setConnection(val));
consumeReadXmlAttribute(connNode, OVF_PREFIX + COLON + LUNS_IQN, val -> conn.setIqn(val));
consumeReadXmlAttribute(connNode, OVF_PREFIX + COLON + LUNS_PORT, val -> conn.setPort(val));
consumeReadXmlAttribute(connNode, XSI_PREFIX + COLON + LUNS_STORAGE_TYPE, val -> conn.setStorageType(StorageType.valueOf(val)));
consumeReadXmlAttribute(connNode, XSI_PREFIX + COLON + LUNS_PORTAL, val -> conn.setPortal(val));
lunConnections.add(conn);
}
luns.setLunConnections(lunConnections);
lun.setLun(luns);
DiskVmElement dve = lun.getDiskVmElementForVm(fullEntityOvfData.getVmBase().getId());
initGeneralDiskAttributes(node, lun, dve);
}
use of org.ovirt.engine.core.utils.ovf.xml.XmlNode in project ovirt-engine by oVirt.
the class OvfOvirtReader method buildVirtualSystem.
@Override
public void buildVirtualSystem() {
XmlNode virtualSystem = selectSingleNode(_document, "//*/Content");
consumeReadProperty(virtualSystem, NAME, val -> fullEntityOvfData.getVmBase().setName(val));
// set ovf version to the ovf object
fullEntityOvfData.getVmBase().setOvfVersion(getVersion());
XmlNodeList list = selectNodes(virtualSystem, "Section");
if (list != null) {
// The Os need to be read before the hardware
XmlNode node = getNode(list, "xsi:type", "ovf:OperatingSystemSection_Type");
if (node != null) {
readOsSection(node);
if (!osRepository.isLinux(fullEntityOvfData.getVmBase().getOsId()) || fullEntityOvfData.getVmBase().getDefaultDisplayType() != DisplayType.qxl) {
fullEntityOvfData.getVmBase().setSingleQxlPci(false);
}
}
node = getNode(list, "xsi:type", "ovf:VirtualHardwareSection_Type");
if (node != null) {
readHardwareSection(node);
}
node = getNode(list, "xsi:type", "ovf:SnapshotsSection_Type");
if (node != null) {
readSnapshotsSection(node);
}
node = getNode(list, "xsi:type", "ovf:AffinityGroupsSection_Type");
if (node != null) {
readAffinityGroupsSection(node);
}
node = getNode(list, "xsi:type", "ovf:AffinityLabelsSection_Type");
if (node != null) {
readAffinityLabelsSection(node);
}
node = getNode(list, "xsi:type", "ovf:UserDomainsSection_Type");
if (node != null) {
readUserDomainsSection(node);
}
}
readGeneralData(virtualSystem);
}
use of org.ovirt.engine.core.utils.ovf.xml.XmlNode in project ovirt-engine by oVirt.
the class OvfReader method readUsbItem.
private void readUsbItem(XmlNode node) {
XmlNode usbPolicy = selectSingleNode(node, "rasd:UsbPolicy", _xmlNS);
vmBase.setUsbPolicy(usbPolicy != null ? UsbPolicy.forStringValue(usbPolicy.innerText) : UsbPolicy.ENABLED_NATIVE);
}
Aggregations