memcpy(tmp, buf + offset, len);
tmp[len] = '\0';
+ /* qemu and qemu-img allow using the protocol driver name inside
+ * of the format field in cases when the dummy 'raw' driver should
+ * not be created. Thus libvirt needs to consider anything that
+ * doesn't look like a format driver name to be a protocol driver
+ * directly and thus the image is in fact still considered raw
+ */
*backingFormat = virStorageFileFormatTypeFromString(tmp);
if (*backingFormat <= VIR_STORAGE_FILE_NONE)
- return -1;
+ *backingFormat = VIR_STORAGE_FILE_RAW;
break;
}
VIR_STORAGE_FILE_QCOW2, EXP_PASS);
TEST_CHAIN("qcow2-protocol-backing-nbd",
abs_srcdir "/virstoragetestdata/images/qcow2-protocol-backing-nbd.qcow2",
- VIR_STORAGE_FILE_QCOW2, EXP_FAIL);
+ VIR_STORAGE_FILE_QCOW2, EXP_PASS);
/* Qcow2 file with missing backing file but specified type */
TEST_CHAIN("qcow2-qcow2_missing",
path:ABS_SRCDIR/virstoragetestdata/images/qcow2-protocol-backing-file.qcow2
backingStoreRaw: raw
-backingStoreRawFormat: <null>(-1)
+backingStoreRawFormat: raw(1)
capacity: 1024
encryption: 0
relPath:<null>
--- /dev/null
+path:ABS_SRCDIR/virstoragetestdata/images/qcow2-protocol-backing-nbd.qcow2
+backingStoreRaw: nbd+tcp://example.org:6000/blah
+backingStoreRawFormat: raw(1)
+capacity: 10485760
+encryption: 0
+relPath:<null>
+type:file
+format:qcow2
+protocol:none
+hostname:<null>
+
+path:blah
+backingStoreRaw: <null>
+backingStoreRawFormat: none(0)
+capacity: 0
+encryption: 0
+relPath:<null>
+type:network
+format:raw
+protocol:nbd
+hostname:example.org