1. 21 2月, 2015 29 次提交
    • M
      conf: support backend domain name in disk and network devices · c374353c
      Marek Marczykowski 提交于
      At least Xen supports backend drivers in another domain (aka "driver
      domain"). This patch introduces an XML config option for specifying the
      backend domain name for <disk> and <interface> devices.  E.g.
      
        <disk>
          <backenddomain name='diskvm'/>
          ...
        </disk>
        <interface type='bridge'>
          <backenddomain name='netvm'/>
          ...
        </interface>
      
      In the future, same option will be needed for USB devices (hostdev
      objects), but for now libxl doesn't have support for PVUSB.
      Signed-off-by: NMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
      c374353c
    • L
      network: allow <pf> together with <interface>/<address> in network status · 8f8e581a
      Laine Stump 提交于
      The function that parses the <forward> subelement of a network used to
      fail/log an error if the network definition contained both a <pf>
      element as well as at least one <interface> or <address> element. That
      check was present because the configuration of a network should have
      either one <pf>, one or more <interface>, or one or more <address>,
      but never combinations of multiple kinds.
      
      This caused a problem when libvirtd was restarted with a network
      already active - when a network with a <pf> element is started, the
      referenced PF (Physical Function of an SRIOV-capable network card) is
      checked for VFs (Virtual Functions), and the <forward> is filled in
      with a list of all VFs for that PF either in the form of their PCI
      addresses (a list of <address>) or their netdev names (a list of
      <interface>); the <pf> element is not removed though. When libvirtd is
      restarted, it parses the network status and finds both the original
      <pf> from the config, as well as the list of either <address> or
      <interface>, fails the parse, and the network is not added to the
      active list. This failure is often obscured because the network is
      marked as autostart so libvirt immediately restarts it.
      
      It seems odd to me that <interface> and <address> are stored in the
      same array rather than keeping two separate arrays, and having
      separate arrays would have made the check much simpler. However,
      changing to use two separate arrays would have required changes in
      more places, potentially creating more conflicts and (more
      importantly) more possible regressions in the event of a backport, so
      I chose to keep the existing data structure in order to localize the
      change.
      
      It appears that this problem has been in the code ever since support
      for <pf> was added (0.9.10), but until commit
      34cc3b2f (first in libvirt 1.2.4)
      networks with interface pools were not properly marked as active on
      restart anyway, so there is no point in backporting this patch any
      further than that.
      8f8e581a
    • P
      qemu: caps: Add capability bit for the "pc-dimm" device · 103707d4
      Peter Krempa 提交于
      The pc-dimm device represents a RAM memory module.
      103707d4
    • P
      conf: Hoist validation of memory size into the post parse callback · e5c7864c
      Peter Krempa 提交于
      Later patches will need to access the full definition to do check the
      memory size and thus the checking needs to be done after the whole
      definition including devices is known.
      e5c7864c
    • P
      conf: numa: Check ABI stability of NUMA configuration · b98596a7
      Peter Krempa 提交于
      Add helper to compare initial sizes of indivitual NUMA nodes and the map
      of belonging vCPUs. Other configuration is not ABI.
      b98596a7
    • P
      conf: ABI: Hugepage backing definition is not guest ABI · e431c3c0
      Peter Krempa 提交于
      The backing of the vm's memory isn't influencing the guest ABI thus
      shouldn't be checked.
      e431c3c0
    • P
      conf: Move all NUMA configuration to virDomainNuma · 181742d4
      Peter Krempa 提交于
      For historical reasons data regarding NUMA configuration were split
      between the CPU definition and numatune. We cannot do anything about the
      XML still being split, but we certainly can at least store the relevant
      data in one place.
      
      This patch moves the NUMA stuff to the right place.
      181742d4
    • P
      conf: numa: Add setter/getter for NUMA node memory size · b9ddb258
      Peter Krempa 提交于
      Add the helpers and refactor places where the value is accessed without
      them.
      b9ddb258
    • P
      7800d473
    • P
      conf: numa: Add accessor for the NUMA node cpu mask · d9a779a3
      Peter Krempa 提交于
      Add virDomainNumaGetNodeCpumask() and refactor a few places that would
      get the cpu mask without the helper.
      d9a779a3
    • P
      conf: numa: Add helper to get guest NUMA node count and refactor users · be22d073
      Peter Krempa 提交于
      Add an accessor so that a later refactor is simpler.
      be22d073
    • P
      qemu: command: Unify retrieval of NUMA cell count in qemuBuildNumaArgStr · ba2183a3
      Peter Krempa 提交于
      The function uses the cell count in 6 places. Add a temp variable to
      hold the count as it will greatly simplify the refactor.
      ba2183a3
    • P
      conf: numa: Don't pass double pointer to virDomainNumatuneParseXML · b83543c5
      Peter Krempa 提交于
      virDomainNumatuneParseXML now doesn't allocate the def->numa object any
      longer so we don't need to pass a double pointer.
      b83543c5
    • P
      numa: conf: Tweak parameters of virDomainNumatuneSet · fa993072
      Peter Krempa 提交于
      As virDomainNumatuneSet now doesn't allocate the virDomainNuma object
      any longer it's not necessary to pass the pointer to a pointer to store
      the object as it will not change any longer.
      
      While touching the parameter definitions I've also changed the name of
      the parameter to "numa".
      fa993072
    • P
      conf: numa: Always allocate the NUMA config · 21008c01
      Peter Krempa 提交于
      Since our formatter now handles well if the config is allocated and not
      filled we can safely always-allocate the NUMA config and remove the
      ad-hoc allocation code.
      
      This will help in later patches as the parser will be refactored to just
      fill the data.
      21008c01
    • P
      conf: Allocate domain definition with the new helper · c0341119
      Peter Krempa 提交于
      Use the virDomainDefNew() helper to allocate the definition instead of
      doing it via VIR_ALLOC.
      c0341119
    • P
      conf: Separate helper for creating domain objects · 61e43ce9
      Peter Krempa 提交于
      Move the existing virDomainDefNew to virDomainDefNewFull as it's setting
      a few things in the conf and re-introduce virDomainDefNew as a function
      without parameters for common use.
      61e43ce9
    • P
      conf: numa: Format <numatune> XML only if necessary · 121cde47
      Peter Krempa 提交于
      Do a content-aware check if formatting of the <numatune> element is
      necessary. Later on the def->numa structure will be always present so we
      cannot decide only on the basis whether it's allocated.
      121cde47
    • P
      conf: numa: Refactor logic in virDomainNumatuneParseXML · 638e3d27
      Peter Krempa 提交于
      Shuffling around the logic will allow to simplify the code quite a bit.
      As an additional bonus the change in the logic now reports an error if
      automatic placement is selected and individual placement is configured.
      638e3d27
    • P
      conf: numa: Reformat virDomainNumatuneParseXML · 67bd807c
      Peter Krempa 提交于
      Collapse few of the conditions so that the program flow is more clear.
      67bd807c
    • P
      conf: numa: Improve error message in case a numa node doesn't have cpus · 60a2ce49
      Peter Krempa 提交于
      Currently the code would exit without reporting an error as
      virBitmapParse reports one only if it fails to parse the bitmap, whereas
      the code was jumping to the error label even in case 0 cpus were
      correctly parsed in the map.
      60a2ce49
    • P
      conf: numa: Recalculate rather than remember total NUMA cpu count · 6b616632
      Peter Krempa 提交于
      It's easier to recalculate the number in the one place it's used as
      having a separate variable to track it. It will also help with moving
      the NUMA code to the separate module.
      6b616632
    • P
      conf: Move enum virMemAccess to the NUMA code and rename it · a3673b22
      Peter Krempa 提交于
      Name it virNumaMemAccess and add it to conf/numa_conf.[ch]
      
      Note that to avoid a circular dependency the type of the NUMA cell
      memAccess variable was changed to int. It will be turned back later
      after the circular dependency will not exist.
      a3673b22
    • P
      conf: numa: Rename virDomainNumatune to virDomainNuma · 6bc80fa8
      Peter Krempa 提交于
      The structure will gradually become the only place for NUMA related
      config, thus rename it appropriately.
      6bc80fa8
    • P
      conf: Move NUMA cell formatter to numa_conf · 456268d4
      Peter Krempa 提交于
      Move the code that formats the /domain/cpu/numa element to numa_conf as
      it belongs there.
      456268d4
    • P
      conf: numa: Don't duplicate NUMA cell cpumask · 2562141f
      Peter Krempa 提交于
      The mask was stored both as a bitmap and as a string. The string is used
      for XML output only. Remove the string, as it can be reconstructed from
      the bitmap.
      
      The test change is necessary as the bitmap formatter doesn't "optimize"
      using the '^' operator.
      2562141f
    • P
      conf: Refactor virDomainNumaDefCPUParseXML · 34a1dd73
      Peter Krempa 提交于
      Rewrite the function to save a few local variables and reorder the code
      to make more sense.
      
      Additionally the ncells_max member of the virCPUDef structure is used
      only for tracking allocation when parsing the numa definition, which can
      be avoided by switching to VIR_ALLOC_N as the array is not resized
      after initial allocation.
      34a1dd73
    • P
      conf: Move NUMA cell parsing code from cpu conf to numa conf · 5bba61fd
      Peter Krempa 提交于
      For weird historical reasons NUMA cells are added as a subelement of
      <cpu> while the actual configuration is done in <numatune>.
      
      This patch splits out the cell parser code from cpu config to NUMA
      config. Note that the changes to the code are minimal just to make it
      work and the function will be refactored in the next patch.
      5bba61fd
    • P
      conf: Move numatune_conf to numa_conf · fcee64e7
      Peter Krempa 提交于
      For a while now there are two places that gather information about NUMA
      related guest configuration. While the XML can't be changed we can at
      least store the data in one place in the definition.
      
      Rename the numatune_conf.[ch] files to numa_conf as later patches will
      move the rest of the definitions from the cpu definition to this one.
      fcee64e7
  2. 20 2月, 2015 4 次提交
  3. 19 2月, 2015 7 次提交
    • M
      parallels: Set the first HDD from XML as bootable · 675fa6b3
      Mikhail Feoktistov 提交于
      1. Delete all boot devices for VM instance
      2. Find the first HDD from XML and set it as bootable
      
      Now we support only one boot device and it should be HDD.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      675fa6b3
    • M
      6783cf63
    • M
      parallels: code aligment · 0268eabd
      Mikhail Feoktistov 提交于
      0268eabd
    • J
      Search for schemas and cpu_map.xml in source tree · bc6e2063
      Jiri Denemark 提交于
      Not all files we want to find using virFileFindResource{,Full} are
      generated when libvirt is built, some of them (such as RNG schemas) are
      distributed with sources. The current API was not able to find source
      files if libvirt was built in VPATH.
      
      Both RNG schemas and cpu_map.xml are distributed in source tarball.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      bc6e2063
    • M
      qemuMigrationDriveMirror: Listen to events · 80c5f10e
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1179678
      
      When migrating with storage, libvirt iterates over domain disks and
      instruct qemu to migrate the ones we are interested in (shared, RO and
      source-less disks are skipped). The disks are migrated in series. No
      new disk is transferred until the previous one hasn't been quiesced.
      This is checked on the qemu monitor via 'query-jobs' command. If the
      disk has been quiesced, it practically went from copying its content
      to mirroring state, where all disk writes are mirrored to the other
      side of migration too. Having said that, there's one inherent error in
      the design. The monitor command we use reports only active jobs. So if
      the job fails for whatever reason, we will not see it anymore in the
      command output. And this can happen fairly simply: just try to migrate
      a domain with storage. If the storage migration fails (e.g. due to
      ENOSPC on the destination) we resume the host on the destination and
      let it run on partly copied disk.
      
      The proper fix is what even the comment in the code says: listen for
      qemu events instead of polling. If storage migration changes state an
      event is emitted and we can act accordingly: either consider disk
      copied and continue the process, or consider disk mangled and abort
      the migration.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      80c5f10e
    • M
      qemuProcessHandleBlockJob: Take status into account · 76c61cdc
      Michal Privoznik 提交于
      Upon BLOCK_JOB_COMPLETED event delivery, we check if the job has
      completed (in qemuMonitorJSONHandleBlockJobImpl()). For better image,
      the event looks something like this:
      
      "timestamp": {"seconds": 1423582694, "microseconds": 372666}, "event":
      "BLOCK_JOB_COMPLETED", "data": {"device": "drive-virtio-disk0", "len":
      8412790784, "offset": 409993216, "speed": 8796093022207, "type":
      "mirror", "error": "No space left on device"}}
      
      If "len" does not equal "offset" it's considered an error, and we can
      clearly see "error" field filled in. However, later in the event
      processing this case was handled no differently to case of job being
      aborted via separate API. It's time that we start differentiate these
      two because of the future work.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      76c61cdc
    • M
      qemuProcessHandleBlockJob: Set disk->mirrorState more often · c37943a0
      Michal Privoznik 提交于
      Currently, upon BLOCK_JOB_* event, disk->mirrorState is not updated
      each time. The callback code handling the events checks if a blockjob
      was started via our public APIs prior to setting the mirrorState.
      However, some block jobs may be started internally (e.g. during
      storage migration), in which case we don't bother with setting
      disk->mirror (there's nothing we can set it to anyway), or other
      fields. But it will come handy if we update the mirrorState in these
      cases too. The event wasn't delivered just for fun - we've started the
      job after all.
      
      So, in this commit, the mirrorState is set to whatever job status
      we've obtained. Of course, there are some actions on some statuses
      that we want to perform. But instead of if {} else if {} else {} ...
      enumeration, let's move to switch().
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      c37943a0