1. 30 1月, 2019 1 次提交
    • J
      storage: Add infrastructure to manage XML namespace options · 7a227688
      John Ferlan 提交于
      Introduce the virStoragePoolFSMountOptionsDef to be used to
      manage the Storage Pool XML Namespace for mount options.
      
      Using a new virStorageBackendNamespaceInit function, set the
      virStoragePoolXMLNamespace into the _virStoragePoolOptions when
      the storage backend is loaded.
      
      Modify the storagepool.rng to allow for the usage of a different
      XML namespace to parse the fs_mount_opts to be included with
      the fs and netfs storage pool definitions.
      
      Modify the storagepoolxml2xmltest to utilize a properly modified
      XML file to parse and format the namespace for a netfs storage pool.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      7a227688
  2. 14 12月, 2018 2 次提交
    • J
      storage: Fix build issue with MOUNT and VGCHANGE commands · e6f53e7a
      John Ferlan 提交于
      Turns out there some build platforms that must not define MOUNT
      or VGCHANGE in config.h... So moving the commands from the storage
      backend specific module into a common storage_util module causes
      issues for those platforms.
      
      So instead of assuming they are there, let's just pass the command
      string to the storage util API's from the storage backend specific
      code (as would have been successful before).  Also modify the test
      to determine whether the MOUNT and/or VGCHANGE doesn't exist and
      just define it to (for example) what Fedora has for the path. Could
      have just used "mount" and "vgchange" in the call, but that defeats
      the purpose of adding the call to virTestClearCommandPath.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      e6f53e7a
    • D
      Remove all Author(s): lines from source file headers · 60046283
      Daniel P. Berrangé 提交于
      In many files there are header comments that contain an Author:
      statement, supposedly reflecting who originally wrote the code.
      In a large collaborative project like libvirt, any non-trivial
      file will have been modified by a large number of different
      contributors. IOW, the Author: comments are quickly out of date,
      omitting people who have made significant contribitions.
      
      In some places Author: lines have been added despite the person
      merely being responsible for creating the file by moving existing
      code out of another file. IOW, the Author: lines give an incorrect
      record of authorship.
      
      With this all in mind, the comments are useless as a means to identify
      who to talk to about code in a particular file. Contributors will always
      be better off using 'git log' and 'git blame' if they need to  find the
      author of a particular bit of code.
      
      This commit thus deletes all Author: comments from the source and adds
      a rule to prevent them reappearing.
      
      The Copyright headers are similarly misleading and inaccurate, however,
      we cannot delete these as they have legal meaning, despite being largely
      inaccurate. In addition only the copyright holder is permitted to change
      their respective copyright statement.
      Reviewed-by: NErik Skultety <eskultet@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      60046283
  3. 13 12月, 2018 3 次提交
  4. 20 9月, 2018 2 次提交
  5. 03 5月, 2018 3 次提交
  6. 09 2月, 2018 2 次提交
  7. 01 2月, 2018 1 次提交
  8. 06 10月, 2017 1 次提交
  9. 11 7月, 2017 1 次提交
  10. 04 4月, 2017 1 次提交
    • P
      storage: util: Pass pool type to virStorageBackendFindGlusterPoolSources · a92160db
      Peter Krempa 提交于
      The native gluster pool source list data differs from the data used for
      attaching gluster volumes as netfs pools. Currently the only difference
      was the format. Since native pools don't use it and later there will be
      more differences add a more deterministic way to switch between the
      types instead.
      a92160db
  11. 21 2月, 2017 1 次提交
  12. 11 2月, 2017 2 次提交
  13. 27 1月, 2017 1 次提交
    • J
      storage: Fix build due to recent storage backend code movement · 448e2d5e
      John Ferlan 提交于
      Commit id '5f07c3c0' broke the freebsd build in the libvirt CI test
      environment because the UMOUNT was not defined unless WITH_STORAGE_FS
      is defined.
      
      So remove the virStorageBackendUmountLocal from storage_util.c,h and
      restore the code back in the storage_backend_fs.c and _vstorage.c
      modules.
      448e2d5e
  14. 26 1月, 2017 3 次提交
    • J
      storage: Create common file/dir volume backend helpers · 1452c85f
      John Ferlan 提交于
      Move all the volume functions to storage_util to create local/common helpers
      using the same naming syntax as the existing upload, download, and wipe
      virStorageBackend*Local API's.
      
      In the process of doing so, found more API's that can now become local
      to storage_util. In order to distinguish between local/external - I
      changed the names of the now local only ones from "virStorageBackend..."
      to just "storageBackend..."
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      1452c85f
    • J
      storage: Create common file/dir pool backend helpers · 5f07c3c0
      John Ferlan 提交于
      Move some pool functions to storage_util to create local/common helpers
      using the same naming syntax as the existing upload, download, and wipe
      virStorageBackend*Local API's.
      
      In the process of doing so, found a few API's that can now become local
      to storage_util. In order to distinguish between local/external - I
      changed the names of the now local only ones from "virStorageBackend..."
      to just "storageBackend..."
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      5f07c3c0
    • J
      storage: Move the virStorageBackendFileSystem{Start|Stop} API's · e26c2162
      John Ferlan 提交于
      Just moving code around with minor adjustment to have the Stop
      code combine with the Unmount code since all the Stop code did
      was call the Unmount code.
      e26c2162
  15. 19 1月, 2017 2 次提交
  16. 18 1月, 2017 3 次提交
    • 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
  17. 13 1月, 2017 1 次提交
    • P
      Revert "storage: For FS pool check for properly formatted target volume" · 9538dff9
      Peter Krempa 提交于
      The check does not work properly (crashes) with netfs filesystems and
      also checking that a device is not empty when attempting to mount a
      filesystem is not very usefull since the mount will fail anyways.
      
      As the code would improve only a very minor corner case I don't really
      see a reason to have this code at all.
      
      This code would also fail if libvirt is compiled without support for
      blkid and without parted.
      
      This reverts commit a11fd697.
      9538dff9
  18. 10 1月, 2017 5 次提交
    • J
      storage: For FS pool check for properly formatted target volume · a11fd697
      John Ferlan 提交于
      Prior to starting up, let's be sure the target volume device is
      formatted as we expect; otherwise, inhibit the start.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      a11fd697
    • 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: 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
    • M
      security_dac: Resolve virSecurityDACSetOwnershipInternal const correctness · 39779eb1
      Michal Privoznik 提交于
      The code at the very bottom of the DAC secdriver that calls
      chown() should be fine with read-only data. If something needs to
      be prepared it should have been done beforehand.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      39779eb1
  19. 16 11月, 2016 1 次提交
  20. 12 9月, 2016 1 次提交
    • J
      storage: Need to refresh secret for luks volume after volume refresh · b68487c9
      John Ferlan 提交于
      A LUKS volume uses the volume secret type just like the QCOW2 secret, so
      adjust the loading of the default secrets to handle any volume that the
      virStorageFileGetMetadataFromBuf code has deemed to be an encrypted volume
      to search for the volume's secret. This lookup is done by volume usage
      where the usage is expected to be the path to volume.
      b68487c9
  21. 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
  22. 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