diff options
| author | Lvov Maxim <usrleon@gmail.com> | 2011-07-15 11:46:33 +0400 |
|---|---|---|
| committer | Lvov Maxim <usrleon@gmail.com> | 2011-07-15 11:46:33 +0400 |
| commit | cb172c1f085e7c22add4e0111bfc1fc199ace0bd (patch) | |
| tree | cf2afe41478d34fab2134df70f9d605139c0ad4c /bin | |
| parent | bfb4a870e44a90c004cd7d568eb35a50221c7bd5 (diff) | |
| parent | ad700b0ecec0ffd8ed9c08caeb8f1f75fc4b482f (diff) | |
| download | nova-cb172c1f085e7c22add4e0111bfc1fc199ace0bd.tar.gz nova-cb172c1f085e7c22add4e0111bfc1fc199ace0bd.tar.xz nova-cb172c1f085e7c22add4e0111bfc1fc199ace0bd.zip | |
merge with trunk, resolve conflicts
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/nova-manage | 59 |
1 files changed, 45 insertions, 14 deletions
diff --git a/bin/nova-manage b/bin/nova-manage index f5c140fa9..2e9b52d74 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -449,8 +449,11 @@ class ProjectCommands(object): except (exception.UserNotFound, exception.ProjectNotFound) as ex: print ex raise - with open(filename, 'w') as f: - f.write(rc) + if filename == "-": + sys.stdout.write(rc) + else: + with open(filename, 'w') as f: + f.write(rc) @args('--user', dest="username", metavar='<username>', help='User name') def list(self, username=None): @@ -505,8 +508,11 @@ class ProjectCommands(object): """Exports credentials for project to a zip file""" try: zip_file = self.manager.get_credentials(user_id, project_id) - with open(filename, 'w') as f: - f.write(zip_file) + if filename == "-": + sys.stdout.write(zip_file) + else: + with open(filename, 'w') as f: + f.write(zip_file) except (exception.UserNotFound, exception.ProjectNotFound) as ex: print ex raise @@ -662,17 +668,19 @@ class NetworkCommands(object): def list(self): """List all created networks""" - print "%-18s\t%-15s\t%-15s\t%-15s\t%-15s" % (_('network'), - _('netmask'), - _('start address'), - 'DNS', - 'project') + 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\t%-15s" % (network.cidr, - network.netmask, - network.dhcp_start, - network.dns, - network.project_id) + 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) @args('--network', dest="fixed_range", metavar='<x.x.x.x/yy>', help='Network to delete') def delete(self, fixed_range): @@ -854,6 +862,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.""" @@ -1248,6 +1278,7 @@ CATEGORIES = [ ('fixed', FixedIpCommands), ('flavor', InstanceTypeCommands), ('floating', FloatingIpCommands), + ('host', HostCommands), ('instance_type', InstanceTypeCommands), ('image', ImageCommands), ('network', NetworkCommands), |
