Skip to content

Commit 524b352

Browse files
authored
vm: import/unmanage docs (#221)
* vm: import/unmanage docs Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * br Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * line break Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * edit Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent e99c2bb commit 524b352

File tree

7 files changed

+162
-138
lines changed

7 files changed

+162
-138
lines changed
1.17 KB
Loading
85.1 KB
Loading
42.5 KB
Loading
146 KB
Loading

source/adminguide/virtual_machines.rst

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -919,16 +919,10 @@ Support for Virtual Appliances
919919
.. include:: virtual_machines/virtual_appliances.rst
920920

921921

922-
Unmanaging Virtual Machines
923-
===========================
922+
Importing and Unmanaging Virtual Machines
923+
=========================================
924924

925-
.. include:: virtual_machines/unmanage_vms.rst
926-
927-
928-
Importing Virtual Machines
929-
===========================
930-
931-
.. include:: virtual_machines/VM_Ingestion.rst
925+
.. include:: ./virtual_machines/importing_unmanaging_vms.rst
932926

933927

934928
Virtual Machine Backups (Backup and Recovery Feature)

source/adminguide/virtual_machines/VM_Ingestion.rst renamed to source/adminguide/virtual_machines/importing_unmanaging_vms.rst

Lines changed: 159 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,31 @@
1313
specific language governing permissions and limitations
1414
under the License.
1515
16+
.. note:: This is currently only available for **vSphere** clusters.
17+
18+
About Unmanaged Virtual Machines
19+
--------------------------------
20+
21+
As of ACS 4.14, CloudStack has the concept of **unmanaged** virtual machines. These are virtual machines that are on CloudStack
22+
managed hosts, but that are not in CloudStack's database and therefore CloudStack cannot control (manage) then in any way. Previously,
23+
such VMs could exist, but CloudStack did not 'see' them (their existence *would* be reported in logs as unrecognised VMs).
24+
25+
From ACS 4.14 onwards, CloudStack is able to list these VMs via the listUnmanagedInstances API command and then import (also known as ingest)
26+
those unmanaged VMs via the importUnmanagedInstance API so that they become CloudStack managed guest instances.
27+
From ACS 4.16 onwards, importing of the unmanaged VMs can also be carried out within the UI.
28+
29+
From ACS 4.15 onwards, administrators are able to unmanage guest virtual machines.
30+
31+
In the UI, both unmanaged and managed virtual machines or instances are listed in *Tools > Import-Export Instances* section:
32+
33+
|vm-unmanagedmanaged.png|
34+
35+
36+
Importing Unmanaged Virtual Machines
37+
------------------------------------
38+
1639
Use Cases and General Usage
17-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
1841

1942
The ability to import VMs allows Cloud operators (both public and private) to onboard new tenants simply and quickly,
2043
with the minimum amount disk IO. But also can be used in disaster recovery scenarios at remote sites (if storage is
@@ -39,17 +62,17 @@ To import instances, it is imagined that a Cloud Provider will:
3962
#. Create a script that will loop through the CSV, sending the importUnmanagedInstance API command with the corresponding
4063
parameters for each instance being read from the CSV
4164

42-
listUnmanagedInstances API
43-
--------------------------
65+
Listing unmanaged instances
66+
---------------------------
4467

4568
Prerequisites to list unmanaged instances (vSphere)
46-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4770

4871
In order for CloudStack to list the instances that are not managed by CloudStack on a host/cluster, the host(s) in the vSphere cluster
4972
must have been added to CloudStack. The standard prerequisites for adding a host to CloudStack apply.
5073

51-
API
52-
~~~
74+
listUnmanagedInstances API
75+
~~~~~~~~~~~~~~~~~~~~~~~~~~
5376

5477
This API will list all unmanaged VMs for a given cluster. Optionally, the vSphere name for an existing unmanaged
5578
VM can be given to retrieve VM details. The API will filter all CloudStack managed VMs, and will also filter templates that show up as VMs on vCenter.
@@ -90,10 +113,16 @@ VM can be given to retrieve VM details. The API will filter all CloudStack manag
90113
91114
92115
Importing Unmanaged Instances
93-
------------------------------
116+
-----------------------------
117+
118+
Administrators can import unmanaged instances either using UI or with the importUnmanagedInstance API.
119+
120+
UI provides the following form for importing the instance when *Import Instance* action is used in *Import-Export Instances* view:
121+
122+
|ImportInstance.png|
94123

95124
importUnmanagedInstance API
96-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
97126

98127
**Request parameters**:
99128

@@ -124,61 +153,31 @@ importUnmanagedInstance API
124153
125154
126155
Prerequisites to Importing Unmanaged Instances (vSphere)
127-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
156+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
128157

129158
There are a few prerequisites to importing unmanaged instances into CloudStack. Largely these are simply that the networks which you are going to
130159
attach the instance in CloudStack need to already exist in CloudStack also the storage which an unmanaged instance is on (before importing) and
131160
also the storage which you wish the instance to be on after importing must already have been added to CloudStack.
132161

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
134163
service offerings using the *migrateallowed* API parameter.
135164

136165
Dummy Template
137-
~~~~~~~~~~~~~~~~~~~~
166+
##############
138167

139168
The assumption that all guest instances in CloudStack are created from a template or ISO is hardcoded into CloudStack. This *source* template will
140169
not exist for instances which have been imported into CloudStack, there for a dummy template has been created in the CloudStack database. When a
141170
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
142171
not be possible to 'revert' to the original template unless you specify a **real** template ID.
143172

144173
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.
169-
170-
.. parsed-literal:: nicipaddresslist[0].nic=NIC_ID nicipaddresslist[0].ip4Address=auto
171-
172-
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+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176175

177176
Compute Offerings
178-
####################
177+
#################
179178

180179
**Custom vs Fixed Offerings**
181-
''''''''''''''''''''''''''''''
180+
'''''''''''''''''''''''''''''
182181

183182
All guest instances in CloudStack must have an associated compute offering. The import API supports using 'fixed' (ie 2 vCPUs with 2GB RAM
184183
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.
226225
For volumes, live-migration will be carried out for the volumes of a running VM. As per existing CloudStack behaviour, a stopped
227226
imported VM may not appear in vCenter when its root volume is migrated until the VM is restarted.
228227

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.
251+
252+
.. parsed-literal:: nicipaddresslist[0].nic=NIC_ID nicipaddresslist[0].ip4Address=auto
253+
254+
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+
229258

230259
Registered Operating System
231260
###########################
@@ -261,7 +290,7 @@ Other notes for the importUnmanagedInstance API
261290

262291

263292
Discovery of Existing Networks (for vSphere)
264-
-----------------------------------------------
293+
--------------------------------------------
265294

266295
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
267296
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:
291320
292321
.. note::
293322
To run this script host machine should have Python 3 and module *pyvmomi* installed.
294-
323+
295324
Python binaries can be found here: https://www.python.org/downloads/
296-
325+
297326
Install instructions for pyvmomi are here: https://github.com/vmware/pyvmomi#installing
298327

299328
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
300329
successful import.
301330

302331

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.
303403

304404
.. |br| raw:: html
305405

306406
<br>
307407
<br>
408+
409+
.. |ImportInstance.png| image:: /_static/images/vm-importinstance.png
410+
:alt: Import Unmanaged Instance.
411+
:width: 600 px
412+
.. |vm-unmanagedmanaged.png| image:: /_static/images/vm-unmanagedmanaged.png
413+
:alt: Unmanaged and Managed Instances.
414+
:width: 600 px
415+
.. |UnmanageButton.png| image:: /_static/images/unmanage-instance-icon.png
416+
:alt: button to unmanage a VM
417+
.. |UnmanageInstance.png| image:: /_static/images/vm-unmanage-instance.png
418+
:alt: button to unmanage a VM
419+
:width: 600 px

source/adminguide/virtual_machines/unmanage_vms.rst

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)