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

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

 



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@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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