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

Re: [libvirt] PATCH: 1/3: Put each QEMU guest in a cgroup



On Thu, Feb 26, 2009 at 04:38:25PM +0000, Daniel P. Berrange wrote:
> This patch sets up the cgroups for QEMU instances. It creates a cgroup
> when starting a guest, uses an exec hook to place the process into the
> correct cgroup, and cleans up empty cgroup when the QEMU process shuts
> down.
> @@ -1185,8 +1261,11 @@ static int qemudStartVMDaemon(virConnect
>      emulator = vm->def->emulator;
>      if (!emulator)
>          emulator = virDomainDefDefaultEmulator(conn, vm->def, driver->caps);
> -    if (!emulator)
> -        return -1;
> +    if (!emulator) {
> +        close(vm->logfile);
> +        vm->logfile = -1;
> +        return -1;
> +    }
>  
>      /* Make sure the binary we are about to try exec'ing exists.
>       * Technically we could catch the exec() failure, but that's
> @@ -1196,6 +1275,8 @@ static int qemudStartVMDaemon(virConnect
>          virReportSystemError(conn, errno,
>                               _("Cannot find QEMU binary %s"),
>                               emulator);
> +        close(vm->logfile);
> +        vm->logfile = -1;
>          return -1;
>      }
>  
> @@ -1205,7 +1286,14 @@ static int qemudStartVMDaemon(virConnect
>          qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
>                           _("Cannot determine QEMU argv syntax %s"),
>                           emulator);
> -        return -1;
> +        close(vm->logfile);
> +        vm->logfile = -1;
> +        return -1;
> +    }
> +
> +    if (qemuSetupCgroup(conn, driver, vm) < 0) {
> +        close(vm->logfile);
> +        vm->logfile = -1;
>      }
>  
>      vm->def->id = driver->nextvmid++;

  Seems the logfile changes are cleanups not directly related,
but yes this all looks sounds to me,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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