[virt-tools-list] [virt-viewer] ovirt: Filter everything which does not end in .iso

Christophe Fergeau cfergeau at redhat.com
Tue Aug 28 17:06:43 UTC 2018


oVirt REST API does not provide a way to know what is a valid ISO image
which can be assigned to a running VM. I've seen floppy disk images
(.vfd) in a domain, which is already filtered. Now I've seen an ISO
domain with .qcow2 files in it, which can't be assigned to a VM either.
This commit filters every file which does not have a .iso extension as
it's unlikely to be possible to use it.

Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
 src/ovirt-foreign-menu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
index f212861..69bf2b3 100644
--- a/src/ovirt-foreign-menu.c
+++ b/src/ovirt-foreign-menu.c
@@ -489,7 +489,8 @@ static void ovirt_foreign_menu_set_files(OvirtForeignMenu *menu,
          * associated with file resources , but as of 3.2, this node
          * is not present, so we do an extension check instead
          * to differentiate between ISOs and floppy images */
-        if (g_str_has_suffix(name, ".vfd")) {
+        if (!g_str_has_suffix(name, ".iso")) {
+            g_debug("Ignoring %s which does not have a .iso extension", name);
             g_free(name);
             continue;
         }
-- 
2.17.1




More information about the virt-tools-list mailing list