515 |
515 |
(OVF_SCHEMA, OVF_SCHEMA))
|
516 |
516 |
network_names = self._GetAttributes(networks_search,
|
517 |
517 |
"{%s}name" % OVF_SCHEMA)
|
518 |
|
required = ["ip", "mac", "link", "mode"]
|
|
518 |
required = ["ip", "mac", "link", "mode", "network"]
|
519 |
519 |
for (counter, network_name) in enumerate(network_names):
|
520 |
520 |
network_search = ("{%s}VirtualSystem/{%s}VirtualHardwareSection/{%s}Item"
|
521 |
521 |
% (OVF_SCHEMA, OVF_SCHEMA, OVF_SCHEMA))
|
... | ... | |
537 |
537 |
GANETI_SCHEMA)
|
538 |
538 |
ganeti_data["link"] = network_ganeti_data.findtext("{%s}Link" %
|
539 |
539 |
GANETI_SCHEMA)
|
|
540 |
ganeti_data["network"] = network_ganeti_data.findtext("{%s}Network" %
|
|
541 |
GANETI_SCHEMA)
|
540 |
542 |
mac_data = None
|
541 |
543 |
if network_data:
|
542 |
544 |
mac_data = network_data.findtext("{%s}Address" % RASD_SCHEMA)
|
... | ... | |
758 |
760 |
SubElementText(nic, "gnt:MACAddress", network["mac"])
|
759 |
761 |
SubElementText(nic, "gnt:IPAddress", network["ip"])
|
760 |
762 |
SubElementText(nic, "gnt:Link", network["link"])
|
|
763 |
SubElementText(nic, "gnt:Network", network["network"])
|
761 |
764 |
|
762 |
765 |
def SaveVirtualSystemData(self, name, vcpus, memory):
|
763 |
766 |
"""Convert virtual system information to OVF sections.
|
... | ... | |
1329 |
1332 |
results["nic%s_mac" % nic_id] = nic_desc.get("mac", constants.VALUE_AUTO)
|
1330 |
1333 |
results["nic%s_link" % nic_id] = \
|
1331 |
1334 |
nic_desc.get("link", constants.VALUE_AUTO)
|
|
1335 |
results["nic%s_network" % nic_id] = \
|
|
1336 |
nic_desc.get("network", constants.VALUE_AUTO)
|
1332 |
1337 |
if nic_desc.get("mode") == "bridged":
|
1333 |
1338 |
results["nic%s_ip" % nic_id] = constants.VALUE_NONE
|
1334 |
1339 |
else:
|
... | ... | |
1660 |
1665 |
counter = 0
|
1661 |
1666 |
while True:
|
1662 |
1667 |
data_link = \
|
1663 |
|
self.config_parser.get(constants.INISECT_INS, "nic%s_link" % counter)
|
|
1668 |
self.config_parser.get(constants.INISECT_INS, "nic%s_network" % counter)
|
1664 |
1669 |
if data_link is None:
|
1665 |
1670 |
break
|
1666 |
1671 |
results.append({
|
... | ... | |
1670 |
1675 |
"nic%s_mac" % counter),
|
1671 |
1676 |
"ip": self.config_parser.get(constants.INISECT_INS,
|
1672 |
1677 |
"nic%s_ip" % counter),
|
1673 |
|
"link": data_link,
|
|
1678 |
"link": self.config_parser.get(constants.INISECT_INS,
|
|
1679 |
"nic%s_link" % counter),
|
|
1680 |
"network": data_link,
|
1674 |
1681 |
})
|
1675 |
1682 |
if results[counter]["mode"] not in constants.NIC_VALID_MODES:
|
1676 |
1683 |
raise errors.OpPrereqError("Network mode %s not recognized"
|