1. 15 11月, 2019 5 次提交
    • P
      vircgroup: introduce virCgroupV2DevicesCreateProg · afa27886
      Pavel Hrdina 提交于
      This function creates new BPF program with new empty BPF map with the
      default size and attaches it to the guest cgroup.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      afa27886
    • P
      vircgroup: introduce virCgroupV2DevicesDetectProg · ce11a5c5
      Pavel Hrdina 提交于
      This function will be called if libvirtd was restarted while some
      domains were running.  It will try to detect existing programs attached
      to the guest cgroup.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      ce11a5c5
    • P
      vircgroup: introduce virCgroupV2DevicesAttachProg · 48423a0b
      Pavel Hrdina 提交于
      This function loads the BPF prog with prepared map into kernel and
      attaches it into guest cgroup.  It can be also used to replace existing
      program in the cgroup if we need to resize BPF map to store more rules
      for devices. The old program will be closed and removed from kernel.
      
      There are two possible ways how to create BPF program:
      
          - One way is to write simple C-like code which can by compiled into
            BPF object file which can be loaded into kernel using elfutils.
      
          - The second way is to define macros which look like assembler
            instructions and can be used directly to create BPF program that
            can be directly loaded into kernel.
      
      Since the program is not too complex we can use the second option.
      
      If there is no program, all devices are allowed, if there is some
      program it is executed and based on the exit status the access is
      denied for 0 and allowed for 1.
      
      Our program will follow these rules:
      
          - first it will try to look for the specific key using major and
            minor to see if there is any rule for that specific device
      
          - if there is no specific rule it will try to look for any rule that
            matches only major of the device
      
          - if there is no match with major it will try the same but with
            minor of the device
      
          - as the last attempt it will try to look for rule for all devices
            and if there is no match it will return 0 to deny that access
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      48423a0b
    • P
      vircgroup: introduce virCgroupV2DevicesAvailable · 30b6ddc4
      Pavel Hrdina 提交于
      There is no exact way how to figure out whether BPF devices support is
      compiled into kernel.  One way is to check kernel configure options but
      this is not reliable as it may not be available.  Let's try to do
      syscall to which will list BPF cgroup device programs.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      30b6ddc4
    • P
      util: introduce virbpf helpers · 07946d6e
      Pavel Hrdina 提交于
      In order to implement devices controller with cgroup v2 we need to
      add support for BPF programs, cgroup v2 doesn't have devices controller.
      
      This introduces required helpers wrapping linux syscalls.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      07946d6e
  2. 14 11月, 2019 2 次提交
  3. 13 11月, 2019 1 次提交
  4. 12 11月, 2019 3 次提交
  5. 25 10月, 2019 3 次提交
  6. 21 10月, 2019 7 次提交
  7. 19 10月, 2019 1 次提交
  8. 18 10月, 2019 1 次提交
  9. 16 10月, 2019 1 次提交
  10. 14 10月, 2019 1 次提交
  11. 12 10月, 2019 1 次提交
  12. 10 10月, 2019 1 次提交
  13. 08 10月, 2019 1 次提交
    • M
      driver: Introduce virDriverShouldAutostart() · ee16a195
      Michal Privoznik 提交于
      Some of objects we manage can be autostarted on libvirtd startup
      (e.g. domains, network, storage pools). The idea was that when
      the host is started up these objects are started too without need
      of user intervention. However, with the latest daemon split and
      switch to socket activated, short lived daemons (we put --timeout
      120 onto each daemon's command line) this doesn't do what we want
      it to. The problem is not new though, we already had the session
      daemon come and go and we circumvented this problem by
      documenting it (see v4.10.0-92-g61b4e8aa). But now that we meet
      the same problem at all fronts it's time to deal with it.
      
      The solution implemented in this commit is to have a file (one
      per each driver) that:
      
        1) if doesn't exist, is created and autostart is allowed for
           given driver,
      
        2) if it does exist, then autostart is suppressed for given
           driver.
      
      All the files live in a location that doesn't survive host
      reboots (/var/run/ for instance) and thus the file is
      automatically not there on fresh host boot.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      ee16a195
  14. 07 10月, 2019 1 次提交
  15. 27 9月, 2019 2 次提交
  16. 25 9月, 2019 2 次提交
    • P
      util: typedparam: Simplify handling of lists of typed parameters · 33773355
      Peter Krempa 提交于
      Introduce a new set of helpers including a new data structure which
      simplifies keeping and construction of lists of typed parameters.
      
      The use of VIR_RESIZE_N in the virTypedParamsAdd API has performance
      benefits but requires passing around 3 arguments. Use of them lead to a
      set of macros with embedded jumps used in the qemu statistics code.
      
      This patch introduces 'virTypedParamList' type which aggregates the
      necessary list-keeping variables and also a new set of functions to add
      new typed parameters to a list.
      
      These new helpers use printf-like format string and arguments to format
      the argument name as the stats code often uses indexed typed parameters.
      
      The accessor function then allows extracting the typed parameter list in
      the same format as virTypedParamsAdd* functions would do.
      
      One additional benefit is also that the list function can easily be used
      with VIR_AUTOPTR.
      Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      33773355
    • P
      util: typedparam: Move and unexport virTypedParameterAssignFromStr · e532aa61
      Peter Krempa 提交于
      The function is only used as a helper in virTypedParamsAddFromString.
      Make it static and move it to virtypedparam-public.c.
      Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      e532aa61
  17. 19 9月, 2019 2 次提交
  18. 16 9月, 2019 4 次提交
  19. 14 9月, 2019 1 次提交
    • D
      network: fix connection usage counts after restart · 7ab9bdd4
      Daniel P. Berrangé 提交于
      Since the introduction of the virNetworkPort object, the network driver
      has a persistent record of ports that have been created against the
      networks. Thus the hypervisor drivers no longer communicate to the
      network driver during libvirtd restart.
      
      This change, however, meant that the connection usage counts were
      no longer re-initialized during a libvirtd restart. To deal with this we
      must iterate over all virNetworkPortDefPtr objects we have and invoke
      the notify callback to record the connection usage count.
      Reviewed-by: NLaine Stump <laine@laine.org>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      7ab9bdd4