diff --git a/bin/nova-manage b/bin/nova-manage index b977eb94d..0b71da41e 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 = [ diff --git a/doc/source/man/novamanage.rst b/doc/source/man/novamanage.rst index bb9d7a7fe..94e93129a 100644 --- a/doc/source/man/novamanage.rst +++ b/doc/source/man/novamanage.rst @@ -179,6 +179,41 @@ Nova Floating IPs Displays a list of all floating IP addresses. +Nova Flavor +~~~~~~~~~~~ + +``nova-manage flavor list`` + + Outputs a list of all active flavors to the screen. + +``nova-manage flavor list --all`` + + Outputs a list of all flavors (active and inactive) to the screen. + +``nova-manage flavor create `` + + creates a flavor with the following positional arguments: + * memory (expressed in megabytes) + * vcpu(s) (integer) + * local storage (expressed in gigabytes) + * flavorid (unique integer) + * swap space (expressed in megabytes, defaults to zero, optional) + * RXTX quotas (expressed in gigabytes, defaults to zero, optional) + * RXTX cap (expressed in gigabytes, defaults to zero, optional) + +``nova-manage flavor delete `` + + Delete the flavor with the name . This marks the flavor as inactive and cannot be launched. However, the record stays in the database for archival and billing purposes. + +``nova-manage flavor delete --purge`` + + Purges the flavor with the name . This removes this flavor from the database. + + +Nova Instance_type +~~~~~~~~~~~~~~~~~~ + +Nova instance_type is a alias for FILES ======== diff --git a/doc/source/runnova/managing.instance.types.rst b/doc/source/runnova/managing.instance.types.rst index 30a47e47d..656268f8e 100644 --- a/doc/source/runnova/managing.instance.types.rst +++ b/doc/source/runnova/managing.instance.types.rst @@ -44,9 +44,9 @@ To see all currently active instance types, use the list subcommand:: m1.small: Memory: 2048MB, VCPUS: 1, Storage: 20GB, FlavorID: 2, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB By default, the list subcommand only shows active instance types. To see all instance types -(even those deleted), add the argument 1 after the list subcommand like so:: +(even those deleted), use the listall subcommand:: - # nova-manage instance_type list 1 + # nova-manage instance_type listall m1.medium: Memory: 4096MB, VCPUS: 2, Storage: 40GB, FlavorID: 3, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB m1.large: Memory: 8192MB, VCPUS: 4, Storage: 80GB, FlavorID: 4, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB m1.tiny: Memory: 512MB, VCPUS: 1, Storage: 0GB, FlavorID: 1, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB @@ -81,3 +81,13 @@ type from the database, pass the "--purge" flag after the name:: # nova-manage instance_type delete m1.xxlarge --purge m1.xxlarge deleted + +To see all instance types (inactive + active), use the list subcommand with the "--all" flag:: + + # nova-manage instance_type list --all + m1.medium: Memory: 4096MB, VCPUS: 2, Storage: 40GB, FlavorID: 3, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB + m1.large: Memory: 8192MB, VCPUS: 4, Storage: 80GB, FlavorID: 4, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB + m1.tiny: Memory: 512MB, VCPUS: 1, Storage: 0GB, FlavorID: 1, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB + m1.xlarge: Memory: 16384MB, VCPUS: 8, Storage: 160GB, FlavorID: 5, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB + m1.small: Memory: 2048MB, VCPUS: 1, Storage: 20GB, FlavorID: 2, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB +