1. 13 11月, 2014 1 次提交
    • M
      virsh: Enforce proper ordering of options · 6beb173d
      Martin Kletzander 提交于
      Even though vshCmddefOptParse() tried returning -1 if there was an
      optional option specification that preceded a required one, it failed to
      check that for boolean type options and options with VSH_OFLAG_REQ_OPT
      flag set.  On the other hand, it makes sense that VSH_OT_ARGV is
      specified at the end of the option list.
      
      Returning -1 enforces the proper ordering thanks to virsh-synopsis test
      in 'make check'.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      6beb173d
  2. 29 10月, 2014 1 次提交
    • E
      maint: avoid static zero init in tools · 05853324
      Eric Blake 提交于
      C guarantees that static variables are zero-initialized.  Some older
      compilers (and also gcc -fno-zero-initialized-in-bss) create larger
      binaries if you explicitly zero-initialize a static variable.
      
      * tools/virsh-console.c (got_signal): Drop unused variable.
      * tools/virsh-domain.c: Fix initialization.
      * tools/virsh.c: Likewise.
      * tools/virt-host-validate-common.c (virHostMsgWantEscape):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      05853324
  3. 02 10月, 2014 1 次提交
  4. 09 9月, 2014 1 次提交
  5. 06 9月, 2014 1 次提交
    • E
      blockjob: add new --bytes flag to virsh blockjob · 1105c1de
      Eric Blake 提交于
      Expose the new flag just added to virDomainGetBlockJobInfo.
      With --raw, the presence or absence of --bytes determines which
      flag to use in the single API call.  Without --raw, the use of
      --bytes forces an error if the server doesn't support it,
      otherwise, the code tries to silently fall back to scaling the
      MiB/s value.
      
      My goal is to eventually also support --bytes in bandwidth mode;
      but that's a bit further down the road (and needs a new API flag
      added in libvirt.h first).
      
      This changes the human output, but the previous patch added
      raw output precisely so that we can have flexibility with the
      human output.  For this commit, I used qemu-monitor-command to
      force an unusual bandwidth, but the same will be possible once
      qemu implements virDomainBlockCopy:
      
      Before:
      Block Copy: [100 %]    Bandwidth limit: 2 MiB/s
      After:
      Block Copy: [100 %]    Bandwidth limit: 1048577 bytes/s (1.000 MiB/s)
      
      The cache avoids having to repeatedly checking whether the flag
      works when talking to an older server, when multiple blockjob
      commands are issued during a batch session and the user is
      manually polling for job completion.
      
      * tools/virsh.h (_vshControl): Add a cache.
      * tools/virsh.c (cmdConnect, vshReconnect): Initialize the cache.
      * tools/virsh-domain.c (opts_block_job): Add --bytes.
      * tools/virsh.pod (blockjob): Document this.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1105c1de
  6. 28 8月, 2014 1 次提交
  7. 21 8月, 2014 1 次提交
  8. 26 6月, 2014 1 次提交
  9. 12 6月, 2014 4 次提交
    • P
      virsh: Reject negative numbers in vshCommandOptULongLong · c6212539
      Peter Krempa 提交于
      To follow the new semantics of the vshCommandOptToU* functions convert
      this one to reject negative numbers too. To allow using -1 for "maximum"
      semantics for the vol-*load two bandwidth functions that use this helper
      introduce vshCommandOptULongLongWrap.
      c6212539
    • P
      virsh: Reject negative numbers in vshCommandOptUL · 0e2d7305
      Peter Krempa 提交于
      To follow the new semantics of the vshCommandOptToU* functions convert
      this one to reject negative numbers too. To allow using -1 for "maximum"
      semantics for the two bandwidth functions that use this helper introduce
      vshCommandOptULWrap. Although currently the migrate-setspeed function
      for the qemu driver will reject -1 as maximum.
      0e2d7305
    • P
      virsh: Reject negative numbers in vshCommandOptUInt · 37e663ad
      Peter Krempa 提交于
      Use virStrToLong_uip instead of virStrToLong_ui to reject negative
      numbers in the helper. None of the callers expects the wraparound
      "feature" for negative numbers.
      
      Also add a function that allows wrapping of negative numbers as it might
      be used in the future and be explicit about the new semantics in the
      function docs.
      37e663ad
    • R
      virsh: include bhyve in virsh -V output · aec0c6d3
      Roman Bogorodskiy 提交于
      Add 'Bhyve' in hypervisor list reported by 'virsh -V'
      if it's compiled it.
      aec0c6d3
  10. 25 4月, 2014 1 次提交
  11. 03 4月, 2014 1 次提交
    • L
      virsh: Make 'exit' action same as 'quit' · cc7e1503
      Li Yang 提交于
      For now 'virsh quit' action like this:
      --------------------------------
      [root@localhost /]# virsh quit
      [root@localhost /]#
      --------------------------------
      And 'virsh exit' action:
      --------------------------------
      [root@localhost /]# virsh exit
      
      [root@localhost /]#
      --------------------------------
      There is a small difference('/n') between them.
      According to manual said:
             quit, exit
                 quit this interactive terminal
      
      And in the code they all called cmdQuit func,
      They should get same actions.
      Signed-off-by: NLi Yang <liyang.fnst@cn.fujitsu.com>
      cc7e1503
  12. 25 3月, 2014 1 次提交
  13. 18 3月, 2014 1 次提交
    • M
      virsh: Add keepalive in new vshConnect function · 676cb4f4
      Martin Kletzander 提交于
      Introducing keepalive similarly to Guannan around 2 years ago.  Since
      we want to introduce keepalive for every connection, it makes sense to
      wrap the connecting function into new virsh one that can deal
      keepalive as well.
      
      Function vshConnect() is now used for connecting and keepalive added
      in that function (if possible) helps preventing long waits e.g. while
      nework goes down during migration.
      
      This patch also adds the options for keepalive tuning into virsh and
      fails connecting only when keepalives are explicitly requested and
      cannot be set (whether it is due to missing support in connected
      driver or remote server).  If not explicitely requested, a debug
      message is printed (hence the addition to virsh-optparse test).
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1073506
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=822839Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      676cb4f4
  14. 10 3月, 2014 1 次提交
  15. 21 2月, 2014 2 次提交
    • E
      virsh: common code for waiting for an event · 4c29530d
      Eric Blake 提交于
      I plan to add 'virsh event' to virsh-domain.c and 'virsh
      net-event' to virsh-network.c; but as they will share quite
      a bit of common boilerplate, it's better to set that up now
      in virsh.c.
      
      * tools/virsh.h (_vshControl): Add fields.
      (vshEventStart, vshEventWait, vshEventDone, vshEventCleanup): New
      prototypes.
      * tools/virsh.c (vshEventFd, vshEventOldAction, vshEventInt)
      (vshEventTimeout): New helper variables and functions.
      (vshEventStart, vshEventWait, vshEventDone, vshEventCleanup):
      Implement new functions.
      (vshInit, vshDeinit, main): Manage event timeout.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      4c29530d
    • E
      virsh: common code for parsing --seconds · 5093b047
      Eric Blake 提交于
      Several virsh commands ask for a --timeout parameter in
      seconds, then use it to control interfaces that operate on
      millisecond limits; I also plan on adding a 'virsh event'
      command that also does this.  Factor this into a common
      function.
      
      * tools/virsh.h (vshCommandOptTimeoutToMs): New prototype.
      * tools/virsh.c (vshCommandOptTimeoutToMs): New function.
      * tools/virsh-domain.c (cmdBlockCommit, cmdBlockCopy)
      (cmdBlockPull, cmdMigrate): Use it.
      (vshWatchJob): Adjust timeout scale.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      5093b047
  16. 12 12月, 2013 1 次提交
    • E
      storage: show gluster option in virsh --version=long · 602751b4
      Eric Blake 提交于
      Adding output to 'virsh --version=long' makes it easier to
      tell if a distro built with particular libraries (it doesn't
      tell you what a remote libvirtd is built with, but is still
      better than nothing).  But we forgot to mention gluster.
      
      * tools/virsh.c (vshShowVersion): Add gluster witness.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      602751b4
  17. 19 11月, 2013 1 次提交
    • R
      build: work around super-old readline.h · 9eb23fe2
      Ryota Ozaki 提交于
      This patch shuts up the following warning of clang
      on Mac OS X:
      
        virsh.c:2761:22: error: assigning to 'char *' from 'const char [6]' discards qualifiers
            [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
            rl_readline_name = "virsh";
                             ^ ~~~~~~~
      
      The warning happens because rl_readline_name on Mac OS X comes
      from an old readline header that still uses 'char *', while it
      is 'const char *' in readline 4.2 (April 2001) and newer.
      
      Tested on Mac OS X 10.8.5 (clang-500.2.75) and Fedora 19 (gcc 4.8.1).
      Signed-off-by: NRyota Ozaki <ozaki.ryota@gmail.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      9eb23fe2
  18. 29 10月, 2013 1 次提交
  19. 24 10月, 2013 1 次提交
    • E
      virsh: allow alias to expand to opt=value pair · 2b172a8e
      Eric Blake 提交于
      We want to treat 'attach-disk --shareable' as an undocumented
      alias for 'attach-disk --mode=shareable'.  By improving our
      alias handling, we can allow all such --bool -> --opt=value
      replacements, and guarantee up front that the alias is not
      mixed with its replacement.
      
      * tools/virsh.c (vshCmddefOptParse, vshCmddefGetOption): Add
      support for expanding bool alias to --opt=value.
      (opts_echo): Add another alias to test it.
      * tests/virshtest.c (mymain): Test it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      2b172a8e
  20. 22 10月, 2013 1 次提交
    • P
      virsh: Fix job watching when STDIN is not a tty · 47e63966
      Peter Krempa 提交于
      In commit b46c4787 I changed the code to
      watch long running jobs in virsh. Unfortunately I didn't take into
      account that poll may get a hangup if the terminal is not a TTY and will
      be closed.
      
      This patch avoids polling the STDIN fd when there's no TTY.
      47e63966
  21. 21 10月, 2013 1 次提交
  22. 07 10月, 2013 1 次提交
    • E
      build: add configure --without-readline · e5f46105
      Eric Blake 提交于
      Make it much easier to test a configuration built without readline
      support, by reusing our existing library probe machinery.  It gets
      a bit tricky with readline, which does not provide a pkg-config
      snippet, and which on some platforms requires one of several
      terminal libraries as a prerequiste, but the end result should be
      the same default behavior but now with the option to disable things.
      
      * m4/virt-readline.m4 (LIBVIRT_CHECK_READLINE): Simplify by using
      LIBVIRT_CHECK_LIB.
      * tools/virsh.c: Convert USE_READLINE to WITH_READLINE.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e5f46105
  23. 17 9月, 2013 1 次提交
  24. 05 9月, 2013 1 次提交
    • E
      virsh: fix build on mingw, which lacks termios stuff · 7e1cbd14
      Eric Blake 提交于
      Recent patches to fix handling of Ctrl-C when interacting with
      ssh are not portable to mingw, which lacks termios handling.
      The simplest solution is to just compile that code out, and
      if someone ever appears that has a serious interest in getting
      virsh fully functional even with ssh connections, they can
      provide patches at that time.
      
      * tools/virsh.h (_vshControl): Make termattr conditional.
      * tools/virsh.c (vshTTYIsInterruptCharacter)
      (vshTTYDisableInterrupt, vshTTYRestore, cfmakeraw, vshTTYMakeRaw)
      (main): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7e1cbd14
  25. 03 9月, 2013 3 次提交
  26. 29 8月, 2013 1 次提交
    • E
      virsh: detect programming errors with option parsing · 8aecd351
      Eric Blake 提交于
      Noticed while reviewing another patch that had an accidental
      mismatch due to refactoring.  An audit of the code showed that
      very few callers of vshCommandOpt were expecting a return of
      -2, indicating programmer error, and of those that DID check,
      they just propagated that status to yet another caller that
      did not check.  Fix this by making the code blatantly warn
      the programmer, rather than silently ignoring it and possibly
      doing the wrong thing downstream.
      
      I know that we frown on assert()/abort() inside libvirtd
      (libraries should NEVER kill the program that linked them),
      but as virsh is an app rather than the library, and as this
      is not the first use of assert() in virsh, I think this
      approach is okay.
      
      * tools/virsh.h (vshCommandOpt): Drop declaration.
      * tools/virsh.c (vshCommandOpt): Make static, and add a
      parameter.  Abort on programmer errors rather than making callers
      repeat that logic.
      (vshCommandOptInt, vshCommandOptUInt, vshCommandOptUL)
      (vshCommandOptString, vshCommandOptStringReq)
      (vshCommandOptLongLong, vshCommandOptULongLong)
      (vshCommandOptBool): Adjust callers.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      8aecd351
  27. 28 8月, 2013 2 次提交
    • M
      virsh: Fix debugging · ac43da70
      Martin Kletzander 提交于
      Commit a0b6a36f "fixed" what abfff210 broke (URI precedence), but
      there was still one more thing missing to fix.  When using virsh
      parameters to setup debugging, those weren't honored, because at the
      time debugging was initializing, arguments weren't parsed yet.  To
      make ewerything work as expected, we need to initialize the debugging
      twice, once before debugging (so we can debug option parsing properly)
      and then again after these options are parsed.
      
      As a side effect, this patch also fixes a leak when virsh is ran with
      multiple '-l' parameters.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      ac43da70
    • J
      virsh: free messages after logging them to a file · 66d124b4
      Ján Tomko 提交于
      The messages were only freed on error.
      
      ==12== 1,100 bytes in 1 blocks are definitely lost in loss record 698 of 729
      ==12==    by 0x4E98C22: virBufferAsprintf (virbuffer.c:294)
      ==12==    by 0x12C950: vshOutputLogFile (virsh.c:2440)
      ==12==    by 0x12880B: vshError (virsh.c:2254)
      ==12==    by 0x131957: vshCommandOptDomainBy (virsh-domain.c:109)
      ==12==    by 0x14253E: cmdStart (virsh-domain.c:3333)
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1001536
      66d124b4
  28. 22 8月, 2013 1 次提交
    • M
      Fix URI connect precedence · a0b6a36f
      Martin Kletzander 提交于
      Commit abfff210 changed the order of vshParseArgv() and vshInit() in
      order to make fix debugging of parameter parsing.  However, vshInit()
      did a vshReconnect() even though ctl->name wasn't set according to the
      '-c' parameter yet.  In order to keep both issues fixed, I've split
      the vshInit() into vshInitDebug() and vshInit().
      
      One simple memleak of ctl->name is fixed as a part of this patch,
      since it is related to the issue it's fixing.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=999323
      a0b6a36f
  29. 20 8月, 2013 1 次提交
    • P
      virsh: modify vshStringToArray to duplicate the elements too · d64af6ce
      Peter Krempa 提交于
      At a slightly larger memory expense allow stealing of items from the
      string array returned from vshStringToArray and turn the result into a
      string list compatible with virStringSplit. This will allow to use the
      common dealloc function.
      
      This patch also fixes a few forgotten checks of return from
      vshStringToArray and one memory leak.
      d64af6ce
  30. 11 7月, 2013 1 次提交
  31. 10 7月, 2013 1 次提交
  32. 19 6月, 2013 1 次提交
    • J
      util: switch virBufferTrim to void · d0d0413e
      Ján Tomko 提交于
      We don't care whether the trim was succesful or not anywhere
      except the tests.
      
      Switch it to void and set the buffer error on wrong usage.
      d0d0413e
  33. 24 5月, 2013 1 次提交