1. 12 1月, 2016 1 次提交
    • J
      virsh: Create macro for common "config" option · 0dbac60b
      John Ferlan 提交于
      Rather than continually cut-n-paste the strings into each command,
      create a common macro to be used generically. The macro will take a
      single argument _helpstr which for many options in virsh-domain.c
      is simply "affect next boot". So, create a second macro within that
      file in order to define the more common use as a revector to the
      common macro with the common _helpstr.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      0dbac60b
  2. 11 1月, 2016 1 次提交
    • A
      virsh: Add timestamps to network events · dd4e9351
      Andrea Bolognani 提交于
      Implement a --timestamp option for 'virsh net-event', similar to the
      one for 'virsh event'.
      
      When the option is used, the human-readable timestamp will be printed
      before the message.
      dd4e9351
  3. 03 12月, 2015 1 次提交
  4. 14 8月, 2015 1 次提交
    • E
      tools: Introduce new client generic module vsh · 834c5720
      Erik Skultety 提交于
      In order to share as much virsh' logic as possible with upcomming
      virt-admin client we need to split virsh logic into virsh specific and
      client generic features.
      
      Since majority of virsh methods should be generic enough to be used by
      other clients, it's much easier to rename virsh specific data to virshX
      than doing this vice versa. It moved generic virsh commands (including info
      and opts structures) to generic module vsh.c.
      
      Besides renaming methods and structures, this patch also involves introduction
      of a client specific control structure being referenced as private data in the
      original control structure, introduction of a new global vsh Initializer,
      which currently doesn't do much, but there is a potential for added
      functionality in the future.
      Lastly it introduced client hooks which are especially necessary during
      client connecting phase.
      834c5720
  5. 12 6月, 2015 2 次提交
  6. 02 6月, 2015 2 次提交
  7. 18 5月, 2015 1 次提交
  8. 15 4月, 2015 1 次提交
    • E
      virsh: fix regression in 'virsh event' by domain · 31ef0836
      Eric Blake 提交于
      Commit a0670aef caused a regression in 'virsh event' and
      'virsh qemu-monitor-event' - if a user tries to filter the
      command to a specific domain, an error message is printed:
      
      $ virsh event dom --loop
      error: internal error: virsh qemu-monitor-event: no domain VSH_OT_DATA option
      
      and then the command continues as though no domain had been
      supplied (giving events for ALL domains, instead of the
      requested one).  This is because the code was incorrectly
      assuming that all "domain" options would be supplied via a
      mandatory VSH_OT_DATA, even though "domain" is optional for
      these two commands, so we had changed them to VSH_OT_STRING
      to quit failing for other reasons (ever since it was decided
      that VSH_OT_DATA and VSH_OT_STRING should no longer be
      synonyms).
      
      In looking at the situation, though, the code for looking up
      a domain was making a pointless check for whether the option
      exists prior to finding the option's string value, as
      vshCommandOptStringReq does just fine at reporting any errors
      when looking up a string whether or not the option was present.
      
      So this is a case of regression fixing by pure code deletion :)
      
      * tools/virsh-domain.c (vshCommandOptDomainBy): Drop useless filter.
      * tools/virsh-interface.c (vshCommandOptInterfaceBy): Likewise.
      * tools/virsh-network.c (vshCommandOptNetworkBy): Likewise.
      * tools/virsh-nwfilter.c (vshCommandOptNWFilterBy): Likewise.
      * tools/virsh-secret.c (vshCommandOptSecret): Likewise.
      * tools/virsh.h (vshCmdHasOption): Drop unused function.
      * tools/virsh.c (vshCmdHasOption): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      31ef0836
  9. 02 4月, 2015 2 次提交
  10. 09 3月, 2015 1 次提交
  11. 12 1月, 2015 1 次提交
  12. 15 11月, 2014 1 次提交
  13. 06 11月, 2014 1 次提交
  14. 30 10月, 2014 1 次提交
    • L
      virsh: Fix memory leak in cmdNetworkDHCPLeases · 089663ae
      Luyao Huang 提交于
      After cidr_format is allocated by virAsprintf and used by vshPrintExtra
      it needs to be freed.
      
      Fix the following memory leak from valgrind:
       18 bytes in 1 blocks are definitely lost in loss record 41 of 192
          at 0x4C29BBD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
          by 0x85CE36F: __vasprintf_chk (vasprintf_chk.c:80)
          by 0x4EE52D5: UnknownInlinedFun (stdio2.h:210)
          by 0x4EE52D5: virVasprintfInternal (virstring.c:459)
          by 0x4EE53CA: virAsprintfInternal (virstring.c:480)
          by 0x14FE96: cmdNetworkDHCPLeases (virsh-network.c:1378)
          by 0x13006B: vshCommandRun (virsh.c:1915)
          by 0x12A9E1: main (virsh.c:3699)
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      089663ae
  15. 11 9月, 2014 2 次提交
    • J
      virsh: Resolve Coverity DEADCODE · b46b7785
      John Ferlan 提交于
      Coverity points out that by using EMPTYSTR(type) we are guarding against
      the possibility that it could be NULL; however, based on how 'type' was
      initialized to NULL, then using nested ternary if-then-else's (?:?:)
      setting either "ipv4", "ipv6", or "" - there is no way it could be NULL.
      Since "-" is supposed to mean something empty in a field - modify the
      nested ternary to an easier to read/process if-then-else leaving the
      initialization to NULL to mean "-" in the formatted output.
      
      Also changed the name from 'type' to 'typestr'.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      b46b7785
    • J
      virsh: Resolve Coverity DEADCODE · daf27d4d
      John Ferlan 提交于
      Since 0766783a
      
      Coverity complains that the EDIT_FREE definition results in DEADCODE.
      
      As it turns out with the change to use the EDIT_FREE macro the call to
      vir*Free() wouldn't be necessary nor would it happen...
      
      Prior code to above commitid would :
      
        vir*Ptr foo = NULL;
        ...
        foo = vir*GetXMLDesc()
        ...
        vir*Free(foo);
        foo = vir*DefineXML()
        ...
      
      And thus the free was needed.  With the change to use EDIT_FREE the
      same code changed to:
      
        vir*Ptr foo = NULL;
        vir*Ptr foo_edited = NULL;
        ...
        foo = vir*GetXMLDesc()
        ...
        if (foo_edited)
            vir*Free(foo_edited);
        foo_edited = vir*DefineXML()
        ...
      
      However, foo_edited could never be set in the code path - even with
      all the goto's since the only way for it to be set is if vir*DefineXML()
      succeeds in which case the code to allow a retry (and thus all the goto's)
      never leaves foo_edited set
      
      All error paths lead to "cleanup:" which causes both foo and foo_edited
      to call the respective vir*Free() routines if set.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      daf27d4d
  16. 28 8月, 2014 1 次提交
  17. 19 8月, 2014 1 次提交
  18. 16 7月, 2014 1 次提交
    • J
      Fix assignment of comparison against zero · 3103a977
      Ján Tomko 提交于
      Assign the value we're comparing:
      (val = func()) < 0
      instead of assigning the comparison value:
      (val = func() < 0)
      
      Both were introduced along with the code,
      the TLS tests by commit bd789dff in 0.9.4
      net events by commit de87691f in 1.2.2.
      
      Note that the event id type fix is a no-op:
      vshNetworkEventIdTypeFromString can only return
      -1 (failure) and the event is never used or
      0 (the only possible event) and the value of 0 < 0 is still 0.
      3103a977
  19. 27 6月, 2014 1 次提交
  20. 24 6月, 2014 1 次提交
    • N
      net-dhcp-leases: Add virsh support · 59cac9a9
      Nehal J Wani 提交于
      Use virNetworkGetDHCPLeases and virNetworkGetDHCPLeasesForMAC in virsh.
      
      The new feature supports the follwing methods:
      
      1. Retrieve leases info for a given virtual network
      
      2. Retrieve leases info for given network interface
      
      tools/virsh-domain-monitor.c
         * Introduce new command : net-dhcp-leases
           Example Usage: net-dhcp-leases <network> [mac]
      
         virsh # net-dhcp-leases --network default6
         Expiry Time          MAC address        Protocol  IP address                Hostname        Client ID or DUID
         -------------------------------------------------------------------------------------------------------------------
         2014-06-16 03:40:14  52:54:00:85:90:e2  ipv4      192.168.150.231/24        fedora20-test   01:52:54:00:85:90:e2
         2014-06-16 03:40:17  52:54:00:85:90:e2  ipv6      2001:db8:ca2:2:1::c0/64   fedora20-test   00:04:b1:d8:86:42:e1:6a:aa:cf:d5:86:94:23:6f:94:04:cd
         2014-06-16 03:34:42  52:54:00:e8:73:eb  ipv4      192.168.150.181/24        ubuntu14-vm     -
         2014-06-16 03:34:46  52:54:00:e8:73:eb  ipv6      2001:db8:ca2:2:1::5b/64   -               00:01:00:01:1b:30:c6:aa:52:54:00:e8:73:eb
      
      tools/virsh.pod
         * Document new command
      
      src/internal.h
         * Introduce new macro: EMPTYSTR
      59cac9a9
  21. 31 3月, 2014 1 次提交
    • E
      virsh: fix 'help event' · 14d7fcc2
      Eric Blake 提交于
      'virsh help event' included a summary line "event - (null)"
      due to a misnamed info field.
      
      * tools/virsh-domain.c (info_event): Use correct name.
      * tools/virsh-network.c (info_network_event): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      14d7fcc2
  22. 25 3月, 2014 1 次提交
  23. 25 2月, 2014 1 次提交
    • E
      virsh: use more compact VIR_ENUM_IMPL · 466b12ab
      Eric Blake 提交于
      Dan Berrange suggested that using VIR_ENUM_IMPL is more compact
      than open-coding switch statements, and still just as forceful
      at making us remember to update lists if we add enum values
      in the future.  Make this change throughout virsh.
      
      Sure enough, doing this change caught that we missed at least
      VIR_STORAGE_VOL_NETDIR.
      
      * tools/virsh-domain-monitor.c (vshDomainIOErrorToString)
      (vshDomainControlStateToString, vshDomainStateToString)
      (vshDomainStateReasonToString): Change switch to enum lookup.
      (cmdDomControl, cmdDominfo): Update caller.
      * tools/virsh-domain.c (vshDomainVcpuStateToString)
      (vshDomainEventToString, vshDomainEventDetailToString): Change
      switch to enum lookup.
      (vshDomainBlockJobToString, vshDomainJobToString): New functions.
      (cmdVcpuinfo, cmdBlockJob, cmdDomjobinfo, cmdEvent): Update
      callers.
      * tools/virsh-network.c (vshNetworkEventToString): Change switch
      to enum lookup.
      * tools/virsh-pool.c (vshStoragePoolStateToString): New function.
      (cmdPoolList, cmdPoolInfo): Update callers.
      * tools/virsh-volume.c (vshVolumeTypeToString): Change switch to
      enum lookup.
      (cmdVolInfo, cmdVolList): Update callers.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      466b12ab
  24. 21 2月, 2014 1 次提交
    • E
      virsh: add net-event command · de87691f
      Eric Blake 提交于
      Add 'virsh net-event --list' and 'virsh net-event [net] --event=name
      [--loop] [--timeout]'.  Very similar to 'virsh event'.
      
      * tools/virsh.pod (net-event): Document new command.
      * tools/virsh-network.c (vshNetworkEventToString, vshNetEventData)
      (vshEventLifecyclePrint, cmdNetworkEvent): New struct and
      functions.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      de87691f
  25. 20 11月, 2013 1 次提交
  26. 28 8月, 2013 1 次提交
    • J
      virsh: free the list from ListAll APIs even for 0 items · f733eac0
      Ján Tomko 提交于
      virsh secret-list leak when no secrets are defined:
      
      ==27== 8 bytes in 1 blocks are definitely lost in loss record 6 of 726
      ==27==    by 0x4E941DD: virAllocN (viralloc.c:183)
      ==27==    by 0x5037F1A: remoteConnectListAllSecrets (remote_driver.c:3076)
      ==27==    by 0x5004EC6: virConnectListAllSecrets (libvirt.c:16298)
      ==27==    by 0x15F813: vshSecretListCollect (virsh-secret.c:397)
      ==27==    by 0x15F0E1: cmdSecretList (virsh-secret.c:532)
      
      And so do some other *-list commands.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1001536
      f733eac0
  27. 26 8月, 2013 1 次提交
  28. 11 7月, 2013 1 次提交
  29. 11 5月, 2013 1 次提交
    • L
      util: move virFile* functions from virutil.c to virfile.c · bfe7721d
      Laine Stump 提交于
      These all existed before virfile.c was created, and for some reason
      weren't moved.
      
      This is mostly straightfoward, although the syntax rule prohibiting
      write() had to be changed to have an exception for virfile.c instead
      of virutil.c.
      
      This movement pointed out that there is a function called
      virBuildPath(), and another almost identical function called
      virFileBuildPath(). They really should be a single function, which
      I'll take care of as soon as I figure out what the arglist should look
      like.
      bfe7721d
  30. 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
  31. 15 3月, 2013 1 次提交
    • 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
  32. 13 2月, 2013 2 次提交
  33. 04 2月, 2013 1 次提交
  34. 17 1月, 2013 1 次提交
  35. 11 1月, 2013 1 次提交
    • P
      virsh: Reformat output of virsh net-list · d0b8bc85
      Peter Krempa 提交于
      This patch changes whitespace and the length of the separation line from
      this format:
      
      $ virsh net-list --all
      Name                 State      Autostart     Persistent
      --------------------------------------------------
      default              inactive   yes           yes
      
      to
      
      $ virsh net-list --all
       Name                 State      Autostart     Persistent
      ----------------------------------------------------------
       default              inactive   yes           yes
      
      to match the output of virsh list.
      d0b8bc85