1. 21 6月, 2012 2 次提交
    • 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
  2. 20 6月, 2012 3 次提交
    • 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
      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
    • 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
  3. 19 6月, 2012 1 次提交
  4. 18 6月, 2012 2 次提交
  5. 16 6月, 2012 2 次提交
    • E
      snapshot: use new virsh function for snapshot-list · 90a61b39
      Eric Blake 提交于
      Operating on a list of snapshot objects looks so much simpler.
      In particular, since the helper function already trimmed out
      irrelevant entries, we no longer have quite so many special cases
      on finding the first snapshot to operate on.  Also, vshTreePrint
      no longer has a generic callback struct; both clients now pass
      something different according to their own needs.
      
      * tools/virsh.c (cmdSnapshotList): Use previous patches.
      (vshTreeArrayLookup): Rename...
      (vshNodeListLookup): ...now that it only has one client.
      (cmdNodeListDevices): Adjust caller.
      90a61b39
    • E
      snapshot: new virsh function factored from snapshot-list · 76d397b0
      Eric Blake 提交于
      This patch is based on the fallback code out of cmdSnapshotList,
      with tweaks to keep the snapshot objects around rather than just
      their name, and to remove unwanted elements before returning.
      It looks forward to a future patch when we add a way to list all
      snapshot objects at once, and the next patch will simplify
      cmdSnapshotList to take advantage of this factorization.
      
      * tools/virsh.c (vshSnapshotList, vshSnapshotListFree): New functions.
      76d397b0
  6. 15 6月, 2012 2 次提交
    • W
      virsh: allow the user to specify vmcore's format · 440b8ad1
      Wen Congyang 提交于
      Add a new parameter --memory-only for 'virsh dump' command. So
      the user can decide the vmcore's format.
      440b8ad1
    • O
      virsh: Null terminated the string memcpy from buffer explicitly · e3843d7f
      Osier Yang 提交于
      Detected by valgrind:
      
      ==16217== 1 errors in context 1 of 12:
      ==16217== Invalid read of size 1
      ==16217==    at 0x4A07804: __GI_strlen (mc_replace_strmem.c:284)
      ==16217==    by 0x3019F167F6: xdr_string (in /lib64/libc-2.12.so)
      ==16217==    by 0x3033709E8D: xdr_remote_nonnull_string (remote_protocol.c:31)
      ==16217==    by 0x303370E5CB: xdr_remote_domain_update_device_flags_args (remote_protocol.c:2028)
      ==16217==    by 0x30337197D1: virNetMessageEncodePayload (virnetmessage.c:341)
      ==16217==    by 0x30337135E1: virNetClientProgramCall (virnetclientprogram.c:327)
      ==16217==    by 0x30336F1EFD: callWithFD (remote_driver.c:4586)
      ==16217==    by 0x30336F1F7B: call (remote_driver.c:4607)
      ==16217==    by 0x30336F42F2: remoteDomainUpdateDeviceFlags (remote_client_bodies.h:2865)
      ==16217==    by 0x30336D46E5: virDomainUpdateDeviceFlags (libvirt.c:9457)
      ==16217==    by 0x41AEE8: cmdChangeMedia (virsh.c:15249)
      ==16217==    by 0x413CB4: vshCommandRun (virsh.c:18669)
      ==16217==  Address 0x4ec5e25 is 0 bytes after a block of size 293 alloc'd
      ==16217==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
      ==16217==    by 0x303364F1DB: virAllocN (memory.c:129)
      ==16217==    by 0x41A844: vshPrepareDiskXML (virsh.c:15043)
      ==16217==    by 0x41AECC: cmdChangeMedia (virsh.c:15246)
      ==16217==    by 0x413CB4: vshCommandRun (virsh.c:18669)
      ==16217==    by 0x423973: main (virsh.c:20261)
      e3843d7f
  7. 14 6月, 2012 4 次提交
    • M
      virsh: Report name from edited object · 79521a5e
      Michal Privoznik 提交于
      There is a little easter egg in virsh: one can easily clone
      an object (domain, network, ...). Just 'virsh edit' change the name
      and remove <uuid>. And then, in the end when reporting success
      the new name was printed out.
      However, with recent edit rewrite we lost the final part and are
      still printing the original name out.
      79521a5e
    • M
      virsh: Honor reedit opts printing to a function · b00469b6
      Michal Privoznik 提交于
      When printing reedit options we make stdin raw. However,
      this results in stdout being raw as well. Therefore we need
      to return carriage when doing new line. Unfortunately,
      '\r' cannot be part of internationalized messages hence
      we must move them to formatting string which then in turn
      become huge and disarranged. To solve this, a new function
      is introduced which takes variable string arguments and
      prepend each with "\r\n" just before printing.
      b00469b6
    • P
      virsh: Don't generate invalid XML in attach-disk command · 5b474026
      Peter Krempa 提交于
      The attach-disk command used with parameter --cache created an invalid
      XML snippet as the beginning of the <driver> element was not printed
      when used solely with --cache and no other attribute to driver.
      5b474026
    • L
      network: fully support/use VIR_NETWORK_XML_INACTIVE flag · 1f145b2f
      Laine Stump 提交于
      commit 52d064f4 added
      VIR_NETWORK_XML_INACTIVE in order to allow suppressing the
      auto-generated list of VFs in network definitions, and a --inactive
      flag to virsh net-dumpxml to take advantage of the flag. However, it
      missed out on two opportunities:
      
      1) Use INACTIVE to get the current config of the network as it
         exists on disk, rather than the currently active config.
      
      2) Add INACTIVE to the flags used for the virsh net-edit command, so
         that it won't include the forward-pool interfaces that were
         autogenerated, and so that a re-edit of the network prior to
         restarting it will show any other edits made since the last restart
         of the network. (prior to this patch, if you edited a network a 2nd
         time without restarting, all of the previous edits would magically
         disappear).
      
      In order to fit with the new #define-based generic edit function in
      virsh.c, a new function vshNetworkGetXMLDesc() was added. This
      function first tries to call virNetworkGetXMLDesc with the INACTIVE
      flag added, then retries without if the first attempt fails (in the
      manner expected when the server doesn't support it).
      1f145b2f
  8. 13 6月, 2012 1 次提交
    • E
      build: silence gettext warning · 78d078c8
      Eric Blake 提交于
      Otherwise, 'make dist' gives multiple warnings like:
      
      libvirt.pot:20814: warning: internationalized messages should not contain the `\r' escape sequence
      
      * tools/virsh.c (vshAskReedit): Avoid \r in _().
      78d078c8
  9. 12 6月, 2012 1 次提交
    • E
      snapshot: add 'virsh snapshot-info' · 757c4763
      Eric Blake 提交于
      Expose the recent API additions in virsh.  Borrows ideas from 'dominfo'
      for the general type of information to display.
      
      Output looks like:
      
      $ tools/virsh snapshot-info fedora-local tmp
      Name:           tmp
      Domain:         fedora-local
      Current:        no
      State:          disk-snapshot
      Parent:         -
      Children:       1
      Descendants:    2
      Metadata:       yes
      
      possibly with fewer lines when talking to older servers.
      
      * tools/virsh.c (cmdSnapshotInfo): New command.
      * tools/virsh.pod (snapshot-info): Document it.
      757c4763
  10. 11 6月, 2012 4 次提交
    • E
      snapshot: virsh indentation cleanup · 90356024
      Eric Blake 提交于
      No semantic change; this will make it easier to refactor code.
      
      * tools/virsh.c (cmdSnapshotList): Drop level of indentation, and
      rename a variable.
      90356024
    • E
      virsh: make tree listing more flexible · c8564ad4
      Eric Blake 提交于
      Requiring the user to pass in parallel arrays of names and parents
      is annoying; it means that you can't qsort one of the arrays without
      invalidating the ordering of the other.  By refactoring this function
      to use callbacks, we isolate the layout to be independent of the
      printing, and a future patch can exploit that to improve layout.
      
      * tools/virsh.c (vshTreePrintInternal): Use callbacks rather than
      requiring a char** array.
      (vshTreeArrayLookup): New helper function.
      (vshTreePrint, cmdNodeListDevices, cmdSnapshotList): Update callers.
      c8564ad4
    • E
      virsh: remove limits on tree listing · ef981053
      Eric Blake 提交于
      I am not a fan of fixed-width buffers.  All it takes is a
      linear chain of more than 100 snapshots to mess up 'virsh
      snapshot-list --tree'.  Now that virBuffer is more powerful,
      we might as well exploit its power.
      
      * tools/virsh.c (cmdNodeListDevicesPrint): Simplify to use a
      virBuffer instead of fixed-width prefix, factor guts, and rename...
      (vshTreePrint, vshTreePrintInternal): ...along with new helper.
      (cmdNodeListDevices, cmdSnapshotList): Update callers.
      ef981053
    • E
      snapshot: avoid virsh crash with older servers · d9f60665
      Eric Blake 提交于
      Commits 51082301, 16d7b390, and 521cc447 introduced support for
      'virsh snapshot-list --from' when talking to a server older than
      0.9.5, but broke support for plain 'virsh snapshot-list' for the
      same old server in the process.  Because the code is not properly
      gated, we end up with a SIGSEGV during a strcmp with a NULL argument.
      
      * tools/virsh.c (cmdSnapshotList): Don't waste time on fallbacks
      when --from is not present.
      d9f60665
  11. 07 6月, 2012 1 次提交
    • E
      build: fix build without i18n · b2ecfe97
      Eric Blake 提交于
      If you compile without NLS support, where _() is a no-op macro,
      then we end up passing a string literal to a char*, provoking:
      
      In file included from virsh.c:3639:0:
      virsh-edit.c: In function ‘cmdSaveImageEdit’:
      virsh-edit.c:97:13: error: assignment discards ‘const’ qualifier from pointer target type [-Werror]
      virsh-edit.c:106:13: error: assignment discards ‘const’ qualifier from pointer target type [-Werror]
      
      * tools/virsh-edit.c: Be const-safe.
      b2ecfe97
  12. 05 6月, 2012 3 次提交
  13. 04 6月, 2012 1 次提交
  14. 02 6月, 2012 2 次提交
    • M
      virsh: Allow users to reedit rejected XML · a7de0523
      Michal Privoznik 提交于
      If users *-edit but make a mistake in XML all changes are
      permanently lost. However, if virsh is not running within
      a script we can ask user if he wants to re-edit the file
      and correct the mistakes.
      a7de0523
    • M
      virsh: Switch from generated cmd*Edit commands to nongenerated · 0766783a
      Michal Privoznik 提交于
      Currently, we either generate some cmd*Edit commands (cmdPoolEdit
      and cmdNetworkEdit) via sed script or copy the body of cmdEdit
      (e.g. cmdInterfaceEdit, cmdNWFilterEdit, etc.). This fact makes
      it harder to implement any new feature to our editing system.
      Therefore switch to new implementation - define macros to:
      - dump XML (EDIT_GET_XML)
      - take an action if XML wasn't changed,
        usually just vshPrint() (EDIT_NOT_CHANGED)
      - define new object (EDIT_DEFINE) - the edited XML is in @doc_edited
      - free object defined by EDIT_DEFINE (EDIT_FREE)
      and #include "virsh-edit.c"
      0766783a
  15. 31 5月, 2012 1 次提交
  16. 29 5月, 2012 1 次提交
    • E
      virsh: avoid strncpy · dc4301c7
      Eric Blake 提交于
      strncpy is generally evil - it runs the risk of missing NUL
      termination, and more often than not wastes time zeroing way
      more bytes than strictly necessary.  We've avoided this evil
      in our virStrncpy wrapper, except for places where we forgot
      to use the wrapper; meanwhile, we have also added an even
      higher layer wrapper for setting virTypedParameter values.
      
      * tools/virsh.c (cmdMemtune, cmdBlkdeviotune): Use modern API.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_strncpy): Tighten.
      dc4301c7
  17. 28 5月, 2012 2 次提交
  18. 22 5月, 2012 1 次提交
    • W
      storage backend: Add RBD (RADOS Block Device) support · 74951ead
      Wido den Hollander 提交于
      This patch adds support for a new storage backend with RBD support.
      
      RBD is the RADOS Block Device and is part of the Ceph distributed storage
      system.
      
      It comes in two flavours: Qemu-RBD and Kernel RBD, this storage backend only
      supports Qemu-RBD, thus limiting the use of this storage driver to Qemu only.
      
      To function this backend relies on librbd and librados being present on the
      local system.
      
      The backend also supports Cephx authentication for safe authentication with
      the Ceph cluster.
      
      For storing credentials it uses the built-in secret mechanism of libvirt.
      Signed-off-by: NWido den Hollander <wido@widodh.nl>
      74951ead
  19. 18 5月, 2012 1 次提交
    • H
      Add a new param 'vcpu_time' to virDomainGetCPUStats · d29a7aaa
      Hu Tao 提交于
      Currently virDomainGetCPUStats gets total cpu usage, which consists
      of:
      
        1. vcpu usage: the physical cpu time consumed by virtual cpu(s) of
           domain
        2. hypervisor: `total cpu usage' - `vcpu usage'
      
      The param 'vcpu_time' is for getting vcpu usages.
      d29a7aaa
  20. 15 5月, 2012 1 次提交
  21. 14 5月, 2012 1 次提交
    • W
      Use XDG Base Directories instead of storing in home directory · 32a9aac2
      William Jon McCann 提交于
      As defined in:
      http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
      
      This offers a number of advantages:
       * Allows sharing a home directory between different machines, or
      sessions (eg. using NFS)
       * Cleanly separates cache, runtime (eg. sockets), or app data from
      user settings
       * Supports performing smart or selective migration of settings
      between different OS versions
       * Supports reseting settings without breaking things
       * Makes it possible to clear cache data to make room when the disk
      is filling up
       * Allows us to write a robust and efficient backup solution
       * Allows an admin flexibility to change where data and settings are stored
       * Dramatically reduces the complexity and incoherence of the
      system for administrators
      32a9aac2
  22. 08 5月, 2012 1 次提交
  23. 02 5月, 2012 2 次提交
    • E
      virsh: output scaled values with correct units · 706aa7c5
      Eric Blake 提交于
      The recent push to use correct scaling terms (kB for 1000, KiB for
      1024 - such as commit 9dfdeadc) missed some places in virsh.
      
      * tools/virsh.c (prettyCapacity, cmdDominfo, cmdFreecell)
      (cmdNodeinfo, cmdNodeMemStats, cmdMigrateSetMaxSpeed)
      (cmdBlockCopy, cmdBlockPull, cmdBlockJob): Use KiB, not kB, when
      referring to multiples of 1024.
      * tests/virshtest.c: Update expected output to match.
      706aa7c5
    • E
      virsh: make -h always give help · 46e5d36b
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=817244 mentions that
      unlike most other tools, where --help or --version prevent all
      further parsing of all later options, virsh was strange in that
      --version stopped parsing but --help tried to plow on to the end.
      There was no rationale for this original implementation (since
      2005!), so I think we can safely conform to common usage patterns.
      
      * tools/virsh.c (main): Drop useless 'help' variable.
      46e5d36b