1. 07 6月, 2014 1 次提交
    • E
      conf: alter disk mirror xml output · 7c6fc394
      Eric Blake 提交于
      Now that we track a disk mirror as a virStorageSource, we might
      as well update the XML to theoretically allow any type of
      mirroring destination (not just a local file).  A later patch
      will also be reusing <mirror> to track the block commit of the
      top layer of a chain, which is another case where libvirt needs
      to update the backing chain after the job is finally pivoted,
      and since backing chains can have network backing files as the
      destination to commit into, it makes more sense to display that
      in the XML.
      
      This patch changes output-only XML; it was already documented
      that <mirror> does not affect a domain definition at this point
      (because qemu doesn't provide persistent bitmaps yet).  Any
      application that was starting a block copy job with older libvirt
      and then relying on the domain XML to determine if it was
      complete will no longer be able to access the file= and format=
      attributes of mirror that were previously used.  However, this is
      not going to be a problem in practice: the only time a block copy
      job works is on a transient domain, and any app that is managing
      a transient domain probably already does enough of its own
      bookkeeping to know which file it is mirroring into without
      having to re-read it from the libvirt XML.  The one thing that
      was likely to be used in a mirroring job was the ready=
      attribute, which is unchanged.  Meanwhile, I made sure the schema
      and parser still accept the old format, even if we no longer
      output it, so that upgrading from an older version of libvirt is
      seamless.
      
      * docs/schemas/domaincommon.rng (diskMirror): Alter definition.
      * src/conf/domain_conf.c (virDomainDiskDefParseXML): Parse two
      styles of mirror elements.
      (virDomainDiskDefFormat): Output new style.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror-old.xml: New
      file, copied from...
      * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: ...here
      before modernizing.
      * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old*: New
      files.
      * tests/qemuxml2xmltest.c (mymain): Test both styles.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7c6fc394
  2. 06 6月, 2014 21 次提交
    • E
      conf: store mirroring information in virStorageSource · 7b7bf001
      Eric Blake 提交于
      The current implementation of 'virsh blockcopy' (virDomainBlockRebase)
      is limited to copying to a local file name.  But future patches want
      to extend it to also copy to network disks.  This patch converts over
      to a virStorageSourcePtr, although it should have no semantic change
      visible to the user, in anticipation of those future patches being
      able to use more fields for non-file destinations.
      
      * src/conf/domain_conf.h (_virDomainDiskDef): Change type of
      mirror information.
      * src/conf/domain_conf.c (virDomainDiskDefParseXML): Localize
      mirror parsing into new object.
      (virDomainDiskDefFormat): Adjust clients.
      * src/qemu/qemu_domain.c (qemuDomainDeviceDefPostParse):
      Likewise.
      * src/qemu/qemu_driver.c (qemuDomainBlockPivot)
      (qemuDomainBlockJobImpl, qemuDomainBlockCopy): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7b7bf001
    • E
      conf: store disk source as pointer, for easier manipulation · c123ef71
      Eric Blake 提交于
      As part of the work on backing chains, I'm finding that it would
      be easier to directly manipulate chains of pointers (adding a
      snapshot merely adjusts pointers to form the correct list) rather
      than copy data from one struct to another.  This patch converts
      domain disk source to be a pointer.
      
      In this patch, the pointer is ALWAYS allocated (thanks in part to
      the previous patch forwarding all disk def allocation through a
      common point), and all other changse are just mechanical fallout of
      the new type; there should be no functional change.  It is possible
      that we may want to leave the pointer NULL for a cdrom with no
      medium in a later patch, but as that requires a closer audit of the
      source to ensure we don't fault on a null dereference, I didn't do
      it here.
      
      * src/conf/domain_conf.h (_virDomainDiskDef): Change type of src.
      * src/conf/domain_conf.c: Adjust all clients.
      * src/security/security_selinux.c: Likewise.
      * src/qemu/qemu_domain.c: Likewise.
      * src/qemu/qemu_command.c: Likewise.
      * src/qemu/qemu_conf.c: Likewise.
      * src/qemu/qemu_process.c: Likewise.
      * src/qemu/qemu_migration.c: Likewise.
      * src/qemu/qemu_driver.c: Likewise.
      * src/lxc/lxc_driver.c: Likewise.
      * src/lxc/lxc_controller.c: Likewise.
      * tests/securityselinuxlabeltest.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c123ef71
    • E
      conf: consolidate disk def allocation · bc3f5f19
      Eric Blake 提交于
      A future patch wants to create disk definitions with non-zero
      default contents; to avoid crashes, all callers that allocate
      a disk definition should go through a common point.
      
      I found allocation points by looking for any code that increments
      ndisks, as well as any matches for ALLOC.*disk.  Most places that
      modified ndisks were covered by the parse from XML to domain/device
      definition by initial domain creation or device hotplug; I also
      hand-checked all drivers that generate a device struct on the
      fly during getXMLDesc.
      
      * src/conf/domain_conf.h (virDomainDiskDefNew): New prototype.
      * src/conf/domain_conf.c (virDomainDiskDefNew): New function.
      (virDomainDiskDefParseXML): Use it.
      * src/parallels/parallels_driver.c (parallelsAddHddInfo):
      Likewise.
      * src/qemu/qemu_command.c (qemuParseCommandLine): Likewise.
      * src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc): Likewise.
      * src/vmx/vmx.c (virVMXParseDisk): Likewise.
      * src/xenxs/xen_sxpr.c (xenParseSxprDisks, xenParseSxpr):
      Likewise.
      * src/xenxs/xen_xm.c (xenParseXM): Likewise.
      * src/libvirt_private.syms (domain_conf.h): Export it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      bc3f5f19
    • E
      conf: store snapshot source as pointer, for easier manipulation · 00c6327a
      Eric Blake 提交于
      As part of the work on backing chains, I'm finding that it would
      be easier to directly manipulate chains of pointers (adding a
      snapshot merely adjusts pointers to form the correct list) rather
      than copy data from one struct to another. This patch converts
      snapshot source to be a pointer.
      
      In this patch, the pointer is ALWAYS allocated (any code that
      increases ndisks now also allocates a source pointer for each
      new disk), and all other changes are just mechanical fallout of
      the new type; there should be no functional change.  It is
      possible that we may want to leave the pointer NULL for internal
      snapshots in a later patch, but as that requires a closer audit
      of the source to ensure we don't fault on a null dereference, I
      didn't do it here.
      
      * src/conf/snapshot_conf.h (_virDomainSnapshotDiskDef): Change
      type of src.
      * src/conf/snapshot_conf.c: Adjust all clients.
      * src/qemu/qemu_conf.c: Likewise.
      * src/qemu/qemu_driver.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      00c6327a
    • J
      Fix virbitmaptest on 32-bit · 61c44f58
      Ján Tomko 提交于
      My commit 7d8afc47 was passing the incorrect size to
      virBitmapDataToString in the newly added test.
      61c44f58
    • M
      nodedev: Export NUMA node locality for PCI devices · 1c702778
      Michal Privoznik 提交于
      A PCI device can be associated with a specific NUMA node. Later, when
      a guest is pinned to one NUMA node the PCI device can be assigned on
      different NUMA node. This makes DMA transfers travel across nodes and
      thus results in suboptimal performance. We should expose the NUMA node
      locality for PCI devices so management applications can make better
      decisions.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      1c702778
    • J
      Implement pretty flag for vcpuinfo and nodecpumap · a3173fef
      Ján Tomko 提交于
      Report CPU affinities / online CPUs in human-readable form when
      this flag is present:
      
      Before:
      CPU Affinity:   y-yy
      
      After:
      CPU Affinity:   0,2-3 (out of 4)
      
      https://bugzilla.redhat.com/show_bug.cgi?id=985980
      a3173fef
    • J
      Introduce virBitmapDataToString · 7d8afc47
      Ján Tomko 提交于
      For converting bitmap data to human-readable strings.
      7d8afc47
    • J
      Always report an error if virBitmapFormat fails · d4edce5f
      Ján Tomko 提交于
      It already reports an error if STRDUP fails.
      d4edce5f
    • J
      Format NULL bitmap as an empty string · cd09ab4d
      Ján Tomko 提交于
      This simplifies the usage in {libxl,qemu}DomainGetNumaParameters
      and it's needed for consistent error reporting in virBitmapFormat.
      
      Also remove the forgotten ATTRIBUTE_NONNULL marker.
      cd09ab4d
    • J
      virsh: Separate API calls and result printing in cmdVcpuinfo · 8f3f51b7
      Ján Tomko 提交于
      This allows reuse of the result printing code.
      8f3f51b7
    • J
      virsh: Invert logic in cmdVcpuinfo · bec105e6
      Ján Tomko 提交于
      Initialize 'ret' to false and introduce a cleanup label.
      bec105e6
    • A
      Parallels: Include CPU info in the capabilities XML · 4d06af97
      Alexander Burluka 提交于
      Openstack uses (or will start to using) CPU info from the
      capabilities XML. So this section is expanded, added CPU info
      about arch, type and info about number of cores, sockets and threads.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      4d06af97
    • A
      Parallels: add connectBaselineCPU() · d1c69d41
      Alexander Burluka 提交于
      Openstack Nova (starting at Icehouse release) requires this function
      to start VM.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d1c69d41
    • A
      Parallels: add domainGetVcpus() · e721e9e6
      Alexander Burluka 提交于
      OpenStack Nova requires this function
      to start VM instance. Cpumask info is obtained via prlctl utility.
      Unlike KVM, Parallels Cloud Server is unable to set cpu affinity
      mask for every VCpu. Mask is unique for all VCpu. You can set it
      using 'prlctl set <vm_id|vm_name> --cpumask <{n[,n,n1-n2]|all}>'
      command. For example, 'prlctl set SomeDomain --cpumask 0,1,5-7'
      would set this mask to yy---yyy.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e721e9e6
    • M
    • M
      Remove unnecessary empty first lines · 3de462fe
      Martin Kletzander 提交于
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      3de462fe
    • M
      translations: Don't leave default template fields in .po files · 96698b54
      Martin Kletzander 提交于
      New gettext-0.19 doesn't like it and we can't build without it.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      96698b54
    • J
      Fix storage format probing · c110cdb2
      Ján Tomko 提交于
      Commit fff74b27 moved the probing into virStorageFileGetMetadataFromBuf
      but didn't update the format in volume definition.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1104908
      c110cdb2
    • J
      Simplify conditions in virStorageBackendProbeTarget · effbb11e
      Ján Tomko 提交于
      Jump out early if no metadata was detected (for directories).
      Join the error and cleanup labels.
      effbb11e
    • J
      Don't reuse 'ret' variable in virStorageBackendProbeTarget · febcb89c
      Ján Tomko 提交于
      To match the convention:
      ret - current function's return value
      rc - other function's return values
      febcb89c
  3. 05 6月, 2014 6 次提交
    • M
      formatcaps: Rework and add stubs to document · e9f4729a
      Michal Privoznik 提交于
      At the moment we are missing even basic documentation on our
      capabilities XML. Without demand on completeness, I'm
      reorganizing the document structure and adding very basic
      documentation to two major components of the capabilities XML.
      These stubs are intended to be enhanced in the future.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      e9f4729a
    • M
      vircaps2xmltest: Introduce basic testing · 6af06232
      Michal Privoznik 提交于
      For now only one test is introduced. It's purpose in life
      is to check we don't break NUMA host distances XML format.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      6af06232
    • J
      libxl: add migration support · 9b8d6e1e
      Jim Fehlig 提交于
      This patch adds initial migration support to the libxl driver,
      using the VIR_DRV_FEATURE_MIGRATION_PARAMS family of migration
      functions.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      9b8d6e1e
    • J
      libxl: introduce libxlDomainDefCheckABIStability · d9a099a4
      Jim Fehlig 提交于
      Introduce a simple libxlDomainDefCheckABIStability() function that
      can be used check ABI stability between two virDomainDef objects.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      d9a099a4
    • E
      maint: detect VPATH builds when checking for gnulib update · 3cbd3b8e
      Eric Blake 提交于
      I accidentally typed 'make' in the srcdir of a VPATH build, and
      was surprised to see this:
      
      $ make
      /bin/sh: s/^[ +-]//;s/ .*//: No such file or directory
      INFO: gnulib update required; running ./autogen.sh first
      make: -n: Command not found
      ./autogen.sh
      I am going to run ./configure with no arguments - if you wish
      to pass any to it, please specify them on the ./autogen.sh command line.
      running bootstrap...
      ./bootstrap: Bootstrapping from checked-out libvirt sources...
      ./bootstrap: getting gnulib files...
      
      Oops - we're trying to execute some fairly bogus command names,
      and then trying to configure in-tree (which breaks all existing
      VPATH builds, since automake refuses to do a VPATH build if it
      detects an in-tree configure).  The third line (executing "-n")
      is fixed by updating to the latest gnulib; the rest of the problem
      is fixed by copying the same filtering in our cfg.mk as what
      gnulib just added, so that we avoid any $(shell) invocations which
      in turn depend on variables that are only populated by a working
      Makefile.  With that in place, we are back to the much nicer:
      
      $ make
      There seems to be no Makefile in this directory.
      You must run ./configure before running 'make'.
      make: *** [abort-due-to-no-makefile] Error 1
      
      Additionally, although harder to see - there was a trailing space in
      the message warning us that autogen would run an in-tree configure.
      
      * .gnulib: Update to latest, in part for maint.mk improvements.
      * cfg.mk (_update_required): Don't check for update in
      unconfigured directory.
      * autogen.sh (no_git): Drop trailing space.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3cbd3b8e
    • E
      maint: optimize locale.h syntax check · d804a58a
      Eric Blake 提交于
      Reusing the maint.mk code allows for a more efficient syntax check
      (fewer grep processes), and a more compact representation of what
      we are really checking for in commit 1919e355.
      
      * cfg.mk (sc_require_locale_h): Use maint.mk loop instead of
      rolling our own.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d804a58a
  4. 04 6月, 2014 5 次提交
    • M
      virnuma: Check for numa_bitmask_isbitset presence · 9e0cbcd8
      Michal Privoznik 提交于
      On some systems, libnuma can be present but it's so ancient that
      it misses some symbols that virNumaGetDistances() needs. To be
      more precise: numa_bitmask_isbitset() and numa_nodes_ptr are the
      symbols in question. Fortunately, they were both introduced in
      the same release so it's sufficient for us to check for only one
      of them. And the winner is numa_bitmask_isbitset().
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      9e0cbcd8
    • M
      cfg.mk: Introduce rule for setlocale() · 1919e355
      Michal Privoznik 提交于
      In the past we had some issues where setlocale() was called without
      corresponding include of locale.h. While on some systems this may
      work, on others the compilation failed. We should have a syntax-check
      rule for that to prevent this from happening again.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      1919e355
    • M
      virnuma: Implement virNumaGetDistances stub for non-NUMA · 3289edd2
      Michal Privoznik 提交于
      In case the libvirt is built without numactl support, we're
      missing the virNumaGetDistances() stub so the linking fails:
      
        CCLD     libvirt_lxc
      libvirt_lxc-nodeinfo.o: In function `virNodeCapsGetSiblingInfo':
      /home/zippy/tmp/libvirt.git/src/nodeinfo.c:1763: undefined reference to `virNumaGetDistances'
      collect2: error: ld returned 1 exit status
      make[3]: *** [libvirt_lxc] Error 1
      
      The issue was introduced in 77c830d8.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      3289edd2
    • M
      virCaps: Expose distance between host NUMA nodes · 8ba0a58f
      Michal Privoznik 提交于
      If user or management application wants to create a guest,
      it may be useful to know the cost of internode latencies
      before the guest resources are pinned. For example:
      
      <capabilities>
      
        <host>
          ...
          <topology>
            <cells num='2'>
              <cell id='0'>
                <memory unit='KiB'>4004132</memory>
                <distances>
                  <sibling id='0' value='10'/>
                  <sibling id='1' value='20'/>
                </distances>
                <cpus num='2'>
                  <cpu id='0' socket_id='0' core_id='0' siblings='0'/>
                  <cpu id='2' socket_id='0' core_id='2' siblings='2'/>
                </cpus>
              </cell>
              <cell id='1'>
                <memory unit='KiB'>4030064</memory>
                <distances>
                  <sibling id='0' value='20'/>
                  <sibling id='1' value='10'/>
                </distances>
                <cpus num='2'>
                  <cpu id='1' socket_id='0' core_id='0' siblings='1'/>
                  <cpu id='3' socket_id='0' core_id='2' siblings='3'/>
                </cpus>
              </cell>
            </cells>
          </topology>
          ...
        </host>
        ...
      </capabilities>
      
      We can see the distance from node1 to node0 is 20 and within nodes 10.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      8ba0a58f
    • M
      virnuma: Introduce virNumaGetDistances · 77c830d8
      Michal Privoznik 提交于
      The API gets a NUMA node and find distances to other nodes.  The
      distances are returned in an array. If an item X within the array
      equals to value of zero, then there's no such node as X.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      77c830d8
  5. 03 6月, 2014 7 次提交
    • P
      tests: monitor: json: Fix error message when returning json in json · 9046f910
      Peter Krempa 提交于
      The qemu JSON monitor test allows to test also expected command
      arguments. As the error from the monitor simulator is returned as a
      simulated qemu error (in JSON) all other JSON contained in the error
      message needs to be escaped. This will happen if the monitor command
      under test receives a JSON array as an argument.
      
      This will improve the error message from:
      libvirt:  error : internal error: cannot parse json { "error":  { "desc":
      "Invalid value of argument 'keys' of command 'send-key': expected 'ble'
      got '[{"type":"number","data":43},{"type":"number","data":26},
      {"type":"number","data":46},{"type":"number","data":32}]'",
      "class": "UnexpectedCommand" } }: lexical error: invalid string in json text.
      
      To:
      libvirt: QEMU Driver error : internal error: unable to execute QEMU
      command 'send-key': Invalid value of argument 'keys' of command
      'send-key': expected 'ble' got '[{"type":"number","data":43},
      {"type":"number","data":26},{"type":"number","data":46},
      {"type":"number","data":32}]'
      
      This improvement will not have any effect on tests executing as
      expected, but it will help test development.
      9046f910
    • P
      network: bridge: Avoid memory leak from networkBuildDhcpDaemonCommandLine · 23c2763b
      Peter Krempa 提交于
      If the leasehelper_path couldn't be found the code would leak the
      freshly constructed command structure. Re-arrange code to avoid the
      problem.
      
      Found by coverity, broken by baafe668.
      23c2763b
    • P
      tests: Build virstoragetest only when storage driver is compiled too · 835dc013
      Peter Krempa 提交于
      virstoragetest now requires parts of the storage driver to be built.
      Without this change the test can't be compiled on platforms that don't
      build the storage driver (mingw).
      
      make[2]: *** No rule to make target `../src/libvirt_driver_storage_impl.la', needed by `virstoragetest.exe'.  Stop.
      
      Broken by commit 713cc3b0
      835dc013
    • P
      qemu: monitor: Fix type of holdtime argument in qemuMonitorJSONSendKey · ce2107a9
      Peter Krempa 提交于
      qemuMonitorJSONSendKey declares the "holdtime" argument as unsigned int
      while the command was constructed in qemuMonitorJSONMakeCommand using
      the "P" modifier which took a unsigned long from the variable
      arguments which then made it possible to access uninitialized memory.
      
      This broke the qemumonitorjsontest on 32bit fedora 20:
      64) qemuMonitorJSONSendKey
      ... libvirt: QEMU Driver error : internal error: unsupported data type 'W' for arg 'WVSƒì ‹D$0è‘wÿÿÃAå' FAILED
      
      Uncovered by upstream commit f744b831.
      
      Additionally add test for the hold-time option.
      ce2107a9
    • D
      libxl: Avoid possible use of uninitialized mem in libxlDomainStart · 10a99a6d
      Daniel P. Berrange 提交于
      The 'libxl_domain_config' object is stack allocated which means its
      memory contents are undefined. The libxl_domain_config_dispose() call
      is only safe if the memory is initialized to a defined state. Not all
      code paths which reach libxl_domain_config_dispose() will ensure that
      libxl_domain_config_init() is called. Move the libxl_domain_config_init()
      call earlier in the function to ensure all codepaths have defined
      memory state.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      10a99a6d
    • D
      libxl: Move virDomainXMLOptionNew into libxlCreateXMLConf · 3bab69c3
      Daniel P. Berrange 提交于
      To allow the test suite to creat the XML option object,
      move the virDomainXMLOptionNew call into a libxlCreateXMLConf
      method.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      3bab69c3
    • D
      libxl: Don't pass libxlDriverPrivatePtr into libxlBuildDomainConfig · a6abdbf6
      Daniel P. Berrange 提交于
      To make it easier to test, change libxlBuildDomainConfig so
      that it takes a virPortAllocatorPtr instead of the larger
      libxlDriverPrivatePtr object.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a6abdbf6