resolved lazy_match conflict between bin/nova-manage instance and instance_type by moving instance subcommand under vm command. documented vm command in man page. removed unused instance_id from vm list subcommand.

This commit is contained in:
Ken Pepple 2011-04-10 16:57:32 +00:00 committed by Tarmac
commit 50f3f75946
2 changed files with 54 additions and 45 deletions

View File

@ -570,6 +570,49 @@ class NetworkCommands(object):
class VmCommands(object):
"""Class for mangaging VM instances."""
def list(self, host=None):
"""Show a list of all instances
:param host: show all instance on specified host.
:param instance: show specificed instance.
"""
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'))
if host == None:
instances = db.instance_get_all(context.get_admin_context())
else:
instances = db.instance_get_all_by_host(
context.get_admin_context(), host)
for instance in instances:
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'])
def live_migration(self, ec2_id, dest):
"""Migrates a running instance to a new machine.
@ -716,49 +759,6 @@ 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'))
if host == None:
instances = db.instance_get_all(context.get_admin_context())
else:
instances = db.instance_get_all_by_host(
context.get_admin_context(), host)
for instance in instances:
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"""
@ -1044,8 +1044,7 @@ CATEGORIES = [
('volume', VolumeCommands),
('instance_type', InstanceTypeCommands),
('image', ImageCommands),
('flavor', InstanceTypeCommands),
('instance', InstanceCommands)]
('flavor', InstanceTypeCommands)]
def lazy_match(name, key_value_tuples):

View File

@ -240,6 +240,16 @@ Nova Images
Converts all images in directory from the old (Bexar) format to the new format.
Nova VM
~~~~~~~~~~~
``nova-manage vm list [host]``
Show a list of all instances. Accepts optional hostname (to show only instances on specific host).
``nova-manage live-migration <ec2_id> <destination host name>``
Live migrate instance from current host to destination host. Requires instance id (which comes from euca-describe-instance) and destination host name (which can be found from nova-manage service list).
FILES
========