From 4227264153e06d576387f76b267f3d35ff17f391 Mon Sep 17 00:00:00 2001 From: Mike Scherbakov Date: Sat, 2 Jul 2011 01:28:13 +0400 Subject: Improvements to nova-manage: network list now includes vlan and projectID, added servers list filtered by zone if needed --- bin/nova-manage | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 7dfe91698..8ba78a56a 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -615,15 +615,19 @@ class NetworkCommands(object): def list(self): """List all created networks""" - print "%-18s\t%-15s\t%-15s\t%-15s" % (_('network'), - _('netmask'), - _('start address'), - 'DNS') + print "%-18s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s" % (_('network'), + _('netmask'), + _('start address'), + _('DNS'), + _('VlanID'), + 'project') for network in db.network_get_all(context.get_admin_context()): - print "%-18s\t%-15s\t%-15s\t%-15s" % (network.cidr, - network.netmask, - network.dhcp_start, - network.dns) + print "%-18s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s" % (network.cidr, + network.netmask, + network.dhcp_start, + network.dns, + network.vlan, + network.project_id) def delete(self, fixed_range): """Deletes a network""" @@ -812,6 +816,28 @@ class ServiceCommands(object): {"method": "update_available_resource"}) +class ServerCommands(object): + """List servers""" + + def list(self, zone=None): + """Show a list of all servers. Filter by zone. + args: [zone]""" + print "%-25s\t%-15s" % (_('host'), + _('zone')) + ctxt = context.get_admin_context() + now = utils.utcnow() + services = db.service_get_all(ctxt) + if zone: + services = [s for s in services if s['availability_zone'] == zone] + servers = [] + for srv in services: + if not [s for s in servers if s['host'] == srv['host']]: + servers.append(srv) + + for srv in servers: + print "%-25s\t%-15s" % (srv['host'], srv['availability_zone']) + + class DbCommands(object): """Class for managing the database.""" @@ -1191,6 +1217,7 @@ CATEGORIES = [ ('project', ProjectCommands), ('role', RoleCommands), ('service', ServiceCommands), + ('server', ServerCommands), ('shell', ShellCommands), ('user', UserCommands), ('version', VersionCommands), -- cgit From 915c7d52fa1b2afe6af9686210982d5bc043be97 Mon Sep 17 00:00:00 2001 From: Mike Scherbakov Date: Tue, 12 Jul 2011 11:07:30 -0700 Subject: Renamed 'nova-manage server list' -> 'nova-manage host list' to differentiate physical hosts from VMs --- bin/nova-manage | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 8ba78a56a..94ab22092 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -816,11 +816,11 @@ class ServiceCommands(object): {"method": "update_available_resource"}) -class ServerCommands(object): - """List servers""" +class HostCommands(object): + """List hosts""" def list(self, zone=None): - """Show a list of all servers. Filter by zone. + """Show a list of all physical hosts. Filter by zone. args: [zone]""" print "%-25s\t%-15s" % (_('host'), _('zone')) @@ -829,13 +829,13 @@ class ServerCommands(object): services = db.service_get_all(ctxt) if zone: services = [s for s in services if s['availability_zone'] == zone] - servers = [] + hosts = [] for srv in services: - if not [s for s in servers if s['host'] == srv['host']]: - servers.append(srv) + if not [h for h in hosts if h['host'] == srv['host']]: + hosts.append(srv) - for srv in servers: - print "%-25s\t%-15s" % (srv['host'], srv['availability_zone']) + for h in hosts: + print "%-25s\t%-15s" % (h['host'], h['availability_zone']) class DbCommands(object): @@ -1211,13 +1211,13 @@ CATEGORIES = [ ('fixed', FixedIpCommands), ('flavor', InstanceTypeCommands), ('floating', FloatingIpCommands), + ('host', HostCommands), ('instance_type', InstanceTypeCommands), ('image', ImageCommands), ('network', NetworkCommands), ('project', ProjectCommands), ('role', RoleCommands), ('service', ServiceCommands), - ('server', ServerCommands), ('shell', ShellCommands), ('user', UserCommands), ('version', VersionCommands), -- cgit