summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorHisaharu Ishii <ishii.hisaharu@lab.ntt.co.jp>2011-08-25 08:16:06 +0000
committerTarmac <>2011-08-25 08:16:06 +0000
commitce413a5b5344a79d612e36c64ddbcb7bfb4ac98b (patch)
treecbb58ec820e9df077af074cac7ce2cac86478f33 /bin
parent9c871b3e815798616623bb8771af7f0e6b24e603 (diff)
parent88a2dfb582eec7b4c7547c2aa51f3b661a3b9c5d (diff)
downloadnova-ce413a5b5344a79d612e36c64ddbcb7bfb4ac98b.tar.gz
nova-ce413a5b5344a79d612e36c64ddbcb7bfb4ac98b.tar.xz
nova-ce413a5b5344a79d612e36c64ddbcb7bfb4ac98b.zip
Once a network is associated with project, I can’t delete this network with ‘nova-manage network delete’.
As you know, I can delete network by scrubbing the project with ‘nova-manage project scrub’. However it is too much. The cause of this problem is there is no modify command of network attribute. This branch adds 'nova-manage network modify' command. In this branch, we only support project and host value modifications. Another attributes are in future work.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/nova-manage33
1 files changed, 33 insertions, 0 deletions
diff --git a/bin/nova-manage b/bin/nova-manage
index 2e0bd0ecb..890cde0b8 100755
--- a/bin/nova-manage
+++ b/bin/nova-manage
@@ -798,6 +798,39 @@ class NetworkCommands(object):
' before delete' % network.project_id))
db.network_delete_safe(context.get_admin_context(), network.id)
+ @args('--network', dest="fixed_range", metavar='<x.x.x.x/yy>',
+ help='Network to modify')
+ @args('--project', dest="project", metavar='<project name>',
+ help='Project name to associate')
+ @args('--host', dest="host", metavar='<host>',
+ help='Host to associate')
+ @args('--disassociate-project', action="store_true", dest='dis_project',
+ default=False, help='Disassociate Network from Project')
+ @args('--disassociate-host', action="store_true", dest='dis_host',
+ default=False, help='Disassociate Host from Project')
+ def modify(self, fixed_range, project=None, host=None,
+ dis_project=None, dis_host=None):
+ """Associate/Disassociate Network with Project and/or Host
+ arguments: network project host
+ leave any field blank to ignore it
+ """
+ admin_context = context.get_admin_context()
+ network = db.network_get_by_cidr(admin_context, fixed_range)
+ net = {}
+ #User can choose the following actions each for project and host.
+ #1) Associate (set not None value given by project/host parameter)
+ #2) Disassociate (set None by disassociate parameter)
+ #3) Keep unchanged (project/host key is not added to 'net')
+ if project:
+ net['project_id'] = project
+ elif dis_project:
+ net['project_id'] = None
+ if host:
+ net['host'] = host
+ elif dis_host:
+ net['host'] = None
+ db.network_update(admin_context, network['id'], net)
+
class VmCommands(object):
"""Class for mangaging VM instances."""