use of org.ovirt.engine.core.utils.ovf.xml.XmlNode 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.utils.ovf.xml.XmlNode in project ovirt-engine by oVirt.
the class OvfOvaReader method readDiskImageItem.
protected void readDiskImageItem(XmlNode node) {
XmlNode hostResourceNode = selectSingleNode(node, "rasd:HostResource", _xmlNS);
String hostResourceText = hostResourceNode.innerText;
String diskId = hostResourceText.substring(hostResourceText.lastIndexOf('/') + 1);
DiskImage image = _images.stream().filter(d -> d.getDescription().equals(diskId)).findFirst().orElse(null);
if (image == null) {
return;
}
super.readDiskImageItem(node, image);
}
use of org.ovirt.engine.core.utils.ovf.xml.XmlNode in project ovirt-engine by oVirt.
the class OvfOvaReader method buildDisk.
@Override
public void buildDisk() {
XmlNode diskSection = selectSingleNode(_document, "//*/DiskSection");
XmlNodeList list = diskSection.selectNodes("Disk");
for (XmlNode node : list) {
readDisk(node, null);
}
}
use of org.ovirt.engine.core.utils.ovf.xml.XmlNode in project ovirt-engine by oVirt.
the class OvfOvaReader method updateSingleNic.
@Override
protected void updateSingleNic(XmlNode node, VmNetworkInterface iface, int nicIdx) {
super.updateSingleNic(node, iface, nicIdx);
XmlNode macNode = selectSingleNode(node, "rasd:MACAddress", _xmlNS);
iface.setMacAddress(macNode != null ? macNode.innerText : "");
}
use of org.ovirt.engine.core.utils.ovf.xml.XmlNode in project ovirt-engine by oVirt.
the class OvfOvirtReader method readUserDomainsSection.
protected void readUserDomainsSection(@SuppressWarnings("unused") XmlNode section) {
XmlNodeList list = selectNodes(section, OvfProperties.USER);
Set<DbUser> dbUsers = new HashSet<>();
Map<String, Set<String>> userToRoles = new HashMap<>();
for (XmlNode node : list) {
String userDomain = selectSingleNode(node, OvfProperties.USER_DOMAIN, _xmlNS).innerText;
DbUser dbUser = new DbUser();
dbUser.setLoginName(userDomain.split("@")[0]);
dbUser.setDomain(userDomain.split("@")[1]);
dbUsers.add(dbUser);
XmlNode rolesElement = selectSingleNode(node, OvfProperties.USER_ROLES);
XmlNodeList roleNodes = selectNodes(rolesElement, OvfProperties.ROLE_NAME);
Set<String> roleNames = new HashSet<>();
for (XmlNode roleNode : roleNodes) {
String roleName = roleNode.innerText;
roleNames.add(roleName);
}
userToRoles.put(dbUser.getLoginName(), roleNames);
}
fullEntityOvfData.setDbUsers(dbUsers);
fullEntityOvfData.setUserToRoles(userToRoles);
}
Aggregations