def _soft_reboot(self, instance):
    'Attempt to shutdown and restart the instance gracefully.\n\n        We use shutdown and create here so we can return if the guest\n        responded and actually rebooted. Note that this method only\n        succeeds if the guest responds to acpi. Therefore we return\n        success or failure so we can fall back to a hard reboot if\n        necessary.\n\n        :returns: True if the reboot succeeded\n        '
    dom = self._lookup_by_name(instance['name'])
    state = LIBVIRT_POWER_STATE[dom.info()[0]]
    old_domid = dom.ID()
    if (state == power_state.RUNNING):
        dom.shutdown()
    self._prepare_pci_devices_for_use(pci_manager.get_instance_pci_devs(instance))
    for x in xrange(CONF.libvirt.wait_soft_reboot_seconds):
        dom = self._lookup_by_name(instance['name'])
        state = LIBVIRT_POWER_STATE[dom.info()[0]]
        new_domid = dom.ID()
        if (old_domid != new_domid):
            if (state in [power_state.SHUTDOWN, power_state.CRASHED]):
                LOG.info(_LI('Instance shutdown successfully.'), instance=instance)
                self._create_domain(domain=dom)
                timer = loopingcall.FixedIntervalLoopingCall(self._wait_for_running, instance)
                timer.start(interval=0.5).wait()
                return True
            else:
                LOG.info(_LI('Instance may have been rebooted during soft reboot, so return now.'), instance=instance)
                return True
        greenthread.sleep(1)
    return False
Attempt to shutdown and restart the instance gracefully.

We use shutdown and create here so we can return if the guest
responded and actually rebooted. Note that this method only
succeeds if the guest responds to acpi. Therefore we return
success or failure so we can fall back to a hard reboot if
necessary.

:returns: True if the reboot succeeded
def _soft_reboot(self, instance):
    'Attempt to shutdown and restart the instance gracefully.\n\n        We use shutdown and create here so we can return if the guest\n        responded and actually rebooted. Note that this method only\n        succeeds if the guest responds to acpi. Therefore we return\n        success or failure so we can fall back to a hard reboot if\n        necessary.\n\n        :returns: True if the reboot succeeded\n        '
    dom = self._lookup_by_name(instance['name'])
    state = LIBVIRT_POWER_STATE[dom.info()[0]]
    old_domid = dom.ID()
    if (state == power_state.RUNNING):
        dom.shutdown()
    self._prepare_pci_devices_for_use(pci_manager.get_instance_pci_devs(instance))
    for x in xrange(CONF.libvirt.wait_soft_reboot_seconds):
        dom = self._lookup_by_name(instance['name'])
        state = LIBVIRT_POWER_STATE[dom.info()[0]]
        new_domid = dom.ID()
        if (old_domid != new_domid):
            if (state in [power_state.SHUTDOWN, power_state.CRASHED]):
                LOG.info(_LI('Instance shutdown successfully.'), instance=instance)
                self._create_domain(domain=dom)
                timer = loopingcall.FixedIntervalLoopingCall(self._wait_for_running, instance)
                timer.start(interval=0.5).wait()
                return True
            else:
                LOG.info(_LI('Instance may have been rebooted during soft reboot, so return now.'), instance=instance)
                return True
        greenthread.sleep(1)
    return False