Improvements to nova-manage:
1. nova-manage network list now shows what belongs to what project, and what's the vlan id, simplifying management in case of several networks/projects 2. nova-manage server list [zone] - shows servers. Useful if you have many servers and want to list them in particular zone, instead of grep'ing nova-manage service list.
This commit is contained in:
@@ -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 HostCommands(object):
|
||||
"""List hosts"""
|
||||
|
||||
def list(self, zone=None):
|
||||
"""Show a list of all physical hosts. 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]
|
||||
hosts = []
|
||||
for srv in services:
|
||||
if not [h for h in hosts if h['host'] == srv['host']]:
|
||||
hosts.append(srv)
|
||||
|
||||
for h in hosts:
|
||||
print "%-25s\t%-15s" % (h['host'], h['availability_zone'])
|
||||
|
||||
|
||||
class DbCommands(object):
|
||||
"""Class for managing the database."""
|
||||
|
||||
@@ -1185,6 +1211,7 @@ CATEGORIES = [
|
||||
('fixed', FixedIpCommands),
|
||||
('flavor', InstanceTypeCommands),
|
||||
('floating', FloatingIpCommands),
|
||||
('host', HostCommands),
|
||||
('instance_type', InstanceTypeCommands),
|
||||
('image', ImageCommands),
|
||||
('network', NetworkCommands),
|
||||
|
||||
Reference in New Issue
Block a user