[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] Re: [PATCH v2] implement virsh dump for qemu guests



On Fri, Jul 10, 2009 at 12:03:26AM +0200, Paolo Bonzini wrote:
> This patch uses a "migrate"+"cont" combination to implement "virsh dump"
> for QEMU guests (BZ507551).
> 
> The code is mostly based on qemudDomainSave, except that the XML
> prolog is not included as it is not needed to examine the dump
> with e.g. crash.
> 

> +    if (virAsprintf(&command, "migrate \"exec:"
> +                  "dd of='%s' 2>/dev/null"
> +                  "\"", safe_path) == -1) {
> +        virReportOOMError(dom->conn);
> +        command = NULL;
> +        goto cleanup;
> +    }
> +
> +    if (qemudMonitorCommand(vm, command, &info) < 0) {
> +        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
> +                         "%s", _("migrate operation failed"));
> +        goto cleanup;
> +    }
> +
> +    DEBUG ("%s: migrate reply: %s", vm->def->name, info);
> +
> +    /* If the command isn't supported then qemu prints:
> +     * unknown command: migrate" */
> +    if (strstr(info, "unknown command:")) {
> +        qemudReportError (dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
> +                          "%s",
> +                          _("'migrate' not supported by this qemu"));
> +        goto cleanup;
> +    }
> +
> +    /* Migrate always stops the VM.  However, since the monitor is always
> +       attached to a pty for libvirt, it will support synchronous
> +       operations so we get here just after the end of the migration.  */
> +    if (vm->state == VIR_DOMAIN_RUNNING) {
> +        if (qemudMonitorCommand(vm, "cont", &info) < 0) {
> +            qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
> +                             "%s", _("continue operation failed"));
> +            goto cleanup;
> +        }
> +        DEBUG("Reply %s", info);
> +        VIR_FREE(info);
> +    }

On second review, this does not look correct. The VM continues to run
normally throughout any 'migrate'  operation and is never stopped, as
this is the whole point of 'live' migration. 

The semantics of virDomainDumpCore (as defined by the current & only
impl in the Xen driver), as that the core dump operation should be
non-live.  So you should in fact issue a 'stop' command to the 
monitor before doing the migration. Then, the 'cont' command after
migrate would indeed make sense.


We have a currently unused, 'flags' parameter for virDomainDumpCore.
We should make use of this flag by defining

  VIR_DOMAIN_DUMP_CORE_LIVE = 1

and then allow for use of this flag in both Xen and KVM to do a 
fully live core dump without pausing.

NB, this might complicate the crash analysis of course...

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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]