Improvements to nova-manage: network list now includes vlan and projectID, added servers list filtered by zone if needed
This commit is contained in:
@@ -615,15 +615,19 @@ class NetworkCommands(object):
|
|||||||
|
|
||||||
def list(self):
|
def list(self):
|
||||||
"""List all created networks"""
|
"""List all created networks"""
|
||||||
print "%-18s\t%-15s\t%-15s\t%-15s" % (_('network'),
|
print "%-18s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s" % (_('network'),
|
||||||
_('netmask'),
|
_('netmask'),
|
||||||
_('start address'),
|
_('start address'),
|
||||||
'DNS')
|
_('DNS'),
|
||||||
|
_('VlanID'),
|
||||||
|
'project')
|
||||||
for network in db.network_get_all(context.get_admin_context()):
|
for network in db.network_get_all(context.get_admin_context()):
|
||||||
print "%-18s\t%-15s\t%-15s\t%-15s" % (network.cidr,
|
print "%-18s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s" % (network.cidr,
|
||||||
network.netmask,
|
network.netmask,
|
||||||
network.dhcp_start,
|
network.dhcp_start,
|
||||||
network.dns)
|
network.dns,
|
||||||
|
network.vlan,
|
||||||
|
network.project_id)
|
||||||
|
|
||||||
def delete(self, fixed_range):
|
def delete(self, fixed_range):
|
||||||
"""Deletes a network"""
|
"""Deletes a network"""
|
||||||
@@ -812,6 +816,28 @@ class ServiceCommands(object):
|
|||||||
{"method": "update_available_resource"})
|
{"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 DbCommands(object):
|
||||||
"""Class for managing the database."""
|
"""Class for managing the database."""
|
||||||
|
|
||||||
@@ -1191,6 +1217,7 @@ CATEGORIES = [
|
|||||||
('project', ProjectCommands),
|
('project', ProjectCommands),
|
||||||
('role', RoleCommands),
|
('role', RoleCommands),
|
||||||
('service', ServiceCommands),
|
('service', ServiceCommands),
|
||||||
|
('server', ServerCommands),
|
||||||
('shell', ShellCommands),
|
('shell', ShellCommands),
|
||||||
('user', UserCommands),
|
('user', UserCommands),
|
||||||
('version', VersionCommands),
|
('version', VersionCommands),
|
||||||
|
|||||||
Reference in New Issue
Block a user