1. 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
  2. 17 9月, 2013 1 次提交
  3. 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
  4. 03 9月, 2013 3 次提交
  5. 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
  6. 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
  7. 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
  8. 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
  9. 11 7月, 2013 1 次提交
  10. 10 7月, 2013 1 次提交
  11. 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
  12. 24 5月, 2013 1 次提交
  13. 23 5月, 2013 1 次提交
  14. 21 5月, 2013 1 次提交
  15. 08 5月, 2013 1 次提交
  16. 03 5月, 2013 1 次提交
    • E
      build: avoid useless virAsprintf · 25ae3d30
      Eric Blake 提交于
      virAsprintf(&foo, "%s", bar) is wasteful compared to
      foo = strdup(bar) (or eventually, VIR_STRDUP(foo, bar),
      but one thing at a time...).
      
      Noticed while reviewing Laine's attempt to clean up broken
      qemu:///session.
      
      * cfg.mk (sc_prohibit_asprintf): Enhance rule.
      * src/esx/esx_storage_backend_vmfs.c
      (esxStorageBackendVMFSVolumeLookupByKey): Fix offender.
      * src/network/bridge_driver.c (networkStateInitialize): Likewise.
      * src/nwfilter/nwfilter_dhcpsnoop.c (virNWFilterSnoopDHCPOpen):
      Likewise.
      * src/storage/storage_backend_sheepdog.c
      (virStorageBackendSheepdogRefreshVol): Likewise.
      * src/util/vircgroup.c (virCgroupAddTaskStrController): Likewise.
      * src/util/virdnsmasq.c (addnhostsAdd): Likewise.
      * src/xen/block_stats.c (xenLinuxDomainDeviceID): Likewise.
      * src/xen/xen_driver.c (xenUnifiedConnectOpen): Likewise.
      * tools/virsh.c (vshGetTypedParamValue): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      25ae3d30
  17. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
  18. 30 4月, 2013 1 次提交
    • J
      virsh: fix incorrect argument errors for long options · 53531e16
      Ján Tomko 提交于
      For long options, print:
      * the option as specified by the user if it's unknown
      * the canonical long option if its argument is not
        a number (and should be)
      
      And for missing arguments, print both the short and
      the long option name.
      (Doing only one of those would require either parsing
      argv ourselves or let getopt print the errors, since
      we can't tell long and short options apart by optopt
      or longindex)
      
      https://bugzilla.redhat.com/show_bug.cgi?id=949373
      
      Unsupported long option:
      
      $ virsh --pm
      Before:
      error: unsupported option '-
      After:
      error: unsupported option '--pm'. See --help.
      
      Missing parameter:
      
      $ virsh --deb
      Before:
      error: option '-d' requires an argument
      After:
      error: option '-d'/'--debug' requires an argument
      
      $ virsh -rd
      Before:
      error: option '-d' requires an argument
      After:
      error: option '-d'/'--debug' requires an argument
      
      Non-numeric parameter:
      
      $ virsh --deb duck
      Before:
      error: option -d takes a numeric argument
      After:
      error: option --debug takes a numeric argument
      53531e16
  19. 26 4月, 2013 1 次提交
  20. 18 4月, 2013 1 次提交
  21. 05 4月, 2013 3 次提交
  22. 26 3月, 2013 1 次提交
  23. 15 3月, 2013 2 次提交
    • M
      Cleanup useless flags specifications · 73cc87d1
      Martin Kletzander 提交于
      After we switched to C99 initialization, I noticed there were many
      places where the specification of .flags parameter differed.  After
      going through many options and deciding whether to unify the
      initialization to be '.flags = 0' or '.flags = VSH_OFLAG_NONE', I
      realized both can be removed and it makes the code easier to go
      through.
      73cc87d1
    • M
      Make vshDebug work when parsing parameters · abfff210
      Martin Kletzander 提交于
      The vshInit initializes ctl->debug by which vshDebug (which is also
      called in vshParseArgv) decides whether to print out the message or
      not.
      abfff210
  24. 20 2月, 2013 1 次提交
    • G
      virsh: distinguish errors between missing argument and wrong option · dd71fa11
      Guannan Ren 提交于
      Specifying ':' to suppress the error messages printed by getopt().
      Then, distinguish the two types of errors.
      
      Before:
       # virsh -c
         virsh: option requires an argument -- 'c'
         error: unsupported option '-?'. See --help.
      
      After:
       # virsh -c
         error: option '-c' requires an argument
      
       # virsh -x
         error: unsupported option '-x'. See --help.
      dd71fa11
  25. 19 2月, 2013 1 次提交
  26. 16 2月, 2013 1 次提交
  27. 13 2月, 2013 2 次提交
  28. 04 2月, 2013 1 次提交
    • P
      virsh: Add helper to request string arguments with error reporting · 41b5e845
      Peter Krempa 提交于
      This patch adds a helper function with similar semantics to
      vshCommandOptString that requests a string argument, but does some error
      reporting without the need to do it in the functions themselves.
      
      The error reporting also provides information about the parameter whose
      retrieval failed.
      41b5e845
  29. 23 1月, 2013 1 次提交
  30. 18 1月, 2013 1 次提交
  31. 17 1月, 2013 1 次提交
  32. 16 1月, 2013 1 次提交
  33. 14 1月, 2013 1 次提交
    • D
      Introduce an LXC specific public API & library · 3d1596b0
      Daniel P. Berrange 提交于
      This patch introduces support for LXC specific public APIs. In
      common with what was done for QEMU, this creates a libvirt_lxc.so
      library and libvirt/libvirt-lxc.h header file.
      
      The actual APIs are
      
        int virDomainLxcOpenNamespace(virDomainPtr domain,
                                      int **fdlist,
                                      unsigned int flags);
      
        int virDomainLxcEnterNamespace(virDomainPtr domain,
                                       unsigned int nfdlist,
                                       int *fdlist,
                                       unsigned int *noldfdlist,
                                       int **oldfdlist,
                                       unsigned int flags);
      
      which provide a way to use the setns() system call to move the
      calling process into the container's namespace. It is not
      practical to write in a generically applicable manner. The
      nearest that we could get to such an API would be an API which
      allows to pass a command + argv to be executed inside a
      container. Even if we had such a generic API, this LXC specific
      API is still useful, because it allows the caller to maintain
      the current process context, in particular any I/O streams they
      have open.
      
      NB the virDomainLxcEnterNamespace() API is special in that it
      runs client side, so does not involve the internal driver API.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      3d1596b0