1. 25 2月, 2013 1 次提交
  2. 21 12月, 2012 7 次提交
  3. 03 12月, 2012 2 次提交
    • P
      maint: Misc whitespace cleanups · 83124357
      Peter Krempa 提交于
      83124357
    • J
      conf: prevent crash with no uuid in cephx auth secret · bc680e13
      Ján Tomko 提交于
      Fix the null pointer access when UUID is not specified.
      Introduce a bool 'uuidUsable' to virStoragePoolAuthCephx that indicates
      if uuid was specified or not and use it instead of the pointless
      comparison of the static UUID array to NULL.
      Add an error message if both uuid and usage are specified.
      
      Fixes:
      Error: FORWARD_NULL (CWE-476):
      libvirt-0.10.2/src/conf/storage_conf.c:461: var_deref_model: Passing
          null pointer "uuid" to function "virUUIDParse(char const *, unsigned
          char *)", which dereferences it. (The dereference is assumed on the
          basis of the 'nonnull' parameter attribute.)
      Error: NO_EFFECT (CWE-398):
          libvirt-0.10.2/src/conf/storage_conf.c:979: array_null: Comparing an
          array to null is not useful: "src->auth.cephx.secret.uuid != NULL".
      bc680e13
  4. 29 11月, 2012 1 次提交
  5. 26 11月, 2012 1 次提交
    • A
      Add private data pointer to virStoragePool and virStorageVol · 2b121dbc
      Ata E Husain Bohra 提交于
      This will simplify the refactoring of the ESX storage driver to support
      a VMFS and an iSCSI backend.
      
      One of the tasks the storage driver needs to do is to decide which backend
      driver needs to be invoked for a given request. This approach extends
      virStoragePool and virStorageVol to store extra parameters:
      
      1. privateData: stores pointer to respective backend storage driver.
      2. privateDataFreeFunc: stores cleanup function pointer.
      
      virGetStoragePool and virGetStorageVol are modfied to accept these extra
      parameters as user params. virStoragePoolDispose and virStorageVolDispose
      checks for cleanup operation if available.
      
      The private data pointer allows the ESX storage driver to store a pointer
      to the used backend with each storage pool and volume. This avoids the need
      to detect the correct backend in each storage driver function call.
      2b121dbc
  6. 29 10月, 2012 1 次提交
    • J
      xml: print uuids in the warning · 0b121614
      Ján Tomko 提交于
      In the XML warning, we print a virsh command line that can be used to
      edit that XML. This patch prints UUIDs if the entity name contains
      special characters (like shell metacharacters, or "--" that would break
      parsing of the XML comment). If the entity doesn't have a UUID, just
      print the virsh command that can be used to edit it.
      0b121614
  7. 20 10月, 2012 1 次提交
    • E
      storage: list more file types · f772b3d9
      Eric Blake 提交于
      When an image has no backing file, using VIR_STORAGE_FILE_AUTO
      for its type is a bit confusing.  Additionally, a future patch
      would like to reserve a default value for the case of no file
      type specified in the XML, but different from the current use
      of -1 to imply probing, since probing is not always safe.
      
      Also, a couple of file types were missing compared to supported
      code: libxl supports 'vhd', and qemu supports 'fat' for directories
      passed through as a file system.
      
      * src/util/storage_file.h (virStorageFileFormat): Add
      VIR_STORAGE_FILE_NONE, VIR_STORAGE_FILE_FAT, VIR_STORAGE_FILE_VHD.
      * src/util/storage_file.c (virStorageFileMatchesVersion): Match
      documentation when version probing not supported.
      (cowGetBackingStore, qcowXGetBackingStore, qcow1GetBackingStore)
      (qcow2GetBackingStoreFormat, qedGetBackingStore)
      (virStorageFileGetMetadataFromBuf)
      (virStorageFileGetMetadataFromFD): Take NONE into account.
      * src/conf/domain_conf.c (virDomainDiskDefForeachPath): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo): Likewise.
      * src/conf/storage_conf.c (virStorageVolumeFormatFromString): New
      function.
      (poolTypeInfo): Use it.
      f772b3d9
  8. 21 9月, 2012 1 次提交
  9. 06 9月, 2012 1 次提交
    • O
      list: Add helpers for listing storage pool objects · 84208a4a
      Osier Yang 提交于
      src/conf/storage_conf.c: Add virStoragePoolMatch to filter the
      pools; Add virStoragePoolList to iterate over the pool objects
      with filter.
      
      src/conf/storage_conf.h: Declare virStoragePoolMatch,
      virStoragePoolList, and the macros for filters.
      
      src/libvirt_private.syms: Export helper virStoragePoolList.
      84208a4a
  10. 03 8月, 2012 2 次提交
    • H
      Added timestamps to storage volumes · 7383c1d7
      Hendrik Schwartke 提交于
      The access, birth, modification and change times are added to
      storage volumes and corresponding xml representations.  This
      shows up in the XML in this format:
      
      <timestamps>
        <atime>1341933637.027319099</atime>
        <mtime>1341933637.027319099</mtime>
      </timestamps>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7383c1d7
    • J
      Update xml schemas according to libvirt source · 37a10129
      Ján Tomko 提交于
      capability.rng: Guest features can be in any order.
      nodedev.rng: Added <driver> element, <capability> phys_function and
      virt_functions for PCI devices.
      storagepool.rng: Owner or group ID can be -1.
      
      schema tests: New capabilities and nodedev files; changed owner and
      group to -1 in pool-dir.xml.
      storage_conf: Print uid_t and gid_t as signed to storage pool XML.
      37a10129
  11. 23 7月, 2012 1 次提交
    • O
      Desert the FSF address in copyright · f9ce7dad
      Osier Yang 提交于
      Per the FSF address could be changed from time to time, and GNU
      recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)
      
        You should have received a copy of the GNU General Public License
        along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
      
      This patch removes the explicit FSF address, and uses above instead
      (of course, with inserting 'Lesser' before 'General').
      
      Except a bunch of files for security driver, all others are changed
      automatically, the copyright for securify files are not complete,
      that's why to do it manually:
      
        src/security/security_selinux.h
        src/security/security_driver.h
        src/security/security_selinux.c
        src/security/security_apparmor.h
        src/security/security_apparmor.c
        src/security/security_driver.c
      f9ce7dad
  12. 19 7月, 2012 2 次提交
    • S
      Add a sheepdog backend for the storage driver · 29bc4fe6
      Sebastian Wiedenroth 提交于
      This patch brings support to manage sheepdog pools and volumes to libvirt.
      It uses the "collie" command-line utility that comes with sheepdog for that.
      
      A sheepdog pool in libvirt maps to a sheepdog cluster.
      It needs a host and port to connect to, which in most cases
      is just going to be the default of localhost on port 7000.
      
      A sheepdog volume in libvirt maps to a sheepdog vdi.
      To create one specify the pool, a name and the capacity.
      Volumes can also be resized later.
      
      In the volume XML the vdi name has to be put into the <target><path>.
      To use the volume as a disk source for virtual machines specify
      the vdi name as "name" attribute of the <source>.
      The host and port information from the pool are specified inside the host tag.
      
        <disk type='network'>
          ...
          <source protocol="sheepdog" name="vdi_name">
            <host name="localhost" port="7000"/>
          </source>
        </disk>
      
      To work right this patch parses the output of collie,
      so it relies on the raw output option. There recently was a bug which caused
      size information to be reported wrong. This is fixed upstream already and
      will be in the next release.
      Signed-off-by: NSebastian Wiedenroth <wiedi@frubar.net>
      29bc4fe6
    • D
      Convert all files in src/conf/ to use virReportError() · 1e0bb184
      Daniel P. Berrange 提交于
      This removes all the per-file error reporting macros
      from the code in src/conf/
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1e0bb184
  13. 11 7月, 2012 1 次提交
    • O
      storage: Default pool permission mode to 0755 · 8a544719
      Osier Yang 提交于
      Per the typical use of libvirt is to fork the qemu process with
      qemu:qemu. Setting the pool permission mode as 0700 by default
      will prevent the guest start with permission reason.
      
      Define macro for the default pool and vol permission modes
      incidentally.
      8a544719
  14. 09 7月, 2012 1 次提交
  15. 22 5月, 2012 1 次提交
    • W
      storage backend: Add RBD (RADOS Block Device) support · 74951ead
      Wido den Hollander 提交于
      This patch adds support for a new storage backend with RBD support.
      
      RBD is the RADOS Block Device and is part of the Ceph distributed storage
      system.
      
      It comes in two flavours: Qemu-RBD and Kernel RBD, this storage backend only
      supports Qemu-RBD, thus limiting the use of this storage driver to Qemu only.
      
      To function this backend relies on librbd and librados being present on the
      local system.
      
      The backend also supports Cephx authentication for safe authentication with
      the Ceph cluster.
      
      For storing credentials it uses the built-in secret mechanism of libvirt.
      Signed-off-by: NWido den Hollander <wido@widodh.nl>
      74951ead
  16. 10 5月, 2012 1 次提交
    • A
      conf: Fix memory leaks in virStoragePoolDefParseSource · 15e0b20a
      Alex Jia 提交于
      Detected by valgrind. Leaks are introduced in commit 122fa379.
      
      src/conf/storage_conf.c: fix memory leaks.
      
      How to reproduce?
      $ make && make -C tests check TESTS=storagepoolxml2xmltest
      $ cd tests && valgrind -v --leak-check=full ./storagepoolxml2xmltest
      
      actual result:
      ==28571== LEAK SUMMARY:
      ==28571==    definitely lost: 40 bytes in 5 blocks
      ==28571==    indirectly lost: 0 bytes in 0 blocks
      ==28571==      possibly lost: 0 bytes in 0 blocks
      ==28571==    still reachable: 1,054 bytes in 21 blocks
      ==28571==         suppressed: 0 bytes in 0 blocks
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      15e0b20a
  17. 01 5月, 2012 1 次提交
    • E
      storage: fix build with iscsi · 29e702e5
      Eric Blake 提交于
      The previous storage patch missed an instance affected by the struct
      member rename.  It also had some botched whitespace detected by
      'make check'.
      
      * src/storage/storage_backend_iscsi.c
      (virStorageBackendISCSIFindPoolSources): Adjust to new struct.
      * src/conf/storage_conf.c (virStoragePoolSourceFormat): Fix
      indentation.
      29e702e5
  18. 30 4月, 2012 2 次提交
  19. 20 4月, 2012 1 次提交
    • E
      conf: tighten up XML integer parsing · c09acad3
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=617711 reported that
      even with my recent patched to allow <memory unit='G'>1</memory>,
      people can still get away with trying <memory>1G</memory> and
      silently get <memory unit='KiB'>1</memory> instead.  While
      virt-xml-validate catches the error, our C parser did not.
      
      Not to mention that it's always fun to fix bugs while reducing
      lines of code.  :)
      
      * src/conf/domain_conf.c (virDomainParseMemory): Check for parse error.
      (virDomainDefParseXML): Avoid strtoll.
      * src/conf/storage_conf.c (virStorageDefParsePerms): Likewise.
      * src/util/xml.c (virXPathLongBase, virXPathULongBase)
      (virXPathULongLong, virXPathLongLong): Likewise.
      c09acad3
  20. 31 3月, 2012 1 次提交
    • E
      build: fix build on cygwin · 87681495
      Eric Blake 提交于
      Regression introduced when we changed types in commit 3e2c3d8f.
      
      We've done this sort of cleanup before (see commit c685993d).
      
      * src/conf/storage_conf.c (virStoragePoolDefFormat)
      (virStorageVolTargetDefFormat): Cast gid_t and uid_t.
      87681495
  21. 08 3月, 2012 2 次提交
    • E
      storage: support more scaling suffixes · 2e148612
      Eric Blake 提交于
      Disk manufacturers are fond of quoting sizes in powers of 10,
      rather than powers of 2 (after all, 2.1 GB sounds larger than
      2.0 GiB, even though the exact opposite is true).  So, we might
      as well follow coreutils' lead in supporting three types of
      suffix: single letter ${u} (which we already had) and ${u}iB
      for the power of 2, and ${u}B for power of 10.
      
      Additionally, it is impossible to create a file with more than
      2**63 bytes, since off_t is signed (if you have enough storage
      to even create one 8EiB file, I'm jealous).  This now reports
      failure up front rather than down the road when the kernel
      finally refuses an impossible size.
      
      * docs/schemas/basictypes.rng (unit): Add suffixes.
      * src/conf/storage_conf.c (virStorageSize): Use new function.
      * docs/formatstorage.html.in: Document it.
      * tests/storagevolxml2xmlin/vol-file-backing.xml: Test it.
      * tests/storagevolxml2xmlin/vol-file.xml: Likewise.
      2e148612
    • E
      xml: output memory unit for clarity · 26545784
      Eric Blake 提交于
      Make it obvious to 'dumpxml' readers what unit we are using,
      since our default of KiB for memory (1024) differs from qemu's
      default of MiB; and differs from our use of bytes for storage.
      
      Tests were updated via:
      
      $ find tests/*data tests/*out -name '*.xml' | \
        xargs sed -i 's/<\(memory\|currentMemory\|hard_limit\|soft_limit\|min_guarantee\|swap_hard_limit\)>/<\1 unit='"'KiB'>/"
      $ find tests/*data tests/*out -name '*.xml' | \
        xargs sed -i 's/<\(capacity\|allocation\|available\)>/<\1 unit='"'bytes'>/"
      
      followed by a few fixes for the stragglers.
      
      Note that with this patch, the RNG for <memory> still forbids
      validation of anything except unit='KiB', since the code silently
      ignores the attribute; a later patch will expand <memory> to allow
      scaled input in the code and update the RNG to match.
      
      * docs/schemas/basictypes.rng (unit): Add 'bytes'.
      (scaledInteger): New define.
      * docs/schemas/storagevol.rng (sizing): Use it.
      * docs/schemas/storagepool.rng (sizing): Likewise.
      * docs/schemas/domaincommon.rng (memoryKBElement): New define; use
      for memory elements.
      * src/conf/storage_conf.c (virStoragePoolDefFormat)
      (virStorageVolDefFormat): Likewise.
      * src/conf/domain_conf.h (_virDomainDef): Document unit used
      internally.
      * src/conf/storage_conf.h (_virStoragePoolDef, _virStorageVolDef):
      Likewise.
      * tests/*data/*.xml: Update all tests.
      * tests/*out/*.xml: Likewise.
      * tests/define-dev-segfault: Likewise.
      * tests/openvzutilstest.c (testReadNetworkConf): Likewise.
      * tests/qemuargv2xmltest.c (blankProblemElements): Likewise.
      26545784
  22. 02 3月, 2012 1 次提交
    • E
      build: use correct type for pid and similar types · 3e2c3d8f
      Eric Blake 提交于
      No thanks to 64-bit windows, with 64-bit pid_t, we have to avoid
      constructs like 'int pid'.  Our API in libvirt-qemu cannot be
      changed without breaking ABI; but then again, libvirt-qemu can
      only be used on systems that support UNIX sockets, which rules
      out Windows (even if qemu could be compiled there) - so for all
      points on the call chain that interact with this API decision,
      we require a different variable name to make it clear that we
      audited the use for safety.
      
      Adding a syntax-check rule only solves half the battle; anywhere
      that uses printf on a pid_t still needs to be converted, but that
      will be a separate patch.
      
      * cfg.mk (sc_correct_id_types): New syntax check.
      * src/libvirt-qemu.c (virDomainQemuAttach): Document why we didn't
      use pid_t for pid, and validate for overflow.
      * include/libvirt/libvirt-qemu.h (virDomainQemuAttach): Tweak name
      for syntax check.
      * src/vmware/vmware_conf.c (vmwareExtractPid): Likewise.
      * src/driver.h (virDrvDomainQemuAttach): Likewise.
      * tools/virsh.c (cmdQemuAttach): Likewise.
      * src/remote/qemu_protocol.x (qemu_domain_attach_args): Likewise.
      * src/qemu_protocol-structs (qemu_domain_attach_args): Likewise.
      * src/util/cgroup.c (virCgroupPidCode, virCgroupKillInternal):
      Likewise.
      * src/qemu/qemu_command.c(qemuParseProcFileStrings): Likewise.
      (qemuParseCommandLinePid): Use pid_t for pid.
      * daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
      * src/conf/domain_conf.h (_virDomainObj): Likewise.
      * src/probes.d (rpc_socket_new): Likewise.
      * src/qemu/qemu_command.h (qemuParseCommandLinePid): Likewise.
      * src/qemu/qemu_driver.c (qemudGetProcessInfo, qemuDomainAttach):
      Likewise.
      * src/qemu/qemu_process.c (qemuProcessAttach): Likewise.
      * src/qemu/qemu_process.h (qemuProcessAttach): Likewise.
      * src/uml/uml_driver.c (umlGetProcessInfo): Likewise.
      * src/util/virnetdev.h (virNetDevSetNamespace): Likewise.
      * src/util/virnetdev.c (virNetDevSetNamespace): Likewise.
      * tests/testutils.c (virtTestCaptureProgramOutput): Likewise.
      * src/conf/storage_conf.h (_virStoragePerms): Use mode_t, uid_t,
      and gid_t rather than int.
      * src/security/security_dac.c (virSecurityDACSetOwnership): Likewise.
      * src/conf/storage_conf.c (virStorageDefParsePerms): Avoid
      compiler warning.
      3e2c3d8f
  23. 01 11月, 2011 1 次提交
  24. 28 10月, 2011 1 次提交
  25. 27 10月, 2011 1 次提交
    • E
      snapshot: simplify indentation of disk encryption xml · 4d8e20f6
      Eric Blake 提交于
      Use auto-indent in more places.
      
      * src/conf/storage_encryption_conf.h (virStorageEncryptionFormat):
      Drop parameter.
      * src/conf/storage_encryption_conf.c (virStorageEncryptionFormat)
      (virStorageEncryptionSecretFormat): Simplify with auto-indent.
      * src/conf/domain_conf.c (virDomainDiskDefFormat): Adjust caller.
      * src/conf/storage_conf.c (virStorageVolTargetDefFormat): Likewise.
      4d8e20f6
  26. 25 10月, 2011 1 次提交
    • E
      storage: make previous leak less likely to regress · b1836a25
      Eric Blake 提交于
      Splitting into two functions allows the user to call the right
      function, rather than having to remember that a *Free function is
      an exception to the rule.
      
      * src/conf/storage_conf.h (virStoragePoolSourceClear): New function.
      * src/libvirt_private.syms (storage_conf.h): Export it.
      * src/conf/storage_conf.c (virStoragePoolSourceFree): Split...
      (virStoragePoolSourceClear): ...into new function.
      (virStoragePoolDefFree, virStoragePoolDefParseSourceString):
      Update callers.
      * src/test/test_driver.c (testStorageFindPoolSources): Likewise.
      * src/storage/storage_backend_fs.c
      (virStorageBackendFileSystemNetFindPoolSourcesFunc)
      (virStorageBackendFileSystemNetFindPoolSources): Likewise.
      * src/storage/storage_backend_iscsi.c
      (virStorageBackendISCSIFindPoolSources): Likewise.
      * src/storage/storage_backend_logical.c
      (virStorageBackendLogicalFindPoolSources): Likewise.
      b1836a25
  27. 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
  28. 05 9月, 2011 1 次提交
    • L
      Check for source conflicts in storage pools · 5a1f2728
      Lei Li 提交于
      Fix bug #611823 storage driver should prohibit pools with duplicate
      underlying storage.
      
      Add internal API virStoragePoolSourceFindDuplicate() to do uniqueness
      check based on source location infomation for pool type.
      
      * AUTHORS: add Lei Li
      5a1f2728
  29. 19 8月, 2011 1 次提交
    • 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