Skip to content

Commit 140e66e

Browse files
committed
Update Instance migration section
1 parent 2695888 commit 140e66e

1 file changed

Lines changed: 206 additions & 46 deletions

File tree

‎source/adminguide/virtual_machines.rst‎

Lines changed: 206 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -666,96 +666,256 @@ Moving Instances Between Hosts (Manual Live Migration)
666666
------------------------------------------------------
667667

668668
The CloudStack administrator can move a running Instance from one host to
669-
another without interrupting service to Users or going into maintenance
670-
mode. This is called manual live migration, and can be done under the
671-
following conditions:
669+
another without interrupting service to Users and without putting the source
670+
host into maintenance mode. This is called manual live migration.
672671

673-
- The root administrator is logged in. Domain admins and Users can not
674-
perform manual live migration of Instances.
672+
Prerequisites
673+
~~~~~~~~~~~~~
675674

676-
- The Instance is running. Stopped Instances can not be live migrated.
675+
- You are logged in as root administrator. Domain admins and Users can not
676+
live migrate Instances.
677677

678-
- The destination host must have enough available capacity. If not, the
679-
Instance will remain in the "migrating" state until memory becomes
680-
available.
678+
- The Instance is Running. To move the volumes of a stopped Instance, see
679+
`Moving Instance's Volumes Between Storage Pools (Offline Volume Migration)`_
680+
below.
681681

682-
- (KVM) The Instance must not be using local disk storage. (On XenServer and
683-
VMware, Instance live migration with local disk is enabled by CloudStack
684-
support for XenMotion and vMotion.)
682+
- The destination host runs the same hypervisor as the source host, is Up and
683+
Enabled, and has enough available capacity for the Instance. If no host
684+
satisfies these conditions, the migration is refused and the Instance keeps
685+
running where it is.
685686

686-
- (KVM) The destination host must be in the same cluster as the
687-
original host. (On XenServer and VMware, Instance live migration from one
688-
cluster to another is enabled by CloudStack support for XenMotion and
689-
vMotion.)
687+
- The destination host can access the storage that the Instance's volumes will
688+
be placed on after the migration.
690689

691-
To manually live migrate an Instance
690+
What Moves During a Live Migration
691+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
692+
693+
Depending on where the volumes are stored, either one or two things are
694+
transferred:
695+
696+
- **The Instance only.** Every volume already resides on storage that the
697+
destination host can access, so only the CPU and memory state is
698+
transferred. Nothing is copied on the storage side.
699+
700+
- **The Instance and some of its volumes (live storage migration).** A volume
701+
resides on storage that the destination host can not access (for example
702+
local storage, or cluster-wide storage belonging to another cluster) so
703+
that volume is moved as part of the migration.
704+
705+
CloudStack evaluates this per volume and leaves untouched every volume that
706+
does not have to move. An Instance with its root volume on cluster-wide NFS and
707+
a data volume on zone-wide storage can therefore be migrated to another cluster
708+
by moving only the root volume.
709+
710+
KVM Live Migration Compatibility
711+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
712+
713+
.. note::
714+
Since CloudStack 4.15.0, KVM Instances can be live migrated **between hosts
715+
of different clusters** of the same pod, including Instances that use local
716+
storage. It is no longer required for the source and the destination host to
717+
belong to the same cluster.
718+
719+
During a KVM live storage migration, the disk contents are streamed directly
720+
from the source host to the destination host over the QEMU/libvirt migration
721+
channel. Secondary storage is **not** used as an intermediate step, unlike in
722+
the offline volume migration described in the next section.
723+
724+
The table below lists which primary storage types support having a volume moved
725+
during a KVM live migration.
726+
727+
.. list-table::
728+
:header-rows: 1
729+
:widths: 25 20 55
730+
731+
* - Primary storage type
732+
- Live migration with storage
733+
- Notes
734+
* - NFS
735+
- Supported
736+
- Since 4.13.0.
737+
* - Local storage
738+
- Supported
739+
- Since 4.12.0.
740+
* - SharedMountPoint
741+
- Supported
742+
- Since 4.16.0.
743+
* - CLVM and CLVM_NG
744+
- Supported
745+
- Since 4.23.0. The volume is always copied in full, as incremental
746+
copies are not possible on block devices.
747+
* - Ceph/RBD
748+
- Not supported
749+
- The volume has to remain on its current storage pool.
750+
* - Managed storage
751+
- Not supported
752+
- For example PowerFlex/ScaleIO and SolidFire. The volume has to remain
753+
on its current storage pool.
754+
755+
The restriction on Ceph/RBD and managed storage only applies to volumes that
756+
would have to move. As those storage types are normally configured zone-wide,
757+
the destination host can usually access them, and the Instance itself still
758+
migrates freely between clusters.
759+
760+
PowerFlex/ScaleIO volumes are an exception: they can not be moved as part of an
761+
Instance migration, but they can be live migrated on their own, from one
762+
PowerFlex/ScaleIO storage pool to another, while the Instance keeps running.
763+
See `Migrating an Instance Volume to a New Storage Pool <storage.html#migrating-an-instance-volume-to-a-new-storage-pool>`_.
764+
765+
.. note::
766+
When the destination pool is NFS, local storage or SharedMountPoint and the
767+
root volume was deployed from a template, CloudStack copies the template
768+
from secondary storage to the destination pool if it is not there yet, so
769+
that the migrated volume keeps its backing file and only the differences are
770+
transferred. Volumes
771+
migrated to or from CLVM and CLVM_NG pools are always copied in full
772+
instead.
773+
774+
Migrating an Instance
775+
~~~~~~~~~~~~~~~~~~~~~
692776

693777
#. Log in to the CloudStack UI as root administrator.
694778

695779
#. In the left navigation, click Instances.
696780

697781
#. Choose the Instance that you want to migrate.
698782

699-
#. Click the Migrate Instance button. |Migrateinstance.png|
783+
#. Click the Migrate Instance to another host button. |Migrateinstance.png|
700784

701-
#. From the list of suitable hosts, choose the one to which you want to
702-
move the Instance.
785+
#. From the list of suitable hosts, choose the one to which you want to move
786+
the Instance. Hosts that require the Instance's storage to be migrated as
787+
well are flagged in the list.
703788

704-
.. note::
705-
If the Instance's storage has to be migrated along with the Instance, this will
706-
be noted in the host list. CloudStack will take care of the storage
707-
migration for you.
789+
#. Optionally, enable "Migrate with storage" to control where the volumes are
790+
placed. You can either send all volumes to a single storage pool or pick a
791+
destination pool per volume. If you leave this option disabled, CloudStack
792+
automatically selects, for each volume that has to move, a suitable pool
793+
that is accessible from the destination host.
708794

709795
#. Click OK.
710796

711-
.. note::
712-
(KVM) If the Instance's storage has to be migrated along with the Instance, from a mounted NFS storage pool to a cluster-wide mounted NFS storage pool, then the 'migrateVirtualMachineWithVolume' API has to be used. There is no UI integration for this feature.
797+
The UI calls the ``migrateVirtualMachine`` API when only the Instance has to
798+
move and ``migrateVirtualMachineWithVolume`` when volumes have to move as well.
799+
Both operations can also be run directly, for example with CloudMonkey:
800+
801+
::
713802

714-
(CloudMonkey) > migrate virtualmachinewithvolume virtualmachineid=<virtual machine uuid> hostid=<destination host uuid> migrateto[i].volume=<virtual machine volume number i uuid> migrateto[i].pool=<destination storage pool uuid for volume number i>
803+
> migrate virtualmachine virtualmachineid=<instance uuid> hostid=<destination host uuid>
715804

716-
where i in [0,..,N] and N = number of volumes of the Instance
805+
> migrate virtualmachinewithvolume virtualmachineid=<instance uuid> hostid=<destination host uuid> migrateto[0].volume=<volume uuid> migrateto[0].pool=<destination storage pool uuid>
806+
807+
For ``migrateVirtualMachineWithVolume``, repeat the ``migrateto[i].volume`` and
808+
``migrateto[i].pool`` pair for each volume that has to be moved, with ``i`` in
809+
``[0..N-1]``, where ``N`` is the number of volumes to move.
717810

718811
.. note::
719812
During live migration, there can be a mismatch between the instance's tags
720-
with the destination host's tags which might be undesirable.
721-
722-
For more details on how to prevent this, see :ref:`strict-host-tags`.
813+
with the destination host's tags which might be undesirable. For more
814+
details on how to prevent this, see :ref:`strict-host-tags`.
723815

724-
Moving Instance's Volumes Between Storage Pools (offline volume Migration)
816+
Moving Instance's Volumes Between Storage Pools (Offline Volume Migration)
725817
--------------------------------------------------------------------------
726818

727-
The CloudStack administrator can move a stopped Instance's volumes from one
728-
storage pool to another within the cluster. This is called offline volume
729-
migration, and can be done under the following conditions:
819+
The CloudStack administrator can move the volumes of a stopped Instance from
820+
one storage pool to another. This is called offline volume migration.
821+
822+
As the Instance is not running, its volumes are not bound to a host and can be
823+
moved to any storage pool that is compatible with the Instance, including pools
824+
of another cluster.
825+
826+
Prerequisites
827+
~~~~~~~~~~~~~
730828

731-
- The root administrator is logged in. Domain admins and Users can not
829+
- You are logged in as root administrator. Domain admins and Users can not
732830
perform offline volume migration of Instances.
733831

734-
- The Instance is stopped.
832+
- The Instance is Stopped. To move the volumes of a running Instance, see
833+
`Moving Instances Between Hosts (Manual Live Migration)`_ above.
735834

736-
- The destination storage pool must have enough available capacity.
835+
- The Instance has no Instance snapshots. Remove them before migrating.
737836

738-
- UI operation allows only migrating the root volume upon selecting the
739-
storage pool. To migrate all volumes to the desired storage pools
740-
the 'migrateVirtualMachineWithVolume' API has to be used by providing
741-
'migrateto' map parameter.
837+
- Each destination storage pool matches the Instance's hypervisor type and
838+
shares a storage access group with the pool the volume currently lives on.
839+
If they have no group in common, at least one running host has to be
840+
connected to both pools.
742841

842+
- The number of migration jobs already queued for the destination pool is
843+
below ``concurrent.migrations.per.target.datastore``, when that setting is
844+
not 0.
743845

744-
To perform stopped Instance's volumes migration
846+
- (Hypervisors other than KVM and VMware, such as XenServer) The Instance has
847+
no data disks attached. Detach them before migrating.
848+
849+
- (KVM) None of the volumes have volume snapshots that exist only on primary
850+
storage. Move them to secondary storage with the ``archiveSnapshot`` API or
851+
delete them.
852+
853+
.. note::
854+
The storage pool list of the UI flags the pools that are not suitable for
855+
the volume, for example because of a storage tag mismatch or a lack of
856+
capacity. See
857+
`Finding Primary Storage for Migration <storage.html#finding-primary-storage-for-migration>`_.
858+
Those criteria are not enforced by the API, so a migration started directly
859+
with ``migrateVirtualMachine`` or ``migrateVirtualMachineWithVolume`` can
860+
still be sent to a pool that does not fit the volume.
861+
862+
How the Volumes Are Copied
863+
~~~~~~~~~~~~~~~~~~~~~~~~~~
864+
865+
By default, each volume is copied to secondary storage first and then from
866+
secondary storage to the destination pool. The staging area is an NFS or SMB/CIFS
867+
secondary storage of the zone, so at least one has to be available.
868+
869+
The copy is made directly between the two primary storage pools, without
870+
touching secondary storage, when both of the following are true:
871+
872+
- The source and the destination pool are both of type NFS, local storage or
873+
Ceph/RBD.
874+
875+
- Their scopes are compatible: both pools have the same scope, or one of them
876+
is zone-wide, or a host-wide pool is paired with a pool of the cluster it
877+
belongs to.
878+
879+
Two cluster-wide pools of *different* clusters are therefore always copied
880+
through secondary storage.
881+
882+
Migrating the Volumes
883+
~~~~~~~~~~~~~~~~~~~~~
745884

746885
#. Log in to the CloudStack UI as root administrator.
747886

748887
#. In the left navigation, click Instances.
749888

750889
#. Choose the Instance that you want to migrate.
751890

752-
#. Click the Migrate Instance button. |Migrateinstance.png|
891+
#. Click the Migrate Instance to another primary storage button.
892+
|Migrateinstance.png|
753893

754-
#. From the list of suitable storage pools, choose the one to which you want to
755-
move the Instance root volume.
894+
#. Choose where the volumes are placed. You can either send all volumes to a
895+
single storage pool or pick a destination pool per volume.
756896

757897
#. Click OK.
758898

899+
The UI calls the ``migrateVirtualMachine`` API when all volumes go to the same
900+
pool and ``migrateVirtualMachineWithVolume`` when a pool is picked per volume.
901+
Both operations can also be run directly, for example with CloudMonkey:
902+
903+
::
904+
905+
> migrate virtualmachine virtualmachineid=<instance uuid> storageid=<destination storage pool uuid>
906+
907+
> migrate virtualmachinewithvolume virtualmachineid=<instance uuid> migrateto[0].volume=<volume uuid> migrateto[0].pool=<destination storage pool uuid>
908+
909+
For ``migrateVirtualMachineWithVolume``, repeat the ``migrateto[i].volume`` and
910+
``migrateto[i].pool`` pair for each volume, with ``i`` in ``[0..N-1]``, where
911+
``N`` is the number of volumes to move. All the cluster-wide destination pools
912+
given in the same call have to belong to the same cluster.
913+
914+
.. note::
915+
To move a single volume instead of all the volumes of an Instance, use the
916+
volume migration described in
917+
`Migrating an Instance Volume to a New Storage Pool <storage.html#migrating-an-instance-volume-to-a-new-storage-pool>`_.
918+
759919
Assigning Instances to Hosts
760920
----------------------------
761921

0 commit comments

Comments
 (0)