1. 25 6月, 2012 15 次提交
    • M
      storage: Introduce --inactive for pool-dumpxml · 8d27005b
      Michal Privoznik 提交于
      Storage is one of the last domains in libvirt where we don't fully
      utilize inactive and live XML. Okay, it might be because we don't
      have support for that. So implement such support. However, we need
      to fallback when talking to old daemon which doesn't support this
      new flag called VIR_STORAGE_XML_INACTIVE.
      8d27005b
    • M
      storage: Switch to new def on pool-destroy · 803dc0a5
      Michal Privoznik 提交于
      Currently, we share the idea of old & new def with domains. Users can
      *-edit an object (domain, pool) which spawns a new internal
      representation for them. This is referenced via
      {domainObj,poolObj}->newDef [compared to ->def]. However, for pool we
      were never overwriting def with newDef. This must be done on
      pool-destroy (like we do analogically in domain detroy).
      803dc0a5
    • M
      sanlock: Properly indent · 85ce9825
      Michal Privoznik 提交于
      One of latest patches (0fce94fe) didn't properly indented #define
      making syntax-check fail.
      85ce9825
    • D
      Fix compilation on older sanlock · 0fce94fe
      Daniel Veillard 提交于
      Temporary fix since compilation broke with older version of
      sanlock following acbd4965
      0fce94fe
    • D
      Remove stray debug fprintf in XML parser · 9273e07f
      Daniel P. Berrange 提交于
      9273e07f
    • D
      Support bind mounting host files, as well as directories in LXC · 465c055f
      Daniel J Walsh 提交于
      Currently libvirt-lxc checks to see if the destination exists and is a
      directory.  If it is not a directory then the mount fails.  Since
      libvirt-lxc can bind mount files on an inode, this patch is needed to
      allow us to bind mount files on files.  Currently we want to bind mount
      on top of /etc/machine-id, and /etc/adjtime
      
      If the destination of the mount point does not exists, it checks if the
      src is a directory and then attempts to create a directory, otherwise it
      creates an empty file for the destination.  The code will then bind mount
      over the destination.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      465c055f
    • D
      Allow NOCONFIGURE=1 to make autogen.sh skip ./configure · 63f5c83b
      Daniel P. Berrange 提交于
      Sometimes it is useful to re-bootstrap libvirt without running
      through a ./configure invocation immediately. eg if you want
      to run ./configure for Mingw32 rather than native.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      63f5c83b
    • D
      Fix unused parameters / functions in virsh on Win32 · 3b9ca940
      Daniel P. Berrange 提交于
      The vshPrintRaw function is not used on Win32, and neither
      is the 'msg' parameter of vshAskReedit. Change the nesting
      of #ifdef WIN32 conditionals to address this
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      3b9ca940
    • D
      Update to latest GNULIB to fix compat with Mingw64 toolchain · db835b7b
      Daniel P. Berrange 提交于
      On both x86_64-w64-mingw32 and i686-w64-mingw32 there were
      the following warnings/errors:
      
        CC     fstat.lo
      ../../../gnulib/lib/fstat.c:27:0: warning: "stat" redefined [enabled by default]
      In file included from ./sys/stat.h:32:0,
                       from ../../../gnulib/lib/fstat.c:25:
      /usr/x86_64-w64-mingw32/sys-root/mingw/include/sys/stat.h:258:0: note: this is the location of the previous definition
      ../../../gnulib/lib/fstat.c:28:0: warning: "fstat" redefined [enabled by default]
      In file included from ./sys/stat.h:32:0,
                       from ../../../gnulib/lib/fstat.c:25:
      /usr/x86_64-w64-mingw32/sys-root/mingw/include/sys/stat.h:259:0: note: this is the location of the previous definition
      
        CC     stat.lo
      ../../../gnulib/lib/stat.c:32:0: warning: "stat" redefined [enabled by default]
      In file included from ./sys/stat.h:32:0,
                       from ../../../gnulib/lib/stat.c:27:
      /usr/x86_64-w64-mingw32/sys-root/mingw/include/sys/stat.h:258:0: note: this is the location of the previous definition
      
        CC     stdio-read.lo
      ../../../gnulib/lib/stdio-read.c:102:1: error: redefinition of 'vscanf'
      In file included from ./stdio.h:43:0,
                       from ../../../gnulib/lib/stdio-read.c:21:
      /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:397:7: note: previous definition of 'vscanf' was here
      ../../../gnulib/lib/stdio-read.c:108:1: error: redefinition of 'vfscanf'
      In file included from ./stdio.h:43:0,
                       from ../../../gnulib/lib/stdio-read.c:21:
      /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:384:7: note: previous definition of 'vfscanf' was here
      make[3]: *** [stdio-read.lo] Error 1
      make[3]: Leaving directory `/home/berrange/src/virt/libvirt/build/gnulib/lib'
      
      While on x86_64-w64-mingw32 only there was:
      
      In file included from ../../../gnulib/lib/regex.c:69:0:
      ../../../gnulib/lib/regcomp.c: In function 'parse_dup_op':
      ../../../gnulib/lib/regcomp.c:2624:39: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      ../../../gnulib/lib/regcomp.c: In function 'mark_opt_subexp':
      ../../../gnulib/lib/regcomp.c:3859:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      db835b7b
    • D
      winsock2.h must always be included before windows.h · 931b7d19
      Daniel P. Berrange 提交于
      Some GNULIB headers (eg unistd.h) will often need to include
      winsock2.h for various symbols. There is a rule that winsock2.h
      must be included before windows.h. This means that any file
      which does
      
        #ifdef WIN32
        #include <windows.h>
        #endif
        #include <unistd.h>
      
      is potentially broken. A simple rule is that /all/ includes of
      windows.h must be matched with a preceding include of winsock2.h
      regardless of whether unistd.h is used currently
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      931b7d19
    • D
      Switch automated builds to use Mingw64 toolchain instead of Mingw32 · 6a714d31
      Daniel P. Berrange 提交于
      The Mingw32 toolchain is broadly obsoleted by the Mingw64 toolchain.
      The latter has been adopted by Fedora 17 and newer. Maintaining a
      RPM spec for Mingw32 is a needless burden, so switch to a Mingw64
      RPM spec (which provides 32 & 64 bit builds).
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      6a714d31
    • D
      virsh: Use virXPath wrappers for vncdisplay cmd · dcbfd572
      Doug Goldstein 提交于
      Update the vncdisplay command to use the virXPath wrappers as well as
      check if the domain is up rather than using the port set to -1 to mean
      the domain is not up.
      Signed-off-by: NDoug Goldstein <cardoe@cardoe.com>
      dcbfd572
    • D
      Add support for shared sanlock leases · acbd4965
      Daniel P. Berrange 提交于
      A sanlock lease can be marked as shared (rather
      than exclusive)  using SANLK_RES_SHARED flag. This
      adds support for that flag and ensures that in auto
      disk mode, any shared disks use shared leases. This
      also makes any read-only disks be completely
      ignored.
      
      These changes remove the need for the option
      
        ignore_readonly_and_shared_disks
      
      so that is removed
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      acbd4965
    • D
      Add support for guest bind mounts with LXC · 3b1ddec1
      Daniel P. Berrange 提交于
      Currently you can configure LXC to bind a host directory to
      a guest directory, but not to bind a guest directory to a
      guest directory. While the guest container init could do
      this itself, allowing it in the libvirt XML means a stricter
      SELinux policy can be written
      3b1ddec1
    • D
      Add support for RAM filesystems for LXC · 76b644c3
      Daniel P. Berrange 提交于
      Introduce a new syntax for filesystems to allow use of a RAM
      filesystem
      
         <filesystem type='ram'>
            <source usage='10' units='MiB'/>
            <target dir='/mnt'/>
         </filesystem>
      
      The usage units default to KiB to limit consumption of host memory.
      
      * docs/formatdomain.html.in: Document new syntax
      * docs/schemas/domaincommon.rng: Add new attributes
      * src/conf/domain_conf.c: Parsing/formatting of RAM filesystems
      * src/lxc/lxc_container.c: Mounting of RAM filesystems
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      76b644c3
  2. 23 6月, 2012 1 次提交
    • H
      fix a bug of ref count in virnetserver.c · 9c77bf04
      Hu Tao 提交于
      The test of ref count is not protected by lock, which is unsafe because
      the ref count may have been changed by other threads during the test.
      
      This patch fixes this.
      9c77bf04
  3. 22 6月, 2012 2 次提交
    • P
      virsh: Improve error when trying to change vm's cpu count 0 · de924ca9
      Peter Krempa 提交于
      This patch adds a check for the count of processors the user requests
      for the guest machine so that invalid values produce a more helpful
      error message.
      de924ca9
    • J
      Fix deadlock on libvirtd shutdown · 0dda594d
      Jim Fehlig 提交于
      When shutting down libvirtd, the virNetServer shutdown can deadlock
      if there are in-flight jobs being handled by virNetServerHandleJob().
      virNetServerFree() will acquire the virNetServer lock and call
      virThreadPoolFree() to terminate the workers, waiting for the workers
      to finish.  But in-flight workers will attempt to acquire the
      virNetServer lock, resulting in deadlock.
      
      Fix the deadlock by unlocking the virNetServer lock before calling
      virThreadPoolFree().  This is safe since the virNetServerPtr object
      is ref-counted and only decrementing the ref count needs to be
      protected.  Additionally, there is no need to re-acquire the lock
      after virThreadPoolFree() completes as all the workers have
      terminated.
      0dda594d
  4. 21 6月, 2012 8 次提交
    • G
      qemu: Add xhci support · fd4fd420
      Gerd Hoffmann 提交于
      qemu 1.1 features a xhci controller,
      this patch adds support for it.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      fd4fd420
    • P
      virsh: add support for virConnectListAllDomains and clean up cmdList · d62e51f8
      Peter Krempa 提交于
      This patch makes use of the newly added api virConnectListAllDomains()
      to list domains in virsh.
      
      Virsh now represents lists of domains using an internal structure
      vshDomainList. This structure contains the virDomainPtr list as provided
      by virConnectListAllDomains() and the count of domains in the list.
      
      For backwards compatibility, the function vshDomainListCollect was added
      that tries to enumerate the domains using the new API and if the API is
      not supported falls back to the older approach with the two list
      functions.  The helper function also simulates filtering by all
      currently supported flags added with virConnectListAllDomains().
      
      This patch also cleans up the "list" command handler to use the new
      helpers and adds new command line flags to make use of filtering.
      d62e51f8
    • P
      f1b872b2
    • O
      util: Fix the indention · fafb80a1
      Osier Yang 提交于
      src/util/util.c: virFileOpenAs.
      fafb80a1
    • J
      Initialize random generator in lxc controller · 57349ffc
      Jim Fehlig 提交于
      The lxc contoller eventually makes use of virRandomBits(), which was
      segfaulting since virRandomInitialize() is never invoked.
      
      Program received signal SIGSEGV, Segmentation fault.
      0x00007ffff554d560 in random_r () from /lib64/libc.so.6
      (gdb) bt
      0  0x00007ffff554d560 in random_r () from /lib64/libc.so.6
      1  0x0000000000469eaa in virRandomBits (nbits=32) at util/virrandom.c:80
      2  0x000000000045bf69 in virHashCreateFull (size=256,
          dataFree=0x4aa2a2 <hashDataFree>, keyCode=0x45bd40 <virHashStrCode>,
          keyEqual=0x45bdad <virHashStrEqual>, keyCopy=0x45bdfa <virHashStrCopy>,
          keyFree=0x45be37 <virHashStrFree>) at util/virhash.c:134
      3  0x000000000045c069 in virHashCreate (size=0, dataFree=0x4aa2a2 <hashDataFree>)
          at util/virhash.c:164
      4  0x00000000004aa562 in virNWFilterHashTableCreate (n=0)
          at conf/nwfilter_params.c:686
      5  0x00000000004aa95b in virNWFilterParseParamAttributes (cur=0x711d30)
          at conf/nwfilter_params.c:793
      6  0x0000000000481a7f in virDomainNetDefParseXML (caps=0x702c90, node=0x7116b0,
          ctxt=0x7101b0, bootMap=0x0, flags=0) at conf/domain_conf.c:4589
      7  0x000000000048cc36 in virDomainDefParseXML (caps=0x702c90, xml=0x710040,
          root=0x7103b0, ctxt=0x7101b0, expectedVirtTypes=16, flags=0)
          at conf/domain_conf.c:8658
      8  0x000000000048f011 in virDomainDefParseNode (caps=0x702c90, xml=0x710040,
          root=0x7103b0, expectedVirtTypes=16, flags=0) at conf/domain_conf.c:9360
      9  0x000000000048ee30 in virDomainDefParse (xmlStr=0x0,
          filename=0x702ae0 "/var/run/libvirt/lxc/x.xml", caps=0x702c90,
          expectedVirtTypes=16, flags=0) at conf/domain_conf.c:9310
      10 0x000000000048ef00 in virDomainDefParseFile (caps=0x702c90,
          filename=0x702ae0 "/var/run/libvirt/lxc/x.xml", expectedVirtTypes=16, flags=0)
          at conf/domain_conf.c:9332
      11 0x0000000000425053 in main (argc=5, argv=0x7fffffffe2b8)
          at lxc/lxc_controller.c:1773
      57349ffc
    • O
      storage: Set the perms if the pool target already exists for fs pools · e4cfe5f6
      Osier Yang 提交于
      The comment says:
      
      /* Now create the final dir in the path with the uid/gid/mode
       * requested in the config. If the dir already exists, just set
       * the perms.
       */
      
      However, virDirCreate is only invoked if the target path doesn't
      exist yet (which is opposite with the comment), or the uid from
      the config is not -1 (I don't understand why, think it's just
      another mistake). And the result is the perms of the pool won't
      be changed if one tries to build the pool with different perms
      again.
      
      Besides these logic error fix, if no uid and gid are specified in
      the config, the practical used uid, gid are reflected.
      e4cfe5f6
    • E
      snapshot: implement new APIs for esx and vbox · d4edc089
      Eric Blake 提交于
      The two new APIs are rather trivial; based on bits and pieces of
      other existing APIs.  But rather than blindly return 0 or 1 for
      HasMetadata, I chose to first validate that the snapshot in
      question in fact exists.
      
      * src/esx/esx_driver.c (esxDomainSnapshotIsCurrent)
      (esxDomainSnapshotHasMetadata): New functions.
      * src/vbox/vbox_tmpl.c (vboxDomainSnapshotIsCurrent)
      (vboxDomainSnapshotHasMetadata): Likewise.
      d4edc089
    • E
      snapshot: require existence before returning success · e3fe4102
      Eric Blake 提交于
      Blindly returning success is misleading if the object no longer
      exists; it is a bit better to check for existence up front before
      returning information about that object.  This pattern matches the
      fact that most of our other APIs check for existence as a side
      effect prior to getting at the real piece of information being
      queried.
      
      * src/esx/esx_driver.c (esxDomainIsUpdated, esxDomainIsPersistent):
      Add existence checks.
      * src/vbox/vbox_tmpl.c (vboxDomainIsPersistent)
      (vboxDomainIsUpdated): Likewise.
      e3fe4102
  5. 20 6月, 2012 13 次提交
    • P
      drivers: Implement virListAllDomains for drivers using virDomainObj · 33dc8cf0
      Peter Krempa 提交于
      This patch adds support for listing all domains into drivers that use
      the common virDomainObj implementation: libxl, lxc, openvz, qemu, test,
      uml, vmware.
      
      For drivers that don't support managed save images the guests are
      treated as if they had none, so filtering guests that do have such an
      image on this driver succeeds and produces 0 results.
      33dc8cf0
    • G
      openvz: check pointer size instead of int · 229773fc
      Guido Günther 提交于
      since int is 4 bytes on both i386 and amd64.
      229773fc
    • D
      Fix default USB controller for ppc64 · d1778b71
      Dipankar Sarma 提交于
      Fix the default usb controller for pseries systems if none
      specified.
      Signed-off-by: NDipankar Sarma <dipankar@in.ibm.com>
      d1778b71
    • E
      list: add qemu snapshot list support · 5488612e
      Eric Blake 提交于
      The two new functions are very similar to the existing functions;
      just a matter of different arguments and a call to a different
      helper function.
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotListNames)
      (qemuDomainSnapshotNum, qemuDomainSnapshotListChildrenNames)
      (qemuDomainSnapshotNumChildren): Support new flags.
      (qemuDomainListAllSnapshots): New functions.
      5488612e
    • E
      list: new helper function to collect snapshots · 8548a9c5
      Eric Blake 提交于
      Wraps the conversion from 'char *name' to virDomainSnapshotPtr in
      a reusable manner.
      
      * src/conf/virdomainlist.h (virDomainListSnapshots): New declaration.
      * src/conf/virdomainlist.c (virDomainListSnapshots): Implement it.
      * src/libvirt_private.syms (virdomainlist.h): Export it.
      8548a9c5
    • E
      list: provide RPC call for snapshots · dbb564f8
      Eric Blake 提交于
      The generator doesn't handle lists of virDomainSnapshotPtr, so
      this commit requires a bit more work than some RPC additions.
      
      * src/remote/remote_protocol.x
      (REMOTE_PROC_DOMAIN_LIST_ALL_SNAPSHOTS)
      (REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_ALL_CHILDREN): New RPC calls,
      with corresponding structs.
      * daemon/remote.c (remoteDispatchDomainListAllSnapshots)
      (remoteDispatchDomainSnapshotListAllChildren): New functions.
      * src/remote/remote_driver.c (remoteDomainListAllSnapshots)
      (remoteDomainSnapshotListAllChildren): Likewise.
      * src/remote_protocol-structs: Regenerate.
      dbb564f8
    • E
      list: provide python bindings for snapshots · f73d99c2
      Eric Blake 提交于
      This adds support for the new virDomainListAllSnapshots (a domain
      function) and virDomainSnapshotListAllChildren (a snapshot function)
      to the libvirt-python bindings.  The implementation is done manually
      as the generator does not support wrapping lists of C pointers into
      python objects.
      
      * python/libvirt-override.c (libvirt_virDomainListAllSnapshots)
      (libvirt_virDomainSnapshotListAllChildren): New functions.
      * python/libvirt-override-api.xml: Document them.
      * python/libvirt-override-virDomain.py (listAllSnapshots): New
      file.
      * python/libvirt-override-virDomainSnapshot.py (listAllChildren):
      Likewise.
      * python/Makefile.am (CLASSES_EXTRA): Ship them.
      f73d99c2
    • E
      list: use the new snapshot API in virsh when possible · a7f7bf02
      Eric Blake 提交于
      Using the new API is so much shorter than the rest of the remainder
      of the function.
      
      * tools/virsh.c (vshSnapshotList): Use the new API.
      a7f7bf02
    • E
      list: add virDomainListAllSnapshots API · 37bb0447
      Eric Blake 提交于
      There was an inherent race between virDomainSnapshotNum() and
      virDomainSnapshotListNames(), where an additional snapshot could
      be created in the meantime, or where a snapshot could be deleted
      before converting the name back to a virDomainSnapshotPtr.  It
      was also an awkward name: the function operates on domains, not
      domain snapshots.  virDomainSnapshotListChildrenNames() suffered
      from the same inherent race, although its naming was nicer.
      
      This patch makes things nicer by grabbing a snapshot list
      atomically, in the format most useful to the user.
      
      * include/libvirt/libvirt.h.in (virDomainListAllSnapshots)
      (virDomainSnapshotListAllChildren): New declarations.
      * src/libvirt.c (virDomainSnapshotListNames)
      (virDomainSnapshotListChildrenNames): Add cross-references.
      (virDomainListAllSnapshots, virDomainSnapshotListAllChildren):
      New functions.
      * src/libvirt_public.syms (LIBVIRT_0.9.13): Export them.
      * src/driver.h (virDrvDomainListAllSnapshots)
      (virDrvDomainSnapshotListAllChildren): New callbacks.
      * python/generator.py (skip_function): Prepare for later
      hand-written versions.
      37bb0447
    • E
      snapshot: expose new flags in virsh · 35ae18f3
      Eric Blake 提交于
      Previously, to get the name of all snapshots with children, it was
      necessary to get the name of all snapshots and then remove the
      name of leaf snapshots.  This is racy, and somewhat inefficient
      compared to planned API additions.  We can emulate --no-metadata on
      0.9.5-0.9.12, but for now, there is no emulation of --no-leaves.
      
      * tools/virsh.c (cmdSnapshotList): Add new options --no-leaves and
      --no-metadata.
      (vshSnapshotList): Emulate where possible.
      * tools/virsh.pod (snapshot-list): Document them.
      35ae18f3
    • E
      snapshot: add additional filters when getting lists · 5873f2e2
      Eric Blake 提交于
      It turns out that one-bit filtering makes it hard to select the inverse
      set, so it is easier to provide filtering groups.  For back-compat,
      omitting all bits within a group means the group is not used for
      filtering, and by definition of a group (each snapshot matches exactly
      one bit within the group, and the set of bits in the group covers all
      snapshots), selecting all bits also makes the group useless.
      
      Unfortunately, virDomainSnapshotListChildren defined the bit
      VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS as an expansion rather than a
      filter, so we cannot make it part of a filter group, so that bit
      (and its counterpart VIR_DOMAIN_SNAPSHOT_LIST_ROOTS for
      virDomainSnapshotList) remains a single control bit.
      
      * include/libvirt/libvirt.h.in (virDomainSnapshotListFlags): Add a
      couple more flags.
      * src/libvirt.c (virDomainSnapshotNum)
      (virDomainSnapshotNumChildren): Document them.
      (virDomainSnapshotListNames, virDomainSnapshotListChildrenNames):
      Likewise, and add thread-safety caveats.
      * src/conf/virdomainlist.h (VIR_DOMAIN_SNAPSHOT_FILTERS_*): New
      convenience macros.
      * src/conf/domain_conf.c (virDomainSnapshotObjListCopyNames)
      (virDomainSnapshotObjListCount): Support the new flags.
      5873f2e2
    • M
      virsh: fix few typos on desc command · 3dc733bb
      Martin Kletzander 提交于
      virsh help fix:
       - <--title> can also /get/ the title
      
      virsh man page:
       - missing <domain-id>
       - <new_desc> should be <new-desc>
      3dc733bb
    • M
      domain_conf: fix possible memory leak · 830d035f
      Martin Kletzander 提交于
      Until now, it was possible to crash libvirtd when defining domain with
      channel device with missing source element.
      
      When creating new virDomainChrDef, target.port is set to -1, but
      unfortunately it is an union with addresses that virDomainChrDefFree
      tries to free in case the deviceType is channel. Having the port set
      to -1 is intended, however the cleanest way to get around the problems
      with the crash seems to be renumbering the VIR_DOMAIN_CHR_CHANNEL_
      target types to cover new NONE type (with value 0) being the default
      (no target type yet).
      830d035f
  6. 19 6月, 2012 1 次提交
    • P
      error: Fix typos in argument checking macros · fbc72a1d
      Peter Krempa 提交于
      Macro virCheckNullArgGoto is supposed to check for NULL argument but
      checks non-NULL instead.
      
      Macro virCheckNonNullArgReturn reports error as if the argument should
      be NULL when it shouldn't.
      fbc72a1d