1. 01 3月, 2016 4 次提交
    • H
      qemu_cgroup: use virCgroupAddTask instead of virCgroupMoveTask · ff16bde1
      Henning Schild 提交于
      qemuProcessSetupEmulator runs at a point in time where there is only
      the qemu main thread. Use virCgroupAddTask to put just that one task
      into the emulator cgroup. That patch makes virCgroupMoveTask and
      virCgroupAddTaskStrController obsolete.
      Signed-off-by: NHenning Schild <henning.schild@siemens.com>
      ff16bde1
    • J
      util: Introduce API's for Polkit text authentication · 6fb96a7f
      John Ferlan 提交于
      Introduce virPolkitAgentCreate and virPolkitAgentDestroy
      
      virPolkitAgentCreate will run the polkit pkttyagent image as an asynchronous
      command in order to handle the local agent authentication via stdin/stdout.
      The code makes use of the pkttyagent --notify-fd mechanism to let it know
      when the agent is successfully registered.
      
      virPolkitAgentDestroy will close the command effectively reaping our
      child process
      6fb96a7f
    • J
      polkit: Adjust message when authentication agent isn't found · 1d35f6ff
      John Ferlan 提交于
      When there isn't a ssh -X type session running and a user has not
      been added to the libvirt group, attempts to run 'virsh -c qemu:///system'
      commands from an otherwise unprivileged user will fail with rather
      generic or opaque error message:
      
          "error: authentication failed: no agent is available to authenticate"
      
      This patch will adjust the error code and message to help reflect the
      situation that the problem is the requested mechanism is UNAVAILABLE and
      a slightly more descriptive error. The result on a failure then becomes:
      
          "error: authentication unavailable: no polkit agent available to
                  authenticate action 'org.libvirt.unix.manage'"
      
      A bit more history on this - at one time a failure generated the
      following type message when running the 'pkcheck' as a subprocess:
      
      "error: authentication failed: polkit\56retains_authorization_after_challenge=1
      Authorization requires authentication but no agent is available."
      
      but, a patch was generated to adjust the error message to help provide
      more details about what failed. This was pushed as commit id '96a108c9'.
      That patch prepended a "polkit: " to the output. It really didn't solve
      the problem, but gave a hint.
      
      After some time it was deemed using DBus API calls directly was a
      better way to go (since pkcheck calls them anyway). So, commit id
      '1b854c76' (more or less) copied the code from remoteDispatchAuthPolkit
      and adjusted it. Then commit id 'c7542573' adjusted the remote.c
      code to call the new API (virPolkitCheckAuth). Finally, commit id
      '308c0c5a' altered the code to call DBus APIs directly. In doing
      so, it reverted the failing error message to the generic message
      that would have been received from DBus anyway.
      1d35f6ff
    • H
      vircgroup: one central point for adding tasks to cgroups · 85d74806
      Henning Schild 提交于
      Use virCgroupAddTaskController in virCgroupAddTask so we have one
      single point where we add tasks to cgroups.
      Signed-off-by: NHenning Schild <henning.schild@siemens.com>
      85d74806
  2. 26 2月, 2016 2 次提交
    • A
      hostdev: Remove temporary variable when checking for VF · b2ce5b02
      Andrea Bolognani 提交于
      The virHostdevIsVirtualFunction() was called exactly twice, and in
      both cases the return value was saved to a temporary variable before
      being checked. This would be okay if it improved readability, but in
      this case is pretty pointless.
      
      Get rid of the temporary variable and check the return value
      directly; while at it, change the check from '<= 0' to '!= 1' to
      align it with the way other similar *IsVirtualFunction() functions
      are used thorough the code.
      b2ce5b02
    • A
      netdev: Use virNetDevIsVirtualFunction() properly · dec3a4a1
      Andrea Bolognani 提交于
      virNetDevIsVirtualFunction() returns 1 if the interface is a
      virtual function, 0 if it isn't and -1 on error. This means that,
      despite the name suggesting otherwise, using it as a predicate is
      not correct.
      
      Fix two callers that were doing so adding an explicit check on
      the return value.
      dec3a4a1
  3. 25 2月, 2016 1 次提交
  4. 23 2月, 2016 1 次提交
  5. 22 2月, 2016 1 次提交
  6. 20 2月, 2016 1 次提交
    • A
      gic: Introduce VIR_GIC_VERSION_DEFAULT alias · d8fc7e05
      Andrea Bolognani 提交于
      GIC v2 is the default, but checking against that specific version when
      we want to know whether the default has been selected is potentially
      error prone; using an alias instead makes it safer.
      d8fc7e05
  7. 19 2月, 2016 1 次提交
  8. 17 2月, 2016 6 次提交
    • M
      vircgroup: Update virCgroupDenyDevicePath stub · 6bfb03ae
      Michal Privoznik 提交于
      In cf113e8d we changed the declaration of
      virCgroupAllowDevicePath() and virCgroupDenyDevicePath().
      However, while updating the stub for non-cgroup platforms for the
      former we forgot to update the latter too causing a build
      failure.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      6bfb03ae
    • E
      util: Refactor virHashForEach so it returns as soon as an iterator fails · 353de572
      Erik Skultety 提交于
      The method will now return 0 on success and -1 on error, rather than number of
      items which it iterated over before it returned back to the caller. Since the
      only place where we actually check the number of elements iterated is in
      virhashtest, return value of 0 and -1 can be a pretty accurate hint that it
      iterated over all the items. However, if we really want to know the number of
      items iterated over (like virhashtest does), a counter has to be provided
      through opaque data to each iterator call. This patch adjusts return value of
      virHashForEach, refactors the body, so it returns as soon as one of the
      iterators fail and adjusts virhashtest to reflect these changes.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      353de572
    • E
      util: Add a return value to void hash iterators · cc48d3a1
      Erik Skultety 提交于
      Our existing virHashForEach method iterates through all items disregarding the
      fact, that some of the iterators might have actually failed. Errors are usually
      dispatched through an error element in opaque data which then causes the
      original caller of virHashForEach to return -1. In that case, virHashForEach
      could return as soon as one of the iterators fail. This patch changes the
      iterator return type and adjusts all of its instances accordingly, so the
      actual refactor of virHashForEach method can be dealt with later.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      cc48d3a1
    • P
      util: cgroup: Allow ignoring EACCES in virCgroup(Allow|Deny)DevicePath · cf113e8d
      Peter Krempa 提交于
      When adding disk images to ACL we may call those functions on NFS
      shares. In that case we might get an EACCES, which isn't really relevant
      since NFS would not hold a block device. This patch adds a flag that
      allows to stop reporting an error on EACCES to avoid spaming logs.
      
      Currently there's no functional change.
      cf113e8d
    • P
      util: cgroup: Drop virCgroup(Allow|Deny)DeviceMajor · 9cd5da71
      Peter Krempa 提交于
      Since commit 47e5b5ae virCgroupAllowDevice allows to pass -1 as either
      the minor or major device number and it automatically uses '*' in place
      of that. Reuse the new approach through the code and drop the duplicated
      functions.
      9cd5da71
    • P
      util: cgroup: Instrument virCgroupDenyDevice to handle -1 device number as * · f42b5c32
      Peter Krempa 提交于
      Similarly to commit 47e5b5ae virCgroupDenyDevice will handle -1 as *.
      f42b5c32
  9. 16 2月, 2016 1 次提交
    • A
      gic: Introduce virGICVersion enumeration · e76bef7f
      Andrea Bolognani 提交于
      We currently blindly accept any numeric value as a GIC version, even
      though only GIC v2 and GIC v3 actually exist; on the other hand, we
      reject "host", which is a perfectly legitimate value for QEMU guests.
      
      This new enumeration contains all GIC versions libvirt is aware of.
      e76bef7f
  10. 15 2月, 2016 2 次提交
    • J
      Spell VMware with a lowercase w · d6165440
      Ján Tomko 提交于
      Replace all occurrences of VMWare outside the news.
      d6165440
    • L
      util: clean up and expand 802.1QbX negotiation logging · 9cb8b0e5
      Laine Stump 提交于
      The existing log messages for this have several problems; there are
      two lines of log when one will suffice, they duplicate the function
      name in log message (when it's already included by VIR_DEBUG), they're
      missing some useful bits, they get logged even when the call is a NOP.
      
      This patch cleans up the problems with those existing logs, and also
      adds a new VIR_INFO-level log down at the function that is actually
      creating and sending the netlink message that logs *everything* going
      into the netlink message (which turns out to be much more useful in
      practice for me; I didn't want to eliminate the logs at the existing
      location though, in case they are useful in some scenario I'm
      unfamiliar with; anyway those logs are remaining at debug level, so it
      shouldn't be a bother to anyone).
      9cb8b0e5
  11. 11 2月, 2016 2 次提交
    • M
      dbus: Don't unref NULL messages · 862298a2
      Michal Privoznik 提交于
      Apparently we are not the only ones with dumb free functions
      because dbus_message_unref() does not accept NULL either. But if
      I were to vote, this one is even more evil. Instead of returning
      an error just like we do it immediately dereference any pointer
      passed and thus crash you app. Well done DBus!
      
        Program received signal SIGSEGV, Segmentation fault.
        [Switching to Thread 0x7f878ebda700 (LWP 31264)]
        0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
        (gdb) bt
        #0  0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
        #1  0x00007f87be3f004e in dbus_message_unref () from /usr/lib64/libdbus-1.so.3
        #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
        #3  0x00007f879761bd4d in qemuConnectCgroup (driver=0x7f87600a32a0, vm=0x7f87600c7550) at qemu/qemu_cgroup.c:909
        #4  0x00007f87976386b7 in qemuProcessReconnect (opaque=0x7f87600db840) at qemu/qemu_process.c:3386
        #5  0x00007f87bf6edfff in virThreadHelper (data=0x7f87600d5580) at util/virthread.c:206
        #6  0x00007f87bb602334 in start_thread (arg=0x7f878ebda700) at pthread_create.c:333
        #7  0x00007f87bb3481bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
        (gdb) frame 2
        #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
        228         dbus_message_unref(reply);
        (gdb) p reply
        $1 = (DBusMessage *) 0x0
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      862298a2
    • J
      virhook: do not save the return value of virBuildPath · 21e2e081
      Ján Tomko 提交于
      This function returns -1 on allocation error, there's no
      need to check the path for NULL again.
      21e2e081
  12. 10 2月, 2016 1 次提交
  13. 09 2月, 2016 1 次提交
  14. 08 2月, 2016 2 次提交
  15. 06 2月, 2016 2 次提交
  16. 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
  17. 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
  18. 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
  19. 28 1月, 2016 1 次提交