Lxc driver patch

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

 



  Patch against CVS version, it tries to avoid 2 issues:
    - problem with global data settings when loading of the driver got
      interrupted. Check more NULLs and reset to NULL, i was getting crashes
      when running the regression tests and the /etc/libvirtd/lxc was not
      accessible.
    - avoid trying to open the driver if not running as root, that's not
      a problem in normal case because the daemon runs as root, but
      when running 'make check' as a normal user libvirtd is run as an
      user and compiling the lxc driver in would break the regression tests

 Dave could you double-check this, hopefully it has no side effect ?

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard@xxxxxxxxxx  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/
Index: src/lxc_driver.c
===================================================================
RCS file: /data/cvs/libxen/src/lxc_driver.c,v
retrieving revision 1.2
diff -p -r1.2 lxc_driver.c
*** src/lxc_driver.c	27 Mar 2008 09:34:06 -0000	1.2
--- src/lxc_driver.c	28 Mar 2008 12:53:14 -0000
***************
*** 61,67 ****
  
  static int lxcStartup(void);
  static int lxcShutdown(void);
! static lxc_driver_t *lxc_driver;
  
  /* Functions */
  static int lxcDummyChild( void *argv ATTRIBUTE_UNUSED )
--- 61,67 ----
  
  static int lxcStartup(void);
  static int lxcShutdown(void);
! static lxc_driver_t *lxc_driver = NULL;
  
  /* Functions */
  static int lxcDummyChild( void *argv ATTRIBUTE_UNUSED )
*************** static char *lxcDomainDumpXML(virDomainP
*** 378,383 ****
--- 378,390 ----
  
  static int lxcStartup(void)
  {
+     uid_t uid = getuid();
+ 
+     /* Check that the user is root */
+     if (0 != uid) {
+         return -1;
+     }
+ 
      lxc_driver = calloc(1, sizeof(lxc_driver_t));
      if (NULL == lxc_driver) {
          return -1;
*************** static void lxcFreeDriver(lxc_driver_t *
*** 412,422 ****
  
  static int lxcShutdown(void)
  {
!     lxc_vm_t *vms = lxc_driver->vms;
! 
!     lxcFreeVMs(vms);
      lxc_driver->vms = NULL;
      lxcFreeDriver(lxc_driver);
  
      return 0;
  }
--- 419,430 ----
  
  static int lxcShutdown(void)
  {
!     if (lxc_driver == NULL)
!         return(NULL);
!     lxcFreeVMs(lxc_driver->vms);
      lxc_driver->vms = NULL;
      lxcFreeDriver(lxc_driver);
+     lxc_driver = NULL;
  
      return 0;
  }
*************** static int lxcShutdown(void)
*** 430,435 ****
--- 438,445 ----
   */
  static int
  lxcActive(void) {
+     if (lxc_driver == NULL)
+         return(0);
      /* If we've any active networks or guests, then we
       * mark this driver as active
       */
--
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]