1. 11 10月, 2011 3 次提交
    • E
      snapshot: virsh snapshot-list and children · fe383bb5
      Eric Blake 提交于
      Sometimes, we only care about one branch of the snapshot hierarchy.
      Make it easier to list a single branch, by using the new APIs.
      
      Technically, I could emulate these new virsh options on old servers
      by doing a complete dump, then scraping xml to filter out just the
      snapshots that I care about, but I didn't want to do that in this patch.
      
      * tools/virsh.c (cmdSnapshotList): Add --from, --descendants.
      * tools/virsh.pod (snapshot-list): Document them.
      fe383bb5
    • E
      snapshot: avoid accidental renames with snapshot-edit · bab4f31c
      Eric Blake 提交于
      I was a bit surprised that 'virsh snapshot-edit dom name' silently
      allowed me to clone things, while still telling me the old name,
      especially since other commands like 'virsh edit dom' reject rename
      attempts (*).  This fixes things to be more explicit (**).
      
      (*) Technically, 'virsh edit dom' relies on virDomainDefineXML
      behavior, which rejects attempts to mix a new name with existing
      uuid or new uuid with existing name, but you can create a new
      domain by changing both uuid and name.  On the other hand, while
      snapshot-edit --clone is a true clone, creating a new domain
      would also have to decide whether to clone snapshot metadata,
      managed save, and any other secondary data related to the domain.
      Domain renames are not trivial either.
      
      (**) Renaming or creating a clone is still a risky proposition -
      for offline snapshots and system checkpoints, if the new name
      does not match an actual name recorded in the qcow2 internal
      snapshots, then you cannot revert to the new checkpoint.  But it
      is assumed that anyone using the new virsh flags knows what they
      are doing, and can deal with the fallout caused by a rename/clone;
      that is, we can't completely prevent a user from shooting
      themselves in the foot, so much as we are making the default
      action less risky.
      
      * tools/virsh.c (cmdSnapshotEdit): Add --rename, --clone.
      * tools/virsh.pod (snapshot-edit): Document them.
      bab4f31c
    • E
      snapshot: sort snapshot-list --tree · 40baa1c8
      Eric Blake 提交于
      Otherwise, the results are not repeatable.
      
      * tools/virsh.c (cmdSnapshotList): Print tree in predictable order.
      40baa1c8
  2. 07 10月, 2011 3 次提交
    • T
      virsh: Update the help information for undefine command. · d5c4067d
      tangchen 提交于
      virsh undefine command can now undefine an active guest, but the help information is still the old.
      This patch modifies it and make it coincident to the manpage of virsh.
      Signed-off-by: Ntangchen <tangchen@cn.fujitsu.com>
      d5c4067d
    • E
      snapshot: let virsh edit disk snapshots · 731f9a5e
      Eric Blake 提交于
      It was impossible for 'virsh snapshot-current dom name' to set name
      as the current snapshot, if name is a disk-only snapshot.
      
      Using strstr rather than full-blown xml parsing is safe, since the
      xml is assumed to be well-formed coming from libvirtd rather than
      arbitrary text coming from the user.
      
      * tools/virsh.c (cmdSnapshotCurrent, cmdSnapshotEdit): Pass
      disk_only flag when redefining a disk snapshot.
      731f9a5e
    • E
      snapshot: fix virsh error message typo · 203b361f
      Eric Blake 提交于
      * tools/virsh.c (cmdSnapshotList): Spell exclusive correctly.
      203b361f
  3. 06 10月, 2011 1 次提交
    • E
      snapshot: add REVERT_FORCE to API · 3c797404
      Eric Blake 提交于
      Although reverting to a snapshot is a form of data loss, this is
      normally expected.  However, there are two cases where additional
      surprises (failure to run the reverted state, or a break in
      connectivity to the domain) can come into play.  Requiring extra
      acknowledgment in these cases will make it less likely that
      someone can get into an unrecoverable state due to a default revert.
      
      Also create a new error code, so users can distinguish when forcing
      would make a difference, rather than having to blindly request force.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_SNAPSHOT_REVERT_FORCE):
      New flag.
      * src/libvirt.c (virDomainRevertToSnapshot): Document it.
      * include/libvirt/virterror.h (VIR_ERR_SNAPSHOT_REVERT_RISKY): New
      error value.
      * src/util/virterror.c (virErrorMsg): Implement it.
      * tools/virsh.c (cmdDomainSnapshotRevert): Add --force to virsh.
      * tools/virsh.pod (snapshot-revert): Document it.
      3c797404
  4. 05 10月, 2011 1 次提交
    • E
      snapshot: better virsh handling of missing current, parent · 64703c03
      Eric Blake 提交于
      Previously, virsh 'snapshot-parent' and 'snapshot-current' were
      completely silent in the case where the code conclusively proved
      there was no parent or current snapshot, but differed in exit
      status; this silence caused some confusion on whether the commands
      worked.  Furthermore, commit d1be48f9 introduced a regression where
      snapshot-parent would leak output about an unknown function, but
      only on the first attempt, when talking to an older server that
      lacks virDomainSnapshotGetParent.  This changes things to consistenly
      report an error message and exit with status 1 when no snapshot
      exists, and to avoid leaking unknown function warnings when using
      fallbacks.
      
      * tools/virsh.c (vshGetSnapshotParent): Alter signature, to
      distinguish between real error and missing parent.  Don't pollute
      last_error on success.
      (cmdSnapshotParent): Adjust caller.  Always output message on
      failure.
      (cmdSnapshotList): Adjust caller.
      (cmdSnapshotCurrent): Always output message on failure.
      64703c03
  5. 01 10月, 2011 1 次提交
    • M
      virsh: do not unlink NULL file · 41bf4e72
      Marc-André Lureau 提交于
      error:could not take a screenshot of xp
      ==6216== Syscall param unlink(pathname) points to unaddressable byte(s)
      ==6216==    at 0x373A0D4937: unlink (syscall-template.S:82)
      ==6216==    by 0x40FD73: cmdScreenshot (virsh.c:3070)
      ==6216==    by 0x42BA0D: vshCommandRun (virsh.c:14920)
      ==6216==    by 0x42EC97: main (virsh.c:16379)
      ==6216==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
      ==6216==
      error:Requested operation is not valid: domain is not running
      41bf4e72
  6. 29 9月, 2011 3 次提交
    • X
      virsh: Add 'reset' command for virsh · 0ec9a8c2
      Xu He Jie 提交于
      Signed-off-by: NXu He Jie <xuhj@linux.vnet.ibm.com>
      0ec9a8c2
    • D
      virsh: describe attach-interface parameter target · dd09da70
      Daniel Veillard 提交于
      This patch is based on a improvement suggested by Kazuhiro Kikuchi
      of Fujitsu, it gives a description of the target parameter for that
      command
      
      * tools/virsh.pod: add description for target parameter of
        attach-interface
      dd09da70
    • D
      virsh: update man page for cpu_shares parameter · 0c92e142
      Daniel Veillard 提交于
      The man page suggest that the cpu_shares parameter of schedinfo
      allows values 0-262144, but the kernel remaps values 0 and 1 to
      the minimum 2, just document that behaviour:
      
      [root@test ~]# cat /cgroup/cpu/libvirt/qemu/cpu.shares
      1024
      [root@test ~]# echo 0 > /cgroup/cpu/libvirt/qemu/cpu.shares
      [root@test ~]# cat /cgroup/cpu/libvirt/qemu/cpu.shares
      2
      [root@test ~]# echo 1 > /cgroup/cpu/libvirt/qemu/cpu.shares
      [root@test ~]# cat /cgroup/cpu/libvirt/qemu/cpu.shares
      2
      [root@test ~]#
      
      * tools/virsh.pod: update description of the cpu_shares parameter
        to indicate the values 0 and 1 are automatically changed by the
        kernel to minimal value 2
      0c92e142
  7. 28 9月, 2011 6 次提交
    • E
      snapshot: add virsh snapshot-list --tree · 1cf0e3db
      Eric Blake 提交于
      Reuse the tree listing of nodedev-list, coupled with the new helper
      function to efficiently grab snapshot parent names, to produce
      tree output for a snapshot hierarchy.  For example:
      
      $ virsh snapshot-list dom --tree
      root1
       |
        +- sibling1
        +- sibling2
        |   |
        |   +- grandchild
        |
        +- sibling3
      
      root2
       |
        +- child
      
      * tools/virsh.c (cmdSnapshotList): Add --tree.
      * tools/virsh.pod (snapshot-list): Document it.
      1cf0e3db
    • E
      snapshot: refactor virsh snapshot parent computation · d1be48f9
      Eric Blake 提交于
      Make parent computation reusable, using virDomainSnapshotGetParent
      when possible.
      
      * tools/virsh.c (vshGetSnapshotParent): New helper.
      (cmdSnapshotParent): Use it.
      d1be48f9
    • E
      docs: document virsh nodedev-* commands · beeab559
      Eric Blake 提交于
      This section of the man page was completely missing; I stumbled on
      it when I had no clue that I had to use nodedev-reattach after
      I was done playing with <hostdev> device passthrough to one of my
      guests.
      
      * tools/virsh.pod (NODEDEV COMMANDS): New section.
      (attach-device, detach-device): Add cross-references.
      beeab559
    • P
      virsh: Allow using complete <capabilities> elements with cpu-baseline · b0889eae
      Peter Krempa 提交于
      This patch cleans the cpu baseline function using new libvirt helper
      functions and fixes XPath expression that selects <cpu> elements from
      the source file, that can contain concatenated <capabilities> XMLs,
      domain XMLs and bare <cpu> elements. The fixed XPath expression ensures
      not to select NUMA <cpu id=... elements.
      
      This patch also removes vshRealloc function, that remained unused after
      cleaning up cpu-baseline.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=731645
      b0889eae
    • P
      virsh: Allow using domain and capabilities XMLs with cpu-compare · 882e768e
      Peter Krempa 提交于
      This patch adds extraction of the <cpu> element from capabilities and
      domain definition XML documents to improve user experience.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=731151
      882e768e
    • E
      snapshot: fix man page typos · 63b2edc8
      Eric Blake 提交于
      pod2man from perl-5.8.8 (RHEL 5) errors out on ill-formed POD:
      
      *** ERROR: unterminated I<...> at line 1114 in file virsh.pod
      *** ERROR: unterminated I<...> at line 1851 in file virsh.pod
      
      Newer pod2man appears to be more tolerant (which is a shame,
      because it meant that this error is harder to detect).
      
      * tools/virsh.pod (undefine, snapshot-current): Add missing >.
      63b2edc8
  8. 27 9月, 2011 2 次提交
  9. 23 9月, 2011 2 次提交
    • O
      Add unsafe cache mode support for disk driver · f887334d
      Oskari Saarenmaa 提交于
      QEMU 0.13 introduced cache=unsafe for -drive, this patch exposes
      it in the libvirt layer.
      
        * Introduced a new QEMU capability flag ($prefix_CACHE_UNSAFE),
          as even if $prefix_CACHE_V2 is set, we can't know if unsafe
          is supported.
      
        * Improved the reliability of qemu cache type detection.
      f887334d
    • P
      virsh: Improve virsh manual for virsh memtune command · c4111bd0
      Peter Krempa 提交于
      Commit 0a22f542 added --min-guarantee option for the memtune command.
      This option is supported only by the ESX hypervisor. This patch adds a
      statement about this fact, to prevent user confusion.
      
      This patch also adds explanation how to clear/set to unlimited the
      memory tunables. (documments the -1 value).
      c4111bd0
  10. 22 9月, 2011 3 次提交
    • O
      virsh: Do not ignore the specified flags for cmdSaveImageDefine · f858bcb2
      Osier Yang 提交于
      Introduced by commit 42c52d53, which added the support for new
      flags, but forgot to update the API use to pass the flags.
      f858bcb2
    • E
      virsh: fix regression in argv parsing · 466f9024
      Eric Blake 提交于
      Prior to commit 85d28108, we had an issue where:
      
      snapshot-create-as dom name --diskspec spec --diskspec spec
      
      failed to parse the second spec, because the first spec had marked
      that option as no longer requiring an argument.
      
      In commit 85d28108, I fixed it by making argv options no longer mark
      the option as seen.  But this in turn breaks mandatory argv options,
      which now complain that the argv option is missing.
      
      This patch reverts that part of 85d28108, and instead replaces it with
      fixes to no longer clear opts_need_arg of an argv argument.
      
      * tools/virsh.c (vshCmddefGetOption, vshCmddefGetData)
      (vshCommandParse): Fix option parsing for required argv option.
      (vshCmddefOptParse): Check that argv option is last.
      * tests/virsh-optparse: Enhance test.
      466f9024
    • O
      virsh: More friendly err if no pool is specified for looking up a vol · 2f059524
      Osier Yang 提交于
      There are 3 ways to lookup a volume, only virStorageVolLookupByName
      needs pool object. So if no --pool is specified, it will tries to
      get the volume via virStorageVolLookupByPath/virStorageVolLookupByKey.
      
      But if all 3 ways fails, and no --pool is specified, a friendly
      error might help the user get right way quickly.
      2f059524
  11. 21 9月, 2011 1 次提交
  12. 20 9月, 2011 3 次提交
    • E
      virsh: tweak previous domblkstat patch · 6d1c11e5
      Eric Blake 提交于
      Translators are likely to botch trailing spacing; by doing the
      formatting outside of the translation, we can generally get
      better alignment.  Also, for consistency, use 'bytes read' to
      match 'bytes written'.
      
      * tools/virsh.c (domblkstat_output): Drop trailing space. Tweak
      rd_bytes output.
      (cmdDomblkstat, DOMBLKSTAT_LEGACY_PRINT): Update formatting.
      6d1c11e5
    • P
      virsh: doc: Fix supported driver types for attach-disk command · 2ad83bf4
      Peter Krempa 提交于
      Virsh man page lists driver types to be used with attach-device
      command, but does not specify that those are usable only with the XEN
      Hypervisor.
      
      This patch adds statement, that those options specified are applicable
      only on the Xen hypervisor and adds option usable with qemu emulator.
      
      This patch also changes type of error returned by QEMU driver if the
      user specifies incompatible driver type from VIR_ERR_INTERNAL_ERROR to
      VIR_ERR_CONFIG_UNSUPPORTED.
      2ad83bf4
    • P
      virsh: Add more human-friendly output of domblkstat command · 619077b9
      Peter Krempa 提交于
      Users of virsh complain that output of the domblkstat command
      is not intuitive enough. This patch adds explanation of fields
      returned by this command to the help section for domblkstat and
      the man page of virsh. Also a switch --human is added for
      domblkstat that prints the fields with more descriptive
      texts.
      
      This patch also changes sequence of the output fields and their
      names back to the order and spelling established by previous
      versions of virsh to maintain compatibility with scripts.
      
      Example of ordered and "translated" output:
      
      PRE-patch:
      
      virsh # domblkstat 1 vda
      vda wr_bytes 5170176
      vda wr_operations 511
      vda rd_bytes 82815488
      vda rd_operations 3726
      
      POST-patch:
      
      virsh # domblkstat 1 vda
      vda rd_req 3726
      vda rd_bytes 82815488
      vda wr_req 478
      vda wr_bytes 4965376
      
      Example of human readable output:
      
      virsh # domblkstat 1 vda --human
      Device: vda
       number of read operations:      3726
       number of read bytes:           82815488
       number of write operations:     478
       number of bytes written:        4965376
      
      https://bugzilla.redhat.com/show_bug.cgi?id=731656
      619077b9
  13. 16 9月, 2011 6 次提交
    • J
      qemu: Introduce shutdown reason for paused state · d2d67763
      Jiri Denemark 提交于
      Qemu sends STOP event as part of the shutdown process. Detect such STOP
      event and consider shutdown to be reason of emitting such event. That's
      the best we can do until qemu provides us the reason directly in STOP
      event. This allows us to report shutdown reason for paused state so that
      apps can detect domains that failed to finish the shutdown process
      (e.g., because qemu is buggy and doesn't exit on SIGTERM or it is
      blocked in flushing disk buffers).
      d2d67763
    • E
      Revert "virsh: Use old API if remote libvirtd does not support new" · e9f55e46
      Eric Blake 提交于
      This reverts commit 799912fa; now
      that the rpc regression is fixed, virsh no longer needs the special
      case here.
      e9f55e46
    • P
      Avoid using "devname" as an identifier. · 79cf07af
      Peter Krempa 提交于
      /usr/lib/stdlib.h in Mac OS X and probably also in BSD's
      exports this symbol :(
      79cf07af
    • P
      doc: Add statment about permissions needed to do a core dump · 4d4430e1
      Peter Krempa 提交于
      Documentation did not specify, that some permissions are required on
      target path for coredump for the user running the hypervisor.
      
      Diff to v1:
      - reword statements
      4d4430e1
    • E
      snapshot: tweak snapshot-create-as diskspec docs · 85d28108
      Eric Blake 提交于
      With this patch, it is hopefully a bit more obvious that for
      snapshot-create-as, a literal '--diskspec' is mandatory if name
      or description was omitted, but optional if all earlier options
      were provided.
      
      These all denote two diskspecs and a description:
      virsh snapshot-create-as dom name desc vda vdb
      virsh snapshot-create-as dom name desc --diskspec vda --diskspec vdb
      virsh snapshot-create-as dom name desc --diskspec vda vdb
      virsh snapshot-create-as dom name desc vda --diskspec vdb
      virsh snapshot-create-as dom --diskspec vda --diskspec vdb name desc
      
      This gives two diskspecs but no description:
      virsh snapshot-create-as dom name --diskspec vda --diskspec vdb
      
      And this treats 'vda' as the description, with only one diskspec:
      virsh snapshot-create-as dom name vda vdb
      
      The help output now shows:
          snapshot-create-as <domain> [<name>] [<description>] [--print-xml] [--no-metadata] [--halt] [--disk-only] [[--diskspec] <string>]...
      
      I also checked the help output for echo and send-key, which are two
      other variants of argv commands.
      
      * tools/virsh.pod (snapshot-create-as): Document when a literal
      --diskspec must preceed a diskspec argument.
      * tools/virsh.c (vshCmddefHelp): Update help output for argv when
      naming the option is useful.
      (vshCmddefGetData): Fix logic on when argv was seen.
      * tests/virsh-optparse: Add tests to avoid regressions.
      85d28108
    • P
      doc: virsh: Fix command name in man page · b4a01cec
      Peter Krempa 提交于
      Fix cut&paste error having command named domif-setlink instead of
      domif-getlink.
      b4a01cec
  14. 15 9月, 2011 1 次提交
  15. 14 9月, 2011 2 次提交
    • P
      xml: Clean up rest of virtual XML document names for XML strings · b998f1f7
      Peter Krempa 提交于
      Commit 498d7833 cleans up some of virtual file names for parsing strings
      in memory. This patch cleans up (hopefuly) the rest forgotten by the
      first patch.
      
      This patch also changes all of the previously modified "filenames" to
      valid URI's replacing spaces for underscores.
      
      Changes to v1:
      - Replace all spaces for underscores, so that the strings form valid
        URI's
      - Replace spaces in places changed by commit 498d7833
      b998f1f7
    • P
      virsh: Use old API if remote libvirtd does not support new · 799912fa
      Peter Krempa 提交于
      Commit ffe28ab7 introduced regression
      while communicating with older libvirtd command 'domblkstat' used the new
      API and did not check for VIR_ERR_RPC error code signalling the remote
      server does not support this API and did not fall back to older API.
      Thereafter 'domblkstat' ended with "error: unknown procedure: 243".
      799912fa
  16. 09 9月, 2011 1 次提交
    • P
      xml: Change virtual file names of xml documents parsed in memory · 498d7833
      Peter Krempa 提交于
      While parsing XML strings from memory, the previous convention in
      libvirt was to set the virtual file name to "domain.xml" or something
      similar. This could potentialy trick the user into looking for a file
      named domain.xml on the disk in an attempt to fix the error.
      
      This patch changes these filenames to something that can't be as easily
      confused for a valid filename.
      
      Examples of error messages:
      ---------------------------
      Error while loading file from disk:
      
      15:07:59.015: 527: error : catchXMLError:709 : /path/to/domain.xml:1: StartTag: invalid element name
      <domain type='kvm'><
      --------------------^
      
      Error while parsing definition in memory:
      
      15:08:43.581: 525: error : catchXMLError:709 : (domain definition):2: error parsing attribute name
        <name>vm1</name>
      --^
      498d7833
  17. 08 9月, 2011 1 次提交
    • E
      snapshot: use new API for less work · a00c37f2
      Eric Blake 提交于
      This has the added benefit of making 'snapshot-create dom --no-metadata'
      now able to tell you the name of the just-generated snapshot.
      
      * tools/virsh.c (vshSnapshotCreate, cmdSnapshotCurrent): Don't get
      XML just for name.
      a00c37f2