1. 23 12月, 2013 1 次提交
    • L
      qemu: properly set MaxMemLock when hotplugging with VFIO · 6d867f72
      Laine Stump 提交于
      This resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1035490
      
      virProcessSetMaxMemLock() (which is a wrapper over prlimit(3)) expects
      the memory size in bytes, but libvirt's domain definition (which was
      being used by qemuDomainAttachHostPciDevice()) stores all memory
      tuning parameters in KiB. This was being accounted for when setting
      MaxMemLock at domain startup time (so cold-plugged devices would
      work), but not for hotplug.
      
      This patch simplifies the few lines that call
      virProcessSetMemMaxLock(), and multiply the amount * 1024 so that
      we're locking the correct amount of memory.
      
      What remains a mystery to me is why hot-plug of a managed='no' device
      would succeed (at least on my system) while managed='yes' would
      fail. I guess in one case the memory was coincidentally already
      resident and in the other it wasn't.
      6d867f72
  2. 21 12月, 2013 3 次提交
    • J
      PanicCheckABIStability: Need to check for existence · d53c57b8
      John Ferlan 提交于
      Commit id '4313fead' added a call to virDomainPanicCheckABIStability()
      which did not check whether the panic device existed before making a call
      to virDomainDeviceInfoCheckABIStability() which ended up segfaulting:
      
      Thread 1 (Thread 0x7f5332837700 (LWP 10964)):
          (src=<optimized out>, dst=<optimized out>)
          at conf/domain_conf.c:13007
          (dst=<optimized out>, src=<optimized out>)
          at conf/domain_conf.c:13712
          (src=<optimized out>, dst=<optimized out>)
          at conf/domain_conf.c:14056
          (domain=domain@entry=0x7f53000057c0, vm=vm@entry=0x7f53000036d0,
           defptr=defptr@entry=0x7f5332836978, snap=snap@entry=0x7f5332836970,
           update_current=update_current@entry=0x7f5332836962, flags=flags@entry=1)
          at conf/snapshot_conf.c:1230
          (domain=0x7f53000057c0, xmlDesc=<optimized out>, flags=1)
          at qemu/qemu_driver.c:12719
          (domain=domain@entry=0x7f53000057c0, xmlDesc=0x7f53000081d0
           "<domainsnapshot>\n  <name>snap2</name>\n
           <description>new-desc</description>\n  <state>running</state>\n
           <parent>\n    <name>snap1</name>\n  </parent>\n
           <creationTime>1387487268</creationTime>\n  <memory s"..., flags=1)
          at libvirt.c:19695
      ...
      
      (gdb) up 3
      (gdb) print *other->def->dom
      $2 = {virtType = 2, id = -1, ..
      ...
        rng = 0x0, panic = 0x0, namespaceData = 0x0,...
      ...
      (gdb) print *def->dom
      $3 = {virtType = 2, id = -1, ...
      ...
        rng = 0x0, panic = 0x0, namespaceData = 0x0,...
      ...
      (gdb)
      
      Also seen using following sequence:
      
      virsh save $dom $file
      virsh save-image-edit $file
        add (or remove) a <panic/> line
        <devices>
        ...
          <panic>
            <address type='isa' iobase='0x505'/>
          </panic>
        ...
        </devices>
      d53c57b8
    • B
      libxl: fix segfault when domain create fail · b03eba13
      Bamvor Jian Zhang 提交于
      there is a segfault in libxl logging in libxl_ctx_free when domain
      create fail. because the log output handler vmessage is freed by
      xtl_logger_destroy before libxl_ctx_free in virDomainObjListRemove.
      move xtl_logger_destroy after libxl_ctx_free could fix this bug.
      Signed-off-by: NBamvor Jian Zhang <bjzhang@suse.com>
      b03eba13
    • D
      libxl: avoid crashing if calling `virsh numatune' on inactive domain · f9ee91d3
      Dario Faggioli 提交于
      by, in libxlDomainGetNumaParameters(), calling libxl_bitmap_init() as soon as
      possible, which avoids getting to 'cleanup:', where libxl_bitmap_dispose()
      happens, without having initialized the nodemap, and hence crashing after some
      invalid free()-s:
      
       # ./daemon/libvirtd -v
       *** Error in `/home/xen/libvirt.git/daemon/.libs/lt-libvirtd': munmap_chunk(): invalid pointer: 0x00007fdd42592666 ***
       ======= Backtrace: =========
       /lib64/libc.so.6(+0x7bbe7)[0x7fdd3f767be7]
       /lib64/libxenlight.so.4.3(libxl_bitmap_dispose+0xd)[0x7fdd2c88c045]
       /home/xen/libvirt.git/daemon/.libs/../../src/.libs/libvirt_driver_libxl.so(+0x12d26)[0x7fdd2caccd26]
       /home/xen/libvirt.git/src/.libs/libvirt.so.0(virDomainGetNumaParameters+0x15c)[0x7fdd4247898c]
       /home/xen/libvirt.git/daemon/.libs/lt-libvirtd(+0x1d9a2)[0x7fdd42ecc9a2]
       /home/xen/libvirt.git/src/.libs/libvirt.so.0(virNetServerProgramDispatch+0x3da)[0x7fdd424e9eaa]
       /home/xen/libvirt.git/src/.libs/libvirt.so.0(+0x1a6f38)[0x7fdd424e3f38]
       /home/xen/libvirt.git/src/.libs/libvirt.so.0(+0xa81e5)[0x7fdd423e51e5]
       /home/xen/libvirt.git/src/.libs/libvirt.so.0(+0xa783e)[0x7fdd423e483e]
       /lib64/libpthread.so.0(+0x7c53)[0x7fdd3febbc53]
       /lib64/libc.so.6(clone+0x6d)[0x7fdd3f7e1dbd]
      Signed-off-by: NDario Faggili <dario.faggioli@citrix.com>
      Cc: Jim Fehlig <jfehlig@suse.com>
      Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
      f9ee91d3
  3. 20 12月, 2013 5 次提交
    • M
      Fix crash in lxcDomainSetMemoryParameters · 9faf3f29
      Martin Kletzander 提交于
      The function doesn't check whether the request is made for active or
      inactive domain.  Thus when the domain is not running it still tries
      accessing non-existing cgroups (priv->cgroup, which is NULL).
      
      I re-made the function in order for it to work the same way it's qemu
      counterpart does.
      
      Reproducer:
       1) Define an LXC domain
       2) Do 'virsh memtune <domain> --hard-limit 133T'
      
      Backtrace:
       Thread 6 (Thread 0x7fffec8c0700 (LWP 26826)):
       #0  0x00007ffff70edcc4 in virCgroupPathOfController (group=0x0, controller=3,
           key=0x7ffff75734bd "memory.limit_in_bytes", path=0x7fffec8bf718) at util/vircgroup.c:1764
       #1  0x00007ffff70e9206 in virCgroupSetValueStr (group=0x0, controller=3,
           key=0x7ffff75734bd "memory.limit_in_bytes", value=0x7fffe409f360 "1073741824")
           at util/vircgroup.c:669
       #2  0x00007ffff70e98b4 in virCgroupSetValueU64 (group=0x0, controller=3,
           key=0x7ffff75734bd "memory.limit_in_bytes", value=1073741824) at util/vircgroup.c:740
       #3  0x00007ffff70ee518 in virCgroupSetMemory (group=0x0, kb=1048576) at util/vircgroup.c:1904
       #4  0x00007ffff70ee675 in virCgroupSetMemoryHardLimit (group=0x0, kb=1048576)
           at util/vircgroup.c:1944
       #5  0x00005555557d54c8 in lxcDomainSetMemoryParameters (dom=0x7fffe40cc420,
           params=0x7fffe409f100, nparams=1, flags=0) at lxc/lxc_driver.c:774
       #6  0x00007ffff72c20f9 in virDomainSetMemoryParameters (domain=0x7fffe40cc420,
           params=0x7fffe409f100, nparams=1, flags=0) at libvirt.c:4051
       #7  0x000055555561365f in remoteDispatchDomainSetMemoryParameters (server=0x555555eb7e00,
           client=0x555555ec4b10, msg=0x555555eb94e0, rerr=0x7fffec8bfb70, args=0x7fffe40b8510)
           at remote_dispatch.h:7621
       #8  0x00005555556133fd in remoteDispatchDomainSetMemoryParametersHelper (server=0x555555eb7e00,
           client=0x555555ec4b10, msg=0x555555eb94e0, rerr=0x7fffec8bfb70, args=0x7fffe40b8510,
           ret=0x7fffe40b84f0) at remote_dispatch.h:7591
       #9  0x00007ffff73b293f in virNetServerProgramDispatchCall (prog=0x555555ec3ae0,
           server=0x555555eb7e00, client=0x555555ec4b10, msg=0x555555eb94e0)
           at rpc/virnetserverprogram.c:435
       #10 0x00007ffff73b207f in virNetServerProgramDispatch (prog=0x555555ec3ae0,
           server=0x555555eb7e00, client=0x555555ec4b10, msg=0x555555eb94e0)
           at rpc/virnetserverprogram.c:305
       #11 0x00007ffff73a4d2c in virNetServerProcessMsg (srv=0x555555eb7e00, client=0x555555ec4b10,
           prog=0x555555ec3ae0, msg=0x555555eb94e0) at rpc/virnetserver.c:165
       #12 0x00007ffff73a4e8d in virNetServerHandleJob (jobOpaque=0x555555ec3e30, opaque=0x555555eb7e00)
           at rpc/virnetserver.c:186
       #13 0x00007ffff7187f3f in virThreadPoolWorker (opaque=0x555555eb7ac0) at util/virthreadpool.c:144
       #14 0x00007ffff718733a in virThreadHelper (data=0x555555eb7890) at util/virthreadpthread.c:161
       #15 0x00007ffff468ed89 in start_thread (arg=0x7fffec8c0700) at pthread_create.c:308
       #16 0x00007ffff3da26bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      9faf3f29
    • M
      CVE-2013-6436: fix crash in lxcDomainGetMemoryParameters · f8c1cb90
      Martin Kletzander 提交于
      The function doesn't check whether the request is made for active or
      inactive domain.  Thus when the domain is not running it still tries
      accessing non-existing cgroups (priv->cgroup, which is NULL).
      
      I re-made the function in order for it to work the same way it's qemu
      counterpart does.
      
      Reproducer:
       1) Define an LXC domain
       2) Do 'virsh memtune <domain>'
      
      Backtrace:
       Thread 6 (Thread 0x7fffec8c0700 (LWP 13387)):
       #0  0x00007ffff70edcc4 in virCgroupPathOfController (group=0x0, controller=3,
           key=0x7ffff75734bd "memory.limit_in_bytes", path=0x7fffec8bf750) at util/vircgroup.c:1764
       #1  0x00007ffff70e958c in virCgroupGetValueStr (group=0x0, controller=3,
           key=0x7ffff75734bd "memory.limit_in_bytes", value=0x7fffec8bf7c0) at util/vircgroup.c:705
       #2  0x00007ffff70e9d29 in virCgroupGetValueU64 (group=0x0, controller=3,
           key=0x7ffff75734bd "memory.limit_in_bytes", value=0x7fffec8bf810) at util/vircgroup.c:804
       #3  0x00007ffff70ee706 in virCgroupGetMemoryHardLimit (group=0x0, kb=0x7fffec8bf8a8)
           at util/vircgroup.c:1962
       #4  0x00005555557d590f in lxcDomainGetMemoryParameters (dom=0x7fffd40024a0,
           params=0x7fffd40027a0, nparams=0x7fffec8bfa24, flags=0) at lxc/lxc_driver.c:826
       #5  0x00007ffff72c28d3 in virDomainGetMemoryParameters (domain=0x7fffd40024a0,
           params=0x7fffd40027a0, nparams=0x7fffec8bfa24, flags=0) at libvirt.c:4137
       #6  0x000055555563714d in remoteDispatchDomainGetMemoryParameters (server=0x555555eb7e00,
           client=0x555555ebaef0, msg=0x555555ebb3e0, rerr=0x7fffec8bfb70, args=0x7fffd40024e0,
           ret=0x7fffd4002420) at remote.c:1895
       #7  0x00005555556052c4 in remoteDispatchDomainGetMemoryParametersHelper (server=0x555555eb7e00,
           client=0x555555ebaef0, msg=0x555555ebb3e0, rerr=0x7fffec8bfb70, args=0x7fffd40024e0,
           ret=0x7fffd4002420) at remote_dispatch.h:4050
       #8  0x00007ffff73b293f in virNetServerProgramDispatchCall (prog=0x555555ec3ae0,
           server=0x555555eb7e00, client=0x555555ebaef0, msg=0x555555ebb3e0)
           at rpc/virnetserverprogram.c:435
       #9  0x00007ffff73b207f in virNetServerProgramDispatch (prog=0x555555ec3ae0,
           server=0x555555eb7e00, client=0x555555ebaef0, msg=0x555555ebb3e0)
           at rpc/virnetserverprogram.c:305
       #10 0x00007ffff73a4d2c in virNetServerProcessMsg (srv=0x555555eb7e00, client=0x555555ebaef0,
           prog=0x555555ec3ae0, msg=0x555555ebb3e0) at rpc/virnetserver.c:165
       #11 0x00007ffff73a4e8d in virNetServerHandleJob (jobOpaque=0x555555ebc7e0, opaque=0x555555eb7e00)
           at rpc/virnetserver.c:186
       #12 0x00007ffff7187f3f in virThreadPoolWorker (opaque=0x555555eb7ac0) at util/virthreadpool.c:144
       #13 0x00007ffff718733a in virThreadHelper (data=0x555555eb7890) at util/virthreadpthread.c:161
       #14 0x00007ffff468ed89 in start_thread (arg=0x7fffec8c0700) at pthread_create.c:308
       #15 0x00007ffff3da26bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      f8c1cb90
    • E
      docs: improve event-related documentation · 3e67714e
      Eric Blake 提交于
      While looking at event code, I noticed that the documentation was
      trying to refer me to functions that don't exist.  Also fix some
      typos and poor formatting.
      
      * src/libvirt.c (virConnectDomainEventDeregister)
      (virConnectDomainEventRegisterAny)
      (virConnectDomainEventDeregisterAny)
      (virConnectNetworkEventRegisterAny)
      (virConnectNetworkEventDeregisterAny): Link to correct function.
      * include/libvirt.h.in (VIR_DOMAIN_EVENT_CALLBACK)
      (VIR_NETWORK_EVENT_CALLBACK): Likewise.
      (virDomainEventID, virConnectDomainEventGenericCallback)
      (virNetworkEventID, virConnectNetworkEventGenericCallback):
      Improve docs.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3e67714e
    • E
      storage: fix bogus target in gluster volume xml · 3a96cebc
      Eric Blake 提交于
      Commit 6cd60b68 was flat out broken - it tried to print into the
      wrong variable.  My testing was obviously too cursory (did the
      name get a slash added?); valgrind would have caught the error.
      Thankfully it didn't hit any release.
      
      Reported by Peter Krempa.
      
      * src/storage/storage_backend_gluster.c
      (virStorageBackendGlusterRefreshVol): Fix bogus code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3a96cebc
    • D
      Remove stray semicolon after pragma macros · 147a3d24
      Daniel P. Berrange 提交于
      The VIR_WARNINGS_NO_CAST_ALIGN / VIR_WARNINGS_RESET should
      not have any trailing ';' since they are pragmas. The use
      of a ';' results in an empty statement which confuses CIL.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      147a3d24
  4. 19 12月, 2013 7 次提交
  5. 18 12月, 2013 8 次提交
    • P
      virsh: domain: Fix undefine with storage of 'volume' disks · ef56cc43
      Peter Krempa 提交于
      The undefine code that removes the storage along with the VM didn't take
      into account the existence of 'volume' type disks. Add the functionality.
      ef56cc43
    • P
      virsh: man: Mention that volumes need to be in storage pool for undefine · 878b8fa4
      Peter Krempa 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1044445
      
      When undefining a VM with storage the man page doesn't explicitly
      mention that the volumes need to be a part of the storage pool otherwise
      it won't work.
      878b8fa4
    • E
      qemu: ask for -enable-fips when FIPS is required · a21cfb0f
      Eric Blake 提交于
      On a system that is enforcing FIPS, most libraries honor the
      current mode by default.  Qemu, on the other hand, refused to
      honor FIPS mode unless you add the '-enable-fips' command
      line option; worse, this option is not discoverable via QMP,
      and is only present on binaries built for Linux.  So, if we
      detect FIPS mode, then we unconditionally ask for FIPS; either
      qemu is new enough to have the option and then correctly
      cripple insecure VNC passwords, or it is so old that we are
      correctly avoiding a FIPS violation by preventing qemu from
      starting.  Meanwhile, if we don't detect FIPS mode, then
      omitting the argument is safe whether the qemu has the option
      (but it would do nothing because FIPS is disabled) or whether
      qemu lacks the option (including in the case where we are not
      running on Linux).
      
      The testsuite was a bit interesting: we don't want our test
      to depend on whether it is being run in FIPS mode, so I had
      to tweak things to set the capability bit outside of our
      normal interaction with capability parsing.
      
      This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1035474
      
      * src/qemu/qemu_capabilities.h (QEMU_CAPS_ENABLE_FIPS): New bit.
      * src/qemu/qemu_capabilities.c (virQEMUCapsInitQMP): Conditionally
      set capability according to detection of FIPS mode.
      * src/qemu/qemu_command.c (qemuBuildCommandLine): Use it.
      * tests/qemucapabilitiestest.c (testQemuCaps): Conditionally set
      capability to test expected output.
      * tests/qemucapabilitiesdata/caps_1.2.2-1.caps: Update list.
      * tests/qemucapabilitiesdata/caps_1.6.0-1.caps: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a21cfb0f
    • M
      configure: make --with-test-suite work · 56bad329
      Martin Kletzander 提交于
      Our option '--with-test-suite' could have never worked since it was
      defined as AC_ARG_ENABLE([with-test-suite], ...), thus working only as
      '--enable-with-test-suite', but documented in configure.ac as
      AC_HELP_STRING([--with-test-suite], ...).
      In my opinion, the help string is as it should be, but the option is
      wrong.
      
      The option has been broken since the introduction in commit 3a2fc277.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      56bad329
    • D
      Set the 'container_ttys' env variable for LXC consoles · daf08f36
      Daniel P. Berrange 提交于
      Systemd specified that any /dev/pts/NNN device on which it
      is expected to spawn a agetty login, should be listed in
      the 'container_ttys' env variable. It should just contain
      the relative paths, eg 'pts/0' not '/dev/pts/0' and should
      be space separated.
      
      http://cgit.freedesktop.org/systemd/systemd/commit/?id=1d97ff7dd71902a5604c2fed8964925d54e09de9Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      daf08f36
    • M
      storage: resize vol against real allocated size · b0579ed9
      Michal Privoznik 提交于
      Currently, 'vol-resize --allocate' allocates new space at the
      vol->capacity offset. But the vol->capacity is not necessarily the same
      as vol->allocation. For instance:.
      
      	[root@localhost ~]# virsh vol-list --pool tmp-pool --details
      	 Name      Path                   Type  Capacity  Allocation
      	-------------------------------------------------------------
      	 tmp-vol  /root/tmp-pool/tmp-vol  file  1.00 GiB  1.00 GiB
      
      	[root@localhost ~]# virsh vol-resize tmp-vol --pool tmp-pool 2G
      
      	[root@localhost ~]# virsh vol-list --pool tmp-pool --details
      	 Name      Path                   Type  Capacity  Allocation
      	-------------------------------------------------------------
      	 tmp-vol  /root/tmp-pool/tmp-vol  file  2.00 GiB  1.00 GiB
      
      So, if we want to allocate more bytes, so the file is say 3G big, the
      real allocated size is 2G actually:
      
      	[root@localhost ~]# virsh vol-resize tmp-vol --pool tmp-pool 3G --allocate
      
      	[root@localhost ~]# virsh vol-list --pool tmp-pool --details
      	 Name      Path                   Type  Capacity  Allocation
      	-------------------------------------------------------------
      	 tmp-vol  /root/tmp-pool/tmp-vol  file  3.00 GiB  2.00 GiB
      
      This commit uses the correct vol->allocation instead of incorrect
      vol->capacity, so the output of the commands above looks like this:
      
      	[root@localhost ~]# virsh vol-resize tmp-vol --pool tmp-pool 3G --allocate
      
      	[root@localhost ~]# virsh vol-list --pool tmp-pool --details
      	 Name      Path                   Type  Capacity  Allocation
      	-------------------------------------------------------------
      	 tmp-vol  /root/tmp-pool/tmp-vol  file  3.00 GiB  3.00 GiB
      
      Moreover, if the '--alocate' flag was used, we must update the
      vol->allocation member in storageVolResize API too, not just
      vol->capacity.
      Reported-by: NWang Sen <wangsen@linux.vnet.ibm.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      b0579ed9
    • W
      Support transient attribute on vmware disks · 5d7e4f0c
      Wout Mertens 提交于
      vmx/vmx.c ignores the transient attribute on the disk xml format. This patch
      adds a 1-1 relationship between it and [disk].mode = "independent-nonpersistent".
      
      The other modes are ignored as before. It works in my testing.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1044023Signed-off-by: NEric Blake <eblake@redhat.com>
      5d7e4f0c
    • L
      Fix build when default python is python3 · eafe4076
      Lénaïc Huard 提交于
      As the python generator scripts are written in python2,
      the ./configure script must check for python2 before checking for python
      otherwise, on platforms where both python2 and python3 are available and
      on which the default python points to python3, ./configure will try to use
      the wrong one.
      Signed-off-by: NLénaïc Huard <lenaic@lhuard.fr.eu.org>
      eafe4076
  6. 17 12月, 2013 3 次提交
  7. 16 12月, 2013 2 次提交
  8. 14 12月, 2013 7 次提交
  9. 13 12月, 2013 4 次提交
    • N
      Fix memory leak in virObjectEventCallbackListRemoveID() · 34d52b34
      Nehal J Wani 提交于
      While running objecteventtest, it was found that valgrind pointed out the
      following memory leak:
      
      ==13464== 5 bytes in 1 blocks are definitely lost in loss record 7 of 134
      ==13464==    at 0x4A0887C: malloc (vg_replace_malloc.c:270)
      ==13464==    by 0x341F485E21: strdup (strdup.c:42)
      ==13464==    by 0x4CAE28F: virStrdup (virstring.c:554)
      ==13464==    by 0x4CF3CBE: virObjectEventCallbackListAddID (object_event.c:286)
      ==13464==    by 0x4CF49CA: virObjectEventStateRegisterID (object_event.c:729)
      ==13464==    by 0x4CF73FE: virDomainEventStateRegisterID (domain_event.c:1424)
      ==13464==    by 0x4D7358F: testConnectDomainEventRegisterAny (test_driver.c:6032)
      ==13464==    by 0x4D600C8: virConnectDomainEventRegisterAny (libvirt.c:19128)
      ==13464==    by 0x402409: testDomainStartStopEvent (objecteventtest.c:232)
      ==13464==    by 0x403451: virtTestRun (testutils.c:138)
      ==13464==    by 0x402012: mymain (objecteventtest.c:395)
      ==13464==    by 0x403AF2: virtTestMain (testutils.c:593)
      ==13464==
      34d52b34
    • M
      qemu: check for reboot-timeout on monitor · 15275f2e
      Martin Kletzander 提交于
      The support for <boot rebootTimeout="12345"/> was added before we were
      checking for qemu command line options in QMP, so we haven't properly
      adapted virQEMUCaps when using it and thus we report unsupported
      option with new enough qemu.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1042690Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      15275f2e
    • C
      lxc: return -1 if failed to kill lxc process · 5ed324a2
      Chen Hanxiao 提交于
      We missed a return when virProcessKillPainfully
      failed to kill lxc process
      Signed-off-by: NChen Hanxiao <chenhanxiao@cn.fujitsu.com>
      5ed324a2
    • E
      object: require maximal alignment in base class · fca4f233
      Eric Blake 提交于
      Recent changes to events (commit 8a29ffcf) resulted in new compile
      failures on some targets (such as ARM OMAP5):
      conf/domain_event.c: In function 'virDomainEventDispatchDefaultFunc':
      conf/domain_event.c:1198:30: error: cast increases required alignment of
      target type [-Werror=cast-align]
      conf/domain_event.c:1314:34: error: cast increases required alignment of
      target type [-Werror=cast-align]
      cc1: all warnings being treated as errors
      
      The error is due to alignment; the base class is merely aligned
      to the worst of 'int' and 'void*', while the child class must
      be aligned to a 'long long'.  The solution is to include a
      'long long' (and for good measure, a function pointer) in the
      base class to ensure correct alignment regardless of what a
      child class may add, but to wrap the inclusion in a union so
      as to not incur any wasted space.  On a typical x86_64 platform,
      the base class remains 16 bytes; on i686, the base class remains
      12 bytes; and on the impacted ARM platform, the base class grows
      from 12 bytes to 16 bytes due to the increase of alignment from
      4 to 8 bytes.
      
      Reported by Michele Paolino and others.
      
      * src/util/virobject.h (_virObject): Use a union to ensure that
      subclasses never have stricter alignment than the parent.
      * src/util/virobject.c (virObjectNew, virObjectUnref)
      (virObjectRef): Adjust clients.
      * src/libvirt.c (virConnectRef, virDomainRef, virNetworkRef)
      (virInterfaceRef, virStoragePoolRef, virStorageVolRef)
      (virNodeDeviceRef, virSecretRef, virStreamRef, virNWFilterRef)
      (virDomainSnapshotRef): Likewise.
      * src/qemu/qemu_monitor.c (qemuMonitorOpenInternal)
      (qemuMonitorClose): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      fca4f233