vm_migrate
Migrate a virtual machine to another host or datastore via vMotion. Preview the blast radius first, then confirm to execute the migration.
Instructions
[WRITE] Migrate (vMotion) a VM to another host, optionally with storage vMotion.
Without confirm=True this only previews: it returns blast_radius (VM and instance UUID, source host and datastores, target host with its connection and maintenance state, target datastore, and live vMotion vs cold migration) and moves nothing. Show it to the user and get their decision. Do not set confirm=True on your own because the user asked earlier: they have not seen the preview yet.
Refused: a target host that is not found, not connected, in maintenance mode or outside a cluster; a target datastore that is not found; a target host that does not mount the VM's datastores when to_datastore is omitted (vCenter rejects cross-host vMotion without shared storage — pass to_datastore); and anything above that cannot be read. The VM's current host with no to_datastore returns action "noop". Run cluster_info first for host names.
Returns: Dict with action (preview, noop, migrated), blast_radius, and result.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | No | vCenter/ESXi target name from config. | |
| confirm | No | False (default) returns the blast radius and changes nothing. True applies it. | |
| to_host | Yes | Target ESXi host name. | |
| vm_name | Yes | VM to migrate. | |
| to_datastore | No | Target datastore (required for cross-storage hosts). |