From 5282156bc397a8c73d42d35b2dacd0d4001429bb Mon Sep 17 00:00:00 2001 From: akalambu Date: Mon, 16 Feb 2015 20:41:44 -0800 Subject: [PATCH] Changes for bypassing metadata/cloud init and use config drive Change-Id: I5d04d7c7613b372d54b0ea16e388e08ec6de3978 --- cfg.default.yaml | 4 ++++ compute.py | 2 ++ instance.py | 1 + perf_instance.py | 5 +++++ 4 files changed, 12 insertions(+) diff --git a/cfg.default.yaml b/cfg.default.yaml index 777bae3..ca2e399 100644 --- a/cfg.default.yaml +++ b/cfg.default.yaml @@ -64,6 +64,10 @@ floating_ip: True # and reuse existing VM reuse_existing_vm : +# Set config drive to true to bypass metadata service and use config drive +# An option of config_drive to True is provided to nova boot to enable this +config_drive: + # Default name for the router to use to connect the internal mgmt network # with the external network. If a router exists with this name it will be # reused, otherwise a new router will be created diff --git a/compute.py b/compute.py index 7e9112f..4aacd54 100644 --- a/compute.py +++ b/compute.py @@ -145,6 +145,7 @@ class Compute(object): # if exists delete and recreate def create_server(self, vmname, image, flavor, key_name, nic, sec_group, avail_zone=None, user_data=None, + config_drive=None, retry_count=10): # Also attach the created security group for the test @@ -155,6 +156,7 @@ class Compute(object): nics=nic, availability_zone=avail_zone, userdata=user_data, + config_drive=config_drive, security_groups=[sec_group.id]) flag_exist = self.find_server(vmname, retry_count) if flag_exist: diff --git a/instance.py b/instance.py index 83d9208..a789766 100644 --- a/instance.py +++ b/instance.py @@ -95,6 +95,7 @@ class Instance(object): sec_group, az, user_data, + self.config_drive, self.config.generic_retry_count) if user_data: user_data.close() diff --git a/perf_instance.py b/perf_instance.py index ff27199..f77a943 100644 --- a/perf_instance.py +++ b/perf_instance.py @@ -30,6 +30,11 @@ class PerfInstance(Instance): self.tp_tool = config.tp_tool(self, config.perf_tool_path) else: self.tp_tool = None + # Override the config drive option to save in instance + if config.config_drive: + self.config_drive = True + else: + self.config_drive = None # No args is reserved for native host server def create(self, image=None, flavor_type=None,