1. 02 5月, 2013 4 次提交
    • G
      virInitctlRequest: unbreak make syntax check · ca75c443
      Guido Günther 提交于
      introduced by dcf97846
      
      To trigger this cppi needs to be installed.
      ca75c443
    • G
      virInitctlRequest: unbreak make syntax check · a1365d73
      Guido Günther 提交于
      introduced by dcf97846
      a1365d73
    • G
      virInitctlRequest: Don't hardcode 384 bytes size · dcf97846
      Guido Günther 提交于
      When MAXHOSTNAMELEN is set we have to take it's value into account.
      Otherwise the build fails on kFreeBSD (FreeBSD kernel and GNU userland)
      dcf97846
    • L
      pci: autolearn name of stub driver, remove from arglist · e482693b
      Laine Stump 提交于
      virPCIDeviceReattach and virPCIDeviceUnbindFromStub (called by
      virPCIDeviceReattach) had previously required the name of the stub
      driver as input. This is unnecessary, because the name of the driver
      the device is currently bound to can be found by looking at the link:
      
        /sys/bus/pci/dddd:bb:ss.ff/driver
      
      Instead of requiring that the name of the expected stub driver name
      and only unbinding if that one name is matched, we no longer take a
      driver name in the arglist for either of these
      functions. virPCIDeviceUnbindFromStub just compares the name of the
      currently bound driver to a list of "well known" stubs (right now
      contains "pci-stub" and "vfio-pci" for qemu, and "pciback" for xen),
      and only performs the unbind if it's one of those devices.
      
      This allows virsh nodedevice-reattach to work properly across a
      libvirtd restart, and fixes a couple of cases where we were
      erroneously still hard-coding "pci-stub" as the drive name.
      
      For some unknown reason, virPCIDeviceReattach had been calling
      modprobe on the stub driver prior to unbinding the device. This was
      problematic because we no longer know the name of the stub driver in
      that function. However, it is pointless to probe for the stub driver
      at that time anyway - because the device is bound to the stub driver,
      we are guaranteed that it is already loaded, and so that call to
      modprobe has been removed.
      e482693b
  2. 01 5月, 2013 1 次提交
  3. 30 4月, 2013 2 次提交
    • R
      portability: handle ifreq differences in virnetdev · 5295e35f
      Roman Bogorodskiy 提交于
      FreeBSD (and maybe other BSDs) have different member
      names in struct ifreq when compared to Linux, such as:
      
       - uses ifr_data instead of ifr_newname for setting
         interface names
       - uses ifr_index instead of ifr_ifindex for interface
         index
      
      Also, add a check for SIOCGIFHWADDR for virNetDevValidateConfig().
      
      Use AF_LOCAL if AF_PACKET is not available.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      5295e35f
    • E
      build: mark conditionally unused variables · b376dea9
      Eric Blake 提交于
      These fixes solve a compilation failure on FreeBSD:
      
      util/virnetdevtap.c: In function 'virNetDevTapGetName':
      util/virnetdevtap.c:56: warning: unused parameter 'tapfd' [-Wunused-parameter]
      util/virnetdevtap.c:56: warning: unused parameter 'ifname' [-Wunused-parameter]
      
      * src/util/virnetdevtap.c (virNetDevTapGetName): Add attributes
      when TUNGETIFF is not present.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b376dea9
  4. 27 4月, 2013 1 次提交
  5. 26 4月, 2013 7 次提交
    • L
      util: new virCommandSetMax(MemLock|Processes|Files) · 776d49f4
      Laine Stump 提交于
      This patch adds two sets of functions:
      
      1) lower level virProcessSet*() functions that will immediately set
      the RLIMIT_MEMLOCK. RLIMIT_NPROC, or RLIMIT_NOFILE of either the
      current process (using setrlimit()) or any other process (using
      prlimit()). "current process" is indicated by passing a 0 for pid.
      
      2) functions for virCommand* that will setup a virCommand object to
      set those limits at a later time just after it has forked a new
      process, but before it execs the new program.
      
      configure.ac has prlimit and setrlimit added to the list of functions
      to check for, and the low level functions log an "unsupported" error)
      on platforms that don't support those functions.
      776d49f4
    • D
      Do proper escaping of cgroup resource partitions · f3662737
      Daniel P. Berrange 提交于
      If a user cgroup name begins with "cgroup.", "_" or with any of
      the controllers from /proc/cgroups followed by a dot, then they
      need to be prefixed with a single underscore. eg if there is
      an object "cpu.service", then this would end up as "_cpu.service"
      in the cgroup filesystem tree, however, "waldo.service" would
      stay "waldo.service", at least as long as nobody comes up with
      a cgroup controller called "waldo".
      
      Since we require a '.XXXX' suffix on all partitions, there is
      no scope for clashing with the kernel 'tasks' and 'release_agent'
      files.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f3662737
    • D
      Ensure all cgroup partitions have a suffix of ".partition" · 9ddfe7ee
      Daniel P. Berrange 提交于
      If the partition named passed in the XML does not already have
      a suffix, ensure it gets a '.partition' added to each component.
      The exceptions are /machine, /user and /system which do not need
      to have a suffix, since they are fixed partitions at the top
      level.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      9ddfe7ee
    • D
      Change VM cgroup suffix from '{lxc,qemu}.libvirt' to 'libvirt-{lxc,qemu}' · 824e86e7
      Daniel P. Berrange 提交于
      Recently we changed to create VM cgroups with the naming pattern
      $VMNAME.$DRIVER.libvirt. Following discussions with the systemd
      community it was decided that only having a single '.' in the
      names is preferrable. So this changes the naming scheme to be
      $VMNAME.libvirt-$DRIVER. eg for LXC 'mycontainer.libvirt-lxc' or
      for KVM 'myvm.libvirt-qemu'.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      824e86e7
    • L
      util: new function virPCIDeviceGetVFIOGroupDev · b210208f
      Laine Stump 提交于
      Given a virPCIDevice, this function returns the path for the device
      that controls the vfio group the device belongs to,
      e.g. "/dev/vfio/15".
      b210208f
    • L
      pci: keep a stubDriver in each virPCIDevice · be64199e
      Laine Stump 提交于
      This can be set when the virPCIDevice is created and placed on a list,
      then used later when traversing the list to determine which stub
      driver to bind/unbind for managed devices.
      
      The existing Detach and Attach functions' signatures haven't been
      changed (they still accept a stub driver name in the arg list), but if
      the arg list has NULL for stub driver and one is available in the
      device's object, that will be used. (we may later deprecate and remove
      the arg from those functions).
      be64199e
    • E
      build: avoid unsafe functions in libgen.h · 1fbf1905
      Eric Blake 提交于
      POSIX says that both basename() and dirname() may return static
      storage (aka they need not be thread-safe); and that they may but
      not must modify their input argument.  Furthermore, <libgen.h>
      is not available on all platforms.  For these reasons, you should
      never use these functions in a multi-threaded library.
      
      Gnulib instead recommends a way to avoid the portability nightmare:
      gnulib's "dirname.h" provides useful thread-safe counterparts.  The
      obvious dir_name() and base_name() are GPL (because they malloc(),
      but call exit() on failure) so we can't use them; but the LGPL
      variants mdir_name() (malloc's or returns NULL) and last_component
      (always points into the incoming string without modifying it,
      differing from basename semantics only on corner cases like the
      empty string that we shouldn't be hitting in the first place) are
      already in use in libvirt.  This finishes the swap over to the safe
      functions.
      
      * cfg.mk (sc_prohibit_libgen): New rule.
      * src/util/vircgroup.c: Fix offenders.
      * src/parallels/parallels_storage.c (parallelsPoolAddByDomain):
      Likewise.
      * src/parallels/parallels_network.c (parallelsGetBridgedNetInfo):
      Likewise.
      * src/node_device/node_device_udev.c (udevProcessSCSIHost)
      (udevProcessSCSIDevice): Likewise.
      * src/storage/storage_backend_disk.c
      (virStorageBackendDiskDeleteVol): Likewise.
      * src/util/virpci.c (virPCIGetDeviceAddressFromSysfsLink):
      Likewise.
      * src/util/virstoragefile.h (_virStorageFileMetadata): Avoid false
      positive.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1fbf1905
  6. 24 4月, 2013 1 次提交
  7. 23 4月, 2013 3 次提交
    • P
      qemu: Fix setting of memory tunables · fa006c4f
      Peter Krempa 提交于
      Refactoring done in 19c6ad9a didn't
      correctly take into account the order cgroup limit modification needs to
      be done in. This resulted into errors when decreasing the limits.
      
      The operations need to take place in this order:
      
      decrease hard limit
      change swap hard limit
      
      or
      
      change swap hard limit
      increase hard limit
      
      This patch also fixes the check if the hard_limit is less than
      swap_hard_limit to print better error messages. For this purpose I
      introduced a helper function virCompareLimitUlong to compare limit
      values where value of 0 is equal to unlimited. Additionally the check is
      now applied also when the user does not provide all of the tunables
      through the API and in that case the currently set values are used.
      
      This patch resolves:
      https://bugzilla.redhat.com/show_bug.cgi?id=950478
      fa006c4f
    • J
      fd2e5530
    • G
      create virSocketAddrGetIpPrefix utility function · bd7c7c1b
      Gene Czarcinski 提交于
      Create the utility function virSocketAddrGetIpPrefix() to
      determine the prefix for this network.  The code in this
      function was adapted from virNetworkIpDefPrefix().
      
      Update virNetworkIpDefPrefix() in src/conf/network_conf.c
      to use the new utility function.
      Signed-off-by: NGene Czarcinski <gene@czarc.net>
      bd7c7c1b
  8. 20 4月, 2013 1 次提交
    • E
      docs: fix usage of 'onto' · 1bf25ba2
      Eric Blake 提交于
      http://www.uhv.edu/ac/newsletters/writing/grammartip2009.07.01.htm
      (and several other sites) give hints that 'onto' is best used if
      you can also add 'up' just before it and still make sense. In many
      cases in the code base, we really want the two-word form, or even
      a simplification to just 'on' or 'to'.
      
      * docs/hacking.html.in: Use correct 'on to'.
      * python/libvirt-override.c: Likewise.
      * src/lxc/lxc_controller.c: Likewise.
      * src/util/virpci.c: Likewise.
      * daemon/THREADS.txt: Use simpler 'on'.
      * docs/formatdomain.html.in: Better usage.
      * docs/internals/rpc.html.in: Likewise.
      * src/conf/domain_event.c: Likewise.
      * src/rpc/virnetclient.c: Likewise.
      * tests/qemumonitortestutils.c: Likewise.
      * HACKING: Regenerate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1bf25ba2
  9. 19 4月, 2013 2 次提交
    • P
      util: allow using virCommandAllowCap with setuid helpers · 5c1cfea4
      Paolo Bonzini 提交于
      When running unprivileged, virSetUIDGIDWithCaps will fail because it
      tries to add the requested capabilities to the permitted and effective
      sets.
      
      Detect this case, and invoke the child with cleared permitted and
      effective sets.  If it is a setuid program, it will get them.
      
      Some care is needed also because you cannot drop capabilities from the
      bounding set without CAP_SETPCAP.  Because of that, ignore errors from
      setting the bounding set.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      5c1cfea4
    • P
      util: simplify virSetUIDGIDWithCaps · 65871845
      Paolo Bonzini 提交于
      The need_prctl variable is not really needed.  If it is false,
      capng_apply will be called twice with the same set, causing
      a little extra work but no problem.  This keeps the code a bit
      simpler.
      
      It is also clearer to invoke capng_apply(CAPNG_SELECT_BOUNDS)
      separately, to make sure it is done while we have CAP_SETPCAP.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      65871845
  10. 17 4月, 2013 3 次提交
    • O
      qemu: Allow the disk wwn to have "0x" prefix · 09d2547f
      Osier Yang 提交于
      The recent qemu requires "0x" prefix for the disk wwn, this patch
      changes virValidateWWN to allow the prefix, and prepend "0x" if
      it's not specified. E.g.
      
      qemu-kvm: -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\
      drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,wwn=6000c60016ea71ad:
      Property 'scsi-hd.wwn' doesn't take value '6000c60016ea71ad'
      
      Though it's a qemu regression, but it's nice to allow the prefix,
      and doesn't hurt for us to always output "0x".
      09d2547f
    • O
      cleanup: Don't include libvirt/libvirt.h · 2d25fd4f
      Osier Yang 提交于
      Which is already included by "internal.h", later patch will add
      syntax-check to avoid it.
      2d25fd4f
    • O
      cleanup: Remove the duplicate header · bc95be5d
      Osier Yang 提交于
      Detected by a simple Shell script:
      
      for i in $(git ls-files -- '*.[ch]'); do
          awk 'BEGIN {
              fail=0
          }
          /# *include.*\.h/{
              match($0, /["<][^">]*[">]/)
              arr[substr($0, RSTART+1, RLENGTH-2)]++
          }
          END {
              for (key in arr) {
                  if (arr[key] > 1) {
                      fail=1
                      printf("%d %s\n", arr[key], key)
                  }
              }
              if (fail == 1)
                  exit 1
          }' $i
      
          if test $? != 0; then
              echo "Duplicate header(s) in $i"
          fi
      done;
      
      A later patch will add the syntax-check to avoid duplicate
      headers.
      bc95be5d
  11. 16 4月, 2013 15 次提交