1. 12 9月, 2015 1 次提交
    • D
      xen: fix race in refresh of config cache · 427067f7
      Daniel P. Berrange 提交于
      The xenXMConfigCacheRefresh method scans /etc/xen and loads
      all config files it finds. It then scans its internal hash
      table and purges any (previously) loaded config files whose
      refresh timestamp does not match the timestamp recorded at
      the start of xenXMConfigCacheRefresh(). There is unfortunately
      a subtle flaw in this, because if loading the config files
      takes longer than 1 second, some of the config files will
      have a refresh timestamp that is 1 or more seconds different
      (newer) than is checked for. So we immediately purge a bunch
      of valid config files we just loaded.
      
      To avoid this flaw, we must pass the timestamp we record at
      the start of xenXMConfigCacheRefresh() into the
      xenXMConfigCacheAddFile() method, instead of letting the
      latter call time(NULL) again.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      427067f7
  2. 11 9月, 2015 1 次提交
  3. 10 9月, 2015 4 次提交
  4. 09 9月, 2015 2 次提交
    • M
      qemu: Report error if per-VM directory cannot be created · 83700237
      Martin Kletzander 提交于
      Commit f1f68ca3 did not report an error if virFileMakePath()
      returned -1.  Well, who would've guessed function with name starting
      with 'vir' sets an errno instead of reporting an error the libvirt way.
      Anyway, let's fix it, so the output changes from:
      
        $ virsh start arm
        error: Failed to start domain arm
        error: An error occurred, but the cause is unknown
      
      to:
      
        $ virsh start arm
        error: Failed to start domain arm
        error: Cannot create directory '/var/lib/libvirt/qemu/domain-arm': Not
        a directory
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1146886Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      83700237
    • P
      qemu: migration: Relax enforcement of memory hotplug support · a98e5a78
      Peter Krempa 提交于
      If the current live definition does not have memory hotplug enabled, but
      the persistent one does libvirt would reject migration if the
      destination does not support memory hotplug even if the user didn't want
      to persist the VM at the destination and thus the XML containing the
      memory hotplug definition would not be used. To fix this corner case the
      code will check for memory hotplug in the newDef only if
      VIR_MIGRATE_PERSIST_DEST was used.
      a98e5a78
  5. 08 9月, 2015 5 次提交
  6. 07 9月, 2015 1 次提交
  7. 05 9月, 2015 7 次提交
  8. 04 9月, 2015 4 次提交
  9. 03 9月, 2015 3 次提交
    • L
      util: don't use netlink to save/set mac for macvtap+passthrough+802.1Qbh · 46cf0cef
      Laine Stump 提交于
      Before libvirt sets the MAC address of the physdev (the physical
      ethernet device) linked to a macvtap passthrough device, it always
      saves the previous MAC address to restore when the guest is finished
      (following a "leave nothing behind" policy). For a long time it
      accomplished the save/restore with a combination of
      ioctl(SIOCGIFHWADDR) and ioctl(SIOCSIFHWADDR), but in commit cbfe38c
      (first in libvirt 1.2.15) this was changed to use netlink RTM_GETLINK
      and RTM_SETLINK commands sent to the Physical Function (PF) of any
      device that was detected to be a Virtual Function (VF).
      
      We later found out that this caused problems with any devices using
      the Cisco enic driver (e.g. vmfex cards) because the enic driver
      hasn't implemented the function that is called to gather the
      information in the IFLA_VFINFO_LIST attribute of RTM_GETLINK
      (ndo_get_vf_config() for those keeping score), so we would never get
      back a useful response.
      
      In an ideal world, all drivers would implement all functions, but it
      turns out that in this case we can work around this omission without
      any bad side effects - since all macvtap passthrough <interface>
      definitions pointing to a physdev that uses the enic driver *must*
      have a <virtualport type='802.1Qbh'>, and since no other type of
      ethernet devices use 802.1Qbh, libvirt can change its behavior in this
      case to use the old-style.  ioctl(SIOC[GS]IFHWADDR).  That's what this
      patch does.
      
      Resolves:  https://bugzilla.redhat.com/show_bug.cgi?id=1257004
      46cf0cef
    • L
      util: make virNetDev(Replace|Restore)MacAddress public functions · 3ce08fab
      Laine Stump 提交于
      These functions were made static as a part of commit cbfe38c since
      they were no longer called from outside virnetdev.c. We once again
      need to call them from another file, so this patch makes them once
      again public.
      3ce08fab
    • M
      remoteClientCloseFunc: Don't mangle connection object refcount · e6893007
      Michal Privoznik 提交于
      Well, in 8ad126e6 we tried to fix a memory corruption problem.
      However, the fix was not as good as it could be. I mean, the
      commit has one line more than it should. I've noticed this output
      just recently:
      
        # ./run valgrind --leak-check=full --show-reachable=yes ./tools/virsh domblklist gentoo
        ==17019== Memcheck, a memory error detector
        ==17019== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
        ==17019== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
        ==17019== Command: /home/zippy/work/libvirt/libvirt.git/tools/.libs/virsh domblklist gentoo
        ==17019==
        Target     Source
        ------------------------------------------------
        fda        /var/lib/libvirt/images/fd.img
        vda        /var/lib/libvirt/images/gentoo.qcow2
        hdc        /home/zippy/tmp/install-amd64-minimal-20150402.iso
      
        ==17019== Thread 2:
        ==17019== Invalid read of size 4
        ==17019==    at 0x4EFF5B4: virObjectUnref (virobject.c:258)
        ==17019==    by 0x5038CFF: remoteClientCloseFunc (remote_driver.c:552)
        ==17019==    by 0x5069D57: virNetClientCloseLocked (virnetclient.c:685)
        ==17019==    by 0x506C848: virNetClientIncomingEvent (virnetclient.c:1852)
        ==17019==    by 0x5082136: virNetSocketEventHandle (virnetsocket.c:1913)
        ==17019==    by 0x4ECD64E: virEventPollDispatchHandles (vireventpoll.c:509)
        ==17019==    by 0x4ECDE02: virEventPollRunOnce (vireventpoll.c:658)
        ==17019==    by 0x4ECBF00: virEventRunDefaultImpl (virevent.c:308)
        ==17019==    by 0x130386: vshEventLoop (vsh.c:1864)
        ==17019==    by 0x4F1EB07: virThreadHelper (virthread.c:206)
        ==17019==    by 0xA8462D3: start_thread (in /lib64/libpthread-2.20.so)
        ==17019==    by 0xAB441FC: clone (in /lib64/libc-2.20.so)
        ==17019==  Address 0x139023f4 is 4 bytes inside a block of size 240 free'd
        ==17019==    at 0x4C2B1F0: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
        ==17019==    by 0x4EA8949: virFree (viralloc.c:582)
        ==17019==    by 0x4EFF6D0: virObjectUnref (virobject.c:273)
        ==17019==    by 0x4FE74D6: virConnectClose (libvirt.c:1390)
        ==17019==    by 0x13342A: virshDeinit (virsh.c:406)
        ==17019==    by 0x134A37: main (virsh.c:950)
      
      The problem is, when registering remoteClientCloseFunc(), it's
      conn->closeCallback which is ref'd. But in the function itself
      it's conn->closeCallback->conn what is unref'd. This is causing
      imbalance in reference counting. Moreover, there's no need for
      the remote driver to increase/decrease conn refcount since it's
      not used anywhere. It's just merely passed to client registered
      callback. And for that purpose it's correctly ref'd in
      virConnectRegisterCloseCallback() and then unref'd in
      virConnectUnregisterCloseCallback().
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      e6893007
  10. 02 9月, 2015 5 次提交
    • J
      storage: Handle failure from refreshVol · db9277a3
      John Ferlan 提交于
      Commit id '155ca616' added the 'refreshVol' API. In an NFS root-squash
      environment it was possible that if the just created volume from XML wasn't
      properly created with the right uid/gid and/or mode, then the followup
      refreshVol will fail to open the volume in order to get the allocation/
      capacity values. This would leave the volume still on the server and
      cause a libvirtd crash because 'voldef' would be in the pool list, but
      the cleanup code would free it.
      db9277a3
    • J
      storage: Correct the 'mode' check · 691dd388
      John Ferlan 提交于
      Commit id '7c2d65dd' changed the default value of mode to be -1 if not
      supplied in the XML, which should cause creation of the volume using the
      default mode of VIR_STORAGE_DEFAULT_VOL_PERM_MODE; however, the check
      made was whether mode was '0' or not to use default or provided value.
      
      This patch fixes the issue to check if the 'mode' was provided in the XML
      and use that value.
      691dd388
    • J
      virfile: Introduce virFileUnlink · 35847860
      John Ferlan 提交于
      In an NFS root-squashed environment the 'vol-delete' command will fail to
      'unlink' the target volume since it was created under a different uid:gid.
      
      This code continues the concepts introduced in virFileOpenForked and
      virDirCreate[NoFork] with respect to running the unlink command under
      the uid/gid of the child. Unlike the other two, don't retry on EACCES
      (that's why we're here doing this now).
      35847860
    • J
      virfile: Add error for root squash change mode failure · 1fafc1bc
      John Ferlan 提交于
      This will only be seen when debugging, but in order to help determine
      whether a virFileOpenForceOwnerMode failed during an NFS root-squash
      volume/file creation, add an error message from the child.
      1fafc1bc
    • J
      qemu: add udp interface support · 5c668a78
      Jonathan Toppins 提交于
      Adds a new interface type using UDP sockets, this seems only applicable
      to QEMU but have edited tree-wide to support the new interface type.
      
      The interface type required the addition of a "localaddr" (local
      address), this then maps into the following xml and qemu call.
      
      <interface type='udp'>
        <mac address='52:54:00:5c:67:56'/>
        <source address='127.0.0.1' port='11112'>
          <local address='127.0.0.1' port='22222'/>
        </source>
        <model type='virtio'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
      </interface>
      
      QEMU call:
      	-net socket,udp=127.0.0.1:11112,localaddr=127.0.0.1:22222
      
      Notice the xml "local" entry becomes the "localaddr" for the qemu call.
      
      reference:
      http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg00629.htmlSigned-off-by: NJonathan Toppins <jtoppins@cumulusnetworks.com>
      Signed-off-by: NJán Tomko <jtomko@redhat.com>
      5c668a78
  11. 31 8月, 2015 3 次提交
  12. 30 8月, 2015 1 次提交
  13. 29 8月, 2015 2 次提交
    • L
      util: fallback to ioctl(SIOCBRDELBR) if netlink RTM_DELLINK fails · 97d26e47
      Laine Stump 提交于
      commit 09778e09 switched from using ioctl(SIOCBRDELBR) for bridge
      device deletion to using a netlink RTM_DELLINK message, which is the
      more modern way to delete a bridge (and also doesn't require the
      bridge to be ~IFF_UP to succeed). However, although older kernels
      (e.g. 2.6.32, in RHEL6/CentOS6) support deleting *some* link types
      with RTM_NEWLINK, they don't support deleting bridges, and there is no
      compile-time way to figure this out.
      
      This patch moves the body of the SIOCBRDELBR version of
      virNetDevBridgeDelete() into a static function, calls the new function
      from the original, and also calls the new function from the
      RTM_DELLINK version if the RTM_DELLINK message generates an EOPNOTSUPP
      error. Since RTM_DELLINK is done from the subordinate function
      virNetlinkDelLink, which is also called for other purposes (deleting a
      macvtap interface), a function pointer called "fallback" has been
      added to the arglist of virNetlinkDelLink() - if that arg != NULL, the
      provided function will be called when (and only when) RTM_DELLINK
      fails with EOPNOTSUPP.
      
      Resolves:  https://bugzilla.redhat.com/show_bug.cgi?id=1252780 (part 2)
      97d26e47
    • L
      util: fallback to ioctl(SIOCBRADDBR) if netlink RTM_NEWLINK fails · 66dcb409
      Laine Stump 提交于
      commit fc7b23db switched from using ioctl(SIOCBRADDBR) for bridge
      creation to using a netlink RTM_NEWLINK message with IFLA_INFO_KIND =
      "bridge", which is the more modern way to create a bridge. However,
      although older kernels (e.g. 2.6.32, in RHEL6/CentOS6) support
      creating *some* link types with RTM_NEWLINK, they don't support
      creating bridges, and there is no compile-time way to figure this out
      (since the "type" isn't an enum, but rather a character string).
      
      This patch moves the body of the SIOCBRADDBR version of
      virNetDevBridgeCreate() into a static function, calls the new function
      from the original, and also calls the new function from the
      RTM_NEWLINK version if the RTM_NEWLINK message generates an EOPNOTSUPP
      error.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1252780
      66dcb409
  14. 28 8月, 2015 1 次提交