Re: [PATCH 09/16] qemu: Convert virExec usage to virCommand

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

 



On Tue, May 10, 2011 at 04:07:48PM -0400, Cole Robinson wrote:
> 
> Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c  |   14 +++++++++-----
>  src/qemu/qemu_process.c |    2 +-
>  2 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index b8d9c92..a4dce5e 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -3150,9 +3150,9 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
>      int intermediatefd = -1;
>      pid_t intermediate_pid = -1;
>      int childstat;
> +    virCommandPtr cmd = NULL;
>  
>      if (header->version == 2) {
> -        const char *intermediate_argv[3] = { NULL, "-dc", NULL };
>          const char *prog = qemudSaveCompressionTypeToString(header->compressed);
>          if (prog == NULL) {
>              qemuReportError(VIR_ERR_OPERATION_FAILED,
> @@ -3162,14 +3162,17 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
>          }
>  
>          if (header->compressed != QEMUD_SAVE_FORMAT_RAW) {
> -            intermediate_argv[0] = prog;
> +            cmd = virCommandNewArgList(prog, "-dc", NULL);
>              intermediatefd = *fd;
>              *fd = -1;
> -            if (virExec(intermediate_argv, NULL, NULL,
> -                        &intermediate_pid, intermediatefd, fd, NULL, 0) < 0) {
> +
> +            virCommandSetInputFD(cmd, intermediatefd);
> +            virCommandSetOutputFD(cmd, fd);
> +
> +            if (virCommandRunAsync(cmd, &intermediate_pid) < 0) {
>                  qemuReportError(VIR_ERR_INTERNAL_ERROR,
>                                  _("Failed to start decompression binary %s"),
> -                                intermediate_argv[0]);
> +                                prog);
>                  *fd = intermediatefd;
>                  goto out;
>              }
> @@ -3234,6 +3237,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
>      ret = 0;
>  
>  out:
> +    virCommandFree(cmd);
>      if (virSecurityManagerRestoreSavedStateLabel(driver->securityManager,
>                                                   vm, path) < 0)
>          VIR_WARN("failed to restore save state label on %s", path);
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index bd7c932..3ea5845 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -2275,7 +2275,7 @@ int qemuProcessStart(virConnectPtr conn,
>           * because the child no longer exists.
>           */
>  
> -        /* The virExec process that launches the daemon failed. Pending on
> +        /* The virCommand process that launches the daemon failed. Pending on
>           * when it failed (we can't determine for sure), there may be
>           * extra info in the domain log (if the hook failed for example).
>           *

ACK

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]