knife-vcloud 0.2.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +44 -1
  3. data/README.md +356 -91
  4. data/lib/chef/knife/{vc_catalog_item_show.rb → catalog/vc_catalog_item_show.rb} +13 -13
  5. data/lib/chef/knife/{vc_catalog_show.rb → catalog/vc_catalog_show.rb} +9 -12
  6. data/lib/chef/knife/common/vc_bootstrap_common.rb +208 -0
  7. data/lib/chef/knife/common/vc_catalog_common.rb +58 -0
  8. data/lib/chef/knife/common/vc_common.rb +165 -0
  9. data/lib/chef/knife/common/vc_network_common.rb +34 -0
  10. data/lib/chef/knife/common/vc_vapp_common.rb +49 -0
  11. data/lib/chef/knife/common/vc_vdc_common.rb +43 -0
  12. data/lib/chef/knife/common/vc_vm_common.rb +80 -0
  13. data/lib/chef/knife/network/vc_network_show.rb +45 -0
  14. data/lib/chef/knife/{vc_org_list.rb → org/vc_org_list.rb} +3 -5
  15. data/lib/chef/knife/{vc_org_show.rb → org/vc_org_show.rb} +10 -11
  16. data/lib/chef/knife/ovf/vc_ovf_upload.rb +71 -0
  17. data/lib/chef/knife/vapp/vc_vapp_bootstrap.rb +51 -0
  18. data/lib/chef/knife/vapp/vc_vapp_clone.rb +80 -0
  19. data/lib/chef/knife/{vc_vapp_create.rb → vapp/vc_vapp_create.rb} +10 -9
  20. data/lib/chef/knife/{vc_vapp_delete.rb → vapp/vc_vapp_delete.rb} +12 -10
  21. data/lib/chef/knife/vapp/vc_vapp_network_external.rb +101 -0
  22. data/lib/chef/knife/vapp/vc_vapp_network_internal.rb +151 -0
  23. data/lib/chef/knife/vapp/vc_vapp_reboot.rb +45 -0
  24. data/lib/chef/knife/vapp/vc_vapp_reset.rb +44 -0
  25. data/lib/chef/knife/vapp/vc_vapp_show.rb +90 -0
  26. data/lib/chef/knife/vapp/vc_vapp_snapshot.rb +58 -0
  27. data/lib/chef/knife/{vc_vapp_start.rb → vapp/vc_vapp_start.rb} +7 -7
  28. data/lib/chef/knife/{vc_vapp_stop.rb → vapp/vc_vapp_stop.rb} +7 -7
  29. data/lib/chef/knife/vapp/vc_vapp_suspend.rb +44 -0
  30. data/lib/chef/knife/vc_commands.rb +70 -0
  31. data/lib/chef/knife/vc_login.rb +2 -2
  32. data/lib/chef/knife/{vc_vdc_show.rb → vdc/vc_vdc_show.rb} +13 -14
  33. data/lib/chef/knife/vm/vc_vm_bootstrap.rb +48 -0
  34. data/lib/chef/knife/vm/vc_vm_config_guest.rb +110 -0
  35. data/lib/chef/knife/{vc_vm_config_network.rb → vm/vc_vm_config_network.rb} +17 -11
  36. data/lib/chef/knife/vm/vc_vm_reboot.rb +44 -0
  37. data/lib/chef/knife/vm/vc_vm_reset.rb +44 -0
  38. data/lib/chef/knife/vm/vc_vm_set_disks.rb +78 -0
  39. data/lib/chef/knife/vm/vc_vm_set_info.rb +79 -0
  40. data/lib/chef/knife/{vc_vm_show.rb → vm/vc_vm_show.rb} +35 -18
  41. data/lib/chef/knife/vm/vc_vm_start.rb +44 -0
  42. data/lib/chef/knife/vm/vc_vm_stop.rb +44 -0
  43. data/lib/chef/knife/vm/vc_vm_suspend.rb +44 -0
  44. data/lib/knife-vcloud/version.rb +3 -0
  45. metadata +69 -38
  46. data/lib/chef/knife/vc_common.rb +0 -103
  47. data/lib/chef/knife/vc_vapp_config_network.rb +0 -63
  48. data/lib/chef/knife/vc_vapp_show.rb +0 -59
  49. data/lib/chef/knife/vc_vm_config_guest.rb +0 -67
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cd99b0e22773c4e32b18849f23e04232c29f1119
4
+ data.tar.gz: 7402cb3ab4a9d15f835936fc253c9bd4bf80c3eb
5
+ SHA512:
6
+ metadata.gz: cfa1352af5c09e4555d92aee07d88ea50d7ac3ce1503aea51a17982488d4d4f24ea10612c9a6d62ba658951a12b2eb759f101bcc1d77b9c2a9ca7c7362ed4dbe
7
+ data.tar.gz: 0b2caca9edfcfbd9832654868a16ff00d3c16d6bae8351dbde26aa8f81b927c1276c5d81758becab3c6f112718cf20691d55429f6c6ef82726d3215d8eb64f81
data/CHANGELOG.md CHANGED
@@ -1,9 +1,48 @@
1
1
  Changes
2
2
  ==
3
+ 2013-11-29 (1.0.0)
4
+ --
5
+
6
+ This is the first release that leaves beta status.
7
+ It's actively used in production by at least one company and thus it's important
8
+ to offer a more stable interface.
9
+
10
+ This version requires vcloud-rest v. 1.0.0.
11
+
12
+ FEATURES:
13
+
14
+ * vApp management
15
+ * Add commands to resume/suspend/reset vApps
16
+ * Add command to clone an existing vApp
17
+ * Show network details in vapp show
18
+ * Split commands to manage internal and external vApp networks
19
+ * Add command to create/revert a vApp snapshot
20
+ * VM management
21
+ * Add commands to manage VM's status (start/stop/delete/reset/suspend/reboot)
22
+ * Show CPU/RAM/Disks info for VMs
23
+ * Add command to set VM's info (Name, CPUs & RAM)
24
+ * Add command to manage VM's disks (add, delete, resize)
25
+ * Add support for customization scripts
26
+ * Guest customization: ensure VM is stopped or stop it
27
+ * Add command to bootstrap single VMs
28
+ * Add command to bootstrap every VM of a vApp
29
+ * CLI revisited
30
+ * Almost every command accepts names in addition to IDs
31
+ * Various
32
+ * Add command to show details about a given network
33
+ * Add command to upload OVF
34
+
35
+ CHANGES:
36
+
37
+ * Renamed & enhanced command _vapp config network_ to _vapp network external_
38
+ * Several options have been revisited (see README.md for details)
39
+ * Sort VDC, Networks, vApps, Catalogs and Catalog Items by name
40
+
3
41
  2012-12-28 (0.2.3)
4
42
  --
5
43
 
6
44
  VARIOUS:
45
+
7
46
  * Update dependency vcloud-rest v. 0.2.1
8
47
  * Update documentation
9
48
 
@@ -14,6 +53,7 @@ FIXES:
14
53
  --
15
54
 
16
55
  FIXES:
56
+
17
57
  * VM Network config: use command line arguments
18
58
  * Properly use boolean options
19
59
  * Minor fixes
@@ -22,17 +62,20 @@ FIXES:
22
62
  --
23
63
 
24
64
  FIXES:
65
+
25
66
  * Change namespace to fix import error under 1.9.x (system-wide)
26
67
 
27
68
  2012-12-24 (0.2.0)
28
69
  --
29
70
 
30
71
  FEATURES:
72
+
31
73
  * Add command for basic VM Guest Customization configuration
32
74
  * Add command for basic VM Network configuration
33
75
  * Add command for basic vApp Network configuration
34
76
 
35
- FIXES:
77
+ CHANGES:
78
+
36
79
  * Renamed _Common#msg_ to _Common#out\_msg_
37
80
 
38
81
  2012-12-21 (0.1.0)
data/README.md CHANGED
@@ -3,11 +3,9 @@ knife-vcloud [![Dependency Status](https://gemnasium.com/astratto/knife-vcloud.p
3
3
 
4
4
  DESCRIPTION
5
5
  --
6
- A knife plugin for the VMWare® vCloud API.
6
+ A knife plugin for the VMware® vCloud API.
7
7
 
8
- It uses [vcloud-rest](https://github.com/astratto/vcloud-rest) to communicate with a VMWare vCloud Server.
9
-
10
- This code is BETA QUALITY.
8
+ It uses [vcloud-rest](https://github.com/astratto/vcloud-rest) to communicate with a VMware vCloud Director instance.
11
9
 
12
10
  INSTALLATION
13
11
  --
@@ -25,60 +23,126 @@ FEATURES
25
23
  - show VDCs
26
24
  - show Catalogs
27
25
  - show Catalog Items
28
- - create/start/stop/delete/show vApps
29
- - show VMs
30
- - basic vApp network configuration
26
+ - create/start/stop/delete/show/reset/suspend/reboot vApps and VMs
27
+ - add/edit/delete vApp networks (both internal and external)
31
28
  - basic VM network configuration
32
29
  - basic VM Guest Customization configuration
30
+ - OVF upload
33
31
 
34
32
  PREREQUISITES
35
33
  --
36
34
  - chef >= 0.10.0
37
35
  - knife-windows
38
- - vcloud-rest
36
+ - vcloud-rest ~> 1.0.0
39
37
 
40
38
  USAGE
41
39
  --
42
40
 
43
41
  ###Available commands
44
42
 
45
- knife vc catalog item show [CATALOG_ID] (options)
46
- knife vc catalog show [CATALOG_ID] (options)
43
+ knife vc catalog item show [CATALOG_ITEM] (options)
44
+ knife vc catalog show [CATALOG] (options)
47
45
  knife vc login (options)
46
+ knife vc network show [network] (options)
48
47
  knife vc org list (options)
49
- knife vc org show [ORG_ID] (options)
50
- knife vc vapp config network [VAPP_ID] [NETWORK_NAME] (options)
51
- knife vc vapp create [VDC_ID] [NAME] [DESCRIPTION] [TEMPLATE_ID] (options)
52
- knife vc vapp delete [VAPP_ID] (options)
53
- knife vc vapp show [VAPP_ID] (options)
54
- knife vc vapp start [VAPP_ID] (options)
55
- knife vc vapp stop [VAPP_ID] (options)
56
- knife vc vdc show [VDC_ID] (options)
57
- knife vc vm config guest [VM_ID] [COMPUTER_NAME] (options)
58
- knife vc vm config network [VM_ID] [NETWORK_NAME] (options)
59
- knife vc vm show [VM_ID] (options)
48
+ knife vc org show (options)
49
+ knife vc ovf upload VDC CATALOG VAPP_NAME VAPP_DESCRIPTION OVF_FILENAME (options)
50
+ knife vc vapp bootstrap [VAPP] (options)
51
+ knife vc vapp clone [VDC] [SOURCE_VAPP] [DEST_NAME] (options)
52
+ knife vc vapp create [VDC] [NAME] [DESCRIPTION] [TEMPLATE_ID] (options)
53
+ knife vc vapp delete [VAPP] (options)
54
+ knife vc vapp network external [add|delete|edit| [VAPP] [NETWORK] (options)
55
+ knife vc vapp network internal [add|delete|edit| [VAPP] [NETWORK] (options)
56
+ knife vc vapp reboot [VAPP] (options)
57
+ knife vc vapp reset [VAPP] (options)
58
+ knife vc vapp show VAPP (options)
59
+ knife vc vapp snapshot [create|revert] [VAPP] (options)
60
+ knife vc vapp start [VAPP] (options)
61
+ knife vc vapp stop [VAPP] (options)
62
+ knife vc vapp suspend [VAPP] (options)
63
+ knife vc vdc show VDC (options)
64
+ knife vc vm bootstrap [VM] (options)
65
+ knife vc vm config guest [VM] (options)
66
+ knife vc vm config network [VM] [NETWORK_NAME] (options)
67
+ knife vc vm reboot [VM] (options)
68
+ knife vc vm reset [VM] (options)
69
+ knife vc vm set disks [VM] (options)
70
+ knife vc vm set info [VM] (options)
71
+ knife vc vm show VM (options)
72
+ knife vc vm start [VM] (options)
73
+ knife vc vm stop [VM] (options)
74
+ knife vc vm suspend [VM] (options)
60
75
 
61
76
  ###Configuration
62
- All commands accept the following options:
63
77
 
64
- --vcloud-url URL
65
- --vcloud-user USER
66
- --vcloud-password SECRET
67
- --vcloud-organization ORGANIZATION
68
- --vcloud-api-version API_VERSION
78
+ Configuration options can be set either via arguments or inside the *.chef/knife.rb* file.
79
+ The only difference is that in *knife.rb* dashes must be converted to underscores
80
+ and *vcloud_* must be prepended.
81
+
82
+ E.g., ```$ ... --org-login XXX``` becomes ```knife[:vcloud_org_login] = 'XXX'``` in *knife.rb*.
83
+
84
+
85
+ #### Common options
86
+
87
+ The following options specify, respectively, the url of the vCloud instance and the API version
88
+ to use:
89
+
90
+ --url URL
91
+ --api-version API_VERSION
69
92
 
70
- In addition, those options can be specified inside your _.chef/knife.rb_ file.
93
+ #### Login Configuration
71
94
 
72
- ####Knife.rb configuration:
95
+ The following options specify user's credentials and thus are accepted by every command:
96
+
97
+ --user-login USER
98
+ --password-login SECRET
99
+ --org-login ORGANIZATION
100
+
101
+ **Knife.rb configuration example:**
73
102
 
74
103
  knife[:vcloud_url] = 'https://vcloud.server.org'
75
- knife[:vcloud_org] = 'vcloud_organization'
76
- knife[:vcloud_user] = 'vcloud_user'
77
- knife[:vcloud_password] = 'vcloud_password'
104
+ knife[:vcloud_org_login] = 'vcloud_organization'
105
+ knife[:vcloud_user_login] = 'vcloud_user'
106
+ knife[:vcloud_password_login] = 'vcloud_password'
78
107
  (OPTIONAL) knife[:vcloud_api_version] = '1.5'
79
108
 
109
+ ####IDs and names
110
+ Most commands accept both names and IDs.
111
+ For searches based on names, in general, at least _--vdc_ must be specified.
112
+
113
+ The examples in this document try to use names whenever is possible.
114
+ Keep in mind that ID-based search is still in place but will be dropped in future releases.
115
+
116
+ _Example:_
117
+
118
+ $ knife vc vapp delete a3f81395-4eda-43b0-8677-b2d597014979
119
+ Note: --vdc not specified, assuming VAPP is an ID
120
+ Do you really want to DELETE vApp TestAppN (ID: a3f81395-4eda-43b0-8677-b2d597014979)? (Y/N) Y
121
+ ...
122
+
123
+ **TIP:**
124
+ Default --vdc and --vapp can be set in _knife.rb_.
125
+ For the sake of simplicity, the following examples assume that --vdc
126
+ is configured in _knife.rb_.
127
+
128
+ _Example:_
129
+
130
+ ...
131
+ knife[:vcloud_vdc] = "vDC_Test"
132
+ knife[:vcloud_vapp] = "Test"
133
+ ...
134
+
135
+ #### Browse multiple organizations
136
+
137
+ Using a vCloud System Administrator account is possible to browse several organizations and thus *--org* can be used to specify different organizations.
138
+
139
+ Only *--org-login* is valid for other users.
140
+ If *--org* is used by those users, a warning is shown:
141
+
142
+ WARNING: --org option is available only for vCloud System Administrators. Using --org-login ('test')
143
+
80
144
  ###Login
81
- This command can be used to verify that the vCloud Server can be reached and credentials are correct.
145
+ This command can be used to verify that vCloud Director can be reached and credentials are correct.
82
146
 
83
147
  _Example:_
84
148
 
@@ -99,7 +163,7 @@ This command shows details about a given organization.
99
163
 
100
164
  _Example:_
101
165
 
102
- $ knife vc org show 9f3ac2a8-92dd-4921-b48b-85b42f4d247c
166
+ $ knife vc org show TEST-ORG
103
167
  CATALOGS
104
168
  Name ID
105
169
  Catalog_1 7414bc46-44fc-44ed-9844-0aa6ea9f5cf9
@@ -123,7 +187,7 @@ This command shows details about a given catalog.
123
187
 
124
188
  _Example:_
125
189
 
126
- $ knife vc catalog show 7414bc46-44fc-44ed-9844-0aa6ea9f5cf9
190
+ $ knife vc catalog show Catalog_1
127
191
  Description: Test Catalog description
128
192
  Name ID
129
193
  CentOS 6.3 40e5e071-8231-46c1-92b7-fbe8f633e259
@@ -135,7 +199,7 @@ e.g., retrieve a template ID
135
199
 
136
200
  _Example:_
137
201
 
138
- $ knife vc catalog item show 40e5e071-8231-46c1-92b7-fbe8f633e259
202
+ $ knife vc catalog item show CentOS 6.3 --catalog Catalog_1
139
203
  Description: Linux CentOS 64 bit 6 update 3
140
204
  Name Template ID
141
205
  CentOS 6.3 edb5bb2f-58bc-4a44-aaf6-c244543e4a1b
@@ -145,49 +209,33 @@ This command shows details about a given vDC.
145
209
 
146
210
  _Example:_
147
211
 
148
- $ knife vc vdc show 440d5134-d2dd-4be7-8692-79a28c86f55b
212
+ $ knife vc vdc show Test_vDC_1
149
213
  Description:
150
214
  vAPPS
151
215
  Name ID Status IP
152
216
  TestKnife (1 VMs) 09551b42-dca9-474d-aa50-201b223522db running 10.102.46.237
153
217
  TestCENTOS (1 VMs) 4338a436-19fc-47b9-aaba-024841acfd66 stopped 10.102.46.23
154
218
 
155
- ###Startup vApp
156
- This command starts up a given vApp.
219
+ ###Manage vApp/VM status
220
+ vApp/VM's status can be managed with _start/stop/reboot/reset/suspend/delete_
157
221
 
158
- _Example:_
159
-
160
- $ knife vc vapp start 4338a436-19fc-47b9-aaba-024841acfd66
161
- vApp startup...Done!
162
- Summary: Status: success - started at 2012-12-19T16:50:31.030+01:00 and ended at 2012-12-19T16:50:38.487+01:00
163
-
164
- ###Shutdown vApp
165
- This command halts a given vApp.
222
+ Note: use _knife vc vm..._ to operate on VMs.
166
223
 
167
224
  _Example:_
168
225
 
169
- $ knife vc vapp stop 09551b42-dca9-474d-aa50-201b223522db
170
- vApp shutdown...Done!
171
- Summary: Status: success - started at 2012-12-19T16:56:31.100+01:00 and ended at 2012-12-19T16:56:38.667+01:00
172
-
173
- ###Delete vApp
174
- This command deletes a given vApp.
175
-
176
- _Example:_
226
+ $ knife vc vapp start clone3
227
+ vApp startup...
228
+ Summary: Status: success - time elapsed: 2.967 seconds
177
229
 
178
- $ knife vc vapp delete c1bad644-6c4d-40fc-a46b-7624ff6d5e75
179
- Do you really want to DELETE vApp c1bad644-6c4d-40fc-a46b-7624ff6d5e75?? (Y/N) Y
180
- vApp deletion...Done!
181
- Summary: Status: success - started at 2012-12-19T17:00:20.503+01:00 and ended at 2012-12-19T17:00:21.133+01:00
182
230
 
183
231
  ###Create vApp from template
184
232
  This command creates a vApp starting from a template (see catalog item).
185
233
 
186
234
  _Example:_
187
235
 
188
- $ knife vc vapp create 440d5134-d2dd-4be7-8692-79a28c86f55b TestvApp "Test vApp description" 14b63ef2-fe93-4d0b-91f0-ccbd3847c665
189
- vApp creation...Done!
190
- Summary: Status: success - started at 2012-12-19T17:02:32.797+01:00 and ended at 2012-12-19T17:02:53.943+01:00
236
+ $ knife vc vapp create vDC_Test clone4 "Create example" 89e33fd7-04a7-4b5f-830b-2423c41089e3
237
+ vApp creation...
238
+ Summary: Status: success - time elapsed: 28.967 seconds
191
239
  vApp created with ID: 9cdd92ad-ab65-467f-abe1-075e35c050ec
192
240
 
193
241
  ###Show vApp's details
@@ -195,44 +243,183 @@ This command shows details about a given vApp.
195
243
 
196
244
  _Example:_
197
245
 
198
- $ knife vc vapp show 4338a436-19fc-47b9-aaba-024841acfd66
246
+ $ knife vc vapp show TEST_CENTOS
199
247
  Name: TEST_CENTOS
200
248
  Status: running
201
- IP: 10.102.46.237
202
- Name Status IPs ID
203
- CENTOS63 running 10.102.46.237 8b943bf9-a8ca-4d41-b97f-316c3aa891ea
249
+ Networks
250
+ TST_Data
251
+ Gateway Netmask Fence Mode Parent Network Retain Info
252
+ 10.22.4.1 255.255.254.0 bridged TST_Data false
253
+ TST_FE
254
+ Gateway Netmask Fence Mode Parent Network Retain Info
255
+ 10.22.3.129 255.255.255.128 bridged TST_FE false
256
+ VMs
257
+ Name Status IPs ID Scoped ID
258
+ CENTOS63 stopped 83f6aeb3-f624-4a79-9e6b-23e162893daf 69b0fe46-224f-4266-a424-2fe16ca99ff7
204
259
 
205
260
  ###vApp's network configuration
206
- This command allows for basic vApp network configuration.
207
- E.g., retain IP address across deployments (defaults to POOL), set fence mode to _Isolated_ or _Bridge_
208
261
 
209
- Please note that you must use the human readable name of the network (i.e., _TestNet\_1_).
262
+ #### External networks
263
+ External vApp networks (from vDC) can be added, removed and modified using the _vapp network external_ command.
264
+
265
+ _Add example:_
266
+
267
+ $ knife vc vapp network external add test_vapp4 TST_DATA
268
+ Forcing parent network to itself
269
+ Adding TST_Data to vApp...
270
+ Summary: Status: success - time elapsed: 2.72 seconds
271
+
272
+ _Edit example:_
273
+
274
+ TBD
275
+
276
+ _Delete example:_
277
+
278
+ $ knife vc vapp network external delete test_vapp4 TST_Data
279
+ Removing TST_Data from vApp...
280
+ Summary: Status: success - time elapsed: 2.63 seconds
281
+
282
+ #### Internal networks
283
+ Internal vApp networks can be added, removed and modified using the _vapp network internal_ command.
284
+
285
+ _Add example:_
286
+
287
+ $ knife vc vapp network internal add test_vapp4 INT_NET
288
+ Gateway: 192.168.0.1
289
+ Netmask: 255.255.255.0
290
+ Dns1: 190.23.12.34
291
+ Dns2: 21.33.24.21
292
+ Dns suffix: test.suffix.local
293
+ Start address: 192.168.0.10
294
+ End address: 192.168.0.100
295
+ Adding INT_NET to vApp...
296
+ Summary: Status: success - time elapsed: 6.88 seconds
297
+
298
+ # Note that options can also be specified on the command line
299
+ $ knife vc vapp network internal add test_vapp4 INT_NET --gateway "192.168.0.1"...
300
+
301
+ _Edit example:_
302
+
303
+ ## Add a parent network to this internal network
304
+ # Note that FenceMode is automatically set to natRouted
305
+
306
+ ## PRE-edit
307
+ ...
308
+ Networks
309
+ INT_NET
310
+ Gateway Netmask Fence Mode Parent Network Retain Network
311
+ 192.168.0.1 255.255.255.0 isolated TST_FE true
312
+ TST_FE
313
+ Gateway Netmask Fence Mode Parent Network Retain Network
314
+ 10.202.3.129 255.255.255.128 bridged TST_FE false
315
+ ...
316
+
317
+ $ knife vc vapp network internal edit test_vapp4 INT_NET --parent-network TST_FE
318
+ Retrieving parent network details
319
+ Setting a parent network for an internal network requires fence mode natRouted. Fixing it...
320
+ vApp network configuration for INT_NET...
321
+ Summary: Status: success - time elapsed: 5.324 seconds
322
+
323
+ ## POST-edit
324
+ ...
325
+ Networks
326
+ INT_NET
327
+ Gateway Netmask Fence Mode Parent Network Retain Network
328
+ 192.168.0.1 255.255.255.0 natRouted TST_FE true
329
+ TST_FE
330
+ Gateway Netmask Fence Mode Parent Network Retain Network
331
+ 10.202.3.129 255.255.255.128 bridged TST_FE false
332
+ ...
333
+
334
+ _Delete example:_
335
+
336
+ $ knife vc vapp network internal delete test_vapp4 INT_NET
337
+ Removing INT_NET from vApp...
338
+ Summary: Status: success - time elapsed: 5.05 seconds
339
+
340
+ ###Clone a vApp
341
+ This command clones an existing vApp.
210
342
 
211
343
  _Example:_
212
344
 
213
- $ knife vc vapp config network 31a56cf6-088b-4a43-b726-d6370b4e7d0a TestNet_1
345
+ $ knife vc vapp clone vDC_Test clone_vAPP clone3
346
+ Cloning vApp...
347
+ Summary: Status: success - time elapsed: 24.69 seconds
348
+ vApp cloned with ID: 587210aa-cf92-48e8-8f37-07e058c0116f
214
349
 
215
350
  ###Show VM's details
216
351
  This command shows details about a given VM.
217
352
 
218
353
  _Example:_
219
354
 
220
- $ knife vc vm show 31a56cf6-088b-4a43-b726-d6370b4e7d0a
221
- OS Name: Red Hat Enterprise Linux 6 (64-bit)
222
- Network TestNet_1
223
- Index 0
224
- Ip 10.102.47.70
225
- Is connected true
226
- Mac address 00:50:56:01:01:80
227
- Ip allocation mode POOL
355
+ $ knife vc vm show TestVM --vapp TEST_CENTOS
356
+ VM Name: centos64-x64-s
357
+ OS Name: CentOS 4/5/6 (64-bit)
358
+ Status: running
359
+
360
+ Cpu
361
+ Number of Virtual CPUs 2 virtual CPU(s)
362
+
363
+ Memory
364
+ Memory Size 1024 MB of memory
365
+
366
+ Disks
367
+ Hard disk 1 16384 MB
368
+
369
+ Networks
370
+ TST_FE
371
+ Index 0
372
+ Ip 10.202.3.251
373
+ External ip
374
+ Is connected true
375
+ Mac address 00:50:21:02:01:27
376
+ Ip allocation mode POOL
228
377
 
229
378
  Guest Customizations
230
- Enabled true
231
- Admin passwd enabled true
232
- Admin passwd auto true
233
- Admin passwd xxxxxxxxxx
234
- Reset passwd required false
235
- Computer name RHEL63-Plus
379
+ Enabled true
380
+ Admin passwd enabled false
381
+ Admin passwd auto false
382
+ Admin passwd xxxxxxxx
383
+ Reset passwd required false
384
+ Computer name centos64-x64-s
385
+
386
+ ###Set VM's CPUs / Memory / Name
387
+ This command sets name, CPUs and RAM info for a given VM.
388
+
389
+ _Example:_
390
+
391
+ $ knife vc vm set info --name NewName --vapp vApp_test vm-test
392
+ Renaming VM from vm-test to NewName
393
+ Summary: Status: success - time elapsed: 7.66 seconds
394
+
395
+ $ knife vc vm set info --ram 512 --vapp vApp_test vm-test
396
+ VM setting RAM info...
397
+ Summary: Status: success - time elapsed: 7.69 seconds
398
+
399
+ $ knife vc vm set info --cpu 2 --vapp vApp_test vm-test
400
+ VM setting CPUs info...
401
+ Summary: Status: success - time elapsed: 5.19 seconds
402
+
403
+ ###Set VM's disks
404
+ This command manages disks for a given VM.
405
+
406
+ _Example:_
407
+
408
+ # Create a new disk
409
+ $ knife vc vm set disks --add --disk-size 3000 --vapp vApp_test vm-test
410
+ VM setting Disks info...
411
+ Summary: Status: success - time elapsed: 6.12 seconds
412
+
413
+ # Resize an existing disk (note that disk size can only be increased)
414
+ $ knife vc vm set disks --disk-name "Hard disk 2" --disk-size 3500 --vapp vApp_test vm-test
415
+ VM setting Disks info...
416
+ Summary: Status: success - time elapsed: 6.69 seconds
417
+
418
+ # Delete an existing disk
419
+ $ knife vc vm set disks --disk-name "Hard disk 2" --delete --vapp vApp_test vm-test
420
+ Do you really want to DELETE disk Hard disk 2? (Y/N) Y
421
+ VM setting Disks info...
422
+ Summary: Status: success - time elapsed: 7.21 seconds
236
423
 
237
424
  ###VM's network configuration
238
425
  This command allows for basic VM network configuration.
@@ -242,25 +429,103 @@ Please note that you must use the human readable name of the network (i.e., _Tes
242
429
 
243
430
  _Example:_
244
431
 
245
- $ knife vc vm config network 31a56cf6-088b-4a43-b726-d6370b4e7d0a TestNet_1
246
- VM network configuration...Done!
247
- Summary: Status: success - started at 2012-12-28T11:42:32.910+01:00 and ended at 2012-12-28T11:42:37.313+01:00
432
+ $ knife vc vm config network test_vm TestNet_1 --vapp test_vapp1
433
+ VM network configuration...
434
+ Summary: Status: success - time elapsed: 4.35 seconds
248
435
 
249
436
  ###VM's Guest Customization configuration
250
437
  This command allows for basic VM Guest Customization configuration.
438
+ By default it forces a guest customization, use _--no-force_ to disable it.
439
+
440
+ Please note that the vapp must be turned off.
441
+
442
+ There are several options that can be specified.
443
+
444
+ i.e.,
445
+
446
+ * admin-passwd: change guest admin password
447
+ * script: load a given file and use it as guest customization script
448
+ * guest-computer-name: change guest name
449
+
450
+ _Example:_
451
+
452
+ $ knife vc vm config guest test_vm --vapp test_vapp1 --script guest_script.txt
453
+ VM guest configuration...
454
+ Summary: Status: success - time elapsed: 5.23 seconds
455
+ Forcing Guest Customization...
456
+ Summary: Status: success - time elapsed: 2.567 seconds
457
+
458
+ It's also possible to upload a customization script using _script_:
459
+
460
+ $ knife vc vm config guest ... --script script_filename.txt
461
+
462
+ ### Bootstrap
463
+ It's possible to bootstrap single VMs or every VM of a vApp.
464
+
465
+ _Example:_
466
+
467
+ # Bootstrap every VM belonging to test_vapp
468
+ $ knife vc vapp bootstrap test_vapp
469
+ Bootstrap VM: SMALL_CentOS6.4-x86_64...
470
+ Trying to reach xxxx (try 1/5)
471
+ xxxx:22 replied with: SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1
472
+ Bootstrap IP: xxxx
473
+ Bootstrapping Chef on xxxx
474
+ xxxx Starting Chef Client, version 11.6.2
475
+ ...
476
+
477
+ # Bootstrap a single VM
478
+ $ knife vc vm bootstrap SMALL_CentOS6.4-x86_64 --vapp test_vapp
479
+ Bootstrap VM: SMALL_CentOS6.4-x86_64...
480
+ Trying to reach xxxx (try 1/5)
481
+ xxxx:22 replied with: SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1
482
+ Bootstrap IP: xxxx
483
+ Bootstrapping Chef on xxxx
484
+ xxxx Starting Chef Client, version 11.6.2
485
+ ...
486
+
487
+ Since a VM may have several addresses, these commands loop over them until they
488
+ find a reachable one.
251
489
 
252
490
  _Example:_
253
491
 
254
- $ knife vc vm config guest c5f11906-561b-4ffd-850a-60a48c6a21e9 CENTOS63 --guest --admin-passwd "testpassword"
255
- VM guest configuration...Done!
256
- Summary: Status: success - started at 2012-12-28T11:42:32.910+01:00 and ended at 2012-12-28T11:42:37.313+01:00
492
+ $ knife vc vapp bootstrap test_vapp
493
+ Bootstrap VM: SMALL_CentOS6.4-x86_64...
494
+ Trying to reach 192.168.0.102 (try 1/5)
495
+ Unable to reach 192.168.0.102:22 => Connection refused - connect(2)
496
+ ...
497
+ Trying to reach xxxx (try 1/5)
498
+ xxxx:22 replied with: SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1
499
+ Bootstrap IP: xxxx
500
+ Bootstrapping Chef on xxxx
501
+ xxxx Starting Chef Client, version 11.6.2
502
+ ...
503
+
504
+ ### OVF Upload
505
+ Upload a given OVF.
506
+
507
+ $ knife vc ovf upload VDC Catalog TemplateName "Example ovf upload" centos64.ovf
508
+ Uploading OVF...
509
+ Time: 00:03:12 <=========> 100% Uploading: ../vm-d384582f-2457-477c-ad9b-6228740ca762-disk-0.vmdk
510
+ Time: 00:00:32 <=========> 100% Uploading: ../vm-d384582f-2457-477c-ad9b-6228740ca762-disk-1.vmdk
511
+ OVF uploaded. vAppTemplate created with ID: b1e58873-8227-4168-add3-87554d2043db
512
+
513
+ DEBUGGING
514
+ --
515
+
516
+ The underlying library *vcloud-rest* can be configured to print debug information.
517
+ Debug can be enabled setting the following environment variables:
518
+
519
+ * *VCLOUD_REST_DEBUG_LEVEL*: to specify the log level (e.g., INFO)
520
+ * *VCLOUD_REST_LOG_FILE*: to specify the output file (defaults to STDOUT)
521
+
257
522
 
258
523
  LICENSE
259
524
  --
260
525
 
261
526
  Author:: Stefano Tortarolo <stefano.tortarolo@gmail.com>
262
527
 
263
- Copyright:: Copyright (c) 2012
528
+ Copyright:: Copyright (c) 2012-2013
264
529
  License:: Apache License, Version 2.0
265
530
 
266
531
  Licensed under the Apache License, Version 2.0 (the "License");