1. 08 2月, 2016 2 次提交
  2. 06 2月, 2016 2 次提交
  3. 05 2月, 2016 3 次提交
    • M
      virnetdevbandwidth: Compute quantum value · 065054da
      Michal Privoznik 提交于
      I've noticed couple of warning in dmesg while debugging
      something:
      
      [ 9683.973754] HTB: quantum of class 10001 is big. Consider r2q change.
      [ 9683.976460] HTB: quantum of class 10002 is big. Consider r2q change.
      
      I've read the HTB documentation and linux kernel code to find out
      what's wrong. Basically we need to pass another argument
      "quantum" to our tc cmd line because the default computed by HTB
      does not always work in which case the warning message is printed
      out.
      
      You can read more details here:
      
      http://luxik.cdi.cz/~devik/qos/htb/manual/userg.htm#sharingSigned-off-by: NMichal Privoznik <mprivozn@redhat.com>
      065054da
    • P
      util: bitmap: Introduce bitmap subtraction · 9479642f
      Peter Krempa 提交于
      Performs binary subtraction of two bitmaps. Stores result in the first
      operand.
      9479642f
    • M
      systemd: Modernize machine naming · c3bd0019
      Martin Kletzander 提交于
      So, systemd-machined has this philosophy that machine names are like
      hostnames and hence should follow the same rules.  But we always allowed
      international characters in domain names.  Thus we need to modify the
      machine name we are passing to systemd.
      
      In order to change some machine names that we will be passing to systemd,
      we also need to call TerminateMachine at the end of a lifetime of a
      domain.  Even for domains that were started with older libvirt.  That
      can be achieved thanks to virSystemdGetMachineNameByPID().  And because
      we can change machine names, we can get rid of the inconsistent and
      pointless escaping of domain names when creating machine names.
      
      So this patch modifies the naming in the following way.  It creates the
      name as <drivername>-<id>-<name> where invalid hostname characters are
      stripped out of the name and if the resulting name is longer, it
      truncates it to 64 characters.  That way we can start domains we
      couldn't start before.  Well, at least on systemd.
      
      To make it work all together, the machineName (which is needed only with
      systemd) is saved in domain's private data.  That way the generation is
      moved to the driver and we don't need to pass various unnecessary
      arguments to cgroup functions.
      
      The only thing this complicates a bit is the scope generation when
      validating a cgroup where we must check both old and new naming, so a
      slight modification was needed there.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1282846Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      c3bd0019
  4. 03 2月, 2016 7 次提交
    • E
      util: Export remoteSerializeTypedParameters internally via util · 8cd1d546
      Erik Skultety 提交于
      Same as for deserializer, this method might get handy for admin one day.
      The major reason for this patch is to stay consistent with idea, i.e.
      when deserializer can be shared, why not serializer as well. The only
      problem to be solved was that the daemon side serializer uses a code
      snippet which handles sparse arrays returned by some APIs as well as
      removes any string parameters that can't be returned to older clients.
      This patch makes of the new virTypedParameterRemote datatype introduced
      by one of the pvious patches.
      8cd1d546
    • E
      util: Export remoteFreeTypedParameters internally via util · 9afc115f
      Erik Skultety 提交于
      Since the method is static to remote_driver, it can't even be used by our
      daemon. Other than that, it would be useful to be able to use it with admin as
      well. This patch uses the new virTypedParameterRemote datatype introduced in
      one of previous patches.
      9afc115f
    • E
      util: Export remoteDeserializeTypedParameters internally via util · 0472cef6
      Erik Skultety 提交于
      Currently, the deserializer is hardcoded into remote_driver which makes
      it impossible for admin to use it. One way to achieve a shared implementation
      (besides moving the code to another module) would be pass @ret_params_val as a
      void pointer as opposed to the remote_typed_param pointer and add a new extra
      argument specifying which of those two protocols is being used and typecast
      the pointer at the function entry. An example from remote_protocol:
      
      struct remote_typed_param_value {
              int type;
              union {
                      int i;
                      u_int ui;
                      int64_t l;
                      uint64_t ul;
                      double d;
                      int b;
                      remote_nonnull_string s;
              } remote_typed_param_value_u;
      };
      typedef struct remote_typed_param_value remote_typed_param_value;
      
      struct remote_typed_param {
              remote_nonnull_string field;
              remote_typed_param_value value;
      };
      
      That would leave us with a bunch of if-then-elses that needed to be used across
      the method. This patch takes the other approach using the new datatype
      introduced in one of earlier commits.
      0472cef6
    • E
      util: Introduce virTypedParameterRemote datatype · 41a45994
      Erik Skultety 提交于
      Both admin and remote protocols define their own types
      (remote_typed_param vs admin_typed_param). Because of the naming convention,
      admin typed params wouldn't be able to reuse the serialization/deserialization
      methods, which are tailored for use by remote protocol, even if those method
      were exported properly. In that case, introduce a new internal data type
      structurally copying both admin and remote protocols which, eventually, would
      allow serializer and deserializer to be used in a more generic way.
      41a45994
    • M
      92757d4d
    • M
      Revert "systemd: Escape only needed characters for machined" · 9ba26462
      Martin Kletzander 提交于
      This reverts commit 0e0149ce.
      
      That commit was added to comply with systemd rules that were changed in
      the meantime, so this patch is pointless.
      9ba26462
    • P
      cgroup: Clean up virCgroupGetPercpuStats · 58578f83
      Peter Krempa 提交于
      Use 'ret' for return variable name, clarify use of 'param_idx' and avoid
      unnecessary 'success' label. No functional changes. Also document the
      function.
      58578f83
  5. 29 1月, 2016 1 次提交
    • A
      pci: Use bool return type for some virPCIDeviceGet*() functions · 11ef5869
      Andrea Bolognani 提交于
      The affected functions are:
      
        virPCIDeviceGetManaged()
        virPCIDeviceGetUnbindFromStub()
        virPCIDeviceGetRemoveSlot()
        virPCIDeviceGetReprobe()
      
      Change their return type from unsigned int to bool: the corresponding
      members in struct _virPCIDevice are defined as bool, and even the
      corresponding virPCIDeviceSet*() functions take a bool value as input
      so there's no point in these functions having unsigned int as return
      type.
      Suggested-by: NJohn Ferlan <jferlan@redhat.com>
      11ef5869
  6. 28 1月, 2016 2 次提交
  7. 27 1月, 2016 7 次提交
    • A
      virnetdevopenvswitch: Don't call strlen() twice on the same string · d87f0c00
      Andrea Bolognani 提交于
      Commit 871e10fc fixed a memory corruption error, but called strlen()
      twice on the same string to do so. Even though the compiler is
      probably smart enough to optimize the second call away, having a
      single invocation makes the code slightly cleaner.
      Suggested-by: NMichal Privoznik <mprivozn@redhat.com>
      d87f0c00
    • M
      virnetdevmacvlan: Provide stubs for build without macvtap · 720bc953
      Michal Privoznik 提交于
      In 370608b4 we have introduced two new internal APIs.
      However, there are no stubs for build without macvtap. Therefore
      build on systems lacking macvtap support (e.g. mingw or freebds)
      fails when trying to link.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      720bc953
    • J
      Fix libvirtd free() segfault when migrating guest with deleted open vswitch port · 871e10fc
      Jason J. Herne 提交于
      libvirtd crashes on free()ing portData for an open vswitch port if that port
      was deleted.  To reproduce:
      
      ovs-vsctl del-port vnet0
      virsh migrate --live kvm1 qemu+ssh://dstHost/system
      
      Error message:
      libvirtd: *** Error in `/usr/sbin/libvirtd': free(): invalid pointer: 0x000003ff90001e20 ***
      
      The problem is that virCommandRun can return an empty string in the event that
      the port being queried does not exist. When this happens then we are
      unconditionally overwriting a newline character at position strlen()-1. When
      strlen is 0, we overwrite memory that does not belong to the string.
      
      The fix: Only overwrite the newline if the string is not empty.
      Reviewed-by: NBjoern Walk <bwalk@linux.vnet.ibm.com>
      Signed-off-by: NJason J. Herne <jjherne@linux.vnet.ibm.com>
      871e10fc
    • L
      util: keep/use a bitmap of in-use macvtap devices · 370608b4
      Laine Stump 提交于
      This patch creates two bitmaps, one for macvlan device names and one
      for macvtap. The bitmap position is used to indicate that libvirt is
      currently using a device with the name macvtap%d/macvlan%d, where %d
      is the position in the bitmap. When requested to create a new
      macvtap/macvlan device, libvirt will now look for the first clear bit
      in the appropriate bitmap and derive the device name from that rather
      than just starting at 0 and counting up until one works.
      
      When libvirtd is restarted, the qemu driver code that reattaches to
      active domains calls the appropriate function to "re-reserve" the
      device names as it is scanning the status of running domains.
      
      Note that it may seem strange that the retry counter now starts at
      8191 instead of 5. This is because we now don't do a "pre-check" for
      the existence of a device once we've reserved it in the bitmap - we
      move straight to creating it; although very unlikely, it's possible
      that someone has a running system where they have a large number of
      network devices *created outside libvirt* named "macvtap%d" or
      "macvlan%d" - such a setup would still allow creating more devices
      with the old code, while a low retry max in the new code would cause a
      failure. Since the objective of the retry max is just to prevent an
      infinite loop, and it's highly unlikely to do more than 1 iteration
      anyway, having a high max is a reasonable concession in order to
      prevent lots of new failures.
      370608b4
    • L
      util: increase libnl buffer size · 8c70d04b
      Leno Hou 提交于
      In the following cases nl_recv() was returning the error "No buffer
      space available":
      
      * When switching CPUs to offline/online in a system more than 128 cpus
      * When using virsh to destroy domain in a system with many interfaces
      
      This patch sets the buffer size for all netlink sockets created by
      libnl to 128K and turns on message peeking for nl_recv(). This
      eliminates the "No buffer space available" errors seen in the cases
      above, and also preempts other future errors the smaller buffers could
      have caused.
      Signed-off-by: NLeno Hou <houqy@linux.vnet.ibm.com>
      Signed-off-by: NLaine Stump <laine@laine.org>
      8c70d04b
    • M
      vircgroup: Finish renaming of virCgroupIsolateMount · c7f5e26b
      Michal Privoznik 提交于
      In dc576025 we renamed virCgroupIsolateMount function to
      virCgroupBindMount. However, we forgot about one occurrence in
      section of the code which provides stubs for platforms without
      support for CGroups like *BSD for instance.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      c7f5e26b
    • 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
  8. 26 1月, 2016 1 次提交
  9. 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
  10. 22 1月, 2016 1 次提交
  11. 15 1月, 2016 1 次提交
  12. 12 1月, 2016 3 次提交
    • L
      util: eliminate bogus error log in virNetDevVPortProfileGetStatus · 21e63916
      Laine Stump 提交于
       if instanceId is NULL
      
      When virNetDevVPortProfileGetStatus() was called with instanceId =
      NULL (which is the case for all DISASSOCIATE requests in 802.1Qbh) it
      would log the following error:
      
         Could not find netlink response with expected parameters
      
      even though the disassociate had been successfully completely. Then,
      due to the fortunate coincidence of status having been initialized to
      0 and then not changed when the "failure" was encountered, it would
      still return a status of 0 (PORT_VDP_RESPONSE_SUCCESS), so the caller
      would assume a successful operation.
      
      This would result in a spurious log message though, and would fill in
      LastErrorMessage, so that the API would return that error if it
      happened during cleanup from some other error. That, in turn, would
      lead to an incorrect supposition that the response to the port profile
      disassociate was the cause of the failure.
      
      During debugging, I noticed that the VF in question usually had *no
      uuid* associated with it (big surprise)by the time the disassociate
      completed, so the solution is *not* to send the previous instanceId
      down.
      
      This patch fixes virNetDevVPortProfileGetStatus() to only check the
      VF's uuid in the status if it was given an instanceId to check against
      when originally called. Otherwise it only checks that the particular
      VF is present (it will be).
      
      This does cause a slight difference in behavior - rather than
      returning with status unchanged (and thus always 0) it will actually
      get the IFLA_PORT_RESPONSE. This could lead to revelation of error
      conditions we were previously ignoring. Or not. So far "not".
      21e63916
    • J
      Unify int types handling in protocol files · 2b6f6ad6
      Jasper Lievisse Adriaanse 提交于
      Some of the protocol files already include handing of the missing int
      types such as xdr_uint64_t, some don't. To fix it everywhere, move out
      of the appropriate defines to the utils/virxdrdefs.h file and include
      it where needed.
      Signed-off-by: NRoman Bogorodskiy <bogorodskiy@gmail.com>
      2b6f6ad6
    • J
      cgroup: don't include sys/mount.h if not needed · 1b60f1b4
      Jasper Lievisse Adriaanse 提交于
      As cgroup implementation only works on Linux, it does not
      make much sense to include sys/mount.h if other requirements are
      not met, such as HAVE_MNTENT_H and HAVE_GETMNTENT_R.
      
      Also, it fixes build on OpenBSD that requires to include sys/param.h
      along with sys/mount.h.
      Signed-off-by: NRoman Bogorodskiy <bogorodskiy@gmail.com>
      1b60f1b4
  13. 09 1月, 2016 1 次提交
  14. 08 1月, 2016 3 次提交
    • A
      pci: Log debug messages when manipulating the inactive list · 4e1f37f8
      Andrea Bolognani 提交于
      Most of the changes to the list of active and inactive PCI devices
      happen in virHostdev, where they are properly logged.
      
      virPCIDeviceDetach() and virPCIDeviceReattach(), however, change the
      inactive list as well, so they should be logging similar messages.
      4e1f37f8
    • M
      virLogVMessage: Don't leak rawinitmsg · 587fd105
      Michal Privoznik 提交于
      Instead of misusing a const string to hold up runtime allocated
      data, introduce new variable @hoststr and obey const correctness.
      
      ==6879== 15 bytes in 1 blocks are definitely lost in loss record 68 of 1,064
      ==6879==    at 0x4C29F80: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==6879==    by 0xA7DDF97: vasprintf (in /lib64/libc-2.21.so)
      ==6879==    by 0x552BBC6: virVasprintfInternal (virstring.c:493)
      ==6879==    by 0x552BCDB: virAsprintfInternal (virstring.c:514)
      ==6879==    by 0x54FA44C: virLogHostnameString (virlog.c:468)
      ==6879==    by 0x54FAB0F: virLogVMessage (virlog.c:645)
      ==6879==    by 0x54FA680: virLogMessage (virlog.c:531)
      ==6879==    by 0x54FBBF4: virLogParseOutputs (virlog.c:1130)
      ==6879==    by 0x11CB4F: daemonSetupLogging (libvirtd.c:685)
      ==6879==    by 0x11E137: main (libvirtd.c:1297)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      587fd105
    • M
      virLogHostnameString: Don't leak hostname · 9f750648
      Michal Privoznik 提交于
      Once @hostname is printed into @hoststr we don't need it anymore.
      
      ==6879== 5 bytes in 1 blocks are definitely lost in loss record 10 of 1,064
      ==6879==    at 0x4C29F80: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==6879==    by 0xA7ED599: strdup (in /lib64/libc-2.21.so)
      ==6879==    by 0x552C126: virStrdup (virstring.c:726)
      ==6879==    by 0x553B13E: virGetHostnameImpl (virutil.c:720)
      ==6879==    by 0x553B1BF: virGetHostnameQuiet (virutil.c:741)
      ==6879==    by 0x54FA3FD: virLogHostnameString (virlog.c:462)
      ==6879==    by 0x54FAB0F: virLogVMessage (virlog.c:645)
      ==6879==    by 0x54FA680: virLogMessage (virlog.c:531)
      ==6879==    by 0x54FBBF4: virLogParseOutputs (virlog.c:1130)
      ==6879==    by 0x11CB4F: daemonSetupLogging (libvirtd.c:685)
      ==6879==    by 0x11E137: main (libvirtd.c:1297)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      9f750648
  15. 06 1月, 2016 1 次提交
    • W
      rbd: Do not append Ceph monitor port number 6789 if not provided · 6343018f
      Wido den Hollander 提交于
      If no port number was provided for a storage pool libvirt defaults to
      port 6789; however, librbd/librados already default to 6789 when no port
      number is provided.
      
      In the future Ceph will switch to a new port for the Ceph monitors since
      port 6789 is already assigned to a different application by IANA.
      
      Port 6789 is assigned to SMC-HTTPS and Ceph now has port 3300 assigned as
      the 'Ceph monitor' port.
      
      In this case it is the best solution to not hardcode any port number into
      libvirt and let librados handle the connection.
      
      Only if a user specifies a different port number we pass it down to librados,
      otherwise we leave it blank.
      Signed-off-by: NWido den Hollander <wido@widodh.nl>
      
      merge
      6343018f
  16. 05 1月, 2016 3 次提交
    • L
      util: reduce debug log in virPCIGetVirtualFunctions() · 3d64a9d7
      Laine Stump 提交于
      Due to debug logs like this:
      
        virPCIGetDeviceAddressFromSysfsLink:2432 : Attempting to resolve device path from device link '/sys/class/net/eth1/device/virtfn6'
        logStrToLong_ui:2369 : Converted '0000:07:00.7' to unsigned int 0
        logStrToLong_ui:2369 : Converted '07:00.7' to unsigned int 7
        logStrToLong_ui:2369 : Converted '00.7' to unsigned int 0
        logStrToLong_ui:2369 : Converted '7' to unsigned int 7
        virPCIGetDeviceAddressFromSysfs:1947 : virPCIDeviceAddress 0000:07:00.7
        virPCIGetVirtualFunctions:2554 : Found virtual function 7
      
      printed *once for each SR-IOV Virtual Function* of a Physical Function
      each time libvirt retrieved the list of VFs (so if the system has 128
      VFs, there would be 900 lines of log for each call), the debug logs on
      any system with a large number of VFs was dominated by "information"
      that was possibly useful for debugging when the code was being
      written, but is now useless for debugging of any problem on a running
      system, and only serves to obscure the real useful information. This
      overkill has no place in production code, so this patch removes it.
      3d64a9d7
    • L
      util: improve error reporting in virNetDevVPortProfileGetStatus · 36e244f3
      Laine Stump 提交于
      The previous error message just indicated that the desired response
      couldn't be found, this patch tells what was desired, as well as
      listing out the entire table that had been in the netlink response, to
      give some kind of idea why it failed.
      36e244f3
    • L
      util: report the MAC address that couldn't be set · 5ffa236b
      Laine Stump 提交于
      I noticed in a log file that we had failed to set a MAC address. The
      log said which interface we were trying to set, but didn't give the
      offending MAC address, which could have been useful in determining the
      source of the problem. This patch modifies all three places in the
      code that set MAC addresses to report the failed MAC as well as
      interface.
      5ffa236b
  17. 25 12月, 2015 1 次提交