From 458e3841bbcca266c3e69404068f566c010987bc Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Tue, 18 Jan 2011 15:49:42 -0600 Subject: [PATCH 01/30] Plug VBD to existing instance and minor cleanup --- nova/tests/xenapi/stubs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/tests/xenapi/stubs.py b/nova/tests/xenapi/stubs.py index 292bd9ba..31366882 100644 --- a/nova/tests/xenapi/stubs.py +++ b/nova/tests/xenapi/stubs.py @@ -37,7 +37,7 @@ def stubout_instance_snapshot(stubs): return self.rv done = FakeEvent() - self._poll_task(id, task, done) + self._poll_task(task, id, done) rv = done.wait() return rv From 47802429327e0e414cbc37a1149925070b6a7b21 Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Tue, 18 Jan 2011 17:57:11 -0600 Subject: [PATCH 02/30] Fixed unit tests --- nova/tests/xenapi/stubs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nova/tests/xenapi/stubs.py b/nova/tests/xenapi/stubs.py index c1ba25e1..13603717 100644 --- a/nova/tests/xenapi/stubs.py +++ b/nova/tests/xenapi/stubs.py @@ -27,7 +27,7 @@ def stubout_instance_snapshot(stubs): def fake_fetch_image(cls, session, instance_id, image, user, project, type): # Stubout wait_for_task - def fake_wait_for_task(self, id, task): + def fake_wait_for_task(self, task, id=None): class FakeEvent: def send(self, value): @@ -37,7 +37,7 @@ def stubout_instance_snapshot(stubs): return self.rv done = FakeEvent() - self._poll_task(task, id, done) + self._poll_task(id, task, done) rv = done.wait() return rv From 94a323931765b3451e5b6c0efcfbc4feaba47121 Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Tue, 18 Jan 2011 18:09:58 -0600 Subject: [PATCH 03/30] Fixed unit tests --- nova/tests/xenapi/stubs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/tests/xenapi/stubs.py b/nova/tests/xenapi/stubs.py index 13603717..66d232a7 100644 --- a/nova/tests/xenapi/stubs.py +++ b/nova/tests/xenapi/stubs.py @@ -27,7 +27,7 @@ def stubout_instance_snapshot(stubs): def fake_fetch_image(cls, session, instance_id, image, user, project, type): # Stubout wait_for_task - def fake_wait_for_task(self, task, id=None): + def fake_wait_for_task(self, task, id): class FakeEvent: def send(self, value): From 9edd3ea39b0fb82c39fd5c668993fefcc5be81ac Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Tue, 1 Feb 2011 18:34:46 -0800 Subject: [PATCH 04/30] initial support for dynamic instance_types: db migration and model, stub tests and stub methods. --- bin/nova-manage | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/bin/nova-manage b/bin/nova-manage index 1b70ebf1..952bf4fd 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -609,6 +609,44 @@ class VolumeCommands(object): "mountpoint": volume['mountpoint']}}) +class InstanceTypesCommands(object): + """Class for managing instance types / flavors.""" + + def create(self, name, memory, vcpus, localstorage): + """Creates instance types / flavors + arguments: name memory vcpus localstorage""" + #for address in IPy.IP(range): + # db.floating_ip_create(context.get_admin_context(), + # {'address': str(address), + # 'host': host}) + + def delete(self, name): + """Deletes instance types / flavors + arguments: name""" + #for address in IPy.IP(ip_range): + # db.floating_ip_destroy(context.get_admin_context(), + # str(address)) + + def list(self): + """Lists all instance types / flavors + arguments: """ + #ctxt = context.get_admin_context() + #if host == None: + # floating_ips = db.floating_ip_get_all(ctxt) + #else: + # floating_ips = db.floating_ip_get_all_by_host(ctxt, host) + #for floating_ip in floating_ips: + # instance = None + # if floating_ip['fixed_ip']: + # instance = floating_ip['fixed_ip']['instance']['ec2_id'] + # print "%s\t%s\t%s" % (floating_ip['host'], + # floating_ip['address'], + # instance) + # print "%-10s %-10s %-8s %s %s" % (svc['host'], svc['binary'], + # active, art, + # svc['updated_at']) + + CATEGORIES = [ ('user', UserCommands), ('project', ProjectCommands), @@ -620,7 +658,8 @@ CATEGORIES = [ ('service', ServiceCommands), ('log', LogCommands), ('db', DbCommands), - ('volume', VolumeCommands)] + ('volume', VolumeCommands), + ('instance_types', InstanceTypesCommands)] def lazy_match(name, key_value_tuples): From 53db643dcf260e15eb658f7e3e91b7af08a3e417 Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Thu, 3 Feb 2011 17:57:46 -0800 Subject: [PATCH 05/30] flagged all INSTANCE_TYPES usage with FIXME comment. Added basic usage to nova-manage (needs formatting). created api methods. --- bin/nova-manage | 39 ++++++++++++++------------------------- nova/tests/test_xenapi.py | 1 + 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 952bf4fd..0406a2dd 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -611,40 +611,29 @@ class VolumeCommands(object): class InstanceTypesCommands(object): """Class for managing instance types / flavors.""" + def usage(self): + print "$ nova-manage instance_type NAME MEMORY_MB VCPUS LOCAL_GB" - def create(self, name, memory, vcpus, localstorage): + def create(self, name, memory, vcpus, local_gb): """Creates instance types / flavors - arguments: name memory vcpus localstorage""" - #for address in IPy.IP(range): - # db.floating_ip_create(context.get_admin_context(), - # {'address': str(address), - # 'host': host}) + arguments: name memory_mb vcpus local_gb""" + db.instance_type_create(context.get_admin_context(), name, memory, vcpus, local_gb) def delete(self, name): - """Deletes instance types / flavors + """Marks instance types / flavors as deleted arguments: name""" - #for address in IPy.IP(ip_range): - # db.floating_ip_destroy(context.get_admin_context(), - # str(address)) + ctxt = context.get_admin_context() + # check to see if it exists + db.instance_type_delete(context,name) def list(self): """Lists all instance types / flavors arguments: """ - #ctxt = context.get_admin_context() - #if host == None: - # floating_ips = db.floating_ip_get_all(ctxt) - #else: - # floating_ips = db.floating_ip_get_all_by_host(ctxt, host) - #for floating_ip in floating_ips: - # instance = None - # if floating_ip['fixed_ip']: - # instance = floating_ip['fixed_ip']['instance']['ec2_id'] - # print "%s\t%s\t%s" % (floating_ip['host'], - # floating_ip['address'], - # instance) - # print "%-10s %-10s %-8s %s %s" % (svc['host'], svc['binary'], - # active, art, - # svc['updated_at']) + instance_types = db.instance_type_get_all(context.get_admin_context()) + for instance in instance_types: + print "%s : %s memory (MB), %s vcpus, %s storage(GB)" % (instance.name, + instance.memory_mb, instance.vcpus, + instance.local_gb) CATEGORIES = [ diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index 9f5b266f..e38bd4da 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -225,6 +225,7 @@ class XenAPIVMTestCase(test.TestCase): vm = vms[0] # Check that m1.large above turned into the right thing. + # FIX-ME(kpepple) for dynamic flavors instance_type = instance_types.INSTANCE_TYPES['m1.large'] mem_kib = long(instance_type['memory_mb']) << 10 mem_bytes = str(mem_kib << 10) From 7862644e473e975ecad14bd50a408054aa872df6 Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Sat, 5 Feb 2011 01:14:45 -0800 Subject: [PATCH 06/30] added FIXME(kpepple) comments for all constant usage of INSTANCE_TYPES. updated api/ec2/admin.py to use the new instance_types db table --- bin/nova-manage | 11 ++++++----- nova/tests/test_xenapi.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 0406a2dd..5a487590 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -617,23 +617,24 @@ class InstanceTypesCommands(object): def create(self, name, memory, vcpus, local_gb): """Creates instance types / flavors arguments: name memory_mb vcpus local_gb""" - db.instance_type_create(context.get_admin_context(), name, memory, vcpus, local_gb) + db.instance_type_create(context.get_admin_context(), + name, memory, vcpus, local_gb) def delete(self, name): """Marks instance types / flavors as deleted arguments: name""" ctxt = context.get_admin_context() # check to see if it exists - db.instance_type_delete(context,name) + db.instance_type_delete(context, name) def list(self): """Lists all instance types / flavors arguments: """ instance_types = db.instance_type_get_all(context.get_admin_context()) for instance in instance_types: - print "%s : %s memory (MB), %s vcpus, %s storage(GB)" % (instance.name, - instance.memory_mb, instance.vcpus, - instance.local_gb) + print "%s : %s memory (MB), %s vcpus, %s storage(GB)" % + (instance.name, instance.memory_mb, instance.vcpus, + instance.local_gb) CATEGORIES = [ diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index e38bd4da..1d42f8da 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -225,7 +225,7 @@ class XenAPIVMTestCase(test.TestCase): vm = vms[0] # Check that m1.large above turned into the right thing. - # FIX-ME(kpepple) for dynamic flavors + # FIXME(kpepple) for dynamic flavors instance_type = instance_types.INSTANCE_TYPES['m1.large'] mem_kib = long(instance_type['memory_mb']) << 10 mem_bytes = str(mem_kib << 10) From e90bf5d1bfaa1bae756e1232617bcbd056d12d70 Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Sat, 5 Feb 2011 02:45:53 -0800 Subject: [PATCH 07/30] converted openstack flavors over to use instance_types table. a few pep changes. --- bin/nova-manage | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 5a487590..69285a42 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -632,9 +632,8 @@ class InstanceTypesCommands(object): arguments: """ instance_types = db.instance_type_get_all(context.get_admin_context()) for instance in instance_types: - print "%s : %s memory (MB), %s vcpus, %s storage(GB)" % - (instance.name, instance.memory_mb, instance.vcpus, - instance.local_gb) + print "%s : %s memory(MB), %s vcpus, %s storage(GB)" % (instance.name, + instance.memory_mb, instance.vcpus, instance.local_gb) CATEGORIES = [ From 61c4b72783946c1248eef1357f1ae793f6ba5326 Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Sat, 5 Feb 2011 13:49:38 -0800 Subject: [PATCH 08/30] corrected db.instance_types to return expect dict instead of lists. updated openstack flavors to expect dicts instead of lists. added deleted column to returned dict. --- bin/nova-manage | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 69285a42..2db1c67b 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -632,8 +632,9 @@ class InstanceTypesCommands(object): arguments: """ instance_types = db.instance_type_get_all(context.get_admin_context()) for instance in instance_types: - print "%s : %s memory(MB), %s vcpus, %s storage(GB)" % (instance.name, - instance.memory_mb, instance.vcpus, instance.local_gb) + print "%s : %s memory(MB), %s vcpus, %s storage(GB)" % \ + (instance.name, instance.memory_mb, instance.vcpus, + instance.local_gb) CATEGORIES = [ From 29adaa08c86ba150d688a4a30b52e65d20364020 Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Sat, 5 Feb 2011 18:27:51 -0800 Subject: [PATCH 09/30] rewrote nova-manage instance_type to use correct db.api returned objects and have more robust error handling --- bin/nova-manage | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 2db1c67b..8e2c7962 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -611,30 +611,51 @@ class VolumeCommands(object): class InstanceTypesCommands(object): """Class for managing instance types / flavors.""" - def usage(self): - print "$ nova-manage instance_type NAME MEMORY_MB VCPUS LOCAL_GB" - def create(self, name, memory, vcpus, local_gb): + def create(self, name, memory, vcpus, local_gb, flavorid): """Creates instance types / flavors arguments: name memory_mb vcpus local_gb""" + # FIXME(kpepple) check for absurb arguments (?) + for option in [memory, flavorid, local_gb, vcpus]: + if option <= 0: + print "Instance type parameters must be positive \ + numbers: %s" % option + sys.exit(1) db.instance_type_create(context.get_admin_context(), - name, memory, vcpus, local_gb) + dict(name=name, memory_mb=memory, + vcpus=vcpus, local_gb=local_gb, + flavorid=flavorid)) + print "%s created" % name + return def delete(self, name): """Marks instance types / flavors as deleted arguments: name""" - ctxt = context.get_admin_context() - # check to see if it exists - db.instance_type_delete(context, name) + if name == None: + print "Instance type name must be supplied" + exit(1) + else: + records = db.instance_type_destroy(context.get_admin_context(),\ + name) + if records != 1: + sys.exit(1) + return - def list(self): + def list(self, name=None): """Lists all instance types / flavors - arguments: """ - instance_types = db.instance_type_get_all(context.get_admin_context()) - for instance in instance_types: + arguments: [name]""" + ctxt = context.get_admin_context() + if name == None: + instance_types = db.instance_type_get_all(ctxt) + if len(instance_types) < 1: + sys.exit(1) + else: + instance_types = db.instance_type_get_by_name(ctxt, name) + for k, v in instance_types.iteritems(): print "%s : %s memory(MB), %s vcpus, %s storage(GB)" % \ - (instance.name, instance.memory_mb, instance.vcpus, - instance.local_gb) + (k, v["memory_mb"], + v["vcpus"], v["local_gb"]) + return CATEGORIES = [ From 4f92279d166b1b940594da1d081f2e887df56763 Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Sun, 6 Feb 2011 13:28:07 -0800 Subject: [PATCH 10/30] simplified instance_types db calls to return entire row - we may need these extra columns for some features and there seems to be little downside in including them. still need to fix testing calls. --- bin/nova-manage | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 8e2c7962..73d69fc6 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -649,12 +649,16 @@ class InstanceTypesCommands(object): instance_types = db.instance_type_get_all(ctxt) if len(instance_types) < 1: sys.exit(1) + for k, v in instance_types.iteritems(): + print "%s : %s memory(MB), %s vcpus, %s storage(GB)" % \ + (k, v["memory_mb"], + v["vcpus"], v["local_gb"]) else: instance_types = db.instance_type_get_by_name(ctxt, name) - for k, v in instance_types.iteritems(): print "%s : %s memory(MB), %s vcpus, %s storage(GB)" % \ - (k, v["memory_mb"], - v["vcpus"], v["local_gb"]) + (instance_types["name"], instance_types["memory_mb"], + instance_types["vcpus"], instance_types["local_gb"]) + return From 02daae32c7f328d460ba46099a8e3b37a5f5f63f Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Sun, 6 Feb 2011 13:48:03 -0800 Subject: [PATCH 11/30] aliased flavor to instance_types in nova-manage. will probably need to make flavor a full fledged class as users will want to list flavors by flavor name --- bin/nova-manage | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 73d69fc6..c3fa9cf3 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -609,7 +609,7 @@ class VolumeCommands(object): "mountpoint": volume['mountpoint']}}) -class InstanceTypesCommands(object): +class InstanceTypeCommands(object): """Class for managing instance types / flavors.""" def create(self, name, memory, vcpus, local_gb, flavorid): @@ -674,7 +674,8 @@ CATEGORIES = [ ('log', LogCommands), ('db', DbCommands), ('volume', VolumeCommands), - ('instance_types', InstanceTypesCommands)] + ('instance_type', InstanceTypeCommands), + ('flavor', InstanceTypeCommands)] def lazy_match(name, key_value_tuples): From 91fd3ab9ddb26f9d7b911573dd822c9cf838ee92 Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Mon, 7 Feb 2011 15:04:26 -0800 Subject: [PATCH 12/30] added INSTANCE_TYPES to test for compatibility with current tests --- nova/tests/test_xenapi.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index 1d42f8da..d8611ea1 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -225,8 +225,7 @@ class XenAPIVMTestCase(test.TestCase): vm = vms[0] # Check that m1.large above turned into the right thing. - # FIXME(kpepple) for dynamic flavors - instance_type = instance_types.INSTANCE_TYPES['m1.large'] + instance_type = test.INSTANCE_TYPES['m1.large'] mem_kib = long(instance_type['memory_mb']) << 10 mem_bytes = str(mem_kib << 10) vcpus = instance_type['vcpus'] From de1944f5b24b92f8058bd5b5aff689cf84e8fab8 Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Tue, 8 Feb 2011 11:24:05 -0800 Subject: [PATCH 13/30] additional error checking for nova-manage instance_type --- bin/nova-manage | 57 ++++++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index c3fa9cf3..78591585 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -617,49 +617,62 @@ class InstanceTypeCommands(object): arguments: name memory_mb vcpus local_gb""" # FIXME(kpepple) check for absurb arguments (?) for option in [memory, flavorid, local_gb, vcpus]: - if option <= 0: + if (option <= 0) or (option.__class__ == int): print "Instance type parameters must be positive \ - numbers: %s" % option + integers: %s" % option sys.exit(1) - db.instance_type_create(context.get_admin_context(), + try: + db.instance_type_create(context.get_admin_context(), dict(name=name, memory_mb=memory, vcpus=vcpus, local_gb=local_gb, flavorid=flavorid)) - print "%s created" % name - return + print "%s created" % name + except exception.DBError, e: + print "%s is already a defined instance types" % name + sys.exit(1) + except: + print "Unknown error" + sys.exit(1) def delete(self, name): """Marks instance types / flavors as deleted arguments: name""" if name == None: print "Instance type name must be supplied" - exit(1) + sys.exit(1) else: - records = db.instance_type_destroy(context.get_admin_context(),\ - name) - if records != 1: + try: + records = db.instance_type_destroy( + context.get_admin_context(), + name) + except exception.NotFound, e: sys.exit(1) - return def list(self, name=None): """Lists all instance types / flavors arguments: [name]""" ctxt = context.get_admin_context() if name == None: - instance_types = db.instance_type_get_all(ctxt) - if len(instance_types) < 1: + try: + instance_types = db.instance_type_get_all(ctxt) + if len(instance_types) < 1: + sys.exit(1) + for k, v in instance_types.iteritems(): + print "%s : %s memory(MB), %s vcpus, %s storage(GB)" % \ + (k, v["memory_mb"], + v["vcpus"], v["local_gb"]) + except exception.NotFound, e: + print e sys.exit(1) - for k, v in instance_types.iteritems(): - print "%s : %s memory(MB), %s vcpus, %s storage(GB)" % \ - (k, v["memory_mb"], - v["vcpus"], v["local_gb"]) else: - instance_types = db.instance_type_get_by_name(ctxt, name) - print "%s : %s memory(MB), %s vcpus, %s storage(GB)" % \ - (instance_types["name"], instance_types["memory_mb"], - instance_types["vcpus"], instance_types["local_gb"]) - - return + try: + instance_types = db.instance_type_get_by_name(ctxt, name) + print "%s : %s memory(MB), %s vcpus, %s storage(GB)" % \ + (instance_types["name"], instance_types["memory_mb"], + instance_types["vcpus"], instance_types["local_gb"]) + except exception.NotFound, e: + print e + sys.exit(1) CATEGORIES = [ From 53a9387e0ade20e9bf62e255f058976206ce5452 Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Tue, 8 Feb 2011 19:24:14 -0800 Subject: [PATCH 14/30] added testing for instance_types.py and refactored nova-manage to use instance_types.py instead of going directly to db. --- bin/nova-manage | 63 ++++++++++++++--------------- nova/tests/test_instance_types.py | 67 +++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 33 deletions(-) create mode 100644 nova/tests/test_instance_types.py diff --git a/bin/nova-manage b/bin/nova-manage index 78591585..3ee18859 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -84,6 +84,7 @@ from nova import utils from nova.api.ec2.cloud import ec2_id_to_id from nova.auth import manager from nova.cloudpipe import pipelib +from nova.compute import instance_types from nova.db import migration @@ -612,67 +613,63 @@ class VolumeCommands(object): class InstanceTypeCommands(object): """Class for managing instance types / flavors.""" + def _print_instance_types(self, n, val): + print "%s: %s memory(MB), %s vcpus, %s storage(GB), %s flavorid"\ + % (n, val["memory_mb"], val["vcpus"], + val["local_gb"], val["flavorid"]) + def create(self, name, memory, vcpus, local_gb, flavorid): """Creates instance types / flavors arguments: name memory_mb vcpus local_gb""" - # FIXME(kpepple) check for absurb arguments (?) - for option in [memory, flavorid, local_gb, vcpus]: - if (option <= 0) or (option.__class__ == int): - print "Instance type parameters must be positive \ - integers: %s" % option - sys.exit(1) try: - db.instance_type_create(context.get_admin_context(), - dict(name=name, memory_mb=memory, - vcpus=vcpus, local_gb=local_gb, - flavorid=flavorid)) - print "%s created" % name + instance_types.create(name, memory, vcpus, local_gb, flavorid) + except exception.InvalidInputException, e: + print "Must supply valid parameters to create instance type" + sys.exit(1) except exception.DBError, e: - print "%s is already a defined instance types" % name + print "DB Error: %s" % e sys.exit(1) except: print "Unknown error" sys.exit(1) + else: + print "%s created" % name def delete(self, name): """Marks instance types / flavors as deleted arguments: name""" - if name == None: - print "Instance type name must be supplied" + try: + records = instance_types.destroy(name) + except exception.InvalidParameters: + print "Valid instance type name is required" + sys.exit(1) + except exception.NotFound, e: + print "Instance type name %s not found. \ + No instance type deleted." % name sys.exit(1) else: - try: - records = db.instance_type_destroy( - context.get_admin_context(), - name) - except exception.NotFound, e: - sys.exit(1) + print "%s deleted" % name def list(self, name=None): - """Lists all instance types / flavors + """Lists all or specific instance types / flavors arguments: [name]""" - ctxt = context.get_admin_context() if name == None: try: - instance_types = db.instance_type_get_all(ctxt) - if len(instance_types) < 1: - sys.exit(1) - for k, v in instance_types.iteritems(): - print "%s : %s memory(MB), %s vcpus, %s storage(GB)" % \ - (k, v["memory_mb"], - v["vcpus"], v["local_gb"]) + inst_types = instance_types.get_all_types() except exception.NotFound, e: print e sys.exit(1) + else: + for k, v in inst_types.iteritems(): + self._print_instance_types(k, v) else: try: - instance_types = db.instance_type_get_by_name(ctxt, name) - print "%s : %s memory(MB), %s vcpus, %s storage(GB)" % \ - (instance_types["name"], instance_types["memory_mb"], - instance_types["vcpus"], instance_types["local_gb"]) + inst_types = instance_types.get_instance_type(name) except exception.NotFound, e: print e sys.exit(1) + else: + self._print_instance_types(name, inst_types) CATEGORIES = [ diff --git a/nova/tests/test_instance_types.py b/nova/tests/test_instance_types.py new file mode 100644 index 00000000..81943176 --- /dev/null +++ b/nova/tests/test_instance_types.py @@ -0,0 +1,67 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +""" +Unit Tests for instance types code +""" +import datetime + +from nova import context +from nova import db +from nova import exception +from nova import flags +from nova import log as logging +from nova import test +from nova import utils +from nova.compute import instance_types +from nova.db.sqlalchemy.session import get_session +from nova.db.sqlalchemy import models + +FLAGS = flags.FLAGS +LOG = logging.getLogger('nova.tests.compute') + + +class InstanceTypeTestCase(test.TestCase): + """Test cases for instance type code""" + def setUp(self): + super(InstanceTypeTestCase, self).setUp() + session = get_session() + max_flavorid = session.query(models.InstanceTypes).\ + order_by("flavorid desc").first() + self.flavorid = max_flavorid["flavorid"] + 1 + self.name = str(datetime.datetime.utcnow()) + + def tearDown(self): + pass + + def test_instance_type_create_then_delete(self): + """Ensure instance types can be created""" + starting_inst_list = instance_types.get_all_types() + instance_types.create(self.name, 256, 1, 120, self.flavorid) + new = instance_types.get_all_types() + self.assertNotEqual(len(starting_inst_list), + len(new), + 'instance was not created') + rows = instance_types.destroy(self.name) + self.assertEqual(rows, 1) + self.assertEqual(1, + instance_types.get_instance_type(self.name)["deleted"]) + self.assertEqual(starting_inst_list, instance_types.get_all_types()) + + def test_get_all_instance_types(self): + """Ensures that all instance types can be retrieved""" + session = get_session() + total_instance_types = session.query(models.InstanceTypes).\ + count() + inst_types = instance_types.get_all_types() + self.assertEqual(total_instance_types, len(inst_types)) From 4856e6526abcfa895910770ca2bb8b0c2598dedf Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Thu, 10 Feb 2011 11:21:53 -0800 Subject: [PATCH 15/30] testing refactor --- bin/nova-manage | 2 +- nova/tests/test_instance_types.py | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 3ee18859..e3c3e70f 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -623,7 +623,7 @@ class InstanceTypeCommands(object): arguments: name memory_mb vcpus local_gb""" try: instance_types.create(name, memory, vcpus, local_gb, flavorid) - except exception.InvalidInputException, e: + except exception.InvalidInputException: print "Must supply valid parameters to create instance type" sys.exit(1) except exception.DBError, e: diff --git a/nova/tests/test_instance_types.py b/nova/tests/test_instance_types.py index 81943176..283f0bce 100644 --- a/nova/tests/test_instance_types.py +++ b/nova/tests/test_instance_types.py @@ -14,7 +14,7 @@ """ Unit Tests for instance types code """ -import datetime +import time from nova import context from nova import db @@ -37,12 +37,10 @@ class InstanceTypeTestCase(test.TestCase): super(InstanceTypeTestCase, self).setUp() session = get_session() max_flavorid = session.query(models.InstanceTypes).\ - order_by("flavorid desc").first() + order_by("flavorid desc").\ + first() self.flavorid = max_flavorid["flavorid"] + 1 - self.name = str(datetime.datetime.utcnow()) - - def tearDown(self): - pass + self.name = str(int(time.time())) def test_instance_type_create_then_delete(self): """Ensure instance types can be created""" From 15cc0f5c2dc4ffda3f2132db9c0c9fed3f5f2676 Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Thu, 10 Feb 2011 16:29:25 -0800 Subject: [PATCH 16/30] fixed destroy calls --- nova/tests/test_instance_types.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nova/tests/test_instance_types.py b/nova/tests/test_instance_types.py index 283f0bce..36c29d33 100644 --- a/nova/tests/test_instance_types.py +++ b/nova/tests/test_instance_types.py @@ -50,8 +50,7 @@ class InstanceTypeTestCase(test.TestCase): self.assertNotEqual(len(starting_inst_list), len(new), 'instance was not created') - rows = instance_types.destroy(self.name) - self.assertEqual(rows, 1) + instance_types.destroy(self.name) self.assertEqual(1, instance_types.get_instance_type(self.name)["deleted"]) self.assertEqual(starting_inst_list, instance_types.get_all_types()) From 09a4cd2d13d8b8160ff2d1759b6f809abda9e126 Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Fri, 11 Feb 2011 15:04:49 -0600 Subject: [PATCH 17/30] Added more columns to instance_types tables --- bin/nova-manage | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index e3c3e70f..bd2fc0e8 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -614,15 +614,42 @@ class InstanceTypeCommands(object): """Class for managing instance types / flavors.""" def _print_instance_types(self, n, val): - print "%s: %s memory(MB), %s vcpus, %s storage(GB), %s flavorid"\ - % (n, val["memory_mb"], val["vcpus"], - val["local_gb"], val["flavorid"]) + print ("%s: Memory: %sMB, VCPUS: %s, Storage: %sGB, FlavorID: %s, " + "Swap: %sGB, RXTX Quota: %sGB, RXTX Cap: %sMB") % ( + n, + val["memory_mb"], + val["vcpus"], + val["local_gb"], + val["flavorid"], + val["swap"], + val["rxtx_quota"], + val["rxtx_cap"]) - def create(self, name, memory, vcpus, local_gb, flavorid): + def create( + self, + name, + memory, + vcpus, + local_gb, + flavorid, + swap, + rxtx_quota, + rxtx_cap): """Creates instance types / flavors - arguments: name memory_mb vcpus local_gb""" + arguments: name memory vcpus local_gb flavorid swap rxtx_quota + rxtx_cap + """ + try: - instance_types.create(name, memory, vcpus, local_gb, flavorid) + instance_types.create( + name, + memory, + vcpus, + local_gb, + flavorid, + swap, + rxtx_quota, + rxtx_cap) except exception.InvalidInputException: print "Must supply valid parameters to create instance type" sys.exit(1) From 9b7a620b1f30a48a6f52d6e3cb6454969985e8bb Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Fri, 11 Feb 2011 13:53:54 -0800 Subject: [PATCH 18/30] updated tests and added more error checking --- bin/nova-manage | 15 ++++++--------- nova/tests/test_instance_types.py | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index e3c3e70f..c819af62 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -623,15 +623,16 @@ class InstanceTypeCommands(object): arguments: name memory_mb vcpus local_gb""" try: instance_types.create(name, memory, vcpus, local_gb, flavorid) - except exception.InvalidInputException: + except exception.InvalidInputException, e: print "Must supply valid parameters to create instance type" + print e sys.exit(1) except exception.DBError, e: print "DB Error: %s" % e - sys.exit(1) + sys.exit(2) except: print "Unknown error" - sys.exit(1) + sys.exit(3) else: print "%s created" % name @@ -639,14 +640,10 @@ class InstanceTypeCommands(object): """Marks instance types / flavors as deleted arguments: name""" try: - records = instance_types.destroy(name) - except exception.InvalidParameters: + instance_types.destroy(name) + except exception.ApiError: print "Valid instance type name is required" sys.exit(1) - except exception.NotFound, e: - print "Instance type name %s not found. \ - No instance type deleted." % name - sys.exit(1) else: print "%s deleted" % name diff --git a/nova/tests/test_instance_types.py b/nova/tests/test_instance_types.py index 36c29d33..68ca3b84 100644 --- a/nova/tests/test_instance_types.py +++ b/nova/tests/test_instance_types.py @@ -62,3 +62,20 @@ class InstanceTypeTestCase(test.TestCase): count() inst_types = instance_types.get_all_types() self.assertEqual(total_instance_types, len(inst_types)) + + def test_invalid_create_args_should_fail(self): + """Ensures that instance type creation fails with invalid args""" + self.assertRaises( + exception.InvalidInputException, + instance_types.create, self.name, 0, 1, 120, self.flavorid) + self.assertRaises( + exception.InvalidInputException, + instance_types.create, self.name, 256, -1, 120, self.flavorid) + self.assertRaises( + exception.InvalidInputException, + instance_types.create, self.name, 256, 1, "aa", self.flavorid) + + def test_non_existant_inst_type_shouldnt_delete(self): + """Ensures that instance type creation fails with invalid args""" + self.assertRaises(exception.ApiError, + instance_types.destroy, "sfsfsdfdfs") From 620db636e618ddd13e591b55945cddd4af7b21f6 Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Fri, 11 Feb 2011 14:06:33 -0800 Subject: [PATCH 19/30] added instance_type_purge() to actually remove records from db --- nova/tests/test_instance_types.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nova/tests/test_instance_types.py b/nova/tests/test_instance_types.py index 68ca3b84..0d54cc28 100644 --- a/nova/tests/test_instance_types.py +++ b/nova/tests/test_instance_types.py @@ -54,6 +54,7 @@ class InstanceTypeTestCase(test.TestCase): self.assertEqual(1, instance_types.get_instance_type(self.name)["deleted"]) self.assertEqual(starting_inst_list, instance_types.get_all_types()) + db.instance_type_purge(context.get_admin_context(), self.name) def test_get_all_instance_types(self): """Ensures that all instance types can be retrieved""" From a65896963a7d83d20710ef4b17e462cd4a1503c7 Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Thu, 17 Feb 2011 16:07:00 -0800 Subject: [PATCH 20/30] completed doc and added --purge option to instance type delete --- bin/nova-manage | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 21de1147..3318a593 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -713,16 +713,21 @@ class InstanceTypeCommands(object): else: print "%s created" % name - def delete(self, name): + def delete(self, name, purge=None): """Marks instance types / flavors as deleted arguments: name""" try: - instance_types.destroy(name) + if purge == "--purge": + instance_types.purge(name) + verb = "deleted" + else: + instance_types.destroy(name) + verb = "purged" except exception.ApiError: print "Valid instance type name is required" sys.exit(1) else: - print "%s deleted" % name + print "%s %s" % (name, verb) def list(self, name=None): """Lists all or specific instance types / flavors From a5b9ce08b2568423fd9642be27c6f15a58e829bf Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Fri, 18 Feb 2011 15:59:42 -0800 Subject: [PATCH 21/30] added instance types purge test --- nova/tests/test_instance_types.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nova/tests/test_instance_types.py b/nova/tests/test_instance_types.py index 0d54cc28..fe052110 100644 --- a/nova/tests/test_instance_types.py +++ b/nova/tests/test_instance_types.py @@ -49,12 +49,16 @@ class InstanceTypeTestCase(test.TestCase): new = instance_types.get_all_types() self.assertNotEqual(len(starting_inst_list), len(new), - 'instance was not created') + 'instance type was not created') instance_types.destroy(self.name) self.assertEqual(1, instance_types.get_instance_type(self.name)["deleted"]) self.assertEqual(starting_inst_list, instance_types.get_all_types()) db.instance_type_purge(context.get_admin_context(), self.name) + self.assertEqual(len(starting_inst_list), + len(instance_types.get_all_types()), + 'instance type not purged') + def test_get_all_instance_types(self): """Ensures that all instance types can be retrieved""" From bf673fb6113ab89e86457e25c29444f3b1e06c6b Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Fri, 18 Feb 2011 16:00:22 -0800 Subject: [PATCH 22/30] pep8 --- nova/tests/test_instance_types.py | 1 - 1 file changed, 1 deletion(-) diff --git a/nova/tests/test_instance_types.py b/nova/tests/test_instance_types.py index fe052110..705144cb 100644 --- a/nova/tests/test_instance_types.py +++ b/nova/tests/test_instance_types.py @@ -59,7 +59,6 @@ class InstanceTypeTestCase(test.TestCase): len(instance_types.get_all_types()), 'instance type not purged') - def test_get_all_instance_types(self): """Ensures that all instance types can be retrieved""" session = get_session() From 82fce457848fb361916a95c1ff8c9249b85f6148 Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Fri, 18 Feb 2011 17:17:47 -0800 Subject: [PATCH 23/30] added purge option and tightened up testing --- bin/nova-manage | 15 ++++++++++----- nova/tests/test_instance_types.py | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 3318a593..8ecf626a 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -683,9 +683,9 @@ class InstanceTypeCommands(object): vcpus, local_gb, flavorid, - swap, - rxtx_quota, - rxtx_cap): + swap=0, + rxtx_quota=0, + rxtx_cap=0): """Creates instance types / flavors arguments: name memory vcpus local_gb flavorid swap rxtx_quota rxtx_cap @@ -719,13 +719,18 @@ class InstanceTypeCommands(object): try: if purge == "--purge": instance_types.purge(name) - verb = "deleted" + verb = "purged" else: instance_types.destroy(name) - verb = "purged" + verb = "deleted" except exception.ApiError: print "Valid instance type name is required" sys.exit(1) + except exception.DBError, e: + print "DB Error: %s" % e + sys.exit(2) + except: + sys.exit(3) else: print "%s %s" % (name, verb) diff --git a/nova/tests/test_instance_types.py b/nova/tests/test_instance_types.py index 705144cb..1b192ca2 100644 --- a/nova/tests/test_instance_types.py +++ b/nova/tests/test_instance_types.py @@ -54,7 +54,7 @@ class InstanceTypeTestCase(test.TestCase): self.assertEqual(1, instance_types.get_instance_type(self.name)["deleted"]) self.assertEqual(starting_inst_list, instance_types.get_all_types()) - db.instance_type_purge(context.get_admin_context(), self.name) + instance_types.purge(self.name) self.assertEqual(len(starting_inst_list), len(instance_types.get_all_types()), 'instance type not purged') From c00df48bfb4e7906a1896b647ca116aa0f09d832 Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Thu, 24 Feb 2011 13:01:16 -0600 Subject: [PATCH 24/30] Updated email in Authors --- .mailmap | 1 + Authors | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index a839eba6..d479bfdf 100644 --- a/.mailmap +++ b/.mailmap @@ -19,6 +19,7 @@ + Masumoto diff --git a/Authors b/Authors index 494e614a..39241b45 100644 --- a/Authors +++ b/Authors @@ -31,7 +31,7 @@ John Dewey Jonathan Bryce Jordan Rinke Josh Durgin -Josh Kearney +Josh Kearney Joshua McKenty Justin Santa Barbara Kei Masumoto From eb3262d6dde11e0417ec480f94f94463a2bb3b87 Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Mon, 28 Feb 2011 13:16:07 -0800 Subject: [PATCH 25/30] refactored nova-manage list (-all, ) and fixed docs --- bin/nova-manage | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index b977eb94..0b71da41 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -666,8 +666,9 @@ class InstanceTypeCommands(object): """Class for managing instance types / flavors.""" def _print_instance_types(self, n, val): + deleted = ('', ', inactive')[val["deleted"] == 1] print ("%s: Memory: %sMB, VCPUS: %s, Storage: %sGB, FlavorID: %s, " - "Swap: %sGB, RXTX Quota: %sGB, RXTX Cap: %sMB") % ( + "Swap: %sGB, RXTX Quota: %sGB, RXTX Cap: %sMB%s") % ( n, val["memory_mb"], val["vcpus"], @@ -675,7 +676,8 @@ class InstanceTypeCommands(object): val["flavorid"], val["swap"], val["rxtx_quota"], - val["rxtx_cap"]) + val["rxtx_cap"], + deleted) def create( self, @@ -688,8 +690,8 @@ class InstanceTypeCommands(object): rxtx_quota=0, rxtx_cap=0): """Creates instance types / flavors - arguments: name memory vcpus local_gb flavorid swap rxtx_quota - rxtx_cap + arguments: name memory vcpus local_gb flavorid [swap] [rxtx_quota] + [rxtx_cap] """ try: instance_types.create( @@ -736,25 +738,22 @@ class InstanceTypeCommands(object): print "%s %s" % (name, verb) def list(self, name=None): - """Lists all or specific instance types / flavors + """Lists all active or specific instance types / flavors arguments: [name]""" - if name == None: - try: + try: + if name == None: inst_types = instance_types.get_all_types() - except exception.NotFound, e: - print e - sys.exit(1) + elif name == "--all": + inst_types = instance_types.get_all_types(1) else: - for k, v in inst_types.iteritems(): - self._print_instance_types(k, v) - else: - try: inst_types = instance_types.get_instance_type(name) - except exception.NotFound, e: - print e - sys.exit(1) - else: - self._print_instance_types(name, inst_types) + except exception.DBError, e: + _db_error(e) + if isinstance(inst_types.values()[0], dict): + for k, v in inst_types.iteritems(): + self._print_instance_types(k, v) + else: + self._print_instance_types(name, inst_types) CATEGORIES = [ From 53fe7d454a4ae5562f1bffe64ae47f5571df6dc9 Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Mon, 28 Feb 2011 16:28:46 -0800 Subject: [PATCH 26/30] replaced ugly INSTANCE_TYPE constant with (slightly less ugly) stubs --- nova/tests/test_xenapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index 27131c45..106c0bd6 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -233,7 +233,7 @@ class XenAPIVMTestCase(test.TestCase): vm = vms[0] # Check that m1.large above turned into the right thing. - instance_type = test.INSTANCE_TYPES['m1.large'] + instance_type = db.instance_type_get_by_name(conn, 'm1.large') mem_kib = long(instance_type['memory_mb']) << 10 mem_bytes = str(mem_kib << 10) vcpus = instance_type['vcpus'] From e9aeb218bba711240c1897980903e7b5e1214cee Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Tue, 1 Mar 2011 10:40:56 -0800 Subject: [PATCH 27/30] corrected copyrights for new files --- nova/tests/test_instance_types.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nova/tests/test_instance_types.py b/nova/tests/test_instance_types.py index 1b192ca2..edc53887 100644 --- a/nova/tests/test_instance_types.py +++ b/nova/tests/test_instance_types.py @@ -1,5 +1,6 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 +# Copyright 2011 Ken Pepple # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at From 62d6347705f40b8a17b77ce609708db57e942dad Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Wed, 2 Mar 2011 16:07:05 -0800 Subject: [PATCH 29/30] fixed coding style per devcamcar review notes --- bin/nova-manage | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 0b71da41..15bbe2f4 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -669,40 +669,19 @@ class InstanceTypeCommands(object): deleted = ('', ', inactive')[val["deleted"] == 1] print ("%s: Memory: %sMB, VCPUS: %s, Storage: %sGB, FlavorID: %s, " "Swap: %sGB, RXTX Quota: %sGB, RXTX Cap: %sMB%s") % ( - n, - val["memory_mb"], - val["vcpus"], - val["local_gb"], - val["flavorid"], - val["swap"], - val["rxtx_quota"], - val["rxtx_cap"], - deleted) + n, val["memory_mb"], val["vcpus"], val["local_gb"], + val["flavorid"], val["swap"], val["rxtx_quota"], + val["rxtx_cap"], deleted) - def create( - self, - name, - memory, - vcpus, - local_gb, - flavorid, - swap=0, - rxtx_quota=0, - rxtx_cap=0): + def create(self, name, memory, vcpus, local_gb, flavorid, + swap=0, rxtx_quota=0, rxtx_cap=0): """Creates instance types / flavors arguments: name memory vcpus local_gb flavorid [swap] [rxtx_quota] [rxtx_cap] """ try: - instance_types.create( - name, - memory, - vcpus, - local_gb, - flavorid, - swap, - rxtx_quota, - rxtx_cap) + instance_types.create(name, memory, vcpus, local_gb, + flavorid, swap, rxtx_quota, rxtx_cap) except exception.InvalidInputException: print "Must supply valid parameters to create instance type" print e From c8f3336c52596dd422fc15f57da51435123e55be Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Wed, 2 Mar 2011 16:35:53 -0800 Subject: [PATCH 30/30] pep8 --- bin/nova-manage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/nova-manage b/bin/nova-manage index 15bbe2f4..9bf3a1bb 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -673,7 +673,7 @@ class InstanceTypeCommands(object): val["flavorid"], val["swap"], val["rxtx_quota"], val["rxtx_cap"], deleted) - def create(self, name, memory, vcpus, local_gb, flavorid, + def create(self, name, memory, vcpus, local_gb, flavorid, swap=0, rxtx_quota=0, rxtx_cap=0): """Creates instance types / flavors arguments: name memory vcpus local_gb flavorid [swap] [rxtx_quota]