1. 15 10月, 2012 10 次提交
    • O
      qemu: Ignore def->cpumask if emulatorpin is specified · 3635b41e
      Osier Yang 提交于
      If the vcpu placement is "static", it's just fine to ignore the
      def->cpumask if emulatorpin is specified.
      3635b41e
    • O
      conf: Ignore emulatorpin if vcpu placement is auto · 5378effd
      Osier Yang 提交于
      When vcpu placement is "auto", the domain process will be pinned
      to advisory nodeset from querying numad, While emulatorpin will
      override the pinning. That means both of them are to set the
      pinning policy for domain process, but conflicts with each other.
      
      This patch ingore emulatorpin if vcpu placement is "auto", because
      <vcpu> placement can't be simply ignored for <numatune> placement
      could default to it.
      5378effd
    • O
      qemu: Initialize cpuset for hotplugged vcpu as def->cpuset · 0df1a790
      Osier Yang 提交于
      The onlined vcpu pinning policy should inherit def->cpuset if
      it's not specified explicitly, and the affinity should be set
      in this case. Oppositely, the offlined vcpu pinning policy should
      be free()'ed.
      0df1a790
    • O
      qemu: Create or remove cgroup when doing vcpu hotpluging · a9bfe887
      Osier Yang 提交于
      Various APIs use cgroup to either set or get the statistics of
      host or guest. Hotplug or hot unplug new vcpus without creating
      or removing the cgroup for the vcpus could cause problems for
      those APIs. E.g.
      
      % virsh vcpucount dom
      maximum      config        10
      maximum      live          10
      current      config         1
      current      live           1
      
      % virsh setvcpu dom 2
      
      % virsh schedinfo dom --set vcpu_quota=1000
      Scheduler      : posix
      error: Unable to find vcpu cgroup for rhel6.2(vcpu: 1): No such file or
      directory
      
      This patch fixes the problem by creating cgroups for each of the
      onlined vcpus, and destroying cgroups for each of the offlined
      vcpus.
      a9bfe887
    • O
      conf: Initialize the pinning policy for vcpus · 10f8a45d
      Osier Yang 提交于
      Document for <vcpu>'s "cpuset" says:
      
      Since 0.4.4, this element can contain an optional cpuset attribute,
      which is a comma-separated list of physical CPU numbers that virtual
      CPUs can be pinned to.
      
      However, it's not the truth, libvirt actually pins the domain
      process to the specified pCPUs by "cpuset" of <vcpu>. And the
      vcpu thread are pinned to all available pCPUs if no <vcpupin>
      is specified for it.
      
      This patch is to implement the codes to inherit <vcpu>'s "cpuset" for
      vcpu that doesn't have <vcpupin> specified, and <vcpupin>
      for these vcpu will be ignored when formating. Underlying
      driver implementation will make sure the vcpu thread pinned
      to correct pCPUs.
      10f8a45d
    • O
      conf: Ignore vcpupin for not onlined vcpus when parsing · 60b176c3
      Osier Yang 提交于
      Setting pinning policy for vcpu which exceeds current vcpus number
      just makes no sense, however, it could cause various problems, E.g.
      
      <vcpu current='1'>4</vcpu>
      <cputune>
        <vcpupin vcpuid='3' cpuset='4'/>
      </cputune>
      
      % virsh start linux
      error: Failed to start domain linux
      error: cannot set CPU affinity on process 32534: No such process
      
      We must have some odd codes underlying which produces the
      "on process 32534", but the point is why we not to prevent
      earlier when parsing? Note that this is only one of the
      problem it could cause.
      
      This patch is to ignore the <vcpupin> for not onlined vcpus.
      60b176c3
    • O
      doc: Sort out the relationship between <vcpu>, <vcpupin>, and <emulatorpin> · f108944a
      Osier Yang 提交于
      These 3 elements conflicts with each other in either the doc
      or the underlying codes.
      
      Current problems:
      
      Problem 1:
      
      The doc shouldn't simply say "These settings are superseded
      by CPU tuning. " for element <vcpu>. As except the tuning, <vcpu>
      allows to specify the current, maxmum vcpu number. Apart from that,
      <vcpu> also allows to specify the placement as "auto", which binds
      the domain process to the advisory nodeset from numad.
      
      Problem 2:
      
      Doc for <vcpu> says its "cpuset" specify the physical CPUs
      that the vcpus can be pinned. But it's not the truth, as
      actually it only pin domain process to the specified physical
      CPUs. So either it's a document bug, or code bug.
      
      Problem 3:
      
      Doc for <vcpupin> says it supersed "cpuset" of <vcpu>, it's
      not quite correct, as each <vcpupin> specify the pinning policy
      only for one vcpu. How about the ones which doesn't have
      <vcpupin> specified? it says the vcpu will be pinned to all
      available physical CPUs, but what's the meaning of attribute
      "cpuset" of <vcpu> then?
      
      Problem 4:
      
      Doc for <emulatorpin> says it pin the emulator threads (domain
      process in other context, perhaps another follow up patch to
      cleanup the inconsistency is needed) to the physical CPUs
      specified its attribute "cpuset". Which conflicts with
      <vcpu>'s "cpuset". And actually in the underlying codes,
      it set the affinity for domain process twice if both
      "cpuset" for <vcpu> and <emulatorpin> are specified,
      and <emulatorpin>'s pinning will override <vcpu>'s.
      
      Problem 5:
      
      When "placement" of <vcpu> is "auto" (I.e. uses numad to
      get the advisory nodeset to which the domain process is
      pinned to), it will also be overridden by <emulatorpin>,
      
      This patch is trying to sort out the conflicts or bugs by:
      
      1) Don't say <vcpu> is superseded by <cputune>
      
      2) Keep the semanteme for "cpuset" of <vcpu> (I.e. Still says it
         specify the physical CPUs the virtual CPUs). But modifying it
         to mention it also set the pinning policy for domain process,
         and the CPU placement of domain process specified by "cpuset"
         of <vcpu> will be ingored if <emulatorpin> specified, and
         similary, the CPU placement of vcpu thread will be ignored
         if it has <vcpupin> specified, for vcpu which doesn't have
         <vcpupin> specified, it inherits "cpuset" of <vcpu>.
      
      3) Don't say <vcpu> is supersed by <vcpupin>. If neither <vcpupin>
         nor "cpuset" of <vcpu> is specified, the vcpu will be pinned
         to all available pCPUs.
      
      4) If neither <emulatorpin> nor "cpuset" of <vcpu> is specified,
         the domain process (emulator threads in the context) will be
         pinned to all available pCPUs.
      
      5) If "placement" of <vcpu> is "auto", <emulatorpin> is not allowed.
      
      6) hotplugged vcpus will also inherit "cpuset" of <vcpu>
      
      Codes changes according to above document changes:
      
      1) Inherit def->cpumask for each vcpu which doesn't have <vcpupin>
         specified, during parsing.
      
      2) ping the vcpu which doesn't have <vcpupin> specified to def->cpumask
         either by cgroup for sched_setaffinity(2), which is actually done
         by 1).
      
      3) Error out if "placement" == "auto", and <emulatorpin> is specified.
         Otherwise, <emulatorpin> is honored, and "cpuset" of <cpuset> is
         ignored.
      
      4) Setup cgroup for each hotplugged vcpu, and setup the pinning policy
         by either cgroup or sched_setaffinity(2).
      
      5) Remove cgroup and <vcpupin> for each hot unplugged vcpu.
      
      Patches are following (6 in total except this patch)
      f108944a
    • C
      Tweak comments in the policykit rules file · d04c53bc
      Cole Robinson 提交于
      - Add the XML header so vim gives us syntax highlighting
      - polkit-policy-file-validate hasn't existed for 3 years
      - Permissions comment was not accurate
      d04c53bc
    • C
      Only keep one polkit rules file · e1019e9e
      Cole Robinson 提交于
      Just tweak it at build time depending on what polkit version we are
      building for.
      e1019e9e
    • C
      daemon: Use $(AM_V_GEN) in a few more places · 0801c149
      Cole Robinson 提交于
      0801c149
  2. 13 10月, 2012 2 次提交
  3. 12 10月, 2012 5 次提交
    • M
      selinux: Use raw contexts · 9674f2c6
      Martin Kletzander 提交于
      We are currently able to work only with non-translated SELinux
      contexts, but we are using functions that work with translated
      contexts throughout the code.  This patch swaps all SELinux context
      translation relative calls with their raw sisters to avoid parsing
      problems.
      
      The problems can be experienced with mcstrans for example.  The
      difference is that if you have translations enabled (yum install
      mcstrans; service mcstrans start), fgetfilecon_raw() will get you
      something like 'system_u:object_r:virt_image_t:s0', whereas
      fgetfilecon() will return 'system_u:object_r:virt_image_t:SystemLow'
      that we cannot parse.
      
      I was trying to confirm that the _raw variants were here since the dawn of
      time, but the only thing I see now is that it was imported together in
      the upstream repo [1] from svn, so before 2008.
      
      Thanks Laurent Bigonville for finding this out.
      
      [1] http://oss.tresys.com/git/selinux.git
      9674f2c6
    • J
      conf: Mark missing optional USB devices in domain XML · f95560b3
      Jiri Denemark 提交于
      When startupPolicy set for a USB devices allows such device to be
      missing, there was no way this could be detected from domain XML. With
      this patch, libvirt emits a new missing='yes' attribute for such devices
      when active domain XML is generated.
      f95560b3
    • J
      virsh: remove reference to migration in blockcopy · c0fab871
      Ján Tomko 提交于
      c0fab871
    • J
      virsh: block SIGINT while getting BlockJobInfo · 13fefaf3
      Ján Tomko 提交于
      SIGINT hasn't been blocked, which could lead to losing it somewhere in
      virDomainGetBlockJobInfo and not aborting the job.
      13fefaf3
    • J
      Various typos and misspellings · 149c87b4
      Ján Tomko 提交于
      149c87b4
  4. 11 10月, 2012 15 次提交
    • P
      qemu: Fix misleading comment for qemuDomainObjBeginJobWithDriver() · 36f7dbf4
      Peter Krempa 提交于
      The comment stated that you may call qemuDomainObjBeginJobWithDriver
      without passing qemud_driver to signal it's not locked.
      qemuDomainObjBeginJobWithDriver still accesses the qemud_driver
      structure and the lock singaling is done through a separate parameter.
      36f7dbf4
    • J
      qemu: Make save/restore with USB devices usable · bd1282d6
      Jiri Denemark 提交于
      Save/restore with passed through USB devices currently only works if the
      USB device can be found at the same USB address where it used to be
      before saving a domain. This makes sense in case a user explicitly
      configure the USB address in domain XML. However, if the device was
      found automatically by vendor/product identification, we should try to
      search for that device when restoring the domain and use any device we
      find as long as there is only one available. In other words, the USB
      device can now be removed and plugged again or the host can be rebooted
      between saving and restoring the domain.
      bd1282d6
    • J
      Add MIGRATABLE flag for virDomainGetXMLDesc · 28f8dfdc
      Jiri Denemark 提交于
      Using VIR_DOMAIN_XML_MIGRATABLE flag, one can request domain's XML
      configuration that is suitable for migration or save/restore. Such XML
      may contain extra run-time stuff internal to libvirt and some default
      configuration may be removed for better compatibility of the XML with
      older libvirt releases.
      
      This flag may serve as an easy way to get the XML that can be passed
      (after desired modifications) to APIs that accept custom XMLs, such as
      virDomainMigrate{,ToURI}2 or virDomainSaveFlags.
      28f8dfdc
    • J
      edc9269a
    • J
      qemu: Add option to treat missing USB devices as success · 059aff6b
      Jiri Denemark 提交于
      All USB device lookup functions emit an error when they cannot find the
      requested device. With this patch, their caller can choose if a missing
      device is an error or normal condition.
      059aff6b
    • J
      qemu: Introduce qemuFindHostdevUSBDevice · 7bcc7278
      Jiri Denemark 提交于
      The code which looks up a USB device specified by hostdev is duplicated
      in two places. This patch creates a dedicated function that can be
      called in both places.
      7bcc7278
    • J
      conf: Add support for startupPolicy for USB devices · e658daeb
      Jiri Denemark 提交于
      USB devices can disappear without OS being mad about it, which makes
      them ideal for startupPolicy. With this attribute, USB devices can be
      configured to be mandatory (the default), requisite (will disappear
      during migration if they cannot be found), or completely optional.
      e658daeb
    • J
      locking: Implement lock failure action in sanlock driver · 89364767
      Jiri Denemark 提交于
      While the changes to sanlock driver should be stable, the actual
      implementation of sanlock_helper is supposed to be replaced in the
      future. However, before we can implement a better sanlock_helper, we
      need an administrative interface to libvirtd so that the helper can just
      pass a "leases lost" event to the particular libvirt driver and
      everything else will be taken care of internally. This approach will
      also allow libvirt to pass such event to applications and use
      appropriate reasons when changing domain states.
      
      The temporary implementation handles all actions directly by calling
      appropriate libvirt APIs (which among other things means that it needs
      to know the credentials required to connect to libvirtd).
      89364767
    • J
      locking: Add support for lock failure action · 297c704a
      Jiri Denemark 提交于
      297c704a
    • J
      locking: Pass hypervisor driver name when acquiring locks · d236f3fc
      Jiri Denemark 提交于
      This is required in case a lock manager needs to contact libvirtd in
      case of an unexpected event.
      d236f3fc
    • J
      e55ff49c
    • J
      conf: Add on_lockfailure event configuration · 76f5bcab
      Jiri Denemark 提交于
      Using this new element, one can configure an action that should be
      performed when resource locks are lost.
      76f5bcab
    • J
      conf: Rename life cycle actions to event actions · d0ea530b
      Jiri Denemark 提交于
      While current on_{poweroff,reboot,crash} action configuration is about
      configuring life cycle actions, they can all be considered events and
      actions that need to be done on a particular event. Let's generalize the
      code by renaming life cycle actions to event actions so that it can be
      reused later for non-lifecycle events.
      d0ea530b
    • Z
      0ec6aebb
    • C
      storage: Report UUID/name consistently in driver errors · 3af8280b
      Cole Robinson 提交于
      Done with:
      
      sed -i -e "s/no pool with matching uuid/no storage pool with matching uuid/g" src/storage/storage_driver.c
      sed -i -e 's/"%s", _("no storage pool with matching uuid")/_("no storage pool with matching uuid %s"), obj->uuid/g' src/storage/storage_driver.c
      sed -i -e 's/"%s", _("storage pool is not active")/_("storage pool '%s' is not active"), pool->def->name/g' src/storage/storage_driver.c
      
      And a couple fixups before, during, and after, and a manual inspection
      pass to make sure nothing was wonky.
      3af8280b
  5. 10 10月, 2012 4 次提交
    • D
      Change qemuSetSchedularParameters to use AFFECT_CURRENT · 4da9b2c1
      Daniel P. Berrange 提交于
      When adding variants of parameter setting APIs which accepted
      flags, the existing APIs were all adapted internally to pass
      VIR_DOMAIN_AFFECT_CURRENT to the new API. The QEMU impl
      qemuSetSchedularParameters was an exception, which instead
      used VIR_DOMAIN_AFFECT_LIVE. Change this to match other
      compatibility scenarios, so that calling
      
         virDomainSetSchedularParameters(dom, params, nparams);
      
      Has the same semantics as
      
         virDomainSetSchedularParametersFlags(dom, params, nparams, 0);
      
      And
      
         virDomainSetSchedularParametersFlags(dom, params, nparams, VIR_DOMAIN_AFFECT_CURRENT);
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      4da9b2c1
    • M
      win32: Pretend that close-on-exec works · fcfa4bfb
      Matthias Bolte 提交于
      Currently virNetSocketNew fails because virSetCloseExec fails as there
      is no proper implementation for it on Windows at the moment. Workaround
      this by pretending that setting close-on-exec on the fd works. This can
      be done because libvirt currently lacks the ability to create child
      processes on Windows anyway. So there is no point in failing to set a
      flag that isn't useful at the moment anyway.
      fcfa4bfb
    • M
      esx: Fix dynamic dispatch for types with more than one level of inheritance · 69037428
      Matthias Bolte 提交于
      Traverse the whole inheritance hierarchy for dynamic dispatch as it is
      already done for the dynamic cast.
      
      Also make AnyType cast errors more verbose.
      
      Reported by Ata Bohra.
      69037428
    • D
      interface: add udevIfaceIsActive() to udev backend · ba96d277
      Doug Goldstein 提交于
      Add support to check if a specific interface is active by supporting the
      following API function in the udev based virInterface backend:
      * virConnectInterfaceIsActive()
      ba96d277
  6. 09 10月, 2012 4 次提交
    • D
      interface: always build all available backends · 43dbcb15
      Doug Goldstein 提交于
      Always build all available backends to avoid bit-rot. At run time we
      select the correct backend and load it by attempting netcf first and
      then udev.
      43dbcb15
    • D
      interface: fix netcf based backend naming · b871830a
      Doug Goldstein 提交于
      All other backends for virInterface or other HVs implementations of
      virInterface list their own names for the name instead of the generic
      'Interface' value. This does the same for the netcf based backend.
      Also, report any errors during registration.
      b871830a
    • D
      interface: add udev based backend for virInterface · 5a33366f
      Doug Goldstein 提交于
      Add a read-only udev based backend for virInterface. Useful for distros
      that do not have netcf support yet. Multiple libvirt based utilities use
      a HAL based fallback when virInterface is not available which is less
      than ideal. This implements:
      * virConnectNumOfInterfaces()
      * virConnectListInterfaces()
      * virConnectNumOfDefinedInterfaces()
      * virConnectListDefinedInterfaces()
      * virConnectListAllInterfaces()
      * virConnectInterfaceLookupByName()
      * virConnectInterfaceLookupByMACString()
      5a33366f
    • E
      hooks: let virCommand do the error reporting · 9c74414d
      Eric Blake 提交于
      The code was reporting raw exit status without decoding it into
      normal vs. signal exit.  virCommandRun already does this, but
      with a different error type, so all we have to do is recast
      the error to the correct type.
      Reported by li guang.
      
      * src/util/hooks.c (virHookCall): Simplify.
      9c74414d