1. 15 11月, 2019 2 次提交
  2. 13 11月, 2019 1 次提交
  3. 12 11月, 2019 2 次提交
  4. 25 10月, 2019 3 次提交
  5. 24 10月, 2019 1 次提交
    • M
      Drop needless ret variable · 3b4df5d3
      Michal Privoznik 提交于
      In few places we have the following code pattern:
      
        int ret;
        ... /* @ret is not accessed here */
        ret = f(...);
        return ret;
      
      This pattern can be written less verbose:
      
        ...
        return f(...);
      
      This patch was generated with following coccinelle spatch:
      
        @@
        type T;
        constant C;
        expression f;
        identifier ret;
        @@
        -T ret = C;
         ... when != ret
        -ret = f;
        -return ret;
        +return f;
      
      Afterwards I needed to fix a few places, e.g. comment in
      virDomainNetIPParseXML() was removed too because coccinelle
      thinks it refers to @ret while in fact it doesn't. Also in few
      places it replaced @ret declaration with a few spaces instead of
      removing the line. But nothing terribly wrong.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      3b4df5d3
  6. 21 10月, 2019 2 次提交
  7. 20 10月, 2019 4 次提交
  8. 16 10月, 2019 1 次提交
  9. 15 10月, 2019 1 次提交
  10. 07 10月, 2019 1 次提交
  11. 07 8月, 2019 1 次提交
  12. 25 7月, 2019 1 次提交
  13. 12 4月, 2019 1 次提交
  14. 25 3月, 2019 3 次提交
    • E
      virsh: Add 'echo --err' option · 2efb42e9
      Eric Blake 提交于
      Since test:///default resets state on every connection, writing a test
      that covers a sequence of commands must be done from a single
      session. But if the test wants to exercise particular failure modes as
      well as successes, it can be nice to leave witnesses in the stderr
      stream immediately before and after the spot where the expected error
      should be, to ensure the rest of the script is not causing errors.
      
      Do this by adding an --err option.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Acked-by: NMichal Privoznik <mprivozn@redhat.com>
      2efb42e9
    • E
      virsh: Treat any command name starting with # as comment · 4e650259
      Eric Blake 提交于
      As the previous commit mentioned, argv mode (such as when you feed
      virsh via stdin with <<\EOF instead of via a single shell argument)
      didn't permit comments. Do this by treating any command name token
      that starts with # as a comment which silently eats all remaining
      arguments to the next newline or semicolon.
      
      Note that batch mode recognizes unquoted # at the start of any word as
      a command as part of the tokenizer, while this patch only treats # at
      the start of the command word as a comment (any other # remaining by
      the time vshCommandParse() is processing things was already quoted
      during the tokenzier, and as such was probably intended as the actual
      argument to the command word earlier in the line).
      
      Now I can do something like:
      
      $ virsh -c test:///default <<EOF
        # setup
        snapshot-create-as test s1
        snapshot-create-as test s2
        # check
        snapshot-list test --name
      EOF
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Acked-by: NMichal Privoznik <mprivozn@redhat.com>
      4e650259
    • E
      virsh: Parse # comments in batch mode · 834f64ca
      Eric Blake 提交于
      Continuing from what I did in commit 4817dec0, now I want to write a
      sequence that is self-documenting.  So I need comments :)
      
      Now I can do something like:
      
      $ virsh -c test:///default '
        # setup
        snapshot-create-as test s1
        snapshot-create-as test s2
        # check
        snapshot-list test --name
      '
      
      Note that this does NOT accept comments in argv mode, another patch
      will tackle that.
      
      (If I'm not careful, I might turn virsh into a full-fledged 'sh'
      replacement? Here's hoping I don't go that far...)
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Acked-by: NMichal Privoznik <mprivozn@redhat.com>
      834f64ca
  15. 12 3月, 2019 2 次提交
  16. 27 2月, 2019 2 次提交
    • E
      virsh: Elide backslash-newline in batch mode · 5817dec0
      Eric Blake 提交于
      The previous patch made it possible to split multiple commands by
      adding newline, but not to split a long single command. The sequence
      backslash-newline was being used as if it were a quoted newline
      character, rather than completely elided the way the shell does.
      
      Again, add more tests, although this time it seems more like I am
      suffering from a leaning-toothpick syndrome with all the \.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      5817dec0
    • E
      virsh: Treat \n like ; in batch mode · fe1b683f
      Eric Blake 提交于
      I wanted to do a demonstration with virsh batch mode, which
      takes multiple commands all packed into a single argument:
      
      $ virsh -c test:///default 'echo a; echo b;'
      a
      b
      
      but that produced a really long line, so I tried to make it
      more legible:
      
      $ virsh -c test:///default '
         echo a;
         echo b;
      '
      error: unknown command: '
      '
      
      Let's be more like the shell, and treat unquoted newline as a
      command separator just as we do for semicolon.  In fact, with
      that, I can even now mix styles:
      
      $ virsh -c test:///default '
         echo a; echo b
         echo c
      '
      a
      b
      c
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      fe1b683f
  17. 03 1月, 2019 1 次提交
  18. 12 10月, 2018 1 次提交
    • E
      virsh: Fix regression with duplicated error messages · 35966308
      Eric Blake 提交于
      Commit 4f4c3b13 (v3.3) fixed an issue where performing cleanup of
      libvirt objects could sometimes lose error messages, by adding code
      to copy the libvirt error into last_error prior to cleanup paths.
      However, it caused a regression: on other paths, some errors are now
      printed twice, if libvirt still remembers in its thread-local
      storage that an error was set even after virsh cleared last_error.
      For example:
      
      $ virsh -c test:///default snapshot-delete test blah
      error: Domain snapshot not found: no domain snapshot with matching name 'blah'
      error: Domain snapshot not found: no domain snapshot with matching name 'blah'
      
      Fix things by telling libvirt to discard any thread-local errors at
      the same time virsh prints an error message (whether or not the libvirt
      error is the same as what is stored in last_error).
      
      Update the virsh-undefine testsuite (partially reverting portions of
      commit b620bdee, by removing -q, to more easily pinpoint which commands
      are causing which messages), now that there is only one error message
      instead of two.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      35966308
  19. 20 9月, 2018 2 次提交
  20. 06 6月, 2018 1 次提交
  21. 11 5月, 2018 1 次提交
  22. 10 5月, 2018 3 次提交
    • L
      vshReadlineParse: Ignore vshReadlineOptionsGenerator for VSH_OT_ARGV options · 0d1c1a74
      Lin Ma 提交于
      Currently the VSH_OT_ARGV options don't support complete, But some of
      VSH_OT_ARGV options are gonna support complete in upcoming patches.
      
      Once applied the upcoming completion patches for VSH_OT_ARGV options, If
      we don't ignore VSH_OT_ARGV here, The vshReadlineOptionsGenerator will
      be called, Hence complete output will consist of the result by command
      completer + the result by option completer, It's confusing.
      e.g.
          $ virsh domstats --domain <TAB><TAB>
          --backing     --interface      --list-paused      --perf      --vcpu
          --balloon     leap42.3         --list-persistent  --raw       win10
          --block       --list-active    --list-running     sles12sp3
          --cpu-total   --list-inactive  --list-shutoff     sles15
          --enforce     --list-other     --list-transient   --state
      
      After this patch and the upcoming completion patches:
          $ virsh domstats --domain <TAB><TAB>
          leap42.3    sles12sp3    sles15    win10
      Signed-off-by: NLin Ma <lma@suse.com>
      0d1c1a74
    • L
      vshReadlineOptionsGenerator: Add already provided VSH_OT_ARGV options to list · ee6113aa
      Lin Ma 提交于
      It's helpful for users while they type certain kind of VSH_OT_ARGV options.
      e.g.
      
      $ virsh domstats --domain sles12sp3 --d<TAB>
      Signed-off-by: NLin Ma <lma@suse.com>
      ee6113aa
    • L
      virsh: Conditionally Ignore the first entry in list of completions · 55948988
      Lin Ma 提交于
      The first entry in the returned array is the substitution for TEXT. It
      causes unnecessary output if other commands or options share the same
      prefix, e.g.
      
      $ virsh des<TAB><TAB>
      des      desc     destroy
      
      or
      
      $ virsh domblklist --d<TAB><TAB>
      --d        --details  --domain
      
      This patch fixes the above issue.
      Signed-off-by: NLin Ma <lma@suse.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      55948988
  23. 28 2月, 2018 1 次提交
    • M
      vshCommandOpt: Do more checking if skipChecks is set · 846d3b58
      Michal Privoznik 提交于
      Currently if cmd->skipChecks is set (done only from completers)
      some basic checks are skipped because we're working over
      partially parsed command. See a26ff63a for more detailed
      explanation. Anyway, the referenced commit was too aggressive in
      disabling checks and effectively returned success even in clear
      case of failure. For instance:
      
        # domif-getlink --interface <TAB><TAB>
      
      causes virshDomainInterfaceCompleter() to be called, which calls
      virshDomainGetXML() which eventually calls
      vshCommandOptStringReq(.., name = "domain"); The --domain
      argument is required for the command and if not present -1 should
      be returned to tell the caller the argument was not found. Well,
      zero is returned meaning the argument was not found but it's not
      required either.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      846d3b58
  24. 25 1月, 2018 2 次提交