1. 27 1月, 2016 1 次提交
    • D
      lxc: don't try to hide parent cgroups inside container · dc576025
      Daniel P. Berrange 提交于
      On the host when we start a container, it will be
      placed in a cgroup path of
      
         /machine.slice/machine-lxc\x2ddemo.scope
      
      under /sys/fs/cgroup/*
      
      Inside the containers' namespace we need to setup
      /sys/fs/cgroup mounts, and currently will bind
      mount /machine.slice/machine-lxc\x2ddemo.scope on
      the host to appear as / in the container.
      
      While this may sound nice, it confuses applications
      dealing with cgroups, because /proc/$PID/cgroup
      now does not match the directory in /sys/fs/cgroup
      
      This particularly causes problems for systems and
      will make it create repeated path components in
      the cgroup for apps run in the container eg
      
        /machine.slice/machine-lxc\x2ddemo.scope/machine.slice/machine-lxc\x2ddemo.scope/user.slice/user-0.slice/session-61.scope
      
      This also causes any systemd service that uses
      sd-notify to fail to start, because when systemd
      receives the notification it won't be able to
      identify the corresponding unit it came from.
      In particular this break rabbitmq-server startup
      
      Future kernels will provide proper cgroup namespacing
      which will handle this problem, but until that time
      we should not try to play games with hiding parent
      cgroups.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      dc576025
  2. 26 1月, 2016 7 次提交
  3. 25 1月, 2016 5 次提交
  4. 23 1月, 2016 1 次提交
    • L
      util: reset MAC address of macvtap passthrough physdev after disassociate · 29cc45cb
      Laine Stump 提交于
      libvirt always resets the MAC address of the physdev used for macvtap
      passthrough when the guest is finished with it. This was happening
      prior to the 802.1Qb[gh] DISASSOCIATE command, and was quite often
      failing, presumably because the driver wouldn't allow the MAC address
      to be reset while the association was still active, with a log message
      like this:
      
      virNetDevSetMAC:168 : Cannot set interface MAC to 00:00:00:00:00:00 on 'eth13': Cannot assign requested address
      
      This patch changes the order - we now do the 802.1Qb[gh] disassociate
      and delete the macvtap interface first, then and reset the MAC
      address.
      29cc45cb
  5. 22 1月, 2016 8 次提交
    • C
      lxc: fuse: Stub out Slab bits in /proc/meminfo · 81da8bc7
      Cole Robinson 提交于
      'free' on fedora23 wants to use the Slab field for calculated used
      memory. The equation is:
      
      used = MemTotal - MemFree - (Cached + Slab) - Buffers
      
      We already set Cached and Buffers to 0, do the same for Slab and its
      related values
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1300781
      81da8bc7
    • C
      lxc: fuse: Fill in MemAvailable for /proc/meminfo · c7be484d
      Cole Robinson 提交于
      'free' on Fedora 23 will use MemAvailable to calculate its 'available'
      field, but we are passing through the host's value. Set it to match
      MemFree, which is what 'free' will do for older linux that don't have
      MemAvailable
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1300781
      c7be484d
    • C
      lxc: fuse: Fix /proc/meminfo size calculation · 8418245a
      Cole Robinson 提交于
      We virtualize bits of /proc/meminfo by replacing host values with
      values specific to the container.
      
      However for calculating the final size of the returned data, we are
      using the size of the original file and not the altered copy, which
      could give garbelled output.
      8418245a
    • C
      lxc: fuse: Unindent meminfo logic · f65dcfcd
      Cole Robinson 提交于
      Reverse the conditional at the start so we aren't stuffing all the logic
      in an 'if' block
      f65dcfcd
    • I
      libxl: Support cmdline= in xl config files · daeace5c
      Ian Campbell 提交于
      ... and consolidate the cmdline/extra/root parsing to facilitate doing
      so.
      
      The logic is the same as xl's parse_cmdline from the current xen.git master
      branch (e6f0e099d2c17de47fd86e817b1998db903cab61).
      
      On the formatting side switch to producing cmdline= instead of extra=.
      
      Update a few tests and add serveral more.
        - test-cmdline is added to test the exclusive use of cmdline.
        - test-fullvirt-direct-kernel-boot.cfg is updated due to the switch
          on the formatting side and now tests the exclusive use of cmdline=.
        - Tests are added for both paravirt and fullvirt where the .cfg uses
          extra= and (paravirt only) root=. These are format (xl->xml) only
          since the inverse will generate cmdline= hence is not a round trip
          (which was already true if using root=, which used to generate
          extra= on the way back).
        - Tests are added for both paravirt and fullvirt where the .cfg
          declares cmdline= as well as bogus extra= and (paravirt only) root=
          entries which should be ignored. Again these are format only tests
          since the inverse won't include the bogus lines.
      
      The last two bullets here required splitting the DO_TEST macro into
      two halves, as is done in the xmconfigtest.c case.
      
      In order to introduce a use of VIR_WARN for logging I had to add
      virerror.h and VIR_LOG_INIT.
      Signed-off-by: NIan Campbell <ian.campbell@citrix.com>
      daeace5c
    • J
      libxl: dispose libxl_dominfo after libxl_domain_info() · d18d6a85
      Joao Martins 提交于
      As suggested in a previous thread [0] this patch adds some missing calls
      to libxl_dominfo_{init,dispose} when doing some of the libxl_domain_info
      operations which would otherwise lead to memory leaks.
      
      [0]
      https://www.redhat.com/archives/libvir-list/2015-September/msg00519.htmlSigned-off-by: NJoao Martins <joao.m.martins@oracle.com>
      d18d6a85
    • J
      Xen: add XENXL to virErrorDomain enum · 8c3c32f1
      Jim Fehlig 提交于
      Add "Xen XL Config" to the virErrorDomain enum and use it in
      src/xenconfig/xen_xl.c.
      8c3c32f1
    • J
      Xen: VIR_FROM_THIS cleanup · 7d3698b4
      Jim Fehlig 提交于
      The virErrorDomain enum has VIR_FROM_XEN, VIR_FROM_XEND,
      VIR_FROM_XENSTORE, VIR_FROM_SEXPR, and VIR_FROM_XENXM. Use
      these elements in the corresponding .c files. While at it,
      remove the VIR_FROM_THIS define in src/xenconfig/xenxs_private.h.
      7d3698b4
  6. 21 1月, 2016 3 次提交
  7. 20 1月, 2016 10 次提交
  8. 19 1月, 2016 2 次提交
    • M
      virLogManagerDomainReadLogFile: Don't do dummy allocs · c03fbecc
      Michal Privoznik 提交于
      Since we pass dummy variables @fdout and @fdoutlen into
      virNetClientProgramCall() we make it alloc @fdout array (even
      though it's an array of 0 elements since vitlogd can hardly pass
      us some FDs at this stage). Nevertheless, it's an allocation not
      followed by free():
      
      ==29385== 0 bytes in 60 blocks are definitely lost in loss record 2 of 1,009
      ==29385==    at 0x4C2C070: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==29385==    by 0x54B99EF: virAllocN (viralloc.c:191)
      ==29385==    by 0x56821B1: virNetClientProgramCall (virnetclientprogram.c:359)
      ==29385==    by 0x563B304: virLogManagerDomainReadLogFile (log_manager.c:272)
      ==29385==    by 0x217CD613: qemuDomainLogContextRead (qemu_domain.c:2485)
      ==29385==    by 0x217EDC76: qemuProcessReadLog (qemu_process.c:1660)
      ==29385==    by 0x217EDE1D: qemuProcessReportLogError (qemu_process.c:1696)
      ==29385==    by 0x217EE8C1: qemuProcessWaitForMonitor (qemu_process.c:1957)
      ==29385==    by 0x217F6636: qemuProcessLaunch (qemu_process.c:4955)
      ==29385==    by 0x217F71A4: qemuProcessStart (qemu_process.c:5152)
      ==29385==    by 0x21846582: qemuDomainObjStart (qemu_driver.c:7396)
      ==29385==    by 0x218467DE: qemuDomainCreateWithFlags (qemu_driver.c:7450)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      c03fbecc
    • M
      qemuProcessReadLog: Fix memmove arguments · 105b51f4
      Michal Privoznik 提交于
      So I can observe this crasher that with freshly started daemon
      (and virtlogd enabled) I am trying to startup a domain that
      immediately dies (because it's said to use huge pages but I
      haven't allocated a single one in the pool). Hardly reproducible
      with -O0 or under valgrind. But I just got lucky:
      
      ==20469== Invalid write of size 8
      ==20469==    at 0x4C2E99B: memcpy@GLIBC_2.2.5 (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==20469==    by 0x217EDD07: qemuProcessReadLog (qemu_process.c:1670)
      ==20469==    by 0x217EDE1D: qemuProcessReportLogError (qemu_process.c:1696)
      ==20469==    by 0x217EE8C1: qemuProcessWaitForMonitor (qemu_process.c:1957)
      ==20469==    by 0x217F6636: qemuProcessLaunch (qemu_process.c:4955)
      ==20469==    by 0x217F71A4: qemuProcessStart (qemu_process.c:5152)
      ==20469==    by 0x21846582: qemuDomainObjStart (qemu_driver.c:7396)
      ==20469==    by 0x218467DE: qemuDomainCreateWithFlags (qemu_driver.c:7450)
      ==20469==    by 0x21846845: qemuDomainCreate (qemu_driver.c:7468)
      ==20469==    by 0x5611CD0: virDomainCreate (libvirt-domain.c:6753)
      ==20469==    by 0x125D9A: remoteDispatchDomainCreate (remote_dispatch.h:3613)
      ==20469==    by 0x125CB7: remoteDispatchDomainCreateHelper (remote_dispatch.h:3589)
      ==20469==  Address 0x27a52ad0 is 0 bytes after a block of size 5,584 alloc'd
      ==20469==    at 0x4C29F80: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==20469==    by 0x9B8D1DB: xdr_string (in /lib64/libc-2.21.so)
      ==20469==    by 0x563B39C: xdr_virLogManagerProtocolNonNullString (log_protocol.c:24)
      ==20469==    by 0x563B6B7: xdr_virLogManagerProtocolDomainReadLogFileRet (log_protocol.c:123)
      ==20469==    by 0x164B34: virNetMessageDecodePayload (virnetmessage.c:407)
      ==20469==    by 0x5682360: virNetClientProgramCall (virnetclientprogram.c:379)
      ==20469==    by 0x563B30E: virLogManagerDomainReadLogFile (log_manager.c:272)
      ==20469==    by 0x217CD613: qemuDomainLogContextRead (qemu_domain.c:2485)
      ==20469==    by 0x217EDC76: qemuProcessReadLog (qemu_process.c:1660)
      ==20469==    by 0x217EDE1D: qemuProcessReportLogError (qemu_process.c:1696)
      ==20469==    by 0x217EE8C1: qemuProcessWaitForMonitor (qemu_process.c:1957)
      ==20469==    by 0x217F6636: qemuProcessLaunch (qemu_process.c:4955)
      
      This points to memmove() in qemuProcessReadLog(). Imagine we just
      read the following string from qemu:
      
      "abc\n2016-01-18T09:40:44.022744Z qemu-system-x86_64: Error\n"
      
      After the first pass of the while() loop in the
      qemuProcessReadLog() (in which we have taken the false branch in
      the if) @buf still points to the beginning of the string,
      @filter_next points to the beginning of the second line.  So we
      start second iteration because there is yet another newline
      character at the end. In this iteration @eol points to it
      actually. Now, the control gets inside true branch of if(). Just
      to remind you:
      
      got = 58
      filter_next = buf + 5,
      eol = buf + 58.
      
      Therefore skip = 54 which is correct. The message we want to skip
      is 54 bytes long. However:
      
      memmove(filter_next, eol + 1, (got - skip) +1);
      
      which is
      
      memmove(filter_next, eol + 1, 5)
      
      is obviously wrong as there is only one byte we can access, not 5!
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      105b51f4
  9. 18 1月, 2016 2 次提交
    • M
      Fix make check with gcc version 5 · 4b47f9b8
      Martin Kletzander 提交于
      When building with gcc-5 (particularly gcc-5.3.0 now) and having pdwtags
      installed (package dwarves) make check fails with the following error:
      
        $ make lock_protocol-struct
        GEN      lock_protocol-struct
        --- lock_protocol-structs	2016-01-13 15:04:59.318809607 +0100
        +++ lock_protocol-struct-t3	2016-01-13 15:05:17.703501234 +0100
        @@ -26,10 +26,6 @@
                 virLockSpaceProtocolNonNullString name;
                 u_int                      flags;
         };
        -enum virLockSpaceProtocolAcquireResourceFlags {
        -        VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_SHARED = 1,
        -        VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_AUTOCREATE = 2,
        -};
         struct virLockSpaceProtocolAcquireResourceArgs {
                 virLockSpaceProtocolNonNullString path;
                 virLockSpaceProtocolNonNullString name;
        Makefile:10415: recipe for target 'lock_protocol-struct' failed
        make: *** [lock_protocol-struct] Error 1
      
      That happens because without any specific options gcc doesn't keep enum
      information in the resulting binary object.  I managed to isolate the
      parameters of gcc that caused this issue to disappear, however I
      remember that they influenced the resulting binaries quite a bit and
      were definitely not something we would want to add as mandatory to the
      build process.
      
      So to deal with this cleanly, let's take that enum and separate it out
      to its own header file.  Since it is only used in the lockd driver and
      the protocol, lock_driver_lockd.h feels like a suitable name.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      4b47f9b8
    • W
      rbd: Set r variable so it can be returned should an error occur · a5a383ad
      Wido den Hollander 提交于
      This was reported in bug #1298024 where r would be filled with the
      return code of rbd_open().
      
      Should rbd_snap_unprotect() fail for any reason the virReportSystemError
      call would return 'Success' since rbd_open() succeeded.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1298024Signed-off-by: NWido den Hollander <wido@widodh.nl>
      a5a383ad
  10. 15 1月, 2016 1 次提交