1. 18 5月, 2015 1 次提交
  2. 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
  3. 02 4月, 2015 2 次提交
  4. 09 3月, 2015 1 次提交
  5. 12 1月, 2015 1 次提交
  6. 15 11月, 2014 1 次提交
  7. 06 11月, 2014 1 次提交
  8. 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
  9. 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
  10. 28 8月, 2014 1 次提交
  11. 19 8月, 2014 1 次提交
  12. 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
  13. 27 6月, 2014 1 次提交
  14. 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
  15. 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
  16. 25 3月, 2014 1 次提交
  17. 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
  18. 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
  19. 20 11月, 2013 1 次提交
  20. 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
  21. 26 8月, 2013 1 次提交
  22. 11 7月, 2013 1 次提交
  23. 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
  24. 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
  25. 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
  26. 13 2月, 2013 2 次提交
  27. 04 2月, 2013 1 次提交
  28. 17 1月, 2013 1 次提交
  29. 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
  30. 21 12月, 2012 4 次提交
  31. 01 11月, 2012 1 次提交
  32. 21 9月, 2012 2 次提交
    • L
      virsh: new net-update command · fe787282
      Laine Stump 提交于
      This command uses the new virNetworkUpdate() API to modify an existing
      network definition, and optionally have those modifications take
      effect immediately without restarting the network.
      
      An example usage:
      
        virsh net-update mynet add-last ip-dhcp-host \
         "<host mac='00:11:22:33:44:55' ip='192.168.122.45'/>" \
         --live --config
      
      If you like, you can instead put the xml into a file, and call like
      this:
      
        virsh net-update mynet add ip-dhcp-host /tmp/myxml.xml
         --live --config
      
      virsh will autodetect whether the argument is itself an xml element,
      or if it's a file, by looking at the first character - the first
      character of an xml element is always "<", and the first character of
      a file is almost always *not* "<" (in the rare case that it is, the
      user could specify "./<filename...").
      
      A --parent-index option is also available (to give the index within a
      list of parent objects, e.g. the index of the parent <ip> element when
      updating ip-dhcp-host elements), but is optional and at least for now
      will probably be used rarely.
      
      --live, --config, and --current options - if you specify --live, only
      the live state of the network will be updated. If you also specify
      --config, then the persistent configuration will also be updated;
      these two commands can be given separately, or both together. If you
      don't specify either (you can optionally specify "--current" for the
      same effect), then the "current" config will be updated (i.e. if the
      network is active, then only its live config is affected, but if the
      network is inactive, only the persistent config is affected).
      fe787282
    • E
      maint: fix up copyright notice inconsistencies · 4ecb723b
      Eric Blake 提交于
      https://www.gnu.org/licenses/gpl-howto.html recommends that
      the 'If not, see <url>.' phrase be a separate sentence.
      
      * tests/securityselinuxhelper.c: Remove doubled line.
      * tests/securityselinuxtest.c: Likewise.
      * globally: s/;  If/.  If/
      4ecb723b
  33. 13 9月, 2012 1 次提交