[gnome-boxes/wip/clone: 8/16] installed-media: Allow bypassing format check



commit 28eda1f908b6dea180ac9d43a299d1d15612803a
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue May 3 18:36:12 2016 +0100

    installed-media: Allow bypassing format check
    
    In certain cases (e.g the cloning code that will be added in a following
    patch), the media will already be in qcow2 format so there is no need to
    check for format of disk image. Moreoever, currently our disk images
    lack the file extension so our own code breaks on detecting it's type as
    we rely on file extensions for detection.

 src/installed-media.vala |    4 ++--
 src/libvirt-media.vala   |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/installed-media.vala b/src/installed-media.vala
index e1102b9..67e3518 100644
--- a/src/installed-media.vala
+++ b/src/installed-media.vala
@@ -35,10 +35,10 @@ private class Boxes.InstalledMedia : Boxes.InstallerMedia {
         }
     }
 
-    public InstalledMedia (string path) throws GLib.Error {
+    public InstalledMedia (string path, bool known_qcow2 = false) throws GLib.Error {
         var supported = false;
 
-        if (path.has_prefix ("/dev/"))
+        if (known_qcow2 || path.has_prefix ("/dev/"))
             supported = true; // Let's assume it's device file in raw format
         else
             foreach (var extension in supported_extensions) {
diff --git a/src/libvirt-media.vala b/src/libvirt-media.vala
index 7e9d0b3..93157ed 100644
--- a/src/libvirt-media.vala
+++ b/src/libvirt-media.vala
@@ -11,8 +11,8 @@ private class Boxes.LibvirtMedia : Boxes.InstalledMedia {
 
     public Domain domain_config { get; private set; }
 
-    public LibvirtMedia (string path, Domain domain_config) throws GLib.Error {
-        base (path);
+    public LibvirtMedia (string path, Domain domain_config, bool known_qcow2 = false) throws GLib.Error {
+        base (path, known_qcow2);
 
         this.domain_config = domain_config;
         label = domain_config.title?? domain_config.name;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]