diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2011-07-18 16:58:23 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2011-07-18 16:58:23 -0700 |
| commit | b5ceab5a46ffac11cb229de86c49802bba3fa383 (patch) | |
| tree | 62459fbead53019efe4efc3e762fe1e07e84a450 /bin | |
| parent | 67e5492d6723a00b0ad5d7e8c44f5762a9b0a206 (diff) | |
| parent | 77db06c908f9c08c80beb11241c0e23247129ad6 (diff) | |
| download | nova-b5ceab5a46ffac11cb229de86c49802bba3fa383.tar.gz nova-b5ceab5a46ffac11cb229de86c49802bba3fa383.tar.xz nova-b5ceab5a46ffac11cb229de86c49802bba3fa383.zip | |
merged trunk
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/nova-manage | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/bin/nova-manage b/bin/nova-manage index a37d68f42..8f7319f7a 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -414,8 +414,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) def list(self, username=None): """Lists all projects @@ -465,8 +468,11 @@ class ProjectCommands(object): arguments: project_id user_id [filename='nova.zip]""" 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 @@ -620,15 +626,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""" @@ -817,6 +827,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.""" @@ -1190,6 +1222,7 @@ CATEGORIES = [ ('fixed', FixedIpCommands), ('flavor', InstanceTypeCommands), ('floating', FloatingIpCommands), + ('host', HostCommands), ('instance_type', InstanceTypeCommands), ('image', ImageCommands), ('network', NetworkCommands), |
