https://bugzilla.redhat.com/show_bug.cgi?id=1527740
Users might use a block device as UEFI VAR store. Or even have
OVMF stored there. Therefore, when starting a domain and separate
mount namespace is used, we have to create all the /dev entries
that are configured for the domain.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_domain.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 43bd0fff4..04af68809 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9470,6 +9470,44 @@ qemuDomainSetupAllRNGs(virQEMUDriverConfigPtr cfg,
}
+static int
+qemuDomainSetupLoader(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
+ virDomainObjPtr vm,
+ const struct qemuDomainCreateDeviceData *data)
+{
+ virDomainLoaderDefPtr loader = vm->def->os.loader;
+ int ret = -1;
+
+ VIR_DEBUG("Setting up loader");
+
+ if (loader) {
+ switch ((virDomainLoader) loader->type) {
+ case VIR_DOMAIN_LOADER_TYPE_ROM:
+ if (qemuDomainCreateDevice(loader->path, data, false) < 0)
+ goto cleanup;
+ break;
+
+ case VIR_DOMAIN_LOADER_TYPE_PFLASH:
+ if (qemuDomainCreateDevice(loader->path, data, false) < 0)
+ goto cleanup;
+
+ if (loader->nvram &&
+ qemuDomainCreateDevice(loader->nvram, data, false) < 0)
+ goto cleanup;
+ break;
+
+ case VIR_DOMAIN_LOADER_TYPE_LAST:
+ break;
+ }
+ }
+
+ VIR_DEBUG("Setup loader");
+ ret = 0;
+ cleanup:
+ return ret;
+}
+
+
int
qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg,
virSecurityManagerPtr mgr,
@@ -9538,6 +9576,9 @@ qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg,
if (qemuDomainSetupAllRNGs(cfg, vm, &data) < 0)
goto cleanup;
+ if (qemuDomainSetupLoader(cfg, vm, &data) < 0)
+ goto cleanup;
+
/* Save some mount points because we want to share them with the host */
for (i = 0; i < ndevMountsPath; i++) {
struct stat sb;
--
2.13.6