[PATCH v3 00/15] Implement support for QCOW2 data files

Nikolai Barybin via Devel posted 15 patches 2 weeks, 2 days ago
docs/formatdomain.rst                         |  45 +++++++-
src/conf/domain_conf.c                        | 100 ++++++++++++++++++
src/conf/domain_conf.h                        |  13 +++
src/conf/schemas/domaincommon.rng             |  15 +++
src/conf/storage_source_conf.c                |  11 ++
src/conf/storage_source_conf.h                |   5 +
src/qemu/qemu_block.c                         |  14 +++
src/qemu/qemu_cgroup.c                        |  13 ++-
src/qemu/qemu_command.c                       |   5 +
src/qemu/qemu_domain.c                        |  50 ++++++---
src/qemu/qemu_namespace.c                     |   7 ++
src/security/security_dac.c                   |  27 ++++-
src/security/security_selinux.c               |  27 ++++-
src/security/virt-aa-helper.c                 |   4 +
src/storage_file/storage_file_probe.c         |  78 ++++++++++----
src/storage_file/storage_source.c             |  39 +++++++
src/storage_file/storage_source.h             |   4 +
.../qcow2-data-file-in.xml                    |  86 +++++++++++++++
.../qcow2-data-file-out.xml                   |  86 +++++++++++++++
tests/qemuxmlactivetest.c                     |   2 +
...sk-qcow2-datafile-store.x86_64-latest.args |  51 +++++++++
...isk-qcow2-datafile-store.x86_64-latest.xml |  81 ++++++++++++++
.../disk-qcow2-datafile-store.xml             |  67 ++++++++++++
tests/qemuxmlconftest.c                       |   1 +
tests/virstoragetest.c                        |  98 +++++++++++++++++
tests/virstoragetestdata/out/qcow2-data_file  |  20 ++++
.../out/qcow2-qcow2_qcow2-qcow2-data_file     |  31 ++++++
27 files changed, 941 insertions(+), 39 deletions(-)
create mode 100644 tests/qemustatusxml2xmldata/qcow2-data-file-in.xml
create mode 100644 tests/qemustatusxml2xmldata/qcow2-data-file-out.xml
create mode 100644 tests/qemuxmlconfdata/disk-qcow2-datafile-store.x86_64-latest.args
create mode 100644 tests/qemuxmlconfdata/disk-qcow2-datafile-store.x86_64-latest.xml
create mode 100644 tests/qemuxmlconfdata/disk-qcow2-datafile-store.xml
create mode 100644 tests/virstoragetestdata/out/qcow2-data_file
create mode 100644 tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2-data_file
[PATCH v3 00/15] Implement support for QCOW2 data files
Posted by Nikolai Barybin via Devel 2 weeks, 2 days ago
Hello everyone!

With help of Peter's comprehensive review I finally present 3rd version
of this series.

Changes since last revision:

 - minor code improvements including memory leaks fixes

 - splitted and regrouped some patches for more logical structure

 - fixed issue with erroneous disk with data file detatch

 - completely rewritten tests

 - added some piece of documentation

Nikolai Barybin (15):
  conf: add data-file feature and related fields to virStorageSource
  Add VIR_STORAGE_FILE_FEATURE_DATA_FILE to virStorageFileFeature enum
  conf: schemas: add data-file store to domain rng schema
  conf: implement XML parsing/formating for dataFileStore
  storage file: add getDataFile function to FileTypeInfo
  storage file: add qcow2 data-file path parsing from header
  storage file: fill in src->dataFileStore during file probe
  security: DAC: handle qcow2 data-file on image label set/restore
  security: selinux: handle qcow2 data-file on image label set/restore
  security: apparmor: handle qcow2 data-file
  qemu: put data-file path to VM's cgroup and namespace
  qemu: factor out qemuDomainPrepareStorageSource()
  qemu: enable basic qcow2 data-file feature support
  tests: add qcow2 data-file tests
  docs: formatdomain: describe dataFileStore element of disk

 docs/formatdomain.rst                         |  45 +++++++-
 src/conf/domain_conf.c                        | 100 ++++++++++++++++++
 src/conf/domain_conf.h                        |  13 +++
 src/conf/schemas/domaincommon.rng             |  15 +++
 src/conf/storage_source_conf.c                |  11 ++
 src/conf/storage_source_conf.h                |   5 +
 src/qemu/qemu_block.c                         |  14 +++
 src/qemu/qemu_cgroup.c                        |  13 ++-
 src/qemu/qemu_command.c                       |   5 +
 src/qemu/qemu_domain.c                        |  50 ++++++---
 src/qemu/qemu_namespace.c                     |   7 ++
 src/security/security_dac.c                   |  27 ++++-
 src/security/security_selinux.c               |  27 ++++-
 src/security/virt-aa-helper.c                 |   4 +
 src/storage_file/storage_file_probe.c         |  78 ++++++++++----
 src/storage_file/storage_source.c             |  39 +++++++
 src/storage_file/storage_source.h             |   4 +
 .../qcow2-data-file-in.xml                    |  86 +++++++++++++++
 .../qcow2-data-file-out.xml                   |  86 +++++++++++++++
 tests/qemuxmlactivetest.c                     |   2 +
 ...sk-qcow2-datafile-store.x86_64-latest.args |  51 +++++++++
 ...isk-qcow2-datafile-store.x86_64-latest.xml |  81 ++++++++++++++
 .../disk-qcow2-datafile-store.xml             |  67 ++++++++++++
 tests/qemuxmlconftest.c                       |   1 +
 tests/virstoragetest.c                        |  98 +++++++++++++++++
 tests/virstoragetestdata/out/qcow2-data_file  |  20 ++++
 .../out/qcow2-qcow2_qcow2-qcow2-data_file     |  31 ++++++
 27 files changed, 941 insertions(+), 39 deletions(-)
 create mode 100644 tests/qemustatusxml2xmldata/qcow2-data-file-in.xml
 create mode 100644 tests/qemustatusxml2xmldata/qcow2-data-file-out.xml
 create mode 100644 tests/qemuxmlconfdata/disk-qcow2-datafile-store.x86_64-latest.args
 create mode 100644 tests/qemuxmlconfdata/disk-qcow2-datafile-store.x86_64-latest.xml
 create mode 100644 tests/qemuxmlconfdata/disk-qcow2-datafile-store.xml
 create mode 100644 tests/virstoragetestdata/out/qcow2-data_file
 create mode 100644 tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2-data_file

-- 
2.43.5
Re: [PATCH v3 00/15] Implement support for QCOW2 data files
Posted by Peter Krempa 2 weeks, 1 day ago
On Wed, Nov 20, 2024 at 18:48:35 +0300, Nikolai Barybin via Devel wrote:
> Hello everyone!
> 
> With help of Peter's comprehensive review I finally present 3rd version
> of this series.
> 
> Changes since last revision:
> 
>  - minor code improvements including memory leaks fixes
> 
>  - splitted and regrouped some patches for more logical structure
> 
>  - fixed issue with erroneous disk with data file detatch
> 
>  - completely rewritten tests
> 
>  - added some piece of documentation

Thanks for the new version. I was recently informed about another
potential use of the 'data-file' feature so any comments I reply with
I'll be directly fixing in the patches themselves. No need to post
another version.

Please remember for future postings to write commit messages. I asked
for them the last time too.
Re: [PATCH v3 00/15] Implement support for QCOW2 data files
Posted by Nikolai Barybin via Devel 2 weeks, 1 day ago
> On Wed, Nov 20, 2024 at 18:48:35 +0300, Nikolai Barybin via Devel wrote:
>> Hello everyone!
>>
>> With help of Peter's comprehensive review I finally present 3rd version
>> of this series.
>>
>> Changes since last revision:
>>
>>   - minor code improvements including memory leaks fixes
>>
>>   - splitted and regrouped some patches for more logical structure
>>
>>   - fixed issue with erroneous disk with data file detatch
>>
>>   - completely rewritten tests
>>
>>   - added some piece of documentation
> Thanks for the new version. I was recently informed about another
> potential use of the 'data-file' feature so any comments I reply with
> I'll be directly fixing in the patches themselves. No need to post
> another version.
>
> Please remember for future postings to write commit messages. I asked
> for them the last time too.
>
>
Thank you, Peter! Sure, I read your previous notes regarding commit 
messages and even added some, but should've added more. I'll keep this 
in mind next time.
Re: [PATCH v3 00/15] Implement support for QCOW2 data files
Posted by Peter Krempa 1 week, 4 days ago
On Wed, Nov 20, 2024 at 18:48:35 +0300, Nikolai Barybin via Devel wrote:
> Hello everyone!
> 
> Nikolai Barybin (15):
>   conf: add data-file feature and related fields to virStorageSource
>   Add VIR_STORAGE_FILE_FEATURE_DATA_FILE to virStorageFileFeature enum
>   conf: schemas: add data-file store to domain rng schema
>   conf: implement XML parsing/formating for dataFileStore
>   storage file: add getDataFile function to FileTypeInfo
>   storage file: add qcow2 data-file path parsing from header
>   storage file: fill in src->dataFileStore during file probe
>   security: DAC: handle qcow2 data-file on image label set/restore
>   security: selinux: handle qcow2 data-file on image label set/restore
>   security: apparmor: handle qcow2 data-file
>   qemu: put data-file path to VM's cgroup and namespace
>   qemu: factor out qemuDomainPrepareStorageSource()
>   qemu: enable basic qcow2 data-file feature support
>   tests: add qcow2 data-file tests
>   docs: formatdomain: describe dataFileStore element of disk

I've finished my reviews and tests. As noted during the review I've
renamed and moved the position of the XML element so that it's stored
under the <source element:

    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/tmp/datafile.qcow2'>
        <dataStore type='block'>
          <format type='raw'/>
          <source dev='/dev/lvm/base1'/>
        </dataStore>
      </source>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </disk>

I've fixed few bugs identified while testing the code and I'm currently
running upstream CI. Once that finishes I'll push these patches with the
modification I've suggested so that we avoid another round trip.

Thanks!

Peter