You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are a few prerequisites to importing unmanaged instances into CloudStack. Largely these are simply that the networks which you are going to
130
159
attach the instance in CloudStack need to already exist in CloudStack also the storage which an unmanaged instance is on (before importing) and
131
160
also the storage which you wish the instance to be on after importing must already have been added to CloudStack.
132
161
133
-
VMs can be imported to isolated, shared or L2 networks. VMs can also be imported and then automatically migrated to storage in accordance with
162
+
VMs can be imported to isolated, shared or L2 networks. VMs can also be imported and then automatically migrated to storage in accordance with
134
163
service offerings using the *migrateallowed* API parameter.
135
164
136
165
Dummy Template
137
-
~~~~~~~~~~~~~~~~~~~~
166
+
##############
138
167
139
168
The assumption that all guest instances in CloudStack are created from a template or ISO is hardcoded into CloudStack. This *source* template will
140
169
not exist for instances which have been imported into CloudStack, there for a dummy template has been created in the CloudStack database. When a
141
170
template ID is not supplied when importing the instance, the built-in dummy template ID will be used. As this template is only a dummy one, it will
142
171
not be possible to 'revert' to the original template unless you specify a **real** template ID.
143
172
144
173
Offerings and Automatic Mapping
145
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
146
-
147
-
Networks
148
-
#########
149
-
When importing an instance, CloudStack needs to attach the virtual network interfaces (vNICs) to CloudStack networks.
150
-
vNICs are associated with a network in one of two ways.
151
-
152
-
#. Automatically (available for L2 and shared networks)
153
-
#. Manual assignment of vNIC to network (ID) as a map if a VM has more that one NIC
154
-
155
-
In an enterprise, the vast majority of networks will operate as *Layer 2* networks with IP addressing handled by an IPAM system such as Active Directory
156
-
or InfoBlox. This makes CloudStack's L2 networks the natural choice for a like-for-like migration/on-boarding of VMs.
157
-
158
-
When importing an instance to a shared or L2 network, CloudStack will automatically look for a CloudStack network that has the same VLAN(s) as the instance's NIC(s)
159
-
is already on. This can be overridden by providing a network_id for the **'nicnetworklist'** parameter
160
-
161
-
.. note:: this includes PVLANs on L2 networks.
162
-
163
-
164
-
IP Addresses
165
-
##############
166
-
167
-
To assigning a specific IP address to a NIC, the **'nicipaddresslist'** parameter is used. This parameter should not be used for L2 networks, and is optional for shared networks.
168
-
To ask CloudStack to assign an instance's existing IP when importing, a value of `auto` can be used.
Auto-assigning IP addresses requires VMware tools to be on the guest instance (for the IP to be reported to vCenter) and is not supported if an unmanaged VM reports more than one IP
173
-
address associated with its NIC (CloudStack cannot tell which is the primary address). For instances with more than 1 IP addresses per NIC, pass the first IP address via the import API
174
-
and then add secondary addresses via the **'addIpToNic**' API
175
-
174
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176
175
177
176
Compute Offerings
178
-
####################
177
+
#################
179
178
180
179
**Custom vs Fixed Offerings**
181
-
''''''''''''''''''''''''''''''
180
+
'''''''''''''''''''''''''''''
182
181
183
182
All guest instances in CloudStack must have an associated compute offering. The import API supports using 'fixed' (ie 2 vCPUs with 2GB RAM
184
183
hardcoded into the offering) and 'custom' (user can choose the number of vCPUs and memory) offerings. When a custom offering is chosen,
@@ -226,6 +225,36 @@ VM to a suitable host when it is restarted.
226
225
For volumes, live-migration will be carried out for the volumes of a running VM. As per existing CloudStack behaviour, a stopped
227
226
imported VM may not appear in vCenter when its root volume is migrated until the VM is restarted.
228
227
228
+
Networks
229
+
########
230
+
231
+
When importing an instance, CloudStack needs to attach the virtual network interfaces (vNICs) to CloudStack networks.
232
+
vNICs are associated with a network in one of two ways.
233
+
234
+
#. Automatically (available for L2 and shared networks)
235
+
#. Manual assignment of vNIC to network (ID) as a map if a VM has more that one NIC
236
+
237
+
In an enterprise, the vast majority of networks will operate as *Layer 2* networks with IP addressing handled by an IPAM system such as Active Directory
238
+
or InfoBlox. This makes CloudStack's L2 networks the natural choice for a like-for-like migration/on-boarding of VMs.
239
+
240
+
When importing an instance to a shared or L2 network, CloudStack will automatically look for a CloudStack network that has the same VLAN(s) as the instance's NIC(s)
241
+
is already on. This can be overridden by providing a network_id for the **'nicnetworklist'** parameter
242
+
243
+
.. note:: this includes PVLANs on L2 networks.
244
+
245
+
246
+
IP Addresses
247
+
''''''''''''
248
+
249
+
To assigning a specific IP address to a NIC, the **'nicipaddresslist'** parameter is used. This parameter should not be used for L2 networks, and is optional for shared networks.
250
+
To ask CloudStack to assign an instance's existing IP when importing, a value of `auto` can be used.
Auto-assigning IP addresses requires VMware tools to be on the guest instance (for the IP to be reported to vCenter) and is not supported if an unmanaged VM reports more than one IP
255
+
address associated with its NIC (CloudStack cannot tell which is the primary address). For instances with more than 1 IP addresses per NIC, pass the first IP address via the import API
256
+
and then add secondary addresses via the **'addIpToNic**' API
257
+
229
258
230
259
Registered Operating System
231
260
###########################
@@ -261,7 +290,7 @@ Other notes for the importUnmanagedInstance API
261
290
262
291
263
292
Discovery of Existing Networks (for vSphere)
264
-
-----------------------------------------------
293
+
--------------------------------------------
265
294
266
295
To import existing VMs, the networks that they are attached to need to already exist as CloudStack networks. As an existing environment can have a great many networks which
267
296
need creating, A Python 3 script has been created to enumerate the existing networks.
@@ -291,17 +320,100 @@ The script can take the following arguments:
291
320
292
321
.. note::
293
322
To run this script host machine should have Python 3 and module *pyvmomi* installed.
294
-
323
+
295
324
Python binaries can be found here: https://www.python.org/downloads/
296
-
325
+
297
326
Install instructions for pyvmomi are here: https://github.com/vmware/pyvmomi#installing
298
327
299
328
The output of this script can then be used in conjunction with the **'createNetwork'** API to add all of the networks to CloudStack that will be required for a
300
329
successful import.
301
330
302
331
332
+
Unmanaging Virtual Machines
333
+
---------------------------
334
+
335
+
Administrators are able to unmanage guest virtual machines from CloudStack. Once unmanaged, CloudStack can no longer monitor, control or administer the provisioning and orchestration related operations on a virtual machine.
336
+
337
+
To unmanage a guest virtual machine, an administrator must either use the UI or invoke the unmanageVirtualMachine API passing the ID of the virtual machine to unmanage. The API has the following preconditions:
338
+
339
+
- The virtual machine must not be destroyed
340
+
- The virtual machine state must be 'Running’ or ‘Stopped’
341
+
- The virtual machine must be a VMware virtual machine
342
+
343
+
The API execution will perform the following pre-checks, failing if they are not met:
344
+
345
+
- There are no volume snapshots associated with any of the virtual machine volumes
346
+
- There is no ISO attached to the virtual machine
347
+
348
+
In the UI, *Unmanage VM* action can be used in virtual machine view. |UnmanageButton.png|
349
+
350
+
Alternately, the same operation can also be carried out using *Unmanage Instance* action in *Import-Export Instances* view under the *Tools* section.
351
+
352
+
|UnmanageInstance.png|
353
+
354
+
Preserving unmanaged virtual machine NICs
355
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
356
+
357
+
The zone setting: unmanage.vm.preserve.nics can be used to preserve virtual machine NICs and its MAC addresses after unmanaging them. If set to true, the virtual machine NICs (and their MAC addresses) are preserved when unmanaging it. Otherwise, NICs are removed and MAC addresses can be reassigned.
358
+
359
+
360
+
Unmanaging virtual machine actions
361
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
362
+
363
+
- Clean up virtual machine NICs and deallocate network resources used such as IP addresses and DHCP entries on virtual routers.
364
+
365
+
- If ‘unmanage.vm.preserve.nics’ = ‘false’ then the NICs are deallocated and removed from CloudStack
366
+
367
+
- If ‘unmanage.vm.preserve.nics’ = ‘true’ then the NICs remain allocated and are not removed from the database. The NIC’s MAC addresses remain preserved and therefore cannot be assigned to any new NIC.
368
+
369
+
- Clean up virtual machine volumes in the CloudStack database
370
+
371
+
- Clean up virtual machine snapshots in the CloudStack database (if any)
372
+
- Revoke host access to any managed volumes attached to the VM (applicable to managed storage only)
373
+
374
+
- Clean up the virtual machine from the following:
375
+
376
+
- Remove the virtual machine from security groups (if any)
377
+
378
+
- Remove the virtual machine from instance groups (if any)
379
+
380
+
- Remove firewall rules for the virtual machine (if any)
381
+
382
+
- Remove port forwarding rules for the virtual machine (if any)
383
+
384
+
- Remove load balancing rules for the virtual machine (if any)
385
+
386
+
- Disable static NAT (if the virtual machine is assigned to it)
387
+
388
+
- Remove the virtual machine from affinity groups (if any)
389
+
390
+
- Remove VM details from the CloudStack database
391
+
392
+
- Decrement the account resources count for volumes and virtual machines
393
+
394
+
- Generate usage events:
395
+
396
+
- For volumes destroyed, with type: ‘VOLUME.DELETE’
397
+
398
+
- For virtual machine snapshots destroyed (if any), with type: ‘VMSNAPSHOT.DELETE’ and 'VMSNAPSHOT.OFF_PRIMARY'
399
+
400
+
- For virtual machine NICs destroyed: with type: ‘NETWORK.OFFERING.REMOVE’
401
+
402
+
- For the virtual machine being unmanaged: stopped and destroyed usage events (similar to the generated usage events when expunging a virtual machine), with types: ‘VM.STOP’ and ‘VM.DESTROY', unless the VM has been already stopped before being unmanaged and in this case only ‘VM.DESTROY' is generated.
0 commit comments