def rescue(self, context, instance, _callback, network_info):
        """Rescue the specified instance.

            - shutdown the instance VM.
            - set 'bootlock' to prevent the instance from starting in rescue.
            - spawn a rescue VM (the vm name-label will be instance-N-rescue).

        """
        rescue_vm_ref = VMHelper.lookup(self._session,
                                        "%s-rescue" % instance.name)
        if rescue_vm_ref:
            raise RuntimeError(_(
                "Instance is already in Rescue Mode: %s" % instance.name))

        vm_ref = VMHelper.lookup(self._session, instance.name)
        self._shutdown(instance, vm_ref)
        self._acquire_bootlock(vm_ref)
        instance._rescue = True
        self.spawn_rescue(context, instance, network_info)
        rescue_vm_ref = VMHelper.lookup(self._session, instance.name)
        rescue_vbd_ref = self._find_rescue_vbd_ref(vm_ref, rescue_vm_ref)

        self._session.call_xenapi("Async.VBD.plug", rescue_vbd_ref)
dataset/ETHPy150Open nii-cloud/dodai-compute/nova/virt/xenapi/vmops.py/VMOps.rescue/original