def migrate_disk_and_power_off(self, context, instance, dest,
                                   flavor, block_device_info):
        """Copies a VHD from one host machine to another, possibly
        resizing filesystem beforehand.

        :param instance: the instance that owns the VHD in question.
        :param dest: the destination host machine.
        :param flavor: flavor to resize to
        """
        self._ensure_not_resize_down_ephemeral(instance, flavor)

        # 0. Zero out the progress to begin
        self._update_instance_progress(context, instance,
                                       step=0,
                                       total_steps=RESIZE_TOTAL_STEPS)

        old_gb = instance['root_gb']
        new_gb = flavor.root_gb
        resize_down = old_gb > new_gb

        if new_gb == 0 and old_gb != 0:
            reason = _("Can't resize a disk to 0 GB.")
            raise exception.ResizeError(reason=reason)

        vm_ref = self._get_vm_opaque_ref(instance)
        sr_path = vm_utils.get_sr_path(self._session)

        if resize_down:
            self._migrate_disk_resizing_down(
                    context, instance, dest, flavor, vm_ref, sr_path)
        else:
            self._migrate_disk_resizing_up(
                    context, instance, dest, vm_ref, sr_path)

        self._detach_block_devices_from_orig_vm(instance, block_device_info)

        # NOTE(sirp): disk_info isn't used by the xenapi driver, instead it
        # uses a staging-area (/images/instance<uuid>) and sequence-numbered
        # VHDs to figure out how to reconstruct the VDI chain after syncing
        disk_info = {}
        return disk_info
dataset/ETHPy150Open openstack/nova/nova/virt/xenapi/vmops.py/VMOps.migrate_disk_and_power_off/original