1. 13 5月, 2013 1 次提交
  2. 11 5月, 2013 2 次提交
    • D
      Cope with missing swap cgroup controls · f493d83f
      Daniel P. Berrange 提交于
      It is possible to build a kernel without swap cgroup controls
      present. This causes a fatal error when querying memory
      parameters. Treat missing swap controls as meaning "unlimited".
      The fatal error remains if the user tries to actually change
      the limit.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f493d83f
    • L
      util: fix virFileOpenAs return value and resulting error logs · a2c1bedb
      Laine Stump 提交于
      This resolves:
      
           https://bugzilla.redhat.com/show_bug.cgi?id=851411
           https://bugzilla.redhat.com/show_bug.cgi?id=955500
      
      The first problem was that virFileOpenAs was returning fd (-1) in one
      of the error cases rather than ret (-errno), so the caller thought
      that the error was EPERM rather than ENOENT.
      
      The second problem was that some log messages in the general purpose
      qemuOpenFile() function would always say "Failed to create" even if
      the caller hadn't included O_CREAT (i.e. they were trying to open an
      existing file).
      
      This fixes virFileOpenAs to jump down to the error return (which
      returns ret instead of fd) in the previously mentioned incorrect
      failure case of virFileOpenAs(), removes all error logging from
      virFileOpenAs() (since the callers report it), and modifies
      qemuOpenFile to appropriately use "open" or "create" in its log
      messages.
      
      NB: I seriously considered removing logging from all callers of
      virFileOpenAs(), but there is at least one case where the caller
      doesn't want virFileOpenAs() to log any errors, because it's just
      going to try again (qemuOpenFile()). We can't simply make a silent
      variation of virFileOpenAs() though, because qemuOpenFile() can't make
      the decision about whether or not it wants to retry until after
      virFileOpenAs() has already returned an error code.
      
      Likewise, I also considered changing virFileOpenAs() to return -1 with
      errno set on return, and may still do that, but only as a separate
      patch, as it obscures the intent of this patch too much.
      a2c1bedb
  3. 09 5月, 2013 1 次提交
  4. 08 5月, 2013 5 次提交
    • D
      Unmerge attach/update/modify device APIs in drivers · a605b7e0
      Daniel P. Berrange 提交于
      The LXC, QEMU, and LibXL drivers have all merged their handling of
      the attach/update/modify device APIs into one large
      
        'xxxxDomainModifyDeviceFlags'
      
      which then does a 'switch()' based on the actual API being invoked.
      While this saves some lines of code, it is not really all that
      significant in the context of the driver API impls as a whole.
      
      This merger of the handling of different APIs creates pain when
      wanting to automated analysis of the code and do things which
      are specific to individual APIs. The slight duplication of code
      from unmerged the API impls, is preferrable to allow for easier
      automated analysis.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a605b7e0
    • D
      Pull parsing of migration xml up into QEMU driver APIs · 449e6b1b
      Daniel P. Berrange 提交于
      Currently the parsing of XML is pushed down into the various
      migration helper APIs. This makes it difficult to insert the
      correct access control checks, since one helper API services
      many public APIs. Pull the parsing of XML up to the top level
      of the QEMU driver APIs
      449e6b1b
    • D
      Separate internal node suspend APIs from public API · 4a044d02
      Daniel P. Berrange 提交于
      The individual hypervisor drivers were directly referencing
      APIs in virnodesuspend.c in their virDriverPtr struct. Separate
      these methods, so there is always a wrapper in the hypervisor
      driver. This allows the unused virConnectPtr args to be removed
      from the virnodesuspend.c file. Again this will ensure that
      ACL checks will only be performed on invocations that are
      directly associated with public API usage.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      4a044d02
    • D
      Separate internal node device APIs from public API · 1c6d4ca5
      Daniel P. Berrange 提交于
      The individual hypervisor drivers were directly referencing
      APIs in src/nodeinfo.c in their virDriverPtr struct. Separate
      these methods, so there is always a wrapper in the hypervisor
      driver. This allows the unused virConnectPtr args to be
      removed from the nodeinfo.c file. Again this will ensure that
      ACL checks will only be performed on invocations that are
      directly associated with public API usage.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1c6d4ca5
    • D
      Separate virGetHostname() API contract from driver APIs · ead63031
      Daniel P. Berrange 提交于
      Currently the virGetHostname() API has a bogus virConnectPtr
      parameter. This is because virtualization drivers directly
      reference this API in their virDriverPtr tables, tieing its
      API design to the public virConnectGetHostname API design.
      
      This also causes problems for access control checks since
      these must only be done for invocations from the public
      API, not internal invocation.
      
      Remove the bogus virConnectPtr parameter, and make each
      hypervisor driver provide a dedicated function for the
      driver API impl. This will allow access control checks
      to be easily inserted later.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      ead63031
  5. 07 5月, 2013 1 次提交
  6. 02 5月, 2013 2 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
    • 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
  7. 30 4月, 2013 1 次提交
  8. 26 4月, 2013 1 次提交
    • L
      qemu: implement virNodeDeviceDetachFlags backend · eaff1611
      Laine Stump 提交于
      The differences from virNodeDeviceDettach are very minor:
      
      1) Check that the flags are 0.
      
      2) Set the virPCIDevice's stubDriver according to the driverName that
         is passed in.
      
      3) Call virPCIDeviceDetach with a NULL stubDriver, indicating it
         should get the name of the stub driver from the virPCIDevice
         object.
      eaff1611
  9. 25 4月, 2013 1 次提交
  10. 24 4月, 2013 2 次提交
  11. 23 4月, 2013 1 次提交
    • 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
  12. 22 4月, 2013 1 次提交
    • O
      qemu: Fix the wrong expression · a71ec988
      Osier Yang 提交于
      Wrong use of the parentheses causes "rc" always having a boolean value,
      either "1" or "0", and thus we can't get the detailed error message
      when it fails:
      
      Before (I only have 1 node):
      % virsh numatune f18 --nodeset 12
      error: Unable to change numa parameters
      error: unable to set numa tunable: Unknown error -1
      
      After:
      virsh numatune f18 --nodeset 12
      error: Unable to change numa parameters
      error: unable to set numa tunable: Invalid argument
      a71ec988
  13. 17 4月, 2013 1 次提交
    • 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
  14. 16 4月, 2013 2 次提交
  15. 15 4月, 2013 2 次提交
    • P
      qemu: Report also domain name in error message when domain object wasn't found · 63b68f3c
      Peter Krempa 提交于
      Report the errors as:
      Domain not found: no domain with matching uuid '41414141-4141-4141-4141-414141414141' (crashtest)
      instead of:
      Domain not found: no domain with matching uuid '41414141-4141-4141-4141-414141414141'
      63b68f3c
    • P
      qemu: Refactor lookup of domain object · 54a99ba8
      Peter Krempa 提交于
      Use the helper to lookup the domain object in the remaining places.
      
      This patch also fixes error reporting when the domain was not found in several
      functions that were printing the raw UUID buffer instead of the formatted
      string. The offending functions were:
      
      qemuDomainGetInterfaceParameters
      qemuDomainSetInterfaceParameters
      qemuGetSchedulerParametersFlags
      qemuSetSchedulerParametersFlags
      qemuDomainGetNumaParameters
      qemuDomainSetNumaParameters
      qemuDomainGetMemoryParameters
      qemuDomainSetMemoryParameters
      qemuDomainGetBlkioParameters
      qemuDomainSetBlkioParameters
      qemuDomainGetCPUStats
      54a99ba8
  16. 11 4月, 2013 1 次提交
  17. 08 4月, 2013 1 次提交
    • O
      qemu: Translate the pool disk source earlier · 60b78b33
      Osier Yang 提交于
      To support "shareable" for volume type disk, we have to translate
      the source before trying to add the shared disk entry. To achieve
      the goal, this moves the helper qemuTranslateDiskSourcePool into
      src/qemu/qemu_conf.c, and introduce an internal only member (voltype)
      for struct _virDomainDiskSourcePoolDef, to record the underlying
      volume type for use when building the drive string.
      
      Later patch will support "shareable" volume type disk.
      60b78b33
  18. 06 4月, 2013 1 次提交
    • O
      qemu: Error out if the bitmap for pinning is all clear · fd1432c7
      Osier Yang 提交于
      For both "live" and "config" changes of vcpupin and emulatorpin, an
      all clear bitmap doesn't make sense, and it can just cause corruptions.
      E.g (similar for emulatorpin).
      
      % virsh vcpupin hame 0 8,^8 --config
      
      % virsh vcpupin hame
      VCPU: CPU Affinity
      ----------------------------------
         0:
         1: 0-63
         2: 0-63
         3: 0-63
      
      % virsh dumpxml hame | grep cpuset
          <vcpupin vcpu='0' cpuset=''/>
      
      % virsh start hame
      error: Failed to start domain hame
      error: An error occurred, but the cause is unknown
      fd1432c7
  19. 05 4月, 2013 6 次提交
    • P
      qemu: Remove maximum cpu limit when setting processor count using the API · ce65b435
      Peter Krempa 提交于
      When setting processor count for a domain using the API libvirt enforced
      a maximum processor count, while it isn't enforced when taking the XML path.
      
      This patch removes the check to match the XML.
      ce65b435
    • D
      Don't create dirs in cgroup controllers we don't want to use · 56f27b3b
      Daniel P. Berrange 提交于
      Currently when getting an instance of virCgroupPtr we will
      create the path in all cgroup controllers. Only at the virt
      driver layer are we attempting to filter controllers. This
      is bad because the mere act of creating the dirs in the
      controllers can have a functional impact on the kernel,
      particularly for performance.
      
      Update the virCgroupForDriver() method to accept a bitmask
      of controllers to use. Only create dirs in the controllers
      that are requested. When creating cgroups for domains,
      respect the active controller list from the parent cgroup
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      56f27b3b
    • P
      virCaps: get rid of defaultDiskDriverName · 9ea249e7
      Peter Krempa 提交于
      This patch removes the defaultDiskDriverName from the virCaps
      structure. This particular default value is used only in the qemu driver
      so this patch uses the recently added callback to fill the driver name
      if it's needed instead of propagating it through virCaps.
      9ea249e7
    • P
      conf callback: Rearrange function parameters · ad0d10b2
      Peter Krempa 提交于
      Move the xmlopt and caps arguments to the end of the argument list.
      ad0d10b2
    • P
      conf: Add post XML parse callbacks and prepare for cleaning of virCaps · 43b99fc4
      Peter Krempa 提交于
      This patch adds instrumentation that will allow hypervisor drivers to
      fill and validate domain and device definitions after parsed by the XML
      parser.
      
      With this patch, after the XML is parsed, a callback to the driver is
      issued requesting to fill and validate driver specific details of the
      configuration. This allows to use sensible defaults and checks on a per
      driver basis at the time the XML is parsed.
      
      Two callback pointers are stored in the new virDomainXMLConf object:
      * virDomainDeviceDefPostParseCallback (devicesPostParseCallback)
        - called for a single device parsed and for every single device in a
          domain config. A virDomainDeviceDefPtr is passed along with the
          domain definition and virCaps.
      
      * virDomainDefPostParseCallback, (domainPostParseCallback)
        - A callback that is meant to process the domain config after it's
        parsed.  A virDomainDefPtr is passed along with virCaps.
      
      Both types of callbacks support arbitrary opaque data passed for the
      callback functions.
      
      Errors may be reported in those callbacks resulting in a XML parsing
      failure.
      43b99fc4
    • P
      maint: Rename xmlconf to xmlopt and virDomainXMLConfig to virDomainXMLOption · e84b1931
      Peter Krempa 提交于
      This patch is the result of running:
      
      for i in $(git ls-files | grep -v html | grep -v \.po$ ); do
        sed -i -e "s/virDomainXMLConf/virDomainXMLOption/g" -e "s/xmlconf/xmlopt/g" $i
      done
      
      and a few manual tweaks.
      e84b1931
  20. 03 4月, 2013 1 次提交
  21. 28 3月, 2013 1 次提交
  22. 21 3月, 2013 2 次提交
  23. 20 3月, 2013 1 次提交
  24. 14 3月, 2013 1 次提交
  25. 13 3月, 2013 1 次提交
    • M
      qemu_driver: Try KVM_CAP_MAX_VCPUS only if defined · 3b94239f
      Michal Privoznik 提交于
      With our recent patch (1715c83b) we thrive to get the correct
      number of maximal VCPUs. However, we are using a constant from
      linux/kvm.h which may be not defined in every distro. Hence, we
      should guard usage of the constant with ifdef preprocessor
      directive. This was introduced in kernel:
      
          commit 8c3ba334f8588e1d5099f8602cf01897720e0eca
          Author: Sasha Levin <levinsasha928@gmail.com>
          Date:   Mon Jul 18 17:17:15 2011 +0300
      
          KVM: x86: Raise the hard VCPU count limit
      
          The patch raises the hard limit of VCPU count to 254.
      
          This will allow developers to easily work on scalability
          and will allow users to test high VCPU setups easily without
          patching the kernel.
      
          To prevent possible issues with current setups, KVM_CAP_NR_VCPUS
          now returns the recommended VCPU limit (which is still 64) - this
          should be a safe value for everybody, while a new KVM_CAP_MAX_VCPUS
          returns the hard limit which is now 254.
      
      $ git desc 8c3ba334f
      v3.1-rc7-48-g8c3ba33
      3b94239f