This is perfectly valid in VMWare and the VM just boots with an empty drive.  We
used to just skip the whole drive before, but since we changed how we parse
empty cdrom drives this results in an error.  Make it behave more closer to
VMWare.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1903953

Signed-off-by: Martin Kletzander <mklet...@redhat.com>
---
 src/vmx/vmx.c       | 2 +-
 tests/vmx2xmltest.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index aa5d1d4eedea..56318fc8b285 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -2448,7 +2448,7 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr 
xmlopt, virConfPtr con
             }
 
             virDomainDiskSetType(*def, VIR_STORAGE_TYPE_FILE);
-            if (ctx->parseFileName(fileName, ctx->opaque, &tmp, false) < 0)
+            if (ctx->parseFileName(fileName, ctx->opaque, &tmp, true) < 0)
                 goto cleanup;
             virDomainDiskSetSource(*def, tmp);
             VIR_FREE(tmp);
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index d622e46fd563..11739e6f3f51 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -247,8 +247,8 @@ mymain(void)
     DO_TEST("cdrom-ide-raw-auto-detect", "cdrom-ide-raw-auto-detect");
     DO_TEST("cdrom-ide-raw-auto-detect", "cdrom-ide-raw-auto-detect");
 
-    DO_TEST_FAIL("cdrom-ide-file-missing-datastore", "cdrom-ide-empty");
-    DO_TEST_FAIL("cdrom-ide-file-missing-file", "cdrom-ide-empty");
+    DO_TEST("cdrom-ide-file-missing-datastore", "cdrom-ide-empty");
+    DO_TEST("cdrom-ide-file-missing-file", "cdrom-ide-empty");
 
     DO_TEST_FAIL("harddisk-ide-file-missing-datastore", "harddisk-ide-file");
     DO_TEST_FAIL("harddisk-scsi-file-missing-file", "harddisk-scsi-file");
-- 
2.30.0

Reply via email to