Revision 21670917 lib/ovf.py
b/lib/ovf.py | ||
---|---|---|
511 | 511 |
(OVF_SCHEMA, OVF_SCHEMA)) |
512 | 512 |
network_names = self._GetAttributes(networks_search, |
513 | 513 |
"{%s}name" % OVF_SCHEMA) |
514 |
required = ["ip", "mac", "link", "mode"] |
|
514 |
required = ["ip", "mac", "link", "mode", "network"]
|
|
515 | 515 |
for (counter, network_name) in enumerate(network_names): |
516 | 516 |
network_search = ("{%s}VirtualSystem/{%s}VirtualHardwareSection/{%s}Item" |
517 | 517 |
% (OVF_SCHEMA, OVF_SCHEMA, OVF_SCHEMA)) |
... | ... | |
533 | 533 |
GANETI_SCHEMA) |
534 | 534 |
ganeti_data["link"] = network_ganeti_data.findtext("{%s}Link" % |
535 | 535 |
GANETI_SCHEMA) |
536 |
ganeti_data["network"] = network_ganeti_data.findtext("{%s}Network" % |
|
537 |
GANETI_SCHEMA) |
|
536 | 538 |
mac_data = None |
537 | 539 |
if network_data: |
538 | 540 |
mac_data = network_data.findtext("{%s}Address" % RASD_SCHEMA) |
... | ... | |
753 | 755 |
SubElementText(nic, "gnt:MACAddress", network["mac"]) |
754 | 756 |
SubElementText(nic, "gnt:IPAddress", network["ip"]) |
755 | 757 |
SubElementText(nic, "gnt:Link", network["link"]) |
758 |
SubElementText(nic, "gnt:Network", network["network"]) |
|
756 | 759 |
|
757 | 760 |
def SaveVirtualSystemData(self, name, vcpus, memory): |
758 | 761 |
"""Convert virtual system information to OVF sections. |
... | ... | |
1313 | 1316 |
results["nic%s_mac" % nic_id] = nic_desc.get("mac", constants.VALUE_AUTO) |
1314 | 1317 |
results["nic%s_link" % nic_id] = \ |
1315 | 1318 |
nic_desc.get("link", constants.VALUE_AUTO) |
1319 |
results["nic%s_network" % nic_id] = \ |
|
1320 |
nic_desc.get("network", constants.VALUE_AUTO) |
|
1316 | 1321 |
if nic_desc.get("mode") == "bridged": |
1317 | 1322 |
results["nic%s_ip" % nic_id] = constants.VALUE_NONE |
1318 | 1323 |
else: |
... | ... | |
1634 | 1639 |
counter = 0 |
1635 | 1640 |
while True: |
1636 | 1641 |
data_link = \ |
1637 |
self.config_parser.get(constants.INISECT_INS, "nic%s_link" % counter)
|
|
1642 |
self.config_parser.get(constants.INISECT_INS, "nic%s_network" % counter)
|
|
1638 | 1643 |
if data_link is None: |
1639 | 1644 |
break |
1640 | 1645 |
results.append({ |
... | ... | |
1644 | 1649 |
"nic%s_mac" % counter), |
1645 | 1650 |
"ip": self.config_parser.get(constants.INISECT_INS, |
1646 | 1651 |
"nic%s_ip" % counter), |
1647 |
"link": data_link, |
|
1652 |
"link": self.config_parser.get(constants.INISECT_INS, |
|
1653 |
"nic%s_link" % counter), |
|
1654 |
"network": data_link, |
|
1648 | 1655 |
}) |
1649 | 1656 |
if results[counter]["mode"] not in constants.NIC_VALID_MODES: |
1650 | 1657 |
raise errors.OpPrereqError("Network mode %s not recognized" |
Also available in: Unified diff