@@ -44,84 +44,126 @@ def parse_args():
4444 -------
4545 The command line namespace.
4646 """
47- parser = argparse .ArgumentParser (description = 'Utility for creating and '
48- 'managing KVM virtual '
49- 'machines on an OCI '
50- 'instance.' )
47+ parser = argparse .ArgumentParser (description = 'Utility for creating and managing KVM virtual machines '
48+ 'on an OCI instance.' )
5149 subparser = parser .add_subparsers (dest = 'mode' )
50+ #
5251 create_parser = subparser .add_parser (_create ,
53- help = 'Create a new virtual machine' )
52+ help = 'Create a new virtual machine.' )
53+ create_parser .add_argument ('-d' , '--disk' ,
54+ action = 'store' ,
55+ type = str ,
56+ help = 'The path to the root disk of the VM.' )
57+ create_parser .add_argument ('-p' , '--pool' ,
58+ action = 'store' ,
59+ type = str ,
60+ help = 'The name a of storage pool to be used for root disk.' )
61+ create_parser .add_argument ('-s' , '--disk-size' ,
62+ action = 'store' ,
63+ type = _disk_size_in_gb ,
64+ help = 'The size of the disk in GB to be created when using storage pool.' )
65+ create_parser .add_argument ('-n' , '--net' ,
66+ action = 'append' ,
67+ type = str ,
68+ help = 'The IP or name of the VNIC that should be attached to the VM.' )
69+ create_parser .add_argument ('-v' , '--virtual-network' ,
70+ action = 'append' ,
71+ type = str ,
72+ help = 'The name of libvirt nework to attach the guest to.' )
73+ create_parser .add_argument ('-D' , '--domain' ,
74+ action = 'store' ,
75+ type = str ,
76+ help = 'The name of the virtual machine.' ,
77+ required = True )
78+ create_parser .add_argument ('-V' , '--virt' ,
79+ nargs = argparse .REMAINDER ,
80+ help = 'Additional arguments to provide to virt-install. '
81+ 'All arguments that appear after this one will be passed unmodified into ' \
82+ 'virt-install, even if they are arguments that oci-kvm would otherwise understand.' ,
83+ required = True )
84+ #
5485 destroy_parser = subparser .add_parser (_destroy ,
55- help = 'Destroy an existing virtual '
56- 'machine' )
86+ help = 'Destroy an existing virtual machine.' )
87+ destroy_parser .add_argument ('-D' , '--domain' ,
88+ action = 'store' ,
89+ type = str ,
90+ help = 'The name of the virtual machine.' ,
91+ required = True )
92+ destroy_parser .add_argument ('--destroy-disks' ,
93+ action = 'store_true' ,
94+ help = 'Also delete storage pool based disks.' )
95+ destroy_parser .add_argument ('-s' , '--stop' ,
96+ action = 'store_true' ,
97+ default = False ,
98+ help = 'First stop the guess if it is running.' )
99+ destroy_parser .add_argument ('-f' , '--force' ,
100+ action = 'store_true' ,
101+ default = False ,
102+ help = 'Forced operation, no gracefull shutdown.' )
103+ #
57104 create_pool_parser = subparser .add_parser (_create_pool ,
58- help = 'Create a filesystem storage pool' )
105+ help = 'Create a filesystem storage pool.' )
106+ dbp_group = create_pool_parser .add_argument_group (title = 'disk pool' ,
107+ description = 'The options for disk based storage pool.' )
108+ dbp_group .add_argument ('-d' , '--disk' ,
109+ action = 'store' ,
110+ type = str ,
111+ help = 'The path to the root disk of the storage pool.' )
112+ #
113+ nfsp_group = create_pool_parser .add_argument_group (title = 'NETFS pool' ,
114+ description = 'The options for NETFS based storage pool.' )
115+ nfsp_group .add_argument ('-N' , '--netfshost' ,
116+ action = 'store' ,
117+ type = str ,
118+ help = 'The name or IP of the NFS server.' )
119+ nfsp_group .add_argument ('-p' , '--path' ,
120+ action = 'store' ,
121+ type = str ,
122+ help = 'The path of the NETFS resource.' )
123+ create_pool_parser .add_argument ('-n' , '--name' ,
124+ action = 'store' ,
125+ type = str ,
126+ help = 'The name of the pool.' ,
127+ required = True )
128+ #
59129 create_network_parser = subparser .add_parser (_create_network ,
60- help = 'Create a libvirt network on an OCI vNIC' )
130+ help = 'Create a libvirt network on an OCI vNIC.' )
131+ create_network_parser .add_argument ('-n' , '--net' ,
132+ action = 'store' ,
133+ required = True , type = str ,
134+ help = 'The IP of the VNIC used to build the network.' )
135+ create_network_parser .add_argument ('-N' , '--network-name' ,
136+ action = 'store' ,
137+ required = True ,
138+ type = str ,
139+ help = 'The name of the network.' )
140+ create_network_parser .add_argument ('-B' , '--ip-bridge' ,
141+ action = 'store' ,
142+ required = True ,
143+ type = str ,
144+ help = 'The bridge IP for virtual network address space.' )
145+ create_network_parser .add_argument ('-S' , '--ip-start' ,
146+ action = 'store' ,
147+ required = True ,
148+ type = str ,
149+ help = 'The guest first IP range in virtual network address space.' )
150+ create_network_parser .add_argument ('-E' , '--ip-end' ,
151+ action = 'store' ,
152+ required = True ,
153+ type = str ,
154+ help = 'The guest last IP range in virtual network address space.' )
155+ create_network_parser .add_argument ('-P' , '--ip-prefix' ,
156+ action = 'store' ,
157+ required = True ,
158+ type = str ,
159+ help = 'The IP prefix to be used in virtual network.' )
160+ #
61161 delete_network_parser = subparser .add_parser (_delete_network ,
62- help = 'Delete a libvirt network on an OCI vNIC' )
63-
64- create_parser .add_argument ('-d' , '--disk' , action = 'store' , type = str ,
65- help = 'Path to the root disk of the VM' )
66- create_parser .add_argument ('-p' , '--pool' , action = 'store' , type = str ,
67- help = 'Name a of storage pool to be used for root disk' )
68- create_parser .add_argument ('-s' , '--disk-size' , action = 'store' , type = _disk_size_in_gb ,
69- help = 'Size of the disk in GB to be created when using storage pool' )
70- create_parser .add_argument ('-n' , '--net' , action = 'append' , type = str ,
71- help = 'IP or name of the VNIC that should be attached '
72- 'to the VM' )
73- create_parser .add_argument ('-v' , '--virtual-network' , action = 'append' , type = str ,
74- help = 'The name of libvirt nework to attach the guest to' )
75- create_parser .add_argument ('-D' , '--domain' , action = 'store' , type = str ,
76- help = 'Name of the virtual machine' ,
77- required = True )
78- create_parser .add_argument ('-V' , '--virt' , nargs = argparse .REMAINDER ,
79- help = 'Additional arguments to provide to '
80- 'virt-install. All arguments that appear '
81- 'after this one will be passed unmodified '
82- 'into virt-install, even if they are '
83- 'arguments that oci-kvm would otherwise '
84- 'understand.' ,
85- required = True )
86-
87- destroy_parser .add_argument ('-D' , '--domain' , action = 'store' , type = str ,
88- help = 'Name of the virtual machine' ,
89- required = True )
90- destroy_parser .add_argument ('--destroy-disks' , action = 'store_true' ,
91- help = 'Also delete storage pool based disks' )
92- destroy_parser .add_argument ('-s' , '--stop' , action = 'store_true' , default = False ,
93- help = 'First stop the guess if it si running' )
94- destroy_parser .add_argument ('-f' , '--force' , action = 'store_true' , default = False ,
95- help = 'Forced operation, no gracefull shutdown' )
96-
97- dbp_group = create_pool_parser .add_argument_group (
98- title = 'disk pool' , description = 'Options for disk based storage pool' )
99- dbp_group .add_argument ('-d' , '--disk' , action = 'store' , type = str ,
100- help = 'Path to the root disk of the storage pool' )
101- nfsp_group = create_pool_parser .add_argument_group (
102- title = 'NETFS pool' , description = 'Options for NETFS based storage pool' )
103- nfsp_group .add_argument ('-N' , '--netfshost' , action = 'store' , type = str ,
104- help = 'name or IP of the NFS server' )
105- nfsp_group .add_argument ('-p' , '--path' , action = 'store' , type = str ,
106- help = 'path of the NETFS resource' )
107- create_pool_parser .add_argument ('-n' , '--name' , action = 'store' , type = str ,
108- help = 'name of the pool' , required = True )
109-
110- create_network_parser .add_argument ('-n' , '--net' , action = 'store' , required = True , type = str ,
111- help = 'IP of the VNIC used to build the network' )
112- create_network_parser .add_argument ('-N' , '--network-name' , action = 'store' , required = True , type = str ,
113- help = 'the name of the network' )
114- create_network_parser .add_argument ('-B' , '--ip-bridge' , action = 'store' , required = True , type = str ,
115- help = 'Bridge IP for virtual network address space' )
116- create_network_parser .add_argument ('-S' , '--ip-start' , action = 'store' , required = True , type = str ,
117- help = 'guest first IP range in virtual network address space' )
118- create_network_parser .add_argument ('-E' , '--ip-end' , action = 'store' , required = True , type = str ,
119- help = 'guest last IP range in virtual network address space' )
120- create_network_parser .add_argument ('-P' , '--ip-prefix' , action = 'store' , required = True , type = str ,
121- help = 'IP prefix to be used in virtual network' )
122-
123- delete_network_parser .add_argument ('-N' , '--network-name' , action = 'store' , required = True , type = str ,
124- help = 'the name of the network' )
162+ help = 'Delete a libvirt network on an OCI vNIC.' )
163+ delete_network_parser .add_argument ('-N' , '--network-name' ,
164+ action = 'store' ,
165+ required = True , type = str ,
166+ help = 'The name of the network.' )
125167
126168 return parser
127169
0 commit comments