1. 23 8月, 2011 1 次提交
  2. 19 8月, 2011 3 次提交
    • E
      virsh: properly interleave shared stdout and stderr · baac9c37
      Eric Blake 提交于
      Without this patch, invoking 'virsh >file 2>&1' results in
      error messages appearing before normal output, even if they
      occurred later in time than the normal output (since stderr
      is unbuffered, but stdout waits until a full buffer).
      
      * tools/virsh.c (print_job_progress, vshError): Flush between
      stream transitions.
      * tests/undefine: Test it.
      baac9c37
    • E
      maint: simplify lots of libxml2 clients · d89dd42d
      Eric Blake 提交于
      Repetitive patterns should be factored.  The sign of a good
      factorization is a change that kills 5x more lines than it adds :)
      
      * src/conf/domain_conf.c (virDomainDeviceDefParse)
      (virDomainSnapshotDefParseString): Use new convenience macros.
      * src/conf/storage_conf.c (virStoragePoolDefParseSourceString):
      Likewise.
      * src/cpu/cpu.c (cpuCompareXML, cpuBaselineXML): Likewise.
      * src/esx/esx_vi.c (esxVI_Context_Execute): Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationCookieXMLParseStr):
      Likewise.
      * src/security/virt-aa-helper.c (caps_mockup): Likewise.
      * src/test/test_driver.c (testOpenFromFile): Likewise.
      * tests/cputest.c (cpuTestLoadXML, cpuTestLoadMultiXML):
      Likewise.
      * tools/virsh.c (cmdFreecell, makeCloneXML, cmdVNCDisplay)
      (cmdTTYConsole, cmdDetachInterface, cmdDetachDisk)
      (cmdSnapshotCreate, cmdSnapshotCreateAs, cmdSnapshotCurrent)
      (cmdSnapshotList, cmdSnapshotParent): Likewise.
      d89dd42d
    • E
      maint: treat more libxml2 functions as free-like · e472fe25
      Eric Blake 提交于
      * cfg.mk (useless_free_options): Add xmlFreeDoc, xmlBufferFree.
      * src/esx/esx_vi.c (ESX_VI__TEMPLATE__FREE): Fix offenders.
      * tools/virsh.c (cmdFreecell, cmdVNCDisplay, cmdTTYConsole)
      (cmdDetachInterface, cmdDetachDisk, cmdSnapshotCreate)
      (cmdSnapshotCreateAs, cmdSnapshotList, cmdSnapshotParent):
      Likewise.
      e472fe25
  3. 17 8月, 2011 2 次提交
    • E
      virsh: concatenate qemu-monitor-command arguments · 531c8581
      Eric Blake 提交于
      Call me lazy, but:
      
      virsh qemu-monitor-command dom --hmp info status
      
      is nicer than:
      
      virsh qemu-monitor-command dom --hmp 'info status'
      
      * tools/virsh.c (cmdQemuMonitorCommand): Allow multiple arguments,
      for convenience.
      531c8581
    • E
      virsh: tweak misleading wording · cfbccb38
      Eric Blake 提交于
      Fixes confusing docs introduced in commit 98369d31.
      
      * tools/virsh.c (cmdSnapshotParent): Operates on named snapshot,
      not current.
      cfbccb38
  4. 13 8月, 2011 2 次提交
  5. 12 8月, 2011 3 次提交
    • E
      virsh: don't reject undefine on active domain · 9a0ec363
      Eric Blake 提交于
      The public API documents that undefine may be used to transition a
      running persistent domain into a transient one.  Many drivers still
      do not support this usage, but virsh shouldn't be getting in the
      way of those that do support it.
      
      This also drops a redundant conditional; vshCommandOptString
      guaranteed that name was non-NULL.
      
      * tools/virsh.c (cmdUndefine): Allow undefine on active domains;
      the drivers may still reject it, but it is a valid API usage.
      * tests/undefine (error): Fix the test to match.
      9a0ec363
    • P
      virsh: Add dir type for listing volumes with vol-list · 594f564c
      Peter Krempa 提交于
      Fix of output of detailed volume list. BZ #727088
      594f564c
    • E
      virsh: add snapshot-parent · 98369d31
      Eric Blake 提交于
      Down the road, I want to add virDomainSnapshotGetParent, and use
      the new API rather than xml scraping; but this virsh command can
      be implemented even without the new API.
      
      * tools/virsh.c (cmdSnapshotParent): New command.
      * tools/virsh.pod (snapshot-parent): Document it.
      98369d31
  6. 11 8月, 2011 2 次提交
    • E
      virsh: add virsh snapshot-current --name · 23b4a3f9
      Eric Blake 提交于
      Sometimes, full XML is too much; since most snapshot commands
      operate on a snapshot name, there should be an easy way to get
      at the current snapshot's name.  For example:
      
      virsh snapshot-revert dom `virsh snapshot-current dom --name`
      
      * tools/virsh.c (cmdSnapshotCurrent): Add an option.
      * tools/virsh.pod (snapshot-current): Document it.
      23b4a3f9
    • E
      virsh: fix snapshot-create-as to handle arbitrary names · 69278878
      Eric Blake 提交于
      Found this working on the next patch to use xpath to parse
      arbitrary names back out.
      
      * tools/virsh.c (cmdSnapshotCreateAs): Escape user input.
      69278878
  7. 02 8月, 2011 1 次提交
  8. 01 8月, 2011 1 次提交
    • M
      virsh: Fix vol-name and vol-pool commands · c9ee3d26
      Matthias Bolte 提交于
      This commands don't have a --pool option, so don't tell
      vshCommandOptVolBy that there could be one. This made
      vshCommandOptString for pooloptname fail and an "missing option"
      error was reported.
      
      Make pooloptname optional for vshCommandOptVolBy.
      c9ee3d26
  9. 28 7月, 2011 3 次提交
    • A
      virsh: avoid missing zero value judgement in cmdBlkiotune · 3f39a0bf
      Alex Jia 提交于
      * tools/virsh.c: fix missing zero value judgement in cmdBlkiotune and correct
        vshError information.
      
        when weight is equal to 0, the cmdBlkiotune will not raise any error information
        when judge weight value first time, and execute else branch to judge weight
        value again, strncpy(temp->field, VIR_DOMAIN_BLKIO_WEIGHT, sizeof(temp->field))
        will be not executed for ever. However, if and only if param->field is equal
        to VIR_DOMAIN_BLKIO_WEIGHT, underlying qemuDomainSetBlkioParameters function
        will check whether weight value is in range [100, 1000].
      
      * how to reproduce?
      
        % virsh blkiotune ${guestname} --weight 0
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      3f39a0bf
    • A
      virsh: fix memory leak in cmdVolPath code · 1768bf63
      Alex Jia 提交于
      * tools/virsh.c: avoid memory leak in cmdVolPath.
      * src/libvirt.c: Add doc for virStorageVolGetPath to tell one
        must free() the returned path after use.
      
      * how to reproduce?
      
      % dd if=/dev/zero of=/var/lib/libvirt/images/foo.img count=1 bs=10M
      % virsh pool-refresh default
      % valgrind -v --leak-check=full virsh vol-path --vol \
      /var/lib/libvirt/images/foo.img
      
      * actual results:
      
      Detected in valgrind run:
      
      ==16436== 32 bytes in 1 blocks are definitely lost in loss record 7 of 22
      ==16436==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
      ==16436==    by 0x386A314B3D: xdr_string (in /lib64/libc-2.12.so)
      ==16436==    by 0x3DF8CD770D: xdr_remote_nonnull_string (remote_protocol.c:3
      ==16436==    by 0x3DF8CD7EC8: xdr_remote_storage_vol_get_path_ret
      % virsh pool-refresh default
      % valgrind -v --leak-check=full virsh vol-path --vol \
      /var/lib/libvirt/images/foo.img
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      1768bf63
    • E
      virsh: expose change-protection during migration · 0d0bf850
      Eric Blake 提交于
      * tools/virsh.c (doMigrate): Add --change-protection flag.
      * tools/virsh.pod (migrate): Document it.
      0d0bf850
  10. 26 7月, 2011 3 次提交
    • A
      tools: format percent strings of nodecpustats · 831c81fc
      Alex Jia 提交于
      * tools/virsh.c: format strings display for virsh nodecpustats --percent.
      
      * how to reproduce?
      
      % virsh nodecpustats --percent
      usage:            2.0%
          user  :       1.0%
          system:       1.0%
      idle  :          98.0%
      iowait:           0.0%
      
      * after format strings
      
      % virsh nodecpustats --percent
      usage:            2.0%
      user:             1.0%
      system:           1.0%
      idle:            98.0%
      iowait:           0.0%
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      831c81fc
    • E
      virsh: use faster bit search · 7e853d6c
      Eric Blake 提交于
      Now that gnulib gives us ffs, we might as well use it.
      
      * tools/virsh.c (vshCmddefGetData): Use ffs rather than
      count_one_bits.
      7e853d6c
    • E
      virsh: make vcpucount use --current consistently · 4b7a8e9c
      Eric Blake 提交于
      Rename the existing --current flag to the new name --active,
      while adding a new flag --current to expose the new
      VIR_DOMAIN_AFFECT_CURRENT flag of virDomainGetVcpusFlags.
      
      For backwards compability, the output does not change (even
      though the label "current" no longer matches the spelling of
      the option that would trigger that number in isolation), and
      we accept "--current --live" as an undocumented synonym for
      "--active --live" to avoid breaking any existing clients.
      
      * tools/virsh.c (cmdVcpucount): Add --active flag, and rearrange
      existing flag handling to expose VIR_DOMAIN_AFFECT_CURRENT support.
      * tools/virsh.pod (vcpucount): Document this.
      4b7a8e9c
  11. 22 7月, 2011 5 次提交
    • A
      Enable the virDomainBlockPull API in virsh · b31abc6f
      Adam Litke 提交于
      Define two new virsh commands:
       * blockpull: Initiate a blockPull for the given disk
       * blockjob: Retrieve progress info, modify speed, and cancel active block jobs
      
      Share print_job_progress() with the migration code.
      
      * tools/virsh.c: implement the new commands
      b31abc6f
    • E
      save: add virsh commands for manipulating save files · bfb485ce
      Eric Blake 提交于
      Now you can edit a saved state file even if you forgot to grab
      a dumpxml file prior to saving a domain.  Plus, in-place editing
      feels so much nicer.
      
      * tools/virsh.c (cmdSaveImageDumpxml, cmdSaveImageDefine)
      (cmdSaveImageEdit): New commands.
      * tools/virsh.pod (save-image-dumpxml, save-image-define)
      (save-image-edit): Document them.
      bfb485ce
    • E
      save: support --xml to virsh save/restore · 38149ec1
      Eric Blake 提交于
      Also, migrate was missing documentation for the --xml option
      added in commit ec5301cb.
      
      * tools/virsh.c (cmdSave, cmdRestore): Add xml argument.
      * tools/virsh.pod (save, restore, migrate): Document it.
      38149ec1
    • 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
  12. 21 7月, 2011 1 次提交
  13. 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
  14. 19 7月, 2011 4 次提交
    • 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
    • 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
  15. 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
  16. 15 7月, 2011 1 次提交
  17. 14 7月, 2011 5 次提交