Last active
January 16, 2017 16:38
-
-
Save amarao/17ecbdefd12a82325dfeaf7ac4d26887 to your computer and use it in GitHub Desktop.
Bugfix for unbound port in ConfigDrive for baremetal instances (Ironic/Newtron/Nova)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/nova/virt/ironic/driver.py b/nova/virt/ironic/driver.py | |
index 5ef3394..be50787 100644 | |
--- a/nova/virt/ironic/driver.py | |
+++ b/nova/virt/ironic/driver.py | |
@@ -25,6 +25,7 @@ import gzip | |
import shutil | |
import tempfile | |
import time | |
+import copy | |
from oslo_log import log as logging | |
from oslo_service import loopingcall | |
@@ -684,6 +685,19 @@ class IronicDriver(virt_driver.ComputeDriver): | |
ports = self.ironicclient.call("node.list_ports", node.uuid) | |
return set([p.address for p in ports]) | |
+ | |
+ @staticmethod | |
+ def fix_wrong_interface_type(obj): | |
+ new_obj = copy.deepcopy(obj) | |
+ for link in new_obj: | |
+ try: | |
+ if link['type'] == 'unbound': | |
+ link['type'] = 'phy' | |
+ except KeyError: | |
+ pass | |
+ return new_obj | |
+ | |
+ | |
def _generate_configdrive(self, context, instance, node, network_info, | |
extra_md=None, files=None): | |
"""Generate a config drive. | |
@@ -700,8 +714,10 @@ class IronicDriver(virt_driver.ComputeDriver): | |
if not extra_md: | |
extra_md = {} | |
+ fixed_NI = self.fix_wrong_interface_type(network_info) | |
+ | |
i_meta = instance_metadata.InstanceMetadata(instance, | |
- content=files, extra_md=extra_md, network_info=network_info, | |
+ content=files, extra_md=extra_md, network_info=fixed_NI, | |
request_context=context) | |
with tempfile.NamedTemporaryFile() as uncompressed: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment