1. 25 4月, 2018 1 次提交
  2. 09 2月, 2018 1 次提交
  3. 03 11月, 2017 1 次提交
    • A
      Remove backslash alignment attempts · 3e7db8d3
      Andrea Bolognani 提交于
      Right-aligning backslashes when defining macros or using complex
      commands in Makefiles looks cute, but as soon as any changes is
      required to the code you end up with either distractingly broken
      alignment or unnecessarily big diffs where most of the changes
      are just pushing all backslashes a few characters to one side.
      
      Generated using
      
        $ git grep -El '[[:blank:]][[:blank:]]\\$' | \
          grep -E '*\.([chx]|am|mk)$$' | \
          while read f; do \
            sed -Ei 's/[[:blank:]]*[[:blank:]]\\$/ \\/g' "$f"; \
          done
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      3e7db8d3
  4. 27 7月, 2017 1 次提交
  5. 03 4月, 2017 1 次提交
    • P
      storage: backend: Use correct stringifier for pool type · 894133a3
      Peter Krempa 提交于
      When registering a storage poll backend, the code would use
      virStorageTypeToString instead of virStoragePoolTypeToString. The
      following message would be logged:
      
      virDriverLoadModuleFunc:71 : Lookup function 'virStorageBackendSCSIRegister'
      virStorageBackendRegister:174 : Registering storage backend '(null)'
      894133a3
  6. 22 2月, 2017 2 次提交
    • P
      tests: drivermodule: Make sure that all compiled storage backends can be loaded · 93a3f516
      Peter Krempa 提交于
      Add a new storage driver registration function that will force the
      backend code to fail if any of the storage backend modules can't be
      loaded. This will make sure that they work and are present.
      93a3f516
    • P
      storage: Turn storage backends into dynamic modules · 0a6d3e51
      Peter Krempa 提交于
      If driver modules are enabled turn storage driver backends into
      dynamically loadable objects. This will allow greater modularity for
      binary distributions, where heavyweight dependencies as rbd and gluster
      can be avoided by selecting only a subset of drivers if the rest is not
      necessary.
      
      The storage modules are installed into 'LIBDIR/libvirt/storage-backend/'
      and users can override the location by using
      'LIBVIRT_STORAGE_BACKEND_DIR' environment variable.
      
      rpm based distros will at this point install all the backends when
      libvirt-daemon-driver-storage package is installed.
      0a6d3e51
  7. 21 2月, 2017 1 次提交
  8. 26 1月, 2017 1 次提交
  9. 19 1月, 2017 2 次提交
  10. 18 1月, 2017 4 次提交
    • J
      storage: Allow probe of volume capacity for BLOCK type · 9508682b
      John Ferlan 提交于
      If the voldef type is VIR_STORAGE_VOL_BLOCK, then as long as the
      format is known, let's allow the probe to happen - gets a truer value
      and the same probe/update would be allowed for the same volume defined
      in a domain.
      9508682b
    • J
      storage: Fix virStorageBackendUpdateVolTargetInfo type check · d04bb05f
      John Ferlan 提交于
      For volume processing in virStorageBackendUpdateVolTargetInfo to get
      the capacity commit id 'a760ba3a' added the ability to probe a volume
      that didn't list a target format. Unfortunately, the code used the
      virStorageSource  (e.g. target->type - virStorageType) rather than
      virStorageVolDef (e.g. vol->type - virStorageVolType) in order to
      make the comparison. As it turns out target->type for a volume is
      not filled in at all for a voldef as the code relies on vol->type.
      Ironically the result is that only VIR_STORAGE_VOL_BLOCK's would get
      their capacity updated.
      
      This patch will adjust the code to check the "vol->type" field instead
      as an argument. This way for a voldef, the correct comparison is made.
      
      Additionally for a backingStore, the 'type' field is never filled in;
      however, since we know that the provided path is a location at which
      the backing store can be accessed on the local filesystem thus just
      pass VIR_STORAGE_VOL_FILE in order to satisfy the adjusted voltype
      check. Whether it's a FILE or a BLOCK only matters if we're trying to
      get more data based on the target->format.
      d04bb05f
    • P
      storage: gluster: Remove build-time dependency on the 'gluster' cli tool · 9e97c8c0
      Peter Krempa 提交于
      The tool is used for pool discovery. Since we call an external binary we
      don't really need to compile out the code that uses it. We can check
      whether it exists at runtime.
      9e97c8c0
    • P
      storage: Fix error reporting when looking up storage pool sources · 7bdb4b8f
      Peter Krempa 提交于
      In commit 4090e153 we went back from reporting no errors if no storage
      pools were found on a given host to reporting a bad error. And only in
      cases when gluster was not installed.
      
      Report a less bad error in case there are no volumes. Also report the
      error when gluster is installed but no volumes were found, since
      virStorageBackendFindGlusterPoolSources would return success in that
      case.
      7bdb4b8f
  11. 14 1月, 2017 3 次提交
    • J
      storage: Alter error message in probe/empty checks · 40ec4ff6
      John Ferlan 提交于
      For case VIR_STORAGE_BLKID_PROBE_DIFFERENT, clean up the message to
      avoid using the virsh like --overwrite syntax. Additionally provide
      a different error message when not writing the label to avoid confusion.
      40ec4ff6
    • J
      storage: Clean up return value checking · f462f9ad
      John Ferlan 提交于
      Rather than special casing the VIR_STORAGE_BLKID_PROBE_UNKNOWN after
      calling virStorageBackendBLKIDFindPart, just allow the switch statement
      handle setting ret = -2.
      f462f9ad
    • J
      storage: Alter logic when both BLKID and PARTED unavailable · d1f5dfc4
      John Ferlan 提交于
      If neither BLKID or PARTED is available and we're not writing, then
      just return 0 which allows the underlying storage pool to generate
      a failure. If both are unavailable and we're writing, then generate
      a more generic error message.
      d1f5dfc4
  12. 10 1月, 2017 7 次提交
    • J
      storage: Fix storage_backend probing when PARTED not installed. · bdd371c5
      John Ferlan 提交于
      Commit id 'a48c674f' caused problems for systems without PARTED installed.
      
      So move the PARTED probing code back to storage_backend_disk.c and create
      a shim within storage_backend.c to call it if WITH_STORAGE_DISK is true;
      otherwise, just return -1 with the error.
      bdd371c5
    • J
      storage: Adjust disk label found to match labels · a4cb4a74
      John Ferlan 提交于
      Currently as long as the disk is formatted using a known parted format
      type, the algorithm is happy to continue. However, that leaves a scenario
      whereby a disk formatted using "pc98" could be used by a pool that's defined
      using "dvh" (or vice versa). Alter the check to be match and different
      and adjust the caller.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      a4cb4a74
    • J
      storage: Move and rename disk backend label checking · a48c674f
      John Ferlan 提交于
      Rather than have the Disk code having to use PARTED to determine if
      there's something on the device, let's use the virStorageBackendDeviceProbe.
      and only fallback to the PARTED probing if the BLKID code isn't built in.
      
      This will also provide a mechanism for the other current caller (File
      System Backend) to utilize a PARTED parsing algorithm in the event that
      BLKID isn't built in to at least see if *something* exists on the disk
      before blindly trying to use. The PARTED error checking will not find
      file system types, but if there is a partition table set on the device,
      it will at least cause a failure.
      
      Move virStorageBackendDiskValidLabel and virStorageBackendDiskFindLabel
      to storage_backend and rename/rework the code to fit the new model.
      
      Update the virsh.pod description to provide a more generic description
      of the process since we could now use either blkid or parted to find
      data on the target device.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      a48c674f
    • J
      storage: Add writelabel bool for virStorageBackendDeviceProbe · 19ced38f
      John Ferlan 提交于
      It's possible that the API could be called from a startup path in
      order to check whether the label on the device matches what our
      format is. In order to handle that condition, add a 'writelabel'
      boolean to the API in order to indicate whether a write or just
      read is about to happen.
      
      This alters two "error" conditions that would care about knowing.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      19ced38f
    • J
      storage: Add partition type checks for BLKID probing · a22e1a00
      John Ferlan 提交于
      A device may be formatted using some sort of disk partition format type.
      We can check that using the blkid_ API's as well - so alter the logic to
      allow checking the device for both a filesystem and a disk partition.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      a22e1a00
    • J
      storage: Fix implementation of no-overwrite for file system backend · f23d4bbc
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1363586
      
      Commit id '27758859' introduced the "NO_OVERWRITE" flag check for
      file system backends; however, the implementation, documentation,
      and algorithm was inconsistent. For the "flag" description for the
      API the flag was described as "Do not overwrite existing pool";
      however, within the storage backend code the flag is described
      as "it probes to determine if filesystem already exists on the
      target device, renurning an error if exists".
      
      The code itself was implemented using the paradigm to set up the
      superblock probe by creating a filter that would cause the code
      to only search for the provided format type. If that type wasn't
      found, then the algorithm would return success allowing the caller
      to format the device. If the format type already existed on the
      device, then the code would fail indicating that the a filesystem
      of the same type existed on the device.
      
      The result is that if someone had a file system of one type on the
      device, it was possible to overwrite it if a different format type
      was specified in updated XML effectively trashing whatever was on
      the device already.
      
      This patch alters what NO_OVERWRITE does for a file system backend
      to be more realistic and consistent with what should be expected when
      the caller requests to not overwrite the data on the disk.
      
      Rather than filter results based on the expected format type, the
      code will allow success/failure be determined solely on whether the
      blkid_do_probe calls finds some known format on the device. This
      adjustment also allows removal of the virStoragePoolProbeResult
      enum that was under utilized.
      
      If it does find a formatted file system different errors will be
      generated indicating a file system of a specific type already exists
      or a file system of some other type already exists.
      
      In the original virsh support commit id 'ddcd5674', the description
      for '--no-overwrite' within the 'pool-build' command help output
      has an ambiguous "of this type" included in the short description.
      Compared to the longer description within the "Build a given pool."
      section of the virsh.pod file it's more apparent that the meaning
      of this flag would cause failure if a probe of the target already
      has a filesystem.
      
      So this patch also modifies the short description to just be the
      antecedent of the 'overwrite' flag, which matches the API description.
      This patch also modifies the grammar in virsh.pod for no-overwrite
      as well as reworking the paragraph formats to make it easier to read.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      f23d4bbc
    • J
      storage: Introduce virStorageBackendDeviceIsEmpty · 553d21da
      John Ferlan 提交于
      Rename virStorageBackendFileSystemProbe and to virStorageBackendBLKIDFindFS
      and move to the more common storage_backend module.
      
      Create a shim virStorageBackendDeviceIsEmpty which will make the call
      to the virStorageBackendBLKIDFindFS and check the return value.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      553d21da
  13. 09 1月, 2017 1 次提交
  14. 13 12月, 2016 2 次提交
    • J
      util: Introduce virStorageSourceUpdateCapacity · 9d734b60
      John Ferlan 提交于
      Instead of having duplicated code in qemuStorageLimitsRefresh and
      virStorageBackendUpdateVolTargetInfo to get capacity specific data
      about the storage backing source or volume -- create a common API
      to handle the details for both.
      
      As a side effect, virStorageFileProbeFormatFromBuf returns to being
      a local/static helper to virstoragefile.c
      
      For the QEMU code - if the probe is done, then the format is saved so
      as to avoid future such probes.
      
      For the storage backend code, there is no need to deal with the probe
      since we cannot call the new API if target->format == NONE.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      9d734b60
    • J
      util: Introduce virStorageSourceUpdateBackingSizes · 3039ec96
      John Ferlan 提交于
      Instead of having duplicated code in qemuStorageLimitsRefresh and
      virStorageBackendUpdateVolTargetInfoFD to fill in the storage backing
      source or volume allocation, capacity, and physical values - create a
      common API that will handle the details for both.
      
      The common API will fill in "default" capacity values as well - although
      those more than likely will be overridden by subsequent code. Having just
      one place to make the determination of what the values should be will
      make things be more consistent.
      
      For the QEMU code - the data filled in will be for inactive domains
      for the GetBlockInfo and DomainGetStatsOneBlock API's. For the storage
      backend code - the data will be filled in during the volume updates.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      3039ec96
  15. 05 8月, 2016 1 次提交
  16. 02 8月, 2016 3 次提交
  17. 28 7月, 2016 1 次提交
    • D
      storage: remove "luks" storage volume type · a48c7141
      Daniel P. Berrange 提交于
      The current LUKS support has a "luks" volume type which has
      a "luks" encryption format.
      
      This partially makes sense if you consider the QEMU shorthand
      syntax only requires you to specify a format=luks, and it'll
      automagically uses "raw" as the next level driver. QEMU will
      however let you override the "raw" with any other driver it
      supports (vmdk, qcow, rbd, iscsi, etc, etc)
      
      IOW the intention though is that the "luks" encryption format
      is applied to all disk formats (whether raw, qcow2, rbd, gluster
      or whatever). As such it doesn't make much sense for libvirt
      to say the volume type is "luks" - we should be saying that it
      is a "raw" file, but with "luks" encryption applied.
      
      IOW, when creating a storage volume we should use this XML
      
        <volume>
          <name>demo.raw</name>
          <capacity>5368709120</capacity>
          <target>
            <format type='raw'/>
            <encryption format='luks'>
              <secret type='passphrase' uuid='0a81f5b2-8403-7b23-c8d6-21ccd2f80d6f'/>
            </encryption>
          </target>
        </volume>
      
      and when configuring a guest disk we should use
      
        <disk type='file' device='disk'>
          <driver name='qemu' type='raw'/>
          <source file='/home/berrange/VirtualMachines/demo.raw'/>
          <target dev='sda' bus='scsi'/>
          <encryption format='luks'>
            <secret type='passphrase' uuid='0a81f5b2-8403-7b23-c8d6-21ccd2f80d6f'/>
          </encryption>
        </disk>
      
      This commit thus removes the "luks" storage volume type added
      in
      
        commit 318ebb36
        Author: John Ferlan <jferlan@redhat.com>
        Date:   Tue Jun 21 12:59:54 2016 -0400
      
          util: Add 'luks' to the FileTypeInfo
      
      The storage file probing code is modified so that it can probe
      the actual encryption formats explicitly, rather than merely
      probing existance of encryption and letting the storage driver
      guess the format.
      
      The rest of the code is then adapted to deal with
      VIR_STORAGE_FILE_RAW w/ VIR_STORAGE_ENCRYPTION_FORMAT_LUKS
      instead of just VIR_STORAGE_FILE_LUKS.
      
      The commit mentioned above was included in libvirt v2.0.0.
      So when querying volume XML this will be a change in behaviour
      vs the 2.0.0 release - it'll report 'raw' instead of 'luks'
      for the volume format, but still report 'luks' for encryption
      format.  I think this change is OK because the storage driver
      did not include any support for creating volumes, nor starting
      guets with luks volumes in v2.0.0 - that only since then.
      Clearly if we change this we must do it before v2.1.0 though.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a48c7141
  18. 20 7月, 2016 2 次提交
  19. 19 7月, 2016 1 次提交
    • J
      storage: Add support to create a luks volume · 5e46d7d6
      John Ferlan 提交于
      Partially resolves:
      https://bugzilla.redhat.com/show_bug.cgi?id=1301021
      
      If the volume xml was looking to create a luks volume take the necessary
      steps in order to make that happen.
      
      The processing will be:
       1. create a temporary file (virStorageBackendCreateQemuImgSecretPath)
         1a. use the storage driver state dir path that uses the pool and
             volume name as a base.
      
       2. create a secret object (virStorageBackendCreateQemuImgSecretObject)
         2a. use an alias combinding the volume name and "_luks0"
         2b. add the file to the object
      
       3. create/add luks options to the commandline (virQEMUBuildLuksOpts)
         3a. at the very least a "key-secret=%s" using the secret object alias
         3b. if found in the XML the various "cipher" and "ivgen" options
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      5e46d7d6
  20. 12 7月, 2016 1 次提交
  21. 02 7月, 2016 2 次提交
    • J
      encryption: Add luks parsing for storageencryption · 9bbf0d7e
      John Ferlan 提交于
      Add parse and format of the luks/passphrase secret including tests for
      volume XML parsing.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      9bbf0d7e
    • J
      util: Add 'usage' for encryption · 47e88b33
      John Ferlan 提交于
      In order to use more common code and set up for a future type, modify the
      encryption secret to allow the "usage" attribute or the "uuid" attribute
      to define the secret. The "usage" in the case of a volume secret would be
      the path to the volume as dictated by the backwards compatibility brought
      on by virStorageGenerateQcowEncryption where it set up the usage field as
      the vol->target.path and didn't allow someone to provide it. This carries
      into virSecretObjListFindByUsageLocked which takes the secret usage attribute
      value from from the domain disk definition and compares it against the
      usage type from the secret definition. Since none of the code dealing
      with qcow/qcow2 encryption secrets uses usage for lookup, it's a mostly
      cosmetic change. The real usage comes in a future path where the encryption
      is expanded to be a luks volume and the secret will allow definition of
      the usage field.
      
      This code will make use of the virSecretLookup{Parse|Format}Secret common code.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      47e88b33
  22. 24 6月, 2016 1 次提交