'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):

    guest = self._host.get_guest(instance)
    state = guest.get_power_state(self._host)
    old_domid = guest.id
    if (state == power_state.RUNNING):
        guest.shutdown()
    self._prepare_pci_devices_for_use(pci_manager.get_instance_pci_devs(instance, 'all'))
    for x in range(CONF.libvirt.wait_soft_reboot_seconds):
        guest = self._host.get_guest(instance)
        state = guest.get_power_state(self._host)
        new_domid = guest.id
        if (old_domid != new_domid):
            if (state in [power_state.SHUTDOWN, power_state.CRASHED]):
                LOG.info('Instance    shutdown    successfully.', instance=instance)
                self._create_domain(domain=guest._domain)
                timer = loopingcall.FixedIntervalLoopingCall(self._wait_for_running, instance)
                timer.start(interval=0.5).wait()
                return True
            else:
                LOG.info('Instance    may    have    been    rebooted    during    soft    reboot,    so    return    now.', instance=instance)
                return True
        greenthread.sleep(1)
    return False
