1. 03 2月, 2016 4 次提交
    • 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
    • N
      qemu: qemuDomainRename and virDomainObjListNumOfDomains ABBA deadlock fix · 1e93470d
      Nikolay Shirokovskiy 提交于
      A pretty nasty deadlock occurs while trying to rename a VM in parallel
      with virDomainObjListNumOfDomains.
      The short description of the problem is as follows:
      
      Thread #1:
      
      qemuDomainRename:
          ------> aquires domain lock by qemuDomObjFromDomain
             ---------> waits for domain list lock in any of the listed functions:
                - virDomainObjListFindByName
                - virDomainObjListRenameAddNew
                - virDomainObjListRenameRemove
      
      Thread #2:
      
      virDomainObjListNumOfDomains:
          ------> aquires domain list lock
             ---------> waits for domain lock in virDomainObjListCount
      
      Introduce generic virDomainObjListRename function for renaming domains.
      It aquires list lock in right order to avoid deadlock. Callback is used
      to make driver specific domain updates.
      Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      1e93470d
    • M
      92757d4d
    • P
      conf: Add helper to retrieve bitmap of active vcpus for a definition · 9bf284da
      Peter Krempa 提交于
      In some cases it may be better to have a bitmap representing state of
      individual vcpus rather than iterating the definition. The new helper
      creates a bitmap representing the state from the domain definition.
      9bf284da
  2. 28 1月, 2016 1 次提交
  3. 27 1月, 2016 2 次提交
    • 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
    • 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
  4. 25 1月, 2016 1 次提交
  5. 21 1月, 2016 1 次提交
  6. 12 1月, 2016 1 次提交
    • L
      qemu: define virDomainDevAddUSBController() · 8ebca27b
      Laine Stump 提交于
      This new function will add a single controller of the given model,
      except the case of ich9-usb-ehci1 (the master controller for a USB2
      controller set) in which case a set of related controllers will be
      added (EHCI1, UHCI1, UHCI2, UHCI3). These controllers will not be
      given PCI addresses, but should be otherwise ready to use.
      
      "-1" is allowed for controller model, and means "default for this
      machinetype". This matches the existing practice in
      qemuDomainDefPostParse(), which always adds the default controller
      with model = -1, and relies on the commandline builder to set a model
      (that is wrong, but will be fixed later).
      8ebca27b
  7. 21 12月, 2015 1 次提交
    • A
      pci: Introduce virPCIStubDriver enumeration · 6d9cdd2a
      Andrea Bolognani 提交于
      This replaces the virPCIKnownStubs string array that was used
      internally for stub driver validation.
      
      Advantages:
      
        * possible values are well-defined
        * typos in driver names will be detected at compile time
        * avoids having several copies of the same string around
        * no error checking required when setting / getting value
      
      The names used mirror those in the
      virDomainHostdevSubsysPCIBackendType enumeration.
      6d9cdd2a
  8. 17 12月, 2015 3 次提交
  9. 11 12月, 2015 1 次提交
    • D
      log: include hostname in initial log message · 1ce92960
      Daniel P. Berrange 提交于
      On the very first log message we send to any output, we include
      the libvirt version number and package string. In some bug reports
      we have been given libvirtd.log files that came from a different
      host than the corresponding /var/log/libvirt/qemu log files. So
      extend the initial log message to include the hostname too.
      
      eg on first log message we would now see:
      
       $ libvirtd
       2015-12-04 17:35:36.610+0000: 20917: info : libvirt version: 1.3.0
       2015-12-04 17:35:36.610+0000: 20917: info : hostname: dhcp-1-180.lcy.redhat.com
       2015-12-04 17:35:36.610+0000: 20917: error : qemuMonitorIO:687 : internal error: End of file from monitor
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1ce92960
  10. 09 12月, 2015 6 次提交
  11. 30 11月, 2015 3 次提交
    • M
      conf: Split virDomainObjList into a separate file · 90f3c0d7
      Michal Privoznik 提交于
      Our domain_conf.* files are big enough. Not only they contain XML
      parsing code, but they served as a storage of all functions whose
      name is virDomain prefixed. This is just wrong as it gathers not
      related functions (and modules) into one big file which is then
      harder to maintain. Split virDomainObjList module into a separate
      file called virdomainobjlist.[ch].
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      90f3c0d7
    • E
      livirt: Move URI alias matching to util · fb90fcc0
      Erik Skultety 提交于
      As we need to provide support for URI aliases in libvirt-admin as well, URI
      alias matching needs to be internally visible. Since
      virConnectOpenResolveURIAlias does have a compatible signature, it could be
      easily reused by libvirt-admin. This patch moves URI alias matching to util,
      renaming it accordingly.
      fb90fcc0
    • E
      libvirt: Move config getters to util · c4bdff19
      Erik Skultety 提交于
      virConnectGetConfig and virConnectGetConfigPath were static libvirt
      methods, merely because there hasn't been any need for having them
      internally exported yet. Since libvirt-admin also needs to reference
      its config file, 'xGetConfig' should be exported.
      Besides moving, this patch also renames the methods accordingly,
      as they are libvirt config specific.
      c4bdff19
  12. 26 11月, 2015 2 次提交
    • D
      logging: add client for virtlogd daemon · 37ed4224
      Daniel P. Berrange 提交于
      Add the virLogManager API which allows for communication with
      the virtlogd daemon to RPC program. This provides the client
      side API to open log files for guest domains.
      
      The virtlogd daemon is setup to auto-spawn on first use when
      running unprivileged. For privileged usage, systemd socket
      activation is used instead.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      37ed4224
    • D
      util: add APIs for reading/writing from/to rotating files · 910e65d9
      Daniel P. Berrange 提交于
      Add virRotatingFileReader and virRotatingFileWriter objects
      which allow reading & writing from/to files with automation
      rotation to N backup files when a size limit is reached. This
      is useful for guest logging when a guaranteed finite size
      limit is required. Use of external tools like logrotate is
      inadequate since it leaves the possibility for guest to DOS
      the host in between invokations of logrotate.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      910e65d9
  13. 19 11月, 2015 1 次提交
  14. 29 10月, 2015 1 次提交
    • M
      network: wait for DAD to finish for bridge IPv6 addresses · 0f7436ca
      Maxim Perevedentsev 提交于
      commit db488c79 assumed that dnsmasq would complete IPv6 DAD before
      daemonizing, but in reality it doesn't wait, which creates problems
      when libvirt's bridge driver sets the matching "dummy tap device" to
      IFF_DOWN prior to DAD completing.
      
      This patch waits for DAD completion by periodically polling the kernel
      using netlink to check whether there are any IPv6 addresses assigned
      to bridge which have a 'tentative' state (if there are any in this
      state, then DAD hasn't yet finished). After DAD is finished, execution
      continues. To avoid an endless hang in case something was wrong with
      the kernel's DAD, we wait a maximum of 5 seconds.
      0f7436ca
  15. 26 10月, 2015 1 次提交
  16. 05 10月, 2015 2 次提交
  17. 22 9月, 2015 3 次提交
    • P
      conf: Pre-calculate initial memory size instead of always calculating it · 403e8606
      Peter Krempa 提交于
      Add 'initial_memory' member to struct virDomainMemtune so that the
      memory size can be pre-calculated once instead of inferring it always
      again and again.
      
      Separating of the fields will also allow finer granularity of decisions
      in later patches where it will allow to keep the old initial memory
      value in cases where we are handling incomming migration from older
      versions that did not always update the size from NUMA as the code did
      previously.
      
      The change also requires modification of the qemu memory alignment
      function since at the point where we are modifying the size of NUMA
      nodes the total size needs to be recalculated too.
      
      The refactoring done in this patch also fixes a crash in the hyperv
      driver that did not properly initialize def->numa and thus
      virDomainNumaGetMemorySize(def->numa) crashed.
      
      In summary this patch should have no functional impact at this point.
      403e8606
    • P
      conf: Rename max_balloon to total_memory · 8059a990
      Peter Krempa 提交于
      The name of the variable was misleading. Rename it and it's setting
      accessor before other fixes.
      8059a990
    • P
      conf: Add helper to determine whether memory hotplug is enabled for a vm · 1891cad5
      Peter Krempa 提交于
      Add a simple helper so that the code doesn't have to rewrite the same
      condition multiple times.
      1891cad5
  18. 21 9月, 2015 1 次提交
    • J
      virfile: Rename virFileUnlink to virFileRemove · 1b046a68
      John Ferlan 提交于
      Similar to commit id '35847860', it's possible to attempt to create
      a 'netfs' directory in an NFS root-squash environment which will cause
      the 'vol-delete' command to fail.  It's also possible error paths from
      the 'vol-create' would result in an error to remove a created directory
      if the permissions were incorrect (and disallowed root access).
      
      Thus rename the virFileUnlink to be virFileRemove to match the C API
      functionality, adjust the code to following using rmdir or unlink
      depending on the path type, and then use/call it for the VIR_STORAGE_VOL_DIR
      1b046a68
  19. 18 9月, 2015 1 次提交
  20. 03 9月, 2015 1 次提交
  21. 02 9月, 2015 1 次提交
    • 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
  22. 24 8月, 2015 1 次提交
  23. 19 8月, 2015 1 次提交