From c51c35f810d55633a8024dbad56dd7e1fe7e13e6 Mon Sep 17 00:00:00 2001 From: Anton Todorov Date: Tue, 13 Dec 2022 10:38:15 +0200 Subject: [PATCH] F #5681: disk source element depends on disk type following the domain XML definition https://libvirt.org/formatdomain.html ``` _source_ Representation of the _disk source_ depends on the _disk type_ attribute value as follows: _file_ The _file_ attribute specifies the fully-qualified path to the file holding the disk. Since 0.0.3 _block_ The _dev_ attribute specifies the fully-qualified path to the host device to serve as the disk. Since 0.0.3 ``` Also, I took the liberty to remove the _Image::FILE_ case form the switch as it is the default one. (cherry picked from commit 83404b5ec29e537665c7c80950bd26ed1c240812) --- src/vmm/LibVirtDriverKVM.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vmm/LibVirtDriverKVM.cc b/src/vmm/LibVirtDriverKVM.cc index 75dbb3d2b0..009001b66c 100644 --- a/src/vmm/LibVirtDriverKVM.cc +++ b/src/vmm/LibVirtDriverKVM.cc @@ -1522,6 +1522,7 @@ int LibVirtDriver::deployment_description_kvm( Image::DiskType ctxt_disk_type = Image::FILE; string s_cdt; + string s_cst; if (auto ds = nd.get_dspool()->get_ro(vm->get_ds_id())) { @@ -1530,21 +1531,20 @@ int LibVirtDriver::deployment_description_kvm( switch (ctxt_disk_type) { - case Image::FILE: - s_cdt = "file"; - break; case Image::BLOCK: s_cdt = "block"; + s_cst = "dev"; break; default: s_cdt = "file"; + s_cst = "file"; break; } fname << vm->get_system_dir() << "/disk." << disk_id; file << "\t\t\n" - << "\t\t\t\n" << "\t\t\t