summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorNaveed Massjouni <naveedm9@gmail.com>2011-02-18 13:27:30 -0500
committerNaveed Massjouni <naveedm9@gmail.com>2011-02-18 13:27:30 -0500
commita55fefdd78ac984b366c8e1701cbbd8f5ad18e97 (patch)
tree528927e45c4ff8d4bbc0b3850da10454f12baeb3 /bin
parent4673afddcb5a1069f75fb3493e43498ed1de11f9 (diff)
parent5dfa5ce7d1374509fea51f8d0b132ea865f34dc6 (diff)
downloadnova-a55fefdd78ac984b366c8e1701cbbd8f5ad18e97.tar.gz
nova-a55fefdd78ac984b366c8e1701cbbd8f5ad18e97.tar.xz
nova-a55fefdd78ac984b366c8e1701cbbd8f5ad18e97.zip
Merging trunk to my branch. Fixed conflicts in Authors file and .mailmap.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/nova-manage60
1 files changed, 56 insertions, 4 deletions
diff --git a/bin/nova-manage b/bin/nova-manage
index 7835ca551..6d67252b8 100755
--- a/bin/nova-manage
+++ b/bin/nova-manage
@@ -433,6 +433,37 @@ class ProjectCommands(object):
"nova-api server on this host.")
+class FixedIpCommands(object):
+ """Class for managing fixed ip."""
+
+ def list(self, host=None):
+ """Lists all fixed ips (optionally by host) arguments: [host]"""
+ ctxt = context.get_admin_context()
+ if host == None:
+ fixed_ips = db.fixed_ip_get_all(ctxt)
+ else:
+ fixed_ips = db.fixed_ip_get_all_by_host(ctxt, host)
+
+ print "%-18s\t%-15s\t%-17s\t%-15s\t%s" % (_('network'),
+ _('IP address'),
+ _('MAC address'),
+ _('hostname'),
+ _('host'))
+ for fixed_ip in fixed_ips:
+ hostname = None
+ host = None
+ mac_address = None
+ if fixed_ip['instance']:
+ instance = fixed_ip['instance']
+ hostname = instance['hostname']
+ host = instance['host']
+ mac_address = instance['mac_address']
+ print "%-18s\t%-15s\t%-17s\t%-15s\t%s" % (
+ fixed_ip['network']['cidr'],
+ fixed_ip['address'],
+ mac_address, hostname, host)
+
+
class FloatingIpCommands(object):
"""Class for managing floating ip."""
@@ -472,8 +503,8 @@ class NetworkCommands(object):
"""Class for managing networks."""
def create(self, fixed_range=None, num_networks=None,
- network_size=None, vlan_start=None, vpn_start=None,
- fixed_range_v6=None):
+ network_size=None, vlan_start=None,
+ vpn_start=None, fixed_range_v6=None, label='public'):
"""Creates fixed ips for host by range
arguments: [fixed_range=FLAG], [num_networks=FLAG],
[network_size=FLAG], [vlan_start=FLAG],
@@ -495,9 +526,22 @@ class NetworkCommands(object):
cidr=fixed_range,
num_networks=int(num_networks),
network_size=int(network_size),
- cidr_v6=fixed_range_v6,
vlan_start=int(vlan_start),
- vpn_start=int(vpn_start))
+ vpn_start=int(vpn_start),
+ cidr_v6=fixed_range_v6,
+ label=label)
+
+ def list(self):
+ """List all created networks"""
+ print "%-18s\t%-15s\t%-15s\t%-15s" % (_('network'),
+ _('netmask'),
+ _('start address'),
+ 'DNS')
+ 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)
class ServiceCommands(object):
@@ -579,6 +623,13 @@ class VolumeCommands(object):
ctxt = context.get_admin_context()
volume = db.volume_get(ctxt, param2id(volume_id))
host = volume['host']
+
+ if not host:
+ print "Volume not yet assigned to host."
+ print "Deleting volume from database and skipping rpc."
+ db.volume_destroy(ctxt, param2id(volume_id))
+ return
+
if volume['status'] == 'in-use':
print "Volume is in-use."
print "Detach volume from instance and then try again."
@@ -615,6 +666,7 @@ CATEGORIES = [
('role', RoleCommands),
('shell', ShellCommands),
('vpn', VpnCommands),
+ ('fixed', FixedIpCommands),
('floating', FloatingIpCommands),
('network', NetworkCommands),
('service', ServiceCommands),