[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Add argument check for xm network-attach command



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1172505050 0
# Node ID 45ddffd595a1a1bcf87ad3823143e37dab459fdd
# Parent  0261e86db3b180e33767c923e65166f69941db86
Add argument check for xm network-attach command

Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
---
 tools/python/xen/xm/main.py |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff -r 0261e86db3b1 -r 45ddffd595a1 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Mon Feb 26 15:41:35 2007 +0000
+++ b/tools/python/xen/xm/main.py       Mon Feb 26 15:50:50 2007 +0000
@@ -155,7 +155,7 @@ SUBCOMMAND_HELP = {
                         'List virtual block devices for a domain.'),
     'network-attach':  ('<Domain> [type=<type>] [mac=<mac>] [bridge=<bridge>] '
                         '[ip=<ip>] [script=<script>] [backend=<BackDomain>] '
-                        '[vifname=<name>]',
+                        '[vifname=<name>] [rate=<rate>] [model=<model>]',
                         'Create a new virtual network device.'),
     'network-detach':  ('<Domain> <DevId> [-f|--force]',
                         'Destroy a domain\'s virtual network device.'),
@@ -1595,13 +1595,20 @@ def xm_block_configure(args):
 
 
 def xm_network_attach(args):
-    arg_check(args, 'network-attach', 1, 10000)
+    arg_check(args, 'network-attach', 1, 10)
 
     dom = args[0]
     vif = ['vif']
+    vif_params = ['type', 'mac', 'bridge', 'ip', 'script', \
+                  'backend', 'vifname', 'rate', 'model']
 
     for a in args[1:]:
-        vif.append(a.split("="))
+        vif_param = a.split("=")
+        if len(vif_param) != 2 or vif_param[1] == '' or \
+           vif_param[0] not in vif_params:
+            err("Invalid argument: %s" % a)
+            usage('network-attach')
+        vif.append(vif_param)
 
     server.xend.domain.device_create(dom, vif)
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.