<dt><code>readonly</code></dt>
<dd>
- An optional <code>readonly</code> attribute is available but currently
- unused.
+ Enables exporting filesytem as a readonly mount for guest, by
+ default read-write access is given (currently only works for
+ QEMU/KVM driver).
</dd>
</dl>
"rombar",
"ich9-ahci",
"no-acpi",
+ "fsdev-readonly",
);
struct qemu_feature_flags {
virBitmapPtr flags)
{
const char *p;
+ const char *fsdev;
if (strstr(help, "-no-kqemu"))
qemuCapsSet(flags, QEMU_CAPS_KQEMU);
qemuCapsSet(flags, QEMU_CAPS_NESTING);
if (strstr(help, ",menu=on"))
qemuCapsSet(flags, QEMU_CAPS_BOOT_MENU);
- if (strstr(help, "-fsdev"))
+ if ((fsdev = strstr(help, "-fsdev"))) {
qemuCapsSet(flags, QEMU_CAPS_FSDEV);
+ if (strstr(fsdev, "readonly"))
+ qemuCapsSet(flags, QEMU_CAPS_FSDEV_READONLY);
+ }
if (strstr(help, "-smbios type"))
qemuCapsSet(flags, QEMU_CAPS_SMBIOS_TYPE);
QEMU_CAPS_PCI_ROMBAR = 76, /* -device rombar=0|1 */
QEMU_CAPS_ICH9_AHCI = 77, /* -device ich9-ahci */
QEMU_CAPS_NO_ACPI = 78, /* -no-acpi */
+ QEMU_CAPS_FSDEV_READONLY =79, /* -fsdev readonly supported */
QEMU_CAPS_LAST, /* this must always be the last item */
};
virBufferAsprintf(&opt, ",id=%s%s", QEMU_FSDEV_HOST_PREFIX, fs->info.alias);
virBufferAsprintf(&opt, ",path=%s", fs->src);
+ if (fs->readonly) {
+ if (qemuCapsGet(qemuCaps, QEMU_CAPS_FSDEV_READONLY)) {
+ virBufferAddLit(&opt, ",readonly");
+ } else {
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("readonly filesystem is not supported by this "
+ "QEMU binary"));
+ goto error;
+ }
+ }
+
if (virBufferError(&opt)) {
virReportOOMError();
goto error;