1. 11 9月, 2014 1 次提交
    • 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
  2. 25 3月, 2014 1 次提交
  3. 13 11月, 2013 1 次提交
    • P
      virsh-nwfilter: Unify list command column alignment · 75fe29e2
      Peter Krempa 提交于
      Before:
      $ virsh nwfilter-list
      UUID                                  Name
      ----------------------------------------------------------------
      651d902c-165c-4bcc-8d73-41319af1e6bc  allow-arp
      9ae11362-df6b-407f-8864-3bdf5125bf77  allow-dhcp
      53b5a9ed-7d46-480f-a201-6d8a503d6533  allow-dhcp-server
      
      After:
      $ virsh nwfilter-list
       UUID                                  Name
      ------------------------------------------------------------------
       651d902c-165c-4bcc-8d73-41319af1e6bc  allow-arp
       9ae11362-df6b-407f-8864-3bdf5125bf77  allow-dhcp
       53b5a9ed-7d46-480f-a201-6d8a503d6533  allow-dhcp-server
      75fe29e2
  4. 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
  5. 11 7月, 2013 1 次提交
  6. 21 5月, 2013 1 次提交
  7. 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
  8. 13 2月, 2013 2 次提交
  9. 04 2月, 2013 1 次提交
  10. 17 1月, 2013 1 次提交
  11. 21 12月, 2012 4 次提交
  12. 21 9月, 2012 1 次提交
  13. 17 9月, 2012 1 次提交
    • O
      list: Use virConnectListAllNWFilters in virsh · 9b096843
      Osier Yang 提交于
      tools/virsh-nwfilter.c:
        * vshNWFilterSorter to sort network filters by name
      
        * vshNWFilterListFree to free the network filter objects list.
      
        * vshNWFilterListCollect to collect the network filter objects, trying
          to use new API first, fall back to older APIs if it's not supported.
      9b096843
  14. 31 8月, 2012 1 次提交
  15. 21 8月, 2012 2 次提交
    • E
      virsh: split out virsh-nwfilter.c · 69af4f7c
      Eric Blake 提交于
      Yet another split file.
      
      * tools/virsh-nwfilter.h: New file.
      * tools/Makefile.am (virsh_SOURCES): Build it.
      * tools/virsh.c: Use new header.
      * tools/virsh-nwfilter.c: Likewise.
      69af4f7c
    • E
      virsh: declare more common functions · 4c10b3c7
      Eric Blake 提交于
      In preparation for splitting virsh-interface.c, I found these
      functions need to be declared in virsh.h, as well as one that
      belongs more properly in virsh-domain.h.  Also, since we
      use the VSH_BY* flags in more than one function, I improved
      how they are used.
      
      * tools/virsh.h (vshNameSorter, vshCmdHasOption): Declare.
      (VSH_BYID): Turn into enum.
      (vshCommandOptDomainBy): Move...
      * tools/virsh-domain.h): ...here.
      * tools/virsh.c: (vshNameSorter): Export.
      (cmd_has_option): Rename...
      (vshCmdHasOption): ...and export.
      (vshCommandOptDomainBy): Move...
      * tools/virsh-domain.c (vshCommandOptDomainBy): ...here, adjust
      signature, and check flags.
      * tools/virsh-network.c (vshCommandOptNetworkBy): Update callers.
      * tools/virsh-nwfilter.c (vshCommandOptNWFilterBy): Likewise.
      * tools/virsh-secret.c (vshCommandOptSecret): Likewise.
      * tools/virsh-domain-monitor.c (includes): Likewise.
      * tools/virsh-host.c (includes): Likewise.
      4c10b3c7
  16. 20 8月, 2012 1 次提交
    • E
      virsh: use common namespacing · e68ee5e7
      Eric Blake 提交于
      Convert the exported items in virsh.h to use a common 'vsh' prefix.
      
      * tools/virsh.h (VIRSH_MAX_XML_FILE): Rename...
      (VSH_MAX_XML_FILE): ...and parenthesize.
      (DIFF_MSEC, CTRL_CLOSE_BRACKET): Delete.
      (vshUsage, vshInit, vshDeinit, vshParseArgv): Remove prototype.
      (editWriteToTempFile, editFile, editReadBackFile, prettyCapacity)
      (virshReportError): Rename...
      (vshEditWriteToTempFile, vshEditFile, vshEditReadBackFile)
      (vshPrettyCapacity, vshReportError): ...into vsh namespace.
      (jobWatchTimeoutFunc): Move to virsh-domain.c.
      * tools/virsh.c (vshCommandRun): Inline former DIFF_MSEC.
      (main): Inline former CTRL_CLOSE_BRACKET.
      (vshUsage, vshInit, vshDeinit, vshParseArgv): Make static.
      (prettyCapacity, virshReportError, editWriteToTempFile, editFile):
      Fix naming, and adjust usage.
      (vshAskReedit, vshCommandRun, vshEventLoop, vshInit): Adjust
      usage.
      * tools/virsh-domain.c (cmdAttachDevice, cmdCPUCompare)
      (cmdCPUBaseline, cmdCreate, cmdDefine, cmdDetachDevice)
      (cmdUpdateDevice, cmdDesc, cmdUndefine, cmdStart, cmdVcpucount)
      (cmdAttachDevice, cmdDomjobinfo): Likewise.
      * tools/virsh-edit.c (do): Likewise.
      * tools/virsh-interface.c (cmdInterfaceDefine): Likewise.
      * tools/virsh-network.c (cmdNetworkCreate, cmdNetworkDefine):
      Likewise.
      * tools/virsh-nodedev.c (cmdNodeDeviceCreate): Likewise.
      * tools/virsh-nwfilter.c (cmdNWFilterDefine): Likewise.
      * tools/virsh-pool.c (cmdPoolCreate, cmdPoolDefine)
      (cmdPoolDiscoverSources, cmdPoolList): Likewise.
      * tools/virsh-secret.c (cmdSecretDefine): Likewise.
      * tools/virsh-snapshot.c (cmdSnapshotCreate, vshSnapshotCreate)
      (vshLookupSnapshot, cmdSnapshotEdit, cmdSnapshotCurrent)
      (vshGetSnapshotParent): Likewise.
      * tools/virsh-volume.c (cmdVolCreate, cmdVolCreateFrom)
      (cmdVolInfo, cmdVolList): Likewise.
      e68ee5e7
  17. 26 7月, 2012 2 次提交
    • O
      virsh: Move command group definition into its own file · c4bdf307
      Osier Yang 提交于
      * virsh-domain-monitor.c: Add domMonitoringCmds
      * virsh-domain.c: Add domManagementCmds
      * virsh-host.c: Add hostAndHypervisorCmds
      * virsh-interface.c: Add ifaceCmds
      * virsh-network.c: Add networkCmds
      * virsh-nodedev.c: Add nodedevCmds
      * virsh-nwfilter.c: Add nwfilterCmds
      * virsh-pool.c: Add storagePoolCmds
      * virsh-secret.c: Add secretCmds
      * virsh-snapshot.c: Add snapshotCmds
      * virsh-volume.c: Add storageVolCmds
      * virsh.c: Remove all the above *Cmds.
      c4bdf307
    • O
      virsh: Split cmds to manage network filter from virsh.c · e9d10055
      Osier Yang 提交于
      Commands to manage network filter are moved from virsh.c to virsh-nwfilter.c,
      with a few helpers for network filter command use.
      
      * virsh.c: Remove network filter commands and a few helpers.
                 (vshCommandOptNWFilter, and vshCommandOptNWFilterBy)
      * virsh-nwfilter.c: New file, filled with network filter commands and its helpers.
      
      * po/POTFILES.in: Add virsh-nwfilter.c
      
      * cfg.mk: Skip to check config.h including for virsh-nwfilter.c
      e9d10055