How to Migrate a Kernel Zone Using Cold Migration

Ensure that the source and target hosts meet requirements described in Kernel Zone Migration Requirements.

  1. Become an administrator who is assigned rights to migrate kernel zones.
  2. If the zone to migrate is running, shut it down.
    source-host$ zoneadm -z kzone shutdown
  3. Verify that the state is installed.

    Output is similar to the following:

    source-host$ zoneadm -z kzone list -v
    ID NAME             STATUS      PATH      BRAND            IP
    -  kzone           installed    -        solaris-kz       excl
  4. If you plan to use the ssh:// URI to connect to the target host, test SSH promptless authentication.

    Execute a command such as date through ssh on the target host.

    source-host$ ssh target-host date
    Tue Oct  4 17:07:55 MDT 2016

    If you are prompted for a password, you have not configured your key pairs to enable login without interactive authentication.

    See How to Generate a Public/Private Key Pair for Use With Secure Shell in Managing Secure Shell Access in Oracle Solaris 11.4.

  5. Perform a dry run of the migration to verify that conditions are set appropriately.

    Output is similar to the following:

    source-host$ zoneadm -z kzone migrate -n ssh://user@target-host
    zoneadm: zone 'kzone': Importing zone configuration.
    zoneadm: zone 'kzone': Attaching zone.
    zoneadm: zone 'kzone': Dry-run migration successful.
    zoneadm: zone 'kzone': Cleaning up.
  6. Perform the migration.

    Output is similar to the following:

    source-host$ zoneadm -z kzone migrate ssh://user@target-host
    zoneadm: zone 'kzone': Importing zone configuration.
    zoneadm: zone 'kzone': Attaching zone.
    zoneadm: zone 'kzone': Migration successful.
  7. Boot the zone on the target host.
    target-host$ zoneadm -z kzone boot

Example 5-11 Dry Run Fails for Cold Migration Due to Local Storage

The following example shows verification that a kernel zone is not running, and then a cold migration dry run that fails because of local storage being used in the kernel zone z3kz.

root@global3 $ zoneadm list -cv
ID NAME             STATUS      PATH                         BRAND      IP
 0 global           running     /                            solaris    shared
 - z3kz             installed   -                            solaris-kz excl
root@global3 $ zoneadm -z z3kz migrate -n ssh://global5 
zoneadm: zone 'z3kz': configuration check failed: The storage property
dev:/dev/zvol/dsk/rpool/VARSHARE/zones/z3kz/disk0  is not a shared storage URI.

Example 5-12 Successful Cold Migration After Configuration Change

The following example shows removal of a non-booting local storage device from the zone configuration for zone z3kz, and then a successful migration. The zone configuration that is used comes from the migrating zone and is imported on the target host.

root@global3 $ zonecfg -z z3kz 'remove device id=1;commit;exit' 
root@global3 $ zoneadm -z z3kz migrate ssh://global5 
zoneadm: zone 'z3kz': Importing zone configuration.
zoneadm: zone 'z3kz': Attaching zone.
zoneadm: zone 'z3kz': Migration successful.