1. 10 3月, 2014 1 次提交
    • E
      storage: use valid XML for awkward volume names · 45d40bcf
      Eric Blake 提交于
      $ touch /var/lib/libvirt/images/'a<b>c'
      $ virsh pool-refresh default
      $ virsh vol-dumpxml 'a<b>c' default | head -n2
      <volume>
        <name>a<b>c</name>
      
      Oops.  That's not valid XML.  And when we fix the XML
      generation, it fails RelaxNG validation.
      
      I'm also tired of seeing <key>(null)</key> in the example
      output for volume xml; while we used NULLSTR() to avoid
      a NULL deref rather than relying on glibc's printf
      extension behavior, it's even better if we avoid the issue
      in the first place.  But this requires being careful that
      we don't invalidate any storage backends that were relying
      on key being unassigned during virStoragVolCreateXML[From].
      
      I would have split this into two patches (one for escaping,
      one for avoiding <key>(null)</key>), but since they both
      end up touching a lot of the same test files, I ended up
      merging it into one.
      
      Note that this patch allows pretty much any volume name
      that can appear in a directory (excluding . and .. because
      those are special), but does nothing to change the current
      (unenforced) RelaxNG claim that pool names will consist
      only of letters, numbers, _, -, and +.  Tightening the C
      code to match RelaxNG patterns and/or relaxing the grammar
      to match the C code for pool names is a task for another
      day (but remember, we DID recently tighten C code for
      domain names to exclude a leading '.').
      
      * src/conf/storage_conf.c (virStoragePoolSourceFormat)
      (virStoragePoolDefFormat, virStorageVolTargetDefFormat)
      (virStorageVolDefFormat): Escape user-controlled strings.
      (virStorageVolDefParseXML): Parse key, for use in unit tests.
      * src/storage/storage_driver.c (storageVolCreateXML)
      (storageVolCreateXMLFrom): Ensure parsed key doesn't confuse
      volume creation.
      * docs/schemas/basictypes.rng (volName): Relax definition.
      * tests/storagepoolxml2xmltest.c (mymain): Test it.
      * tests/storagevolxml2xmltest.c (mymain): Likewise.
      * tests/storagepoolxml2xmlin/pool-dir-naming.xml: New file.
      * tests/storagepoolxml2xmlout/pool-dir-naming.xml: Likewise.
      * tests/storagevolxml2xmlin/vol-file-naming.xml: Likewise.
      * tests/storagevolxml2xmlout/vol-file-naming.xml: Likewise.
      * tests/storagevolxml2xmlout/vol-*.xml: Fix fallout.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 6cc4d6a3)
      45d40bcf
  2. 30 10月, 2013 1 次提交
  3. 15 10月, 2013 1 次提交
  4. 16 9月, 2013 1 次提交
  5. 06 9月, 2013 1 次提交
  6. 05 9月, 2013 1 次提交
  7. 27 8月, 2013 1 次提交
  8. 21 8月, 2013 3 次提交
    • O
      storage: Fix the use-after-free memory bug · 4140dbed
      Osier Yang 提交于
      Introduced by commit e0139e30. virStorageVolDefFree free'ed the
      pointers that are still used by the added volume object, this changes
      it back to VIR_FREE.
      4140dbed
    • O
      storage: Fix coverity warning · b8a0103d
      Osier Yang 提交于
      Introduced by commit e0139e30:
      
      1777 	    /* Updating pool metadata */
      
      (40) Event var_deref_op: Dereferencing null pointer "newvol".
           Also see events: [assign_zero]
      
      1778 	    pool->def->allocation += newvol->allocation;
      1779 	    pool->def->available -= newvol->allocation;
      b8a0103d
    • J
      Report secret usage error message similarly · 1fa7946f
      John Ferlan 提交于
      Each of the modules handled reporting error messages from the secret fetching
      slightly differently with respect to the error. Provide a similar message
      for each error case and provide as much data as possible.
      1fa7946f
  9. 19 8月, 2013 1 次提交
  10. 26 7月, 2013 1 次提交
  11. 24 7月, 2013 1 次提交
    • J
      storage: Add connection for autostart storage pool · a873b496
      John Ferlan 提交于
      Add a privileged field to storageDriverState
      
      Use the privileged value in order to generate a connection which could
      be passed to the various storage backend drivers.
      
      In particular, the iSCSI driver will need a connect in order to perform
      pool authentication using the 'chap' secrets and the RBD driver utilizes
      the connection during pool refresh for pools using 'ceph' secrets.
      
      For now that connection will be to be to qemu driver until a mechanism
      is devised to get a connection to just the secret driver without qemu.
      a873b496
  12. 23 7月, 2013 3 次提交
    • J
      Adjust 'ceph' authentication secret usage for rbd pool. · c2257d2e
      John Ferlan 提交于
      Update virStorageBackendRBDOpenRADOSConn() to use the internal API to the
      secret driver in order to get the secret value instead of the external
      virSecretGetValue() path. Without the flag VIR_SECRET_GET_VALUE_INTERNAL_CALL
      there is no way to get the value of private secret.
      
      This also requires ensuring there is a connection which wasn't true for
      for the refreshPool() path calls from storageDriverAutostart() prior to
      adding support for the connection to a qemu driver. It seems calls to
      virSecretLookupByUUIDString() and virSecretLookupByUsage() from the
      refreshPool() path would have failed with no way to find the secret - that is
      theoretically speaking since the 'conn' was NULL the failure would have been
      "failed to find the secret".
      c2257d2e
    • J
      storage: Support "chap" authentication for iscsi pool · 249409e7
      John Ferlan 提交于
      Although the XML for CHAP authentication with plain "password"
      was introduced long ago, the function was never implemented. This
      patch replaces the login/password mechanism by following the
      'ceph' (or RBD) model of using a 'username' with a 'secret' which
      has the authentication information.
      
      This patch performs the authentication during startPool() processing
      of pools with an authType of VIR_STORAGE_POOL_AUTH_CHAP specified
      for iSCSI pools.
      
      There are two types of CHAP configurations supported for iSCSI
      authentication:
      
        * Initiator Authentication
            Forward, one-way; The initiator is authenticated by the target.
      
        * Target Authentication
            Reverse, Bi-directional, mutual, two-way; The target is authenticated
            by the initiator; This method also requires Initiator Authentication
      
      This only supports the "Initiator Authentication". (I don't have any
      enterprise iSCSI env for testing, only have a iSCSI target setup with
      tgtd, which doesn't support "Target Authentication").
      
      "Discovery authentication" is not supported by tgt yet too. So this only
      setup the session authentication by executing 3 iscsiadm commands, E.g:
      
      % iscsiadm -m node --target "iqn.2013-05.test:iscsi.foo" --name \
        "node.session.auth.authmethod" -v "CHAP" --op update
      
      % iscsiadm -m node --target "iqn.2013-05.test:iscsi.foo" --name \
        "node.session.auth.username" -v "Jim" --op update
      
      % iscsiadm -m node --target "iqn.2013-05.test:iscsi.foo" --name \
        "node.session.auth.password" -v "Jimsecret" --op update
      249409e7
    • J
      storage_iscsi: Reflect the default target port · 5c62d5ea
      John Ferlan 提交于
      Make sure default iSCSI target is 3260.
      5c62d5ea
  13. 16 7月, 2013 2 次提交
  14. 12 7月, 2013 1 次提交
    • J
      storage_backend: Resolve Coverity issue · ba3427a0
      John Ferlan 提交于
      The switch statement in 'virStorageBackendCreateQemuImgOpts' used the
      for loop end condition 'VIR_STORAGE_FILE_FEATURE_LAST' as a possible value,
      but since that cannot happen Coverity spits out a DEADCODE message. Adding
      the Coverity tag just removes the Coverity message
      ba3427a0
  15. 11 7月, 2013 2 次提交
  16. 10 7月, 2013 1 次提交
  17. 04 7月, 2013 1 次提交
  18. 03 7月, 2013 1 次提交
  19. 29 6月, 2013 1 次提交
    • J
      Resolve valgrind error in virStorageBackendCreateQemuImgCmd() · 164d46e8
      John Ferlan 提交于
      Commit id '53d5967c' introduced the following:
      
      TEST: storagevolxml2argvtest
            ..............                           14  OK
      ==25636== 358 (264 direct, 94 indirect) bytes in 1 blocks are definitely lost in loss record 67 of 75
      ==25636==    at 0x4A06B6F: calloc (vg_replace_malloc.c:593)
      ==25636==    by 0x4C95791: virAlloc (viralloc.c:124)
      ==25636==    by 0x4CA0BB4: virCommandNewArgs (vircommand.c:805)
      ==25636==    by 0x4CA0C88: virCommandNew (vircommand.c:789)
      ==25636==    by 0x408602: virStorageBackendCreateQemuImgCmd (storage_backend.c:849)
      ==25636==    by 0x405427: testCompareXMLToArgvHelper (storagevolxml2argvtest.c:61)
      ==25636==    by 0x4064DF: virtTestRun (testutils.c:158)
      ==25636==    by 0x40516F: mymain (storagevolxml2argvtest.c:195)
      ==25636==    by 0x406B1A: virtTestMain (testutils.c:722)
      ==25636==    by 0x37C1021A04: (below main) (libc-start.c:225)
      ==25636==
      PASS: storagevolxml2argvtest
      164d46e8
  20. 28 6月, 2013 1 次提交
  21. 24 6月, 2013 2 次提交
  22. 21 6月, 2013 2 次提交
    • J
      storage: add support for creating qcow2 images with extensions · 6298f74d
      Ján Tomko 提交于
      Add -o compat= and -o lazy_refcounts options for qemu-img.
      6298f74d
    • J
      conf: add features to volume target XML · 31d42506
      Ján Tomko 提交于
      Add <features> and <compat> elements to volume target XML.
      
      <compat> is a string which for qcow2 represents the QEMU version
      it should be compatible with. Valid values are 0.10 and 1.1.
      1.1 is implicit if the <features> element is present, otherwise
      qemu-img default is used. 0.10 can be specified to explicitly
      create older images after the qemu-img default changes.
      
      <features> contains optional features, so far
      <lazy_refcounts/> is available, which enables caching of reference
      counters, improving performance for snapshots.
      31d42506
  23. 19 6月, 2013 1 次提交
  24. 10 6月, 2013 1 次提交
  25. 07 6月, 2013 2 次提交
  26. 06 6月, 2013 2 次提交
    • J
      Replace two-state local integers with bool · e557766c
      Ján Tomko 提交于
      Found with 'git grep "= 1"'.
      e557766c
    • P
      storage: Avoid unnecessary ternary operators and refactor the code · b0c3ee0c
      Peter Krempa 提交于
      Setting of local variables in virStorageBackendCreateQemuImgCmd was
      unnecessarily cluttered with ternary operators and repeated testing of
      of conditions.
      
      This patch refactors the function to use if statements and improves
      error reporting in case inputvol is specified but does not contain
      target path. Previously we would complain about "unknown storage vol
      type 0" instead of the actual problem.
      b0c3ee0c
  27. 05 6月, 2013 4 次提交