1. 05 10月, 2011 2 次提交
    • E
      snapshot: simplify esx snapshot name lookup · f0455833
      Eric Blake 提交于
      No need to request the parent of a snapshot if we aren't going to use it.
      
      * src/esx/esx_vi.c (esxVI_GetSnapshotTreeByName): Make parent
      optional.
      * src/esx/esx_driver.c (esxDomainSnapshotCreateXML)
      (esxDomainSnapshotLookupByName, esxDomainRevertToSnapshot)
      (esxDomainSnapshotDelete): Simplify accordingly.
      f0455833
    • E
      snapshot: implement snapshot roots listing in esx · 827a992a
      Eric Blake 提交于
      Commit 9f5e53e2 introduced the ability to filter snapshots to
      just roots, but it was never implemented for ESX until now.
      
      * src/esx/esx_vi.h (esxVI_GetNumberOfSnapshotTrees)
      (esxVI_GetSnapshotTreeNames): Add parameter.
      * src/esx/esx_vi.c (esxVI_GetNumberOfSnapshotTrees)
      (esxVI_GetSnapshotTreeNames): Allow choice of recursion or not.
      * src/esx/esx_driver.c (esxDomainSnapshotNum)
      (esxDomainSnapshotListNames): Use it to limit to roots.
      827a992a
  2. 14 9月, 2011 1 次提交
    • P
      xml: Clean up rest of virtual XML document names for XML strings · b998f1f7
      Peter Krempa 提交于
      Commit 498d7833 cleans up some of virtual file names for parsing strings
      in memory. This patch cleans up (hopefuly) the rest forgotten by the
      first patch.
      
      This patch also changes all of the previously modified "filenames" to
      valid URI's replacing spaces for underscores.
      
      Changes to v1:
      - Replace all spaces for underscores, so that the strings form valid
        URI's
      - Replace spaces in places changed by commit 498d7833
      b998f1f7
  3. 08 9月, 2011 1 次提交
  4. 19 8月, 2011 2 次提交
    • E
      maint: simplify lots of libxml2 clients · d89dd42d
      Eric Blake 提交于
      Repetitive patterns should be factored.  The sign of a good
      factorization is a change that kills 5x more lines than it adds :)
      
      * src/conf/domain_conf.c (virDomainDeviceDefParse)
      (virDomainSnapshotDefParseString): Use new convenience macros.
      * src/conf/storage_conf.c (virStoragePoolDefParseSourceString):
      Likewise.
      * src/cpu/cpu.c (cpuCompareXML, cpuBaselineXML): Likewise.
      * src/esx/esx_vi.c (esxVI_Context_Execute): Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationCookieXMLParseStr):
      Likewise.
      * src/security/virt-aa-helper.c (caps_mockup): Likewise.
      * src/test/test_driver.c (testOpenFromFile): Likewise.
      * tests/cputest.c (cpuTestLoadXML, cpuTestLoadMultiXML):
      Likewise.
      * tools/virsh.c (cmdFreecell, makeCloneXML, cmdVNCDisplay)
      (cmdTTYConsole, cmdDetachInterface, cmdDetachDisk)
      (cmdSnapshotCreate, cmdSnapshotCreateAs, cmdSnapshotCurrent)
      (cmdSnapshotList, cmdSnapshotParent): Likewise.
      d89dd42d
    • E
      maint: treat more libxml2 functions as free-like · e472fe25
      Eric Blake 提交于
      * cfg.mk (useless_free_options): Add xmlFreeDoc, xmlBufferFree.
      * src/esx/esx_vi.c (ESX_VI__TEMPLATE__FREE): Fix offenders.
      * tools/virsh.c (cmdFreecell, cmdVNCDisplay, cmdTTYConsole)
      (cmdDetachInterface, cmdDetachDisk, cmdSnapshotCreate)
      (cmdSnapshotCreateAs, cmdSnapshotList, cmdSnapshotParent):
      Likewise.
      e472fe25
  5. 08 6月, 2011 1 次提交
    • E
      esx: avoid dead code · 657ae229
      Eric Blake 提交于
      Detected by Coverity.  The beginning of the function already filtered
      out NULL objectContentList as invalid.  Further investigation shows:
      
      esxVI_RetrieveProperties is generated and returns a list of objects
      that match the given propertyFilterSpec.
      esxVI_LookupObjectContentByType then tests whether the result
      corresponds to the expected occurrence and reports an error otherwise.
      This simplifies the callers of  esxVI_LookupObjectContentByType, but
      due to the missing dereference the check was never performed because
      the code thought that at least one item was obtained. NULL represents
      an empty list. This is a potential segfault fix because callers of
      esxVI_LookupObjectContentByType that specified "required" occurrence
      assume *objectContentList to be non-NULL when
      esxVI_LookupObjectContentByType succeeds.
      
      * src/esx/esx_vi.c (esxVI_LookupObjectContentByType): Check
      correct pointer.
      657ae229
  6. 17 5月, 2011 3 次提交
  7. 13 5月, 2011 1 次提交
  8. 12 5月, 2011 1 次提交
    • L
      libvirt,logging: cleanup VIR_XXX0() · b65f37a4
      Lai Jiangshan 提交于
      These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.
      
      How do these coversions works? The magic is using the gcc extension of ##.
      When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to
      avoid compile error.
      
      example: origin				after CPP
      	high_level_api("%d", a_int)	low_level_api("%d", a_int)
      	high_level_api("a  string")	low_level_api("a  string")
      
      About 400 conversions.
      
      8 special conversions:
      VIR_XXXX0("") -> VIR_XXXX("msg") (avoid empty format) 2 conversions
      VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions
      VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal)
        (for security) 6 conversions
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      b65f37a4
  9. 06 5月, 2011 1 次提交
    • E
      maint: rename virBufferVSprintf to virBufferAsprintf · 68ea80cf
      Eric Blake 提交于
      We already have virAsprintf, so picking a similar name helps for
      seeing a similar purpose.  Furthermore, the prefix V before printf
      generally implies 'va_list', even though this variant was '...', and
      the old name got in the way of adding a new va_list version.
      
      global rename performed with:
      
      $ git grep -l virBufferVSprintf \
        | xargs -L1 sed -i 's/virBufferVSprintf/virBufferAsprintf/g'
      
      then revert the changes in ChangeLog-old.
      68ea80cf
  10. 24 4月, 2011 2 次提交
  11. 16 4月, 2011 1 次提交
  12. 14 4月, 2011 1 次提交
  13. 08 1月, 2011 1 次提交
  14. 07 1月, 2011 1 次提交
  15. 30 12月, 2010 1 次提交
  16. 22 12月, 2010 2 次提交
    • M
      esx: Move VMX handling code out of the driver directory · 42b2f35d
      Matthias Bolte 提交于
      Now the VMware driver doesn't depend on the ESX driver anymore.
      
      Add a WITH_VMX option that depends on WITH_ESX and WITH_VMWARE.
      Also add a libvirt_vmx.syms file.
      
      Move some escaping functions from esx_util.c to vmx.c.
      
      Adapt the test suite, ESX and VMware driver to the new code layout.
      42b2f35d
    • M
      esx: Fix cluster resource lookup when connecting to a vCenter · 8cd4ca45
      Matthias Bolte 提交于
      Connecting to a ESX(i) server that is part of a cluster failed
      when the connection also involved a vCenter.
      
      Accept ClusterComputeResource type in addition to ComputeResource
      type in the object lookup function.
      
      Reported by Guillaume Le Louët.
      8cd4ca45
  17. 11 12月, 2010 1 次提交
    • M
      esx: Improve error reporting for failed tasks · 2a151699
      Matthias Bolte 提交于
      Instead of just reporting that a task failed get the
      localized message from the TaskInfo error and include
      it in the reported error message.
      
      Implement minimal deserialization support for the
      MethodFault type in order to obtain the actual fault
      type.
      
      For example, this changes the reported error message
      when trying to create a volume with zero size from
      
        Could not create volume
      
      to
      
        Could not create volume: InvalidArgument - A specified parameter was not correct.
      
      Not perfect yet, but better than before.
      2a151699
  18. 10 11月, 2010 1 次提交
  19. 15 10月, 2010 1 次提交
  20. 08 9月, 2010 2 次提交
    • M
      esx: Use SessionIsActive when available · 5699034b
      Matthias Bolte 提交于
      Before this commit SessionIsActive was not used because ESX(i)
      doesn't implement it. vCenter supports SessionIsActive, so use
      it here, but keep the fall back mechanism for ESX(i) and GSX.
      5699034b
    • M
      esx: Fall back to path as key when QueryVirtualDiskUuid isn't available · 8fdb0b0c
      Matthias Bolte 提交于
      QueryVirtualDiskUuid is only available on an ESX(i) server. vCenter
      returns an NotImplemented fault and a GSX server is missing the
      VirtualDiskManager completely. Therefore only use QueryVirtualDiskUuid
      with an ESX(i) server and fall back to path as storage volume key for
      vCenter and GSX server.
      8fdb0b0c
  21. 04 9月, 2010 2 次提交
  22. 03 9月, 2010 1 次提交
    • M
      esx: Rework datastore path parsing and handling · 84768912
      Matthias Bolte 提交于
      Instead of splitting the path part of a datastore path into
      directory and file name, keep this in one piece. An example:
      
        "[datastore] directory/file"
      
      was split into this before:
      
        datastoreName = "datastore"
        directoryName = "directory"
        fileName = "file"
      
      Now it's split into this:
      
        datastoreName = "datastore"
        directoryName = "directory"
        directoryAndFileName = "directory/file"
      
      This simplifies code using esxUtil_ParseDatastorePath, because
      directoryAndFileName is used more often than fileName. Also the
      old approach expected the datastore path to reference an actual
      file, but this isn't always correct, especially when listing
      volumes. In that case esxUtil_ParseDatastorePath is used to parse
      a path that references a directory. This fails for a vpx://
      connection because the vCenter returns directory paths with a
      trailing '/'. The new approach is robust against this and the
      actual decision if the datastore path should reference a file or
      a directory is up to the caller of esxUtil_ParseDatastorePath.
      
      Update the tests accordingly.
      84768912
  23. 27 8月, 2010 2 次提交
  24. 24 8月, 2010 1 次提交
    • M
      esx: Improve object-by-type lookup performance · 8c48743b
      Matthias Bolte 提交于
      Instead of using one big traversal spec for lookup use a set of
      more fine grained traversal specs that are selected based on the
      actual needs of the lookup.
      
      This gives up to 20% speedup for certain operations like domain
      listing due to less HTTP(S) traffic.
      8c48743b
  25. 18 8月, 2010 1 次提交
  26. 03 8月, 2010 4 次提交
    • M
      esx: Set storage pool target path to host.mountInfo.path · 14954fb8
      Matthias Bolte 提交于
      Now all storage pool types expose the target path.
      14954fb8
    • M
      esx: Make storage pool lookup by name and UUID more robust · 5254546b
      Matthias Bolte 提交于
      Don't rely on summary.url anymore, because its value is different
      between an esx:// and vpx:// connection. Use host.mountInfo.path
      instead.
      
      Don't fallback to lookup by UUID (actually lookup by absolute path)
      in esxVI_LookupDatastoreByName when lookup by name fails. Add a
      seperate function for this: esxVI_LookupDatastoreByAbsolutePath
      5254546b
    • M
      esx: Restrict vpx:// to handle a single host in a vCenter · e4938ce2
      Matthias Bolte 提交于
      Now a vpx:// connection has an explicitly specified host. This
      allows to enabled several functions for a vpx:// connection
      again, like host UUID, hostname, general node info, max vCPU
      count, free memory, migration and defining new domains.
      
      Lookup datacenter, compute resource, resource pool and host
      system once and cache them. This simplifies the rest of the
      code and reduces overall HTTP(S) traffic a bit.
      
      esx:// and vpx:// can be mixed freely for a migration.
      
      Ensure that migration source and destination refer to the
      same vCenter. Also directly encode the resource pool and
      host system object IDs into the migration URI in the prepare
      function. Then directly build managed object references in
      the perform function instead of re-looking up already known
      information.
      e4938ce2
    • M
      esx: Parse the path of the URI · ac041072
      Matthias Bolte 提交于
      The path will be used to specify the datacenter, compute resource
      and host system to be used with a vpx:// connection.
      ac041072
  27. 30 7月, 2010 1 次提交
    • M
      esx: Improve blocked task detection and fix race condition · 25e34b70
      Matthias Bolte 提交于
      esxVI_WaitForTaskCompletion can take a UUID to lookup the
      corresponding domain and check if the current task for it
      is blocked by a question. It calls another function to do
      this: esxVI_LookupAndHandleVirtualMachineQuestion looks up
      the VirtualMachine and checks for a question. If there is
      a question it calls esxVI_HandleVirtualMachineQuestion to
      handle it.
      
      If there was no question or it has been answered the call
      to esxVI_LookupAndHandleVirtualMachineQuestion returns 0.
      If any error occurred during the lookup and answering
      process -1 is returned. The problem with this is, that -1
      is also returned when there was no error but the question
      could not be answered. So esxVI_WaitForTaskCompletion cannot
      distinguish between this two situations and reports that a
      question is blocking the task even when there was actually
      another problem.
      
      This inherent problem didn't surface until vSphere 4.1 when
      you try to define a new domain. The driver tries to lookup
      the domain that is just in the process of being registered.
      There seems to be some kind of race condition and the driver
      manages to issue a lookup command before the ESX server was
      able to register the domain. This used to work before.
      
      Due to the return value problem described above the driver
      reported a false error message in that case.
      
      To solve this esxVI_WaitForTaskCompletion now takes an
      additional occurrence parameter that describes whether or
      not to expect the domain to be existent. Also add a new
      parameter to esxVI_LookupAndHandleVirtualMachineQuestion
      that allows to distinguish if the call returned -1 because
      of an actual error or because the question could not be
      answered.
      25e34b70
  28. 25 7月, 2010 1 次提交