Skip to content

KVMotion: vmware compute eph support#648

Draft
anokfireball wants to merge 2 commits into
stable/2023.2-m3from
kvmotion-vmware-compute-eph-support
Draft

KVMotion: vmware compute eph support#648
anokfireball wants to merge 2 commits into
stable/2023.2-m3from
kvmotion-vmware-compute-eph-support

Conversation

@anokfireball

Copy link
Copy Markdown
Member

No description provided.

Power off a source VMware VM and detach its root VMDK for cross-HV
conversion (prep), and the inverse that reattaches and powers back on
(abort).

New private helpers in VMwareVMOps:

  _get_root_disk_device(hardware_devices)
    Finds the VirtualDisk on any SCSI controller at unit number 0.
    Requires class name 'VirtualDisk' to skip CD-ROMs and other
    devices that may share the same slot. Raises DiskNotFound when
    absent.

  _derive_cinder_host()
    Returns 'cinder-volume-vmware-{vc-name}@vmware_fcd', where
    vc-name is the first DNS label of CONF.vmware.host_ip. Requires
    FQDN vCenter addressing.

prep_cross_hv_conversion(context, instance):
  - Discovers the root disk before touching power state; any
    DiskNotFound is raised immediately with no side effects.
  - If RUNNING, calls power_off_instance and records its boolean
    return as powered_off_by_us. The helper returns False when the
    VM was already off at the point the task fired.
  - Accepts SHUTDOWN without re-issuing power-off (makes the call
    tolerable to retry if a previous attempt got as far as power-off
    but not detach).
  - Rejects any other state with InstanceInvalidState.
  - Detaches the root VMDK via detach_virtual_disk_spec, passed as a
    single-element list to reconfigure_vm_device_change (deviceChange
    is an array type in the vSphere WSDL; all existing callers pass
    lists).
  - On detach failure, powers the VM back on only when
    powered_off_by_us is True. Pre-existing shutdown state is left
    unchanged.
  - Returns vmdk_path, size_bytes (derived via _get_device_capacity
    for pre-vSphere-5.5 KB fallback), cinder_host, rollback dict, and
    optional source_fcd_id when the disk has a vDiskId.

abort_cross_hv_conversion(context, instance, prep_data):
  - Skips reattach if the backing.fileName already matches vmdk_path.
  - Reattaches via get_vmdk_attach_config_spec, which sets key=-100
    and fills in connectable and diskMode.
  - Skips power-on if the VM is already RUNNING.

Change-Id: I5b8057f8797d714c1e33f782a3b9f72a47f50407
Add two compute RPC methods that call through to the virt driver:
prep_cross_hv_conversion and abort_cross_hv_conversion.

nova/virt/driver.py:
  Base stubs raising NotImplementedError. Drivers that don't support
  cross-HV conversion inherit them unchanged.

nova/virt/vmwareapi/driver.py:
  Delegation to VMwareVMOps.

nova/virt/fake.py:
  Stubs raising NotImplementedError. Unit tests that exercise the
  manager endpoints mock the driver method directly.

nova/compute/manager.py:
  ComputeManager.target bumped to '6.2.1'.

  prep_cross_hv_conversion: decorated with
    @messaging.expected_exceptions(DiskNotFound, InstanceInvalidState)
  so those exception types survive the RPC wire as typed exceptions
  rather than RemoteError. Also carries the standard
  @wrap_exception / @wrap_instance_event / @wrap_instance_fault stack.

  abort_cross_hv_conversion: same standard decorator stack, no
  expected_exceptions (abort failure is not an expected path and
  should surface as RemoteError).

nova/compute/rpcapi.py:
  Both methods require version '6.2.1'; raise UnsupportedRPCVersion
  when the target compute does not support it. Synchronous call()
  with call_monitor_timeout=CONF.rpc_response_timeout and a 180 s
  hard timeout.

nova/objects/service.py:
  SERVICE_VERSION = 67, history entry {'compute_rpc': '6.2.1'}.

Change-Id: I277618423e1fe881e56a36cd277b713bcc7a6cda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant