1. 22 7月, 2011 2 次提交
    • E
      save: add --bypass-cache flag to virsh save/restore operations · a779d2ff
      Eric Blake 提交于
      Wire up the new flag to several virsh commands.  Also, the
      'dump' command had undocumented flags.
      
      * tools/virsh.c (cmdSave, cmdManagedSave, cmdDump, cmdStart)
      (cmdRestore): Add new flag.
      * tools/virsh.pod (save, managedsave, dump, start, restore):
      Document flags.
      a779d2ff
    • E
      build: rename files.h to virfile.h · 8e22e089
      Eric Blake 提交于
      In preparation for a future patch adding new virFile APIs.
      
      * src/util/files.h, src/util/files.c: Move...
      * src/util/virfile.h, src/util/virfile.c: ...here, and rename
      functions to virFile prefix.  Macro names are intentionally
      left alone.
      * *.c: All '#include "files.h"' uses changed.
      * src/Makefile.am (UTIL_SOURCES): Reflect rename.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_close): Likewise.
      * src/libvirt_private.syms: Likewise.
      * docs/hacking.html.in: Likewise.
      * HACKING: Regenerate.
      8e22e089
  2. 21 7月, 2011 1 次提交
  3. 20 7月, 2011 1 次提交
    • O
      undefine: Extend virsh undefine to support the new flag · 83e849c1
      Osier Yang 提交于
      If the domain has managed save image, and --managed-save is
      not specified, then it fails with an error telling the user
      that a managed save image still exists.
      
      If the domain has managed save image, and --managed-save is
      specified, it invokes virDomainUndefineFlags. If
      virDomainUndefineFlags fails, then it tries to remove the managed
      save image using virDomainManagedSaveRemove first, with
      invoking virDomainUndefine following. (For compatibility between
      new virsh with this patch and older libvirt without this patch).
      
      Similarly if the domain has no managed save image. See the codes for
      detail.
      
      NOTE: Have not removing the codes checking if the domain is running
      in function "cmdUndefine", it will go along with qemu driver's fix
      (allow to undefine a running domain).
      83e849c1
  4. 19 7月, 2011 6 次提交
    • E
      Revert "virsh: make migrate --tunnelled imply --p2p" · 74594c57
      Eric Blake 提交于
      This reverts commit 40143fb6.
      
      The patch prevents future compatibility if migration ever learns
      how to do tunnelled without p2p.
      74594c57
    • O
      virsh: Extend virsh dominfo to display if managed save image exists · 73d4625a
      Osier Yang 提交于
      * tools/virsh.c: new column "Managed save" for "cmdDominfo".
      * tools/virsh.pod: Update document of "managedsave" to tell one can
        use "dominfo" to query whether a domain has any managed save image.
      73d4625a
    • O
      doc: Correct documents for iface commands · dde56813
      Osier Yang 提交于
      The problems:
          * Duplicate documents for "iface-name"
          * Lacks of document for "iface-mac"
          * Inconsistent option names with virsh help strings.
      dde56813
    • E
      virsh: make migrate --tunnelled imply --p2p · 40143fb6
      Eric Blake 提交于
      We can make the virsh migrate UI friendlier by supplying the
      missing bit automatically instead of erroring out when requesting
      --tunnelled without --p2p.
      
      * tools/virsh.c (doMigrate): Make --p2p optional when using
      --tunnelled.
      * tools/virsh.pod (migrate): Tweak wording accordingly.
      40143fb6
    • A
      virsh: avoid double free of domain · 6f669d4e
      Alex Jia 提交于
      * tools/virsh.c: avoid double free of domain, when weight value of blkiotune
        less than 0, codes will free domain and jump to cleanup section, however,
        cleanup will free domain again.
      
      Detected in valgrind run:
      
      ==21297== ERROR SUMMARY: 20 errors from 20 contexts (suppressed: 69 from 8)
      ==21297==
      ==21297== 1 errors in context 1 of 20:
      ==21297== Invalid read of size 4
      ==21297==    at 0x40E209B: virDomainFree (libvirt.c:2096)
      ==21297==    by 0x8065274: cmdBlkiotune (virsh.c:3695)
      ==21297==    by 0x8054CC1: vshCommandRun (virsh.c:13135)
      ==21297==    by 0x806B967: main (virsh.c:14487)
      ==21297==  Address 0x446ad48 is 0 bytes inside a block of size 36 free'd
      ==21297==    at 0x4005B0A: free (vg_replace_malloc.c:325)
      ==21297==    by 0x406814D: virFree (memory.c:310)
      ==21297==    by 0x40D6635: virReleaseDomain (datatypes.c:243)
      ==21297==    by 0x40D6C5E: virUnrefDomain (datatypes.c:280)
      ==21297==    by 0x40E20B9: virDomainFree (libvirt.c:2101)
      ==21297==    by 0x8065297: cmdBlkiotune (virsh.c:3613)
      ==21297==    by 0x8054CC1: vshCommandRun (virsh.c:13135)
      ==21297==    by 0x806B967: main (virsh.c:14487)
      ==21297==
      ==21297==
      ==21297== 1 errors in context 2 of 20:
      ==21297== Invalid read of size 4
      ==21297==    at 0x40E1FE6: virDomainFree (libvirt.c:2092)
      ==21297==    by 0x8065274: cmdBlkiotune (virsh.c:3695)
      ==21297==    by 0x8054CC1: vshCommandRun (virsh.c:13135)
      ==21297==    by 0x806B967: main (virsh.c:14487)
      ==21297==  Address 0x446ad48 is 0 bytes inside a block of size 36 free'd
      ==21297==    at 0x4005B0A: free (vg_replace_malloc.c:325)
      ==21297==    by 0x406814D: virFree (memory.c:310)
      ==21297==    by 0x40D6635: virReleaseDomain (datatypes.c:243)
      ==21297==    by 0x40D6C5E: virUnrefDomain (datatypes.c:280)
      ==21297==    by 0x40E20B9: virDomainFree (libvirt.c:2101)
      ==21297==    by 0x8065297: cmdBlkiotune (virsh.c:3613)
      ==21297==    by 0x8054CC1: vshCommandRun (virsh.c:13135)
      ==21297==    by 0x806B967: main (virsh.c:14487)
      
      * how to reproduce?
        % valgrind -v --leak-check=full virsh blkiotune guestname --weight -1
      6f669d4e
    • E
      docs: improve virsh man page synopses · 08d3b0a2
      Eric Blake 提交于
      "optional" is not a very good meta-syntactic construct in our man
      page.  I scrubbed this, and additionally improved some documentation
      on mutually exclusive options.  For example,
      
      [[--live] [--config] | [--current]]
      
      implies a set of optional flags, where within the set you can have
      either --current or a choice of 0, 1, or both --live and --config.
      
      * tools/virsh.pod: Use "[name]" rather than "optional name" for
      optional arguments.
      08d3b0a2
  5. 16 7月, 2011 2 次提交
    • E
      virsh: improve option handling · ca92c857
      Eric Blake 提交于
      The documentation for vshCommandOptString claims that it returns
      -1 on a missing required argument, but in reality, that error
      message was unreachable (it was buried inside an if clause that
      is true only if the argument was present).  The code was so hairy
      that I decided a rewrite would make it easier to understand,
      and actually return the error values we want.
      
      Meanwhile, our construction guarantees that all vshCmdOpt have
      a non-null def member, so there are some redundant checks that
      can be trimmed.
      
      * tools/virsh.c (vshCommandOpt): Alter signature.
      (vshCommandOptInt, vshCommandOptUInt, vshCommandOptUL)
      (vshCommandOptString, vshCommandOptLongLong)
      (vshCommandOptULongLong, vshCommandOptBool): Adjust all callers.
      (vshCommandOptArgv): Remove dead condition.
      ca92c857
    • H
      add --cache, --serial, --shareable and --address to attach-disk · e962a579
      Hu Tao 提交于
      This adds four options for virsh command attach-disk.
      
      --cache option allows user to specify cache mode of disk device
      from virsh command line when attaching a disk device.
      
      --serial option allows user to specify serial string of disk device
      from virsh command line when attaching a disk device.
      
      --shareable option allows user to specify whether the disk device is
      shareable between domains when attaching a disk device from virsh
      command line.
      
      --address option allows user to specify address of disk device when
      attaching a disk device.
      e962a579
  6. 15 7月, 2011 1 次提交
  7. 14 7月, 2011 6 次提交
  8. 12 7月, 2011 2 次提交
  9. 08 7月, 2011 2 次提交
    • E
      virsh: make destroy sound less scary · 085d2415
      Eric Blake 提交于
      Destroy has a rather negative English connotation.  Try to reduce
      the impact, so newbies aren't as scared to use it.
      
      * tools/virsh.c: Tweak all destroy documentation.
      * tools/virsh.pod: Likewise.
      085d2415
    • E
      build: use gnulib pthread_sigmask · 8437e738
      Eric Blake 提交于
      Gnulib finally learned how to do pthread_sigmask on mingw.
      
      * .gnulib: Update to latest, for pthread_sigmask.
      * bootstrap.conf (gnulib_modules): Add pthread_sigmask.
      * configure.ac (AC_CHECK_FUNCS): Drop redundant check.
      * src/rpc/virnetclient.c (virNetClientSetTLSSession)
      (virNetClientIOEventLoop): Make code unconditional.
      * src/util/command.c (virFork): Likewise.
      * tools/virsh.c (doMigrate, cmdMigrate): Likewise.
      8437e738
  10. 01 7月, 2011 2 次提交
    • E
      virsh: avoid uninitialized variable · cdb0e0dc
      Eric Blake 提交于
      Detected by Coverity; neither vshCmddefHelp nor vshCmdOptParse
      was initializing opts_required.
      
      * tools/virsh.c (vshCmddefOptParse): Always initialize bitmaps.
      cdb0e0dc
    • E
      virsh: avoid integer overflow · 6f9432fc
      Eric Blake 提交于
      Detected by Coverity.  info.nrVirtCpu is unsigned short, but if
      cpumaplen is int, then the product of the two in vshMalloc risks
      unintended sign extension.  cmdVcpuinfo had already solved this
      by using size_t cpumaplen.
      
      * tools/virsh.c (cmdVcpuPin): Use correct type.
      6f9432fc
  11. 30 6月, 2011 1 次提交
  12. 29 6月, 2011 2 次提交
    • E
      build: avoid pod2man on tarball · f1fea71d
      Eric Blake 提交于
      virt-sanlock-cleanup.8 has static contents (no dependency on
      configure), but is generated by pod2man (a perl dependency that
      maintainers must have, but which ordinary tarball users need
      not have).  Therefore, ensure that it is always part of the
      tarball, even though it is only conditionally installed.
      
      This is similar to commit 6db98a2d, but made simpler by the fact
      that the .8 page is static content.
      
      * tools/Makefile.am (EXTRA_DIST): Add virt-sanlock-cleanup.8.
      f1fea71d
    • D
      Support automatic creation of leases for disks in sanlock · 97e4f217
      Daniel P. Berrange 提交于
      The current sanlock plugin requires a central management
      application to manually add <lease> elements to each guest,
      to protect resources that are assigned to it (eg writable
      disks). This makes the sanlock plugin useless for usage
      in more ad hoc deployment environments where there is no
      central authority to associate disks with leases.
      
      This patch adds a mode where the sanlock plugin will
      automatically create leases for each assigned read-write
      disk, using a md5 checksum of the fully qualified disk
      path. This can work pretty well if guests are using
      stable disk paths for block devices eg /dev/disk/by-path/XXXX
      symlinks, or if all hosts have NFS volumes mounted in
      a consistent pattern.
      
      The plugin will create one lockspace for managing disks
      with filename /var/lib/libvirt/sanlock/__LIBVIRT__DISKS__.
      For each VM disks, there will be another file to hold
      a lease /var/lib/libvirt/sanlock/5903e5d25e087e60a20fe4566fab41fd
      Each VM disk lease is usually 1 MB in size. The script
      virt-sanlock-cleanup should be run periodically to remove
      unused lease files from the lockspace directory.
      
      To make use of this capability the admin will need to do
      several tasks:
      
       - Mount an NFS volume (or other shared filesystem)
         on /var/lib/libvirt/sanlock
       - Configure 'host_id' in /etc/libvirt/qemu-sanlock.conf
         with a unique value for each host with the same NFS
         mount
       - Toggle the 'auto_disk_leases' parameter in qemu-sanlock.conf
      
      Technically the first step can be skipped, in which case
      sanlock will only protect against 2 vms on the same host
      using the same disk (or the same VM being started twice
      due to error by libvirt).
      
      * src/locking/libvirt_sanlock.aug,
        src/locking/sanlock.conf,
        src/locking/test_libvirt_sanlock.aug: Add config params
        for configuring auto lease setup
      * libvirt.spec.in: Add virt-sanlock-cleanup program, man
        page
      * tools/virt-sanlock-cleanup.in: Script to purge unused
        disk resource lease files
      97e4f217
  13. 28 6月, 2011 1 次提交
  14. 27 6月, 2011 1 次提交
    • E
      build: rename Vcpupin to VcpuPin · 28e45afc
      Eric Blake 提交于
      We already have a public virDomainPinVcpu, which implies that
      Pin and Vcpu are treated as separate words.  Unreleased commit
      e261987c introduced virDomainGetVcpupinInfo as the first public
      API that used Vcpupin, although we had prior internal uses of
      that spelling.  For consistency, change the spelling to be two
      words everywhere, regardless of whether pin comes first or last.
      
      * daemon/remote.c: Treat vcpu and pin as separate words.
      * include/libvirt/libvirt.h.in: Likewise.
      * src/conf/domain_conf.c: Likewise.
      * src/conf/domain_conf.h: Likewise.
      * src/driver.h: Likewise.
      * src/libvirt.c: Likewise.
      * src/libvirt_private.syms: Likewise.
      * src/libvirt_public.syms: Likewise.
      * src/libxl/libxl_driver.c: Likewise.
      * src/qemu/qemu_driver.c: Likewise.
      * src/remote/remote_driver.c: Likewise.
      * src/xen/xend_internal.c: Likewise.
      * tools/virsh.c: Likewise.
      * src/remote/remote_protocol.x: Likewise.
      * src/remote_protocol-structs: Likewise.
      Suggested by Matthias Bolte.
      28e45afc
  15. 25 6月, 2011 2 次提交
  16. 24 6月, 2011 2 次提交
    • E
      Revert "Enable the virDomainBlockPull API in virsh" · f7f5e3e8
      Eric Blake 提交于
      This reverts commit 3e2493ce.
      f7f5e3e8
    • D
      Allow automatic kill of guests when a connection is closed · 3ba937da
      Daniel P. Berrange 提交于
      If an application is using libvirt + KVM as a piece of its
      internal infrastructure to perform a specific task, it can
      be desirable to guarentee the VM dies when the virConnectPtr
      disconnects from libvirtd. This ensures the app can't leak
      any VMs it was using. Adding VIR_DOMAIN_START_AUTOKILL as
      a flag when starting guests enables this to be done.
      
      * include/libvirt/libvirt.h.in: All VIR_DOMAIN_START_AUTOKILL
      * src/qemu/qemu_driver.c: Support automatic killing of guests
        upon connection close
      * tools/virsh.c: Add --autokill flag to 'start' and 'create'
        commands
      3ba937da
  17. 23 6月, 2011 1 次提交
    • E
      maint: remove syntax-check exception · 50a6a126
      Eric Blake 提交于
      We weren't using the @FOO@ notation for a Makefile substitution,
      but instead for a sed rule, so using [@]FOO@ instead avoids the
      need to exempt this syntax check.
      
      * cfg.mk (_makefile_at_at_check_exceptions): Delete.
      * tools/Makefile.am (virt-xml-validate, virt-pki-validate): Avoid
      tripping syntax-check.
      Reported by Daniel P. Berrange.
      50a6a126
  18. 22 6月, 2011 1 次提交
  19. 21 6月, 2011 4 次提交
    • C
      Promote virEvent*Handle/Timeout to public API · 6094ad7b
      Cole Robinson 提交于
      Since we virEventRegisterDefaultImpl is now a public API, callers need
      a way to invoke the default registered Handle and Timeout functions. We
      already have general functions for these internally, so promote
      them to the public API.
      
      v2:
          Actually add APIs to libvirt.h
      6094ad7b
    • E
      virsh: enhance snapshot-create-as · 9256ad84
      Eric Blake 提交于
      Similar to pool-create-as.
      
      * tools/virsh.c (cmdSnapshotCreateAs): Add --print-xml.
      * tools/virsh.pod: Document it.
      9256ad84
    • E
      virsh: add snapshot-create-as command · 1546dcf8
      Eric Blake 提交于
      Producing an xml file just for name and description fields is
      overkill; this makes life easier from virsh.
      
      * tools/virsh.c (cmdSnapshotCreateAs): New command.
      (snapshotCmds): Install it.
      * tools/virsh.pod: Document it.
      1546dcf8
    • E
      virsh: clarify snapshot vs. save · ea71d828
      Eric Blake 提交于
      * tools/virsh.c (info_snapshot_create, info_save): Clarify
      description.
      * tools/virsh.pod (save): Likewise.
      ea71d828