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

Re: [libvirt] [PATCH 19/20] Consolidate "cont" into qemudMonitorSendCont()



On Thu, Aug 20, 2009 at 08:18:17PM +0200, Miloslav Trma?? wrote:
> The interface allows qemudMonitorSendCont() to report errors that are
> not overridden by its callers.
> 
> Also fix a potential infinite loop in qemuDomainCoreDump() if sending
> cont repeatedly fails.
> ---
>  src/qemu_driver.c |   89 +++++++++++++++++++++++++++++++----------------------
>  1 files changed, 52 insertions(+), 37 deletions(-)
> 
> diff --git a/src/qemu_driver.c b/src/qemu_driver.c
> index 3ab0fcc..d013007 100644
> --- a/src/qemu_driver.c
> +++ b/src/qemu_driver.c
> @@ -28,6 +28,7 @@
>  #include <dirent.h>
>  #include <limits.h>
>  #include <string.h>
> +#include <stdbool.h>
>  #include <stdio.h>
>  #include <strings.h>
>  #include <stdarg.h>
> @@ -135,6 +136,9 @@ static int qemudMonitorCommandExtra(const virDomainObjPtr vm,
>                                      const char *extraPrompt,
>                                      int scm_fd,
>                                      char **reply);
> +static int qemudMonitorSendCont(virConnectPtr conn,
> +                                const virDomainObjPtr vm,
> +                                bool *error_reported);

[snip]

>      if (migrateFrom == NULL) {
> +        bool error_reported;
> +
>          /* Allow the CPUS to start executing */
> -        if (qemudMonitorCommand(vm, "cont", &info) < 0) {
> -            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
> -                             "%s", _("resume operation failed"));
> +        if (qemudMonitorSendCont(conn, vm, &error_reported) < 0) {
> +            if (!error_reported)
> +                qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
> +                                 "%s", _("resume operation failed"));
>              return -1;
>          }
> -        VIR_FREE(info);
>      }


I think we can do something a little nicer than this  'error_reported'
boolean.  At the start of every API call we do a 'virResetError',
so we can guarentee no error is set. Thus, you ought to be able to see
if an error has been set by qemudMonitorSendCont() just by doing
once it returns

    if (virGetLastError() == NULL)


The only minor bump on the road in that plan, is that I've just 
noticed a bug in qemudAutostartConfigs() which fails to call
the virResetErrror() before runing qemudStartVMDaemon(), but
that's easily fixed.



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]