1. 14 12月, 2016 1 次提交
  2. 13 12月, 2016 3 次提交
    • 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
    • J
      util: Introduce virStorageSourceUpdatePhysicalSize · c5f61513
      John Ferlan 提交于
      Commit id '8dc27259' introduced virStorageSourceUpdateBlockPhysicalSize
      in order to retrieve the physical size for a block backed source device
      for an active domain since commit id '15fa84ac' changed to use the
      qemuMonitorGetAllBlockStatsInfo and qemuMonitorBlockStatsUpdateCapacity
      API's to (essentially) retrieve the "actual-size" from a 'query-block'
      operation for the source device.
      
      However, the code only was made functional for a BLOCK backing type
      and it neglected to use qemuOpenFile, instead using just open. After
      the open the block lseek would find the end of the block and set the
      physical value, close the fd and return.
      
      Since the code would return 0 immediately if the source device wasn't
      a BLOCK backed device, the physical would be displayed incorrectly,
      such as follows in domblkinfo for a file backed source device:
      
      Capacity:       1073741824
      Allocation:     0
      Physical:       0
      
      This patch will modify the algorithm to get the physical size for other
      backing types and it will make use of the qemuDomainStorageOpenStat
      helper in order to open/stat the source file depending on its type.
      The qemuDomainGetStatsOneBlock will no longer inhibit printing errors,
      but it will still ignore them leaving the physical value set to 0.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      c5f61513
  3. 25 11月, 2016 1 次提交
    • M
      virstring: Unify string list function names · c2a5a4e7
      Michal Privoznik 提交于
      We have couple of functions that operate over NULL terminated
      lits of strings. However, our naming sucks:
      
      virStringJoin
      virStringFreeList
      virStringFreeListCount
      virStringArrayHasString
      virStringGetFirstWithPrefix
      
      We can do better:
      
      virStringListJoin
      virStringListFree
      virStringListFreeCount
      virStringListHasString
      virStringListGetFirstWithPrefix
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      c2a5a4e7
  4. 24 11月, 2016 1 次提交
  5. 12 9月, 2016 1 次提交
    • J
      storage: Need to properly read the crypt offset value · 2f6b750e
      John Ferlan 提交于
      Commit id 'a48c7141' altered how to determine if a volume was encrypted
      by adding a peek at an offset into the file at a specific buffer location.
      Unfortunately, all that was compared was the first "char" of the buffer
      against the expect "int" value.
      
      Restore the virReadBufInt32BE to get the complete field in order to
      compare against the expected value from the qcow2EncryptionInfo or
      qcow1EncryptionInfo "modeValue" field.
      
      This restores the capability to create a volume with encryption, then
      refresh the pool, and still find the encryption for the volume.
      2f6b750e
  6. 06 9月, 2016 2 次提交
  7. 20 8月, 2016 1 次提交
    • J
      qemu: Fix crash hot plugging luks volume · b4478c16
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1367259
      
      Crash occurs because 'secrets' is being dereferenced in call:
      
              if (qemuDomainSecretSetup(conn, priv, secinfo, disk->info.alias,
                                        VIR_SECRET_USAGE_TYPE_VOLUME, NULL,
                                        &src->encryption->secrets[0]->seclookupdef,
                                        true) < 0)
      
      (gdb) p *src->encryption
      $1 = {format = 2, nsecrets = 0, secrets = 0x0, encinfo = {cipher_size = 0,
          cipher_name = 0x0, cipher_mode = 0x0, cipher_hash = 0x0, ivgen_name = 0x0,
          ivgen_hash = 0x0}}
      (gdb) bt
          priv=priv@entry=0x7fffc03be160, disk=disk@entry=0x7fffb4002ae0)
          at qemu/qemu_domain.c:1087
          disk=0x7fffb4002ae0, vm=0x7fffc03a2580, driver=0x7fffc02ca390,
          conn=0x7fffb00009a0) at qemu/qemu_hotplug.c:355
      
      Upon entry to qemuDomainAttachVirtioDiskDevice, src->encryption points
      at a valid 'secret' buffer w/ nsecrets == 1; however, the call to
      qemuDomainDetermineDiskChain will call virStorageFileGetMetadata
      and eventually virStorageFileGetMetadataInternal where the src->encryption
      was overwritten when probing the volume.
      
      Commit id 'a48c7141' added code to virStorageFileGetMetadataInternal
      to determine if the disk/volume would use/need encryption and allocated
      a meta->encryption. This overwrote an existing encryption buffer
      already provided by the XML
      
      This patch adds a check for meta->encryption already present before
      just allocating and overwriting an existing buffer. It then checks the
      existing encryption data to ensure the XML provided format for the
      disk matches the expected format read from the disk and errors if there
      is a mismatch.
      b4478c16
  8. 16 8月, 2016 1 次提交
  9. 28 7月, 2016 2 次提交
    • 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
    • D
      virstoragefile: refactor virStorageFileMatchesNNN methods · 970f42ab
      Daniel P. Berrange 提交于
      Refactor the virStorageFileMatchesNNN methods so that
      they don't take a struct FileFormatInfo parameter, but
      instead get the actual raw dat items they needs. This
      will facilitate reuse in other contexts.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      970f42ab
  10. 27 7月, 2016 10 次提交
  11. 25 6月, 2016 2 次提交
  12. 24 6月, 2016 3 次提交
  13. 13 5月, 2016 1 次提交
  14. 11 5月, 2016 1 次提交
    • J
      storage: Fix regression cloning volume into a logical pool · 2c52ec43
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1318993
      
      Commit id 'dd519a29' caused a regression cloning a volume into a
      logical pool by removing just the 'allocation' adjustment during
      storageVolCreateXMLFrom. Combined with the change to not require the
      new volume input XML to have a capacity listed (commit id 'e3f1d2a8')
      left the possibility that a zero allocation value (e.g., not provided)
      would create a thin/sparse logical volume. When a thin lv becomes fully
      populated, then LVM sets the partition 'inactive' and the subsequent
      fdatasync() fails.
      
      Add a new 'has_allocation' flag to be set at XML parse time to indicate
      that allocation was provided. This is done so that if it's not provided
      the create-from code uses the capacity value since we document that if
      omitted, the volume will be fully allocated at time of creation.
      
      For a logical backend, that creation time is 'createVol', while for a
      file backend, creation doesn't set the size, but the 'createRaw' called
      during buildVolFrom will decide whether the file is sparse or not based
      on the provided capacity and allocation value.
      
      For volume clones that provide different allocation and capacity values
      to allow for sparse files, there is no change.
      2c52ec43
  15. 09 5月, 2016 1 次提交
    • P
      util: Replace virDomainDiskSourceIsBlockType with a new helper · 3ec7bb35
      Peter Krempa 提交于
      For disks sources described by a libvirt volume we don't need to do a
      complicated check since virStorageTranslateDiskSourcePool already
      correctly determines the actual disk type.
      
      Replace the checks using a new accessor that does not open-code the
      whole logic.
      3ec7bb35
  16. 15 4月, 2016 1 次提交
    • O
      storage: dir: adapt .refreshVol and .refreshPool for ploop volumes · ea94be47
      Olga Krishtal 提交于
      Refreshes meta-information such as allocation, capacity, format, etc.
      Ploop volumes differ from other volume types. Path to volume is the path
      to directory with image file root.hds and DiskDescriptor.xml.
      https://openvz.org/Ploop/format
      Due to this fact, operations of opening the volume have to be done once
      again. get the information.
      
      To decide whether the given volume is ploops one, it is necessary to check
      the presence of root.hds and DiskDescriptor.xml files in volumes' directory.
      Only in this case the volume can be manipulated as the ploops one.
      Such strategy helps us to resolve problems that might occure, when we
      upload some other volume type from ploop source.
      Signed-off-by: NOlga Krishtal <okrishtal@virtuozzo.com>
      Signed-off-by: NJán Tomko <jtomko@redhat.com>
      ea94be47
  17. 15 2月, 2016 1 次提交
  18. 10 2月, 2016 1 次提交
  19. 06 1月, 2016 1 次提交
    • W
      rbd: Do not append Ceph monitor port number 6789 if not provided · 6343018f
      Wido den Hollander 提交于
      If no port number was provided for a storage pool libvirt defaults to
      port 6789; however, librbd/librados already default to 6789 when no port
      number is provided.
      
      In the future Ceph will switch to a new port for the Ceph monitors since
      port 6789 is already assigned to a different application by IANA.
      
      Port 6789 is assigned to SMC-HTTPS and Ceph now has port 3300 assigned as
      the 'Ceph monitor' port.
      
      In this case it is the best solution to not hardcode any port number into
      libvirt and let librados handle the connection.
      
      Only if a user specifies a different port number we pass it down to librados,
      otherwise we leave it blank.
      Signed-off-by: NWido den Hollander <wido@widodh.nl>
      
      merge
      6343018f
  20. 07 8月, 2015 1 次提交
  21. 27 4月, 2015 1 次提交
  22. 22 4月, 2015 3 次提交