[libvirt] [PATCH] Reboot support for QEMU/KVM

Daniel P. Berrange berrange at redhat.com
Tue Oct 7 20:58:47 UTC 2008


On Tue, Oct 07, 2008 at 05:55:37PM -0300, Eduardo Habkost wrote:
> This patch implements reboot support on qemu_driver.
> 
> It is so simple that I am wondering if there is some problem I am missing,
> that would be the reason it wasn't implemented yet. I hope not.  :)

The reboot command is intended todo a controlled shutdown, followed by
warm restart. Doesn't the system_reset command do an immediate warm 
reboot ?

I think we needs to happen is that we invoke the 'system_shutdown'
command, and when we detect the VM has quit, then manually start
it again. This is technically a cold reboot, but its close enough

> +static int qemudDomainReboot(virDomainPtr dom) {
> +    struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
> +    virDomainObjPtr vm = virDomainFindByID(driver->domains, dom->id);
> +    char* info;
> +
> +    if (!vm) {
> +        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
> +                         _("no domain with matching id %d"), dom->id);
> +        return -1;
> +    }
> +
> +    if (qemudMonitorCommand(driver, vm, "system_reset", &info) < 0) {
> +        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
> +                         "%s", _("reboot operation failed"));
> +        return -1;
> +    }
> +    VIR_FREE(info);
> +    return 0;
> +}
> +
> +
>  static int qemudDomainDestroy(virDomainPtr dom) {


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list