On 04/25/2018 11:15 AM, Peter Krempa wrote: > When using blockdev-add and friends, libvirt will need to create also > properties for the qcow2/raw/... format handler in qemu. This patch adds > the infrastructure and implements all formats known to libvirt including > all properties which are expressed at the format level in qemu. > > Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> > --- > src/qemu/qemu_block.c | 296 ++++++++++++++++++++++++++++++++++++++++++++++++++ > src/qemu/qemu_block.h | 3 + > 2 files changed, 299 insertions(+) > There's a few inconsistencies with blank lines in switch/cases in qemuBlockStorageSourceGetBlockdevFormatProps that need adjustment, but otherwise, Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx> John [...] > + > +static virJSONValuePtr > +qemuBlockStorageSourceGetBlockdevFormatProps(virStorageSourcePtr src) > +{ > + const char *driver = NULL; > + virJSONValuePtr props = NULL; > + virJSONValuePtr ret = NULL; > + > + if (!(props = qemuBlockStorageSourceGetBlockdevFormatCommonProps(src))) > + goto cleanup; > + > + switch ((virStorageFileFormat) src->format) { > + case VIR_STORAGE_FILE_FAT: > + /* The fat layer is emulated by the storage access layer, so we need to > + * put a raw layer on top */ > + case VIR_STORAGE_FILE_RAW: > + if (qemuBlockStorageSourceGetFormatRawProps(src, props) < 0) > + goto cleanup; > + Unnecessary blank line. > + break; > + > + case VIR_STORAGE_FILE_QCOW2: > + if (qemuBlockStorageSourceGetFormatQcow2Props(src, props) < 0) > + goto cleanup; > + break; > + > + case VIR_STORAGE_FILE_QCOW: > + if (qemuBlockStorageSourceGetFormatQcowGenericProps(src, "qcow", props) < 0) > + goto cleanup; > + break; > + > + /* formats without any special parameters */ > + case VIR_STORAGE_FILE_PLOOP: > + driver = "parallels"; > + break; add blank line > + case VIR_STORAGE_FILE_VHD: > + driver = "vhdx"; > + break; add blank line > + case VIR_STORAGE_FILE_BOCHS: > + case VIR_STORAGE_FILE_CLOOP: > + case VIR_STORAGE_FILE_DMG: > + case VIR_STORAGE_FILE_VDI: > + case VIR_STORAGE_FILE_VPC: > + case VIR_STORAGE_FILE_QED: > + case VIR_STORAGE_FILE_VMDK: > + driver = virStorageFileFormatTypeToString(src->format); > + break; > + > + case VIR_STORAGE_FILE_AUTO_SAFE: > + case VIR_STORAGE_FILE_AUTO: > + case VIR_STORAGE_FILE_NONE: > + case VIR_STORAGE_FILE_COW: > + case VIR_STORAGE_FILE_ISO: > + case VIR_STORAGE_FILE_DIR: > + virReportError(VIR_ERR_INTERNAL_ERROR, > + _("mishandled storage format '%s'"), > + virStorageFileFormatTypeToString(src->format)); > + goto cleanup; > + > + case VIR_STORAGE_FILE_LAST: > + default: > + virReportEnumRangeError(virStorageFileFormat, src->format); > + goto cleanup; > + } [...] -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list