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
.. Licensed to the Apache Software Foundation (ASF) under one
2
2
or more contributor license agreements. See the NOTICE file
3
3
distributed with this work for additional information#
4
-
regarding copyright ownership. The ASF licenses this file
4
+
regarding copyright ownership. The ASF licenses this file
5
5
to you under the Apache License, Version 2.0 (the
6
6
"License"); you may not use this file except in compliance
7
7
with the License. You may obtain a copy of the License at
@@ -13,58 +13,68 @@
13
13
specific language governing permissions and limitations
14
14
under the License.
15
15
16
-
.. note:: This is currently only available for **vSphere** clusters.
16
+
About Import Export Instances
17
+
-------------------------
18
+
17
19
18
-
About Unmanaged Instances
20
+
For certain hypervisors, CloudStack supports importing of Instances from Managed Hosts, External Hosts, Local Storage and Shared Storage, into CloudStack.
21
+
22
+
Manage or Unmanage Instances on Managed Hosts
19
23
-------------------------
20
24
21
-
As of ACS 4.14, CloudStack has the concept of **unmanaged** Instances. These are Instances 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,
25
+
.. note:: This is currently only available for **vSphere** and **KVM** clusters.
26
+
27
+
28
+
As of ACS 4.14, CloudStack has the concept of **unmanaged** Instances. These are Instances that exist on CloudStack
29
+
managed hosts, but are not in CloudStack's database and therefore CloudStack cannot control (manage) them in any way. Previously,
23
30
such Instances could exist, but CloudStack did not 'see' them (their existence *would* be reported in logs as unrecognised Instances).
24
31
25
-
From ACS 4.14 onwards, CloudStack is able to list these Instances via the listUnmanagedInstances API command and then import (also known as ingest)
26
-
those unmanaged Instances via the importUnmanagedInstance API so that they become CloudStack managed Guest Instances.
27
-
From ACS 4.16 onwards, importing of the unmanaged Instances can also be carried out within the UI.
32
+
From ACS 4.14 onwards, CloudStack is able to list VMware-based unmanaged instances via the listUnmanagedInstances API command and then import (also known as ingest)
33
+
those unmanaged Instances via the importUnmanagedInstance API so that they become CloudStack-managed Guest Instances.
34
+
35
+
From ACS 4.15 onwards, administrators are able to unmanage VMware-based guest Instances.
36
+
37
+
From ACS 4.16 onwards, importing unmanaged Instances can also be done in the UI.
28
38
29
-
From ACS 4.15 onwards, administrators are able to unmanage guest Instances.
39
+
From ACS 4.19, CloudStack also supports importing KVM-based guest instances. However, this feature is experimental, and only KVM instances which were previously unmanaged, can be imported/become managed again.
30
40
31
41
Importing Unmanaged Instances
32
42
-----------------------------
33
43
34
44
Use Cases and General Usage
35
45
~~~~~~~~~~~~~~~~~~~~~~~~~~~
36
46
37
-
The ability to import Instances allows Cloud operators (both public and private) to onboard new tenants simply and quickly,
38
-
with the minimum amount disk IO. But also can be used in disaster recovery scenarios at remote sites (if storage is
39
-
replicated) and in the recreation of Instances which have been backed up (part of the code is indeed used in
40
-
CloudStack's Backup and Recovery feature).
47
+
The ability to import Instances allows Cloud operators to onboard new tenants simply and quickly,
48
+
with the minimum amount of disk IO. It can also be used in disaster recovery scenarios at remote sites (if storage is
49
+
replicated).
41
50
42
-
The most complex part of importing Instances is the mapping of an unmanaged Instance's Networks to CloudStack Networks. As an operator
43
-
could be importing tens or even hundreds of Instances, a UI for this feature has not been created as yet.
51
+
The most complex part of importing Instances is the mapping of an unmanaged Instance's Networks (on the hypervisor level) to CloudStack Networks, as an operator
52
+
could be importing tens or even hundreds of Instances.
44
53
45
-
If the 'destination' Network VLAN(s) and the requested service offerings match the existing Instance, then the Instance can be
46
-
imported whilst it is running. If the VLANs or service offerings do not match, then the Instance to be imported must be stopped.
47
-
Once the Instance has been added to CloudStack, starting it through CloudStack will alter the Instances settings in line with
48
-
those set in the CloudStack DB.
54
+
If the 'destination' Network's VLAN(s) and the requested service offerings match the existing VLAN and the CPU/RAM profile of the Instance on the hypervisor level, then the Instance can be
55
+
imported while it is running. If the VLANs or service offerings do not match, then the Instance to be imported must be stopped.
56
+
Once the Instance has been added to CloudStack, starting it through CloudStack will alter the Instance's settings on the hypervisor in line with
57
+
those set in the CloudStack DB (e.g. the Instance might be moved to a different Port Group on vSwitch/dvSwitch, with the corresponding VLAN)
49
58
50
59
To import Instances, it is imagined that a Cloud Provider will:
51
60
52
-
#. Listall of the existing Networks which the Instances to be imported are on.
53
-
#. Create corresponding Networks in CloudStack
61
+
#. List/get familiar with all of the existing Networks on which the Instances to be imported are on.
62
+
#. Create corresponding Networks in CloudStack (with the same VLANs, as needed)
54
63
#. Use the listUnmanagedInstances API to create a CSV of Instances to be imported.
55
-
#. Where required, add metadata to the CSV such as the Account into which each Instance is to associated, the Network which each Instance is to be
56
-
attached to, the Compute Offering required for each Instance, and the Disk Offering for each disk
64
+
#. Where required, add metadata to the CSV such as the Account to which the imported Instance should belong, the Network to which each Instance should be
65
+
attached to, the Compute Offering required for each Instance, and the Disk Offering for each disk.
57
66
#. Create a script that will loop through the CSV, sending the importUnmanagedInstance API command with the corresponding
58
67
parameters for each Instance being read from the CSV
59
68
69
+
Using CSV is just an example that would help in the automation of bulk-importing multiple VMs, but it is not mandatory and operators might decide to do it differently.
70
+
60
71
Listing unmanaged Instances
61
72
---------------------------
62
73
63
-
Prerequisites to list unmanaged Instances (vSphere)
74
+
Prerequisites to list unmanaged Instances (vSphere or KVM)
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
67
-
must have been added to CloudStack. The standard prerequisites for adding a host to CloudStack apply.
77
+
In order for CloudStack to list the Instances that are not managed by CloudStack on a host/cluster, the instances must exist on the hosts that are already part to the CloudStack.
68
78
69
79
listUnmanagedInstances API
70
80
~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -138,7 +148,7 @@ importUnmanagedInstance API
138
148
- **migrateallowed** (Instance and its volumes are allowed to migrate to different host/storage pool when offering tags conflict with host/storage pool)
139
149
- **forced** (If true, an Instance is imported despite some of its NIC's MAC addresses being already present)
140
150
141
-
.. note:: The `forced` parameter is false by default and prevents importing an Instance which has a NIC containing a MAC address that has been previously assigned by CloudStack. If it is set to true, the NICs with MAC addresses which already exist in the CloudStack database have the existing MAC addresses reassigned to its NICs.
151
+
.. note:: The `forced` parameter is false by default and thus prevents importing an Instance which has a NIC containing a MAC address that has been previously assigned by CloudStack to another existing VM. If it is set to true, importing a VM with such already-used MAC addresses of the NICS will be allowed. This should be done with a full understanding of possible consequences due to duplicate MAC addresses.
142
152
143
153
**Response**:
144
154
@@ -150,9 +160,9 @@ importUnmanagedInstance API
150
160
Prerequisites to Importing Unmanaged Instances (vSphere)
There are a few prerequisites to importing unmanaged Instances into CloudStack. Largely these are simply that the networks which you are going to
154
-
attach the Instance in CloudStack need to already exist in CloudStack also the storage which an unmanaged Instance is on (before importing) and
155
-
also the storage which you wish the Instance to be on after importing must already have been added to CloudStack.
163
+
There are a few prerequisites to importing unmanaged Instances into CloudStack. Largely, these are simply that the network which you are going to
164
+
attach the Instance to in CloudStack need to already exist in CloudStack and also that the storage which an unmanaged Instance is located on (before importing) and
165
+
also the storage which you wish the Instance to be on after importing (if different from the original storage) must already have been added to CloudStack as Primary Storage pools.
156
166
157
167
Instances can be imported to isolated, shared or L2 networks. Instances can also be imported and then automatically migrated to storage in accordance with
158
168
service offerings using the *migrateallowed* API parameter.
@@ -187,7 +197,7 @@ the CPU speed will have been set to a sensible value by the admin when creating
187
197
188
198
189
199
.. note::
190
-
To use Custom Unconstrained type of compute offering, CPU speed will need to be passed using details parameter when the CPU reservation is not set for
200
+
To use the Custom Unconstrained type of compute offering, CPU speed will need to be passed using details parameter when the CPU reservation is not set for
191
201
the unmanaged Instance in vSphere. CPU speed in the latter case can be passed as, details[0].cpuSpeed=SOME_VALUE.
192
202
193
203
@@ -327,20 +337,20 @@ successful import.
327
337
Unmanaging Instances
328
338
--------------------
329
339
330
-
Administrators are able to unmanage guest Instances from CloudStack. Once unmanaged, CloudStack can no longer monitor, control or administer the provisioning and orchestrationrelated operations on an Instance.
340
+
Administrators can unmanage guest Instances from CloudStack. Once unmanaged, CloudStack can no longer monitor, control or administer the provisioning and orchestration-related operations on an Instance.
331
341
332
342
To unmanage a guest Instance, an administrator must either use the UI or invoke the unmanageVirtualMachine API passing the ID of the Instance to unmanage. The API has the following preconditions:
333
343
334
344
- The Instance must not be destroyed
335
345
- The Instance state must be 'Running’ or ‘Stopped’
336
-
- The Instance must be a VMware Instance
346
+
- The Instance must be a VMware Instance (as of CloudStack 4.19, it's also possible to unmanage a KVM-based Instances)
337
347
338
348
The API execution will perform the following pre-checks, failing if they are not met:
339
349
340
350
- There are no Volume Snapshots associated with any of the Instance volumes
341
351
- There is no ISO attached to the Instance
342
352
343
-
In the UI, *Unmanage instance* action can be used in Instance view. |UnmanageButton.png|
353
+
In the UI, *Unmanage instance* action can be used in the Instance view. |UnmanageButton.png|
344
354
345
355
Alternately, the same operation can also be carried out using *Unmanage Instance* action in *Import-Export Instances* view under the *Tools* section.
346
356
@@ -396,6 +406,167 @@ Unmanaging Instance actions
396
406
397
407
- For the Instance being unmanaged: stopped and destroyed usage events (similar to the generated usage events when expunging an Instance), with types: ‘VM.STOP’ and ‘VM.DESTROY', unless the instance has been already stopped before being unmanaged and in this case only ‘VM.DESTROY' is generated.
398
408
409
+
Import Instances from External Hosts
410
+
-------------------------
411
+
.. note:: This is currently only available for **KVM** hypervisor.
412
+
413
+
External Host
414
+
~~~~~~~~~~~~~
415
+
416
+
An External Host refers to a host that is not managed by CloudStack. The "Import from external host" feature enables importing/migrating
417
+
instances from these external hosts. This feature is available in both UI and API.
418
+
419
+
Prerequisites
420
+
~~~~~~~~~~~~~
421
+
- Ensure that the External KVM host are running libvirt
422
+
- Allow libvirt TCP connections (listen_tcp=1) on those External Hosts from CloudStack hosts.
423
+
- Instances on the external host have to be in a stopped state, as live migration of instances is not supported
424
+
- For some guest operating systems, it's also required that the operating system inside the Instance has been gracefully shut down.
425
+
- Currently, it's supported to only use NFS and Local storage as the destination Primary Storage pools in CloudStack
426
+
- Currently, only libvirt-based instances can be migrated
427
+
428
+
listVmsForImport API
429
+
~~~~~~~~~~~~~~~~~~~~
430
+
431
+
listVmsForImport API serves the purpose of listing all
432
+
instances currently in a stopped state on the designated External KVM host. Linux user's username and password are needed for this API call and
433
+
those same credentials are later used for SSH authentication when the QCOW2 images are moved to the destination CloudStack storage pools
434
+
435
+
**Request parameters**:
436
+
437
+
.. parsed-literal::
438
+
- **zoneid** (Zone to which Instance will be imported)
439
+
- **host** (the host name or IP address of External Host)
440
+
- **username** (the username of External Host for authentication)
441
+
- **password** (the password of External Host for authentication)
442
+
443
+
**Response**:
444
+
445
+
.. parsed-literal::
446
+
- **name**
447
+
- **osdisplayname**
448
+
- **memory**
449
+
- **powerstate**
450
+
- **cpuCoresPerSocket**
451
+
- **cpunumber**
452
+
- **cpuspeed**
453
+
- **disk**
454
+
- **id**
455
+
- **capacity** (in bytes)
456
+
- **controller**
457
+
- **controllerunit**
458
+
- **imagepath**
459
+
- **position**
460
+
- **nic**
461
+
- **id**
462
+
- **macaddress**
463
+
- **networkname**
464
+
- **vlanid**
465
+
- **pcislot**
466
+
- **adaptertype** (when available)
467
+
- **ipaddress**
468
+
469
+
470
+
importVm API
471
+
~~~~~~~~~~~~
472
+
473
+
importVm API invokes the import/migration of the instance (it's disks). Instance's volumes are first converted to the QCOW2 file on the remote host,
474
+
and then copied over via SSH to the CloudStack pool.
475
+
476
+
The conversion of existing disk images of the Instance on a remote host, to a QCOW2 format is handled by the qemu-img utility. Administrators can
477
+
choose the temporary storage location on the external host for the converted file, with the default location set to /tmp.
478
+
479
+
**Request parameters**:
480
+
481
+
.. parsed-literal::
482
+
- **zoneid** (Zone to which Instance will be imported)
483
+
- **host** (the host name or IP address of External Host)
484
+
- **username** (the username of External Host for authentication)
485
+
- **password** (the password of External Host for authentication)
486
+
- **importsource** (Import source should be external)
487
+
- **tmppath** (Temp Path on external host for disk image copy)
488
+
- **name** (Instance name on External Host)
489
+
- **displayname**
490
+
- **hostname**
491
+
- **account** (An optional account name for the Instance. Must be used with domainid parameter)
492
+
- **domainid** (An optional domain ID for the Instance. Must be used with account parameter)
493
+
- **projectid**
494
+
- **serviceofferingid**
495
+
- **nicnetworklist** (Map for NIC ID and corresponding Network UUID)
496
+
- **nicipaddresslist** (Map for NIC ID and corresponding IP address)
497
+
- **datadiskofferinglist** (Map for data disk ID and corresponding disk offering UUID)
498
+
- **details** (Map for Instance details)
499
+
- **forced** (If true, an Instance is imported despite some of its NIC's MAC addresses being already present)
500
+
501
+
.. note:: The `forced` parameter is false by default and thus prevents importing an Instance which has a NIC containing a MAC address that has been previously assigned by CloudStack to another existing VM. If it is set to true, importing a VM with such already-used MAC addresses of the NICS will be allowed. This should be done with a full understanding of possible consequences due to duplicate MAC addresses.
502
+
503
+
**Response**:
504
+
505
+
.. parsed-literal::
506
+
Same response as that of deployVirtualMachine API.
507
+
508
+
Import Instances from Local/Shared Storage
509
+
----------------------------------------
510
+
511
+
.. note:: This is currently only available for **KVM** hypervisor.
512
+
513
+
This feature enables an operator to create an Instance using an already-existing QCOW2 image on a Local or Shared Storage pool (NFS only)
514
+
in CloudStack. The selected disk image should not be actively in use by any existing volume. The disk image must be in the QCOW2 format.
515
+
516
+
QCOW2 files have to already exist on the chosen Local/Shared storage pool - QOCW2 files are not moved/migrated in any way - i.e. they
517
+
are expected to already exist on the path as defined when creating an Instance using this feature.
518
+
519
+
Import Instances from Local Storage
520
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
521
+
522
+
The importVm API is utilized to create instances using QCOW2 file from an existing Local Storage pool of a managed KVM host within the CloudStack infrastructure.
523
+
524
+
**Request parameters**:
525
+
526
+
.. parsed-literal::
527
+
- **zoneid** (Zone to which Instance will be imported)
528
+
- **hostid** (Host where disk image is located)
529
+
- **importsource** (Import source should be local)
530
+
- **diskpath** (Path of the disk image relative to local storage pool path)
531
+
- **name** (Instance name on External Host)
532
+
- **displayname**
533
+
- **hostname**
534
+
- **account** (An optional account name for the Instance. Must be used with domainid parameter)
535
+
- **domainid** (An optional domain ID for the Instance. Must be used with account parameter)
536
+
- **projectid**
537
+
- **serviceofferingid**
538
+
539
+
**Response**:
540
+
541
+
.. parsed-literal::
542
+
Same response as that of deployVirtualMachine API.
543
+
544
+
Import Instances from Shared Storage
545
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
546
+
547
+
The importVm API is utilized to create instances using QCOW2 file from an existing Shared Storage pool of a KVM cluster within the CloudStack infrastructure.
548
+
Only NFS Storage Pool are supported.
549
+
550
+
**Request parameters**:
551
+
552
+
.. parsed-literal::
553
+
- **zoneid** (Zone to which Instance will be imported)
554
+
- **poolid** (Shared Storage Pool where disk image is located)
555
+
- **importsource** (Import source should be shared)
556
+
- **diskpath** (Path of the disk image relative to Shared storage pool path)
557
+
- **name** (Instance name on External Host)
558
+
- **displayname**
559
+
- **hostname**
560
+
- **account** (An optional account name for the Instance. Must be used with domainid parameter)
561
+
- **domainid** (An optional domain ID for the Instance. Must be used with account parameter)
562
+
- **projectid**
563
+
- **serviceofferingid**
564
+
565
+
**Response**:
566
+
567
+
.. parsed-literal::
568
+
Same response as that of deployVirtualMachine API.
0 commit comments