1. 17 1月, 2020 1 次提交
  2. 03 1月, 2020 2 次提交
  3. 20 12月, 2019 2 次提交
  4. 12 12月, 2019 2 次提交
  5. 10 12月, 2019 2 次提交
  6. 19 11月, 2019 1 次提交
  7. 15 11月, 2019 2 次提交
  8. 13 11月, 2019 1 次提交
  9. 12 11月, 2019 2 次提交
  10. 25 10月, 2019 3 次提交
  11. 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
  12. 21 10月, 2019 2 次提交
  13. 20 10月, 2019 4 次提交
  14. 16 10月, 2019 1 次提交
  15. 15 10月, 2019 1 次提交
  16. 07 10月, 2019 1 次提交
  17. 07 8月, 2019 1 次提交
  18. 25 7月, 2019 1 次提交
  19. 12 4月, 2019 1 次提交
  20. 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
  21. 12 3月, 2019 2 次提交
  22. 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
  23. 03 1月, 2019 1 次提交
  24. 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