summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Berendt <berendt@b1-systems.de>2011-02-18 12:01:50 +0100
committerChristian Berendt <berendt@b1-systems.de>2011-02-18 12:01:50 +0100
commitcf8cf8287169e3e0b996db7db5a135dea88db63a (patch)
treeaaf5154bfa7dfcd998b48f4e00dc38f29678eb79
parent205810c3da4652fd0f5203f53299cd998ac7cf82 (diff)
downloadnova-cf8cf8287169e3e0b996db7db5a135dea88db63a.tar.gz
nova-cf8cf8287169e3e0b996db7db5a135dea88db63a.tar.xz
nova-cf8cf8287169e3e0b996db7db5a135dea88db63a.zip
added new class Instances to manage instances and added a new listing method into the class
# nova-manage instance list instance node type state launched image kernel ramdisk project user zone index i-00000547 XXXXXXX m1.small running 2011-02-18 08:36:37 ami-a03ndz0q ami-0isqekvw testing berendt None 0 i-00000548 XXXXXXX m1.small running 2011-02-18 08:37:17 ami-a03ndz0q ami-0isqekvw testing berendt None 1 i-00000549 XXXXXXX m1.small running 2011-02-18 08:37:52 ami-a03ndz0q ami-0isqekvw testing berendt None 2
-rwxr-xr-xbin/nova-manage43
1 files changed, 42 insertions, 1 deletions
diff --git a/bin/nova-manage b/bin/nova-manage
index 60a00f1cf..68847bdde 100755
--- a/bin/nova-manage
+++ b/bin/nova-manage
@@ -618,6 +618,45 @@ class DbCommands(object):
print migration.db_version()
+class InstanceCommands(object):
+ """Class for managing instances."""
+
+ def list(self, host=None, instance=None):
+ """Show a list of all instances"""
+ print "%-10s %-15s %-10s %-10s %-19s %-12s %-12s" \
+ " %-12s %-10s %-10s %-10s %-5s" % (
+ _('instance'),
+ _('node'),
+ _('type'),
+ _('state'),
+ _('launched'),
+ _('image'),
+ _('kernel'),
+ _('ramdisk'),
+ _('project'),
+ _('user'),
+ _('zone'),
+ _('index'),
+ )
+
+ for instance in db.instance_get_all(context.get_admin_context()):
+ print "%-10s %-15s %-10s %-10s %-19s %-12s %-12s %-12s" \
+ " %-10s %-10s %-10s %-5d" % (
+ instance['hostname'],
+ instance['host'],
+ instance['instance_type'],
+ instance['state_description'],
+ instance['launched_at'],
+ instance['image_id'],
+ instance['kernel_id'],
+ instance['ramdisk_id'],
+ instance['project_id'],
+ instance['user_id'],
+ instance['availability_zone'],
+ instance['launch_index']
+ )
+
+
class VolumeCommands(object):
"""Methods for dealing with a cloud in an odd state"""
@@ -677,7 +716,9 @@ CATEGORIES = [
('service', ServiceCommands),
('log', LogCommands),
('db', DbCommands),
- ('volume', VolumeCommands)]
+ ('volume', VolumeCommands)
+ ('instance', InstanceCommands),
+]
def lazy_match(name, key_value_tuples):