From 0c57bca6e346eef12fbce7ad17f77ec59c127b16 Mon Sep 17 00:00:00 2001 From: Christopher MacGown Date: Fri, 22 Jul 2011 20:29:37 -0700 Subject: [PATCH] Config-Drive happiness, minus smoketest --- Authors | 1 + nova/scheduler/simple.py | 1 + nova/tests/test_compute.py | 14 ++++++++++++++ run_tests.sh | 2 +- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Authors b/Authors index f3129c26e..51f511996 100644 --- a/Authors +++ b/Authors @@ -16,6 +16,7 @@ Chiradeep Vittal Chmouel Boudjnah Chris Behrens Christian Berendt +Christopher MacGown Chuck Short Cory Wright Dan Prince diff --git a/nova/scheduler/simple.py b/nova/scheduler/simple.py index fc1b3142a..61c76b35d 100644 --- a/nova/scheduler/simple.py +++ b/nova/scheduler/simple.py @@ -41,6 +41,7 @@ class SimpleScheduler(chance.ChanceScheduler): def _schedule_instance(self, context, instance_id, *_args, **_kwargs): """Picks a host that is up and has the fewest running instances.""" + instance_ref = db.instance_get(context, instance_id) if (instance_ref['availability_zone'] and ':' in instance_ref['availability_zone'] diff --git a/nova/tests/test_compute.py b/nova/tests/test_compute.py index 5d59b628a..bc681706d 100644 --- a/nova/tests/test_compute.py +++ b/nova/tests/test_compute.py @@ -162,6 +162,20 @@ class ComputeTestCase(test.TestCase): db.security_group_destroy(self.context, group['id']) db.instance_destroy(self.context, ref[0]['id']) + def test_create_instance_associates_config_drive(self): + """Make sure create associates a config drive.""" + + instance_id = self._create_instance(params={'config_drive': True,}) + + try: + self.compute.run_instance(self.context, instance_id) + instances = db.instance_get_all(context.get_admin_context()) + instance = instances[0] + + self.assertTrue(instance.config_drive) + finally: + db.instance_destroy(self.context, instance_id) + def test_default_hostname_generator(self): cases = [(None, 'server_1'), ('Hello, Server!', 'hello_server'), ('<}\x1fh\x10e\x08l\x02l\x05o\x12!{>', 'hello')] diff --git a/run_tests.sh b/run_tests.sh index b8078e150..5dba410b0 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -59,7 +59,7 @@ function run_tests { ERRSIZE=`wc -l run_tests.log | awk '{print \$1}'` if [ "$ERRSIZE" -lt "40" ]; then - cat run_tests.log + echo cat run_tests.log fi fi return $RESULT