render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 2a2ab8c8b8fe774a5cde91eef099d21e2d792101 Mon Sep 17 00:00:00 2001
Message-Id: <2a2ab8c8b8fe774a5cde91eef099d21e2d792101@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 26 Feb 2014 14:54:53 +0100
Subject: [PATCH] qemu: snapshot: Add functions similar to disk source pool
 translation

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

To avoid future pain, add placeholder functions to get the actual
snapshot disk type.

(cherry picked from commit 7e6242e9a7cf4b1f57402015fe7e93c8da71bee5)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_conf.c | 23 +++++++++++++++++++++++
 src/qemu/qemu_conf.h |  6 ++++++
 2 files changed, 29 insertions(+)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index ec5a895..eb20228 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1371,3 +1371,26 @@ cleanup:
     virStoragePoolDefFree(pooldef);
     return ret;
 }
+
+
+int
+qemuSnapshotDiskGetActualType(virDomainSnapshotDiskDefPtr def)
+{
+    if (def->type == -1)
+        return VIR_DOMAIN_DISK_TYPE_FILE;
+
+    return def->type;
+}
+
+
+int
+qemuTranslateSnapshotDiskSourcePool(virConnectPtr conn ATTRIBUTE_UNUSED,
+                                    virDomainSnapshotDiskDefPtr def)
+{
+    if (def->type != VIR_DOMAIN_DISK_TYPE_VOLUME)
+        return 0;
+
+    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                   _("Snapshots are not yet supported with 'pool' volumes"));
+    return -1;
+}
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 576a2e2..e03be95 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -29,6 +29,7 @@
 # include "capabilities.h"
 # include "network_conf.h"
 # include "domain_conf.h"
+# include "snapshot_conf.h"
 # include "domain_event.h"
 # include "virthread.h"
 # include "security/security_manager.h"
@@ -302,4 +303,9 @@ virDomainXMLOptionPtr virQEMUDriverCreateXMLConf(virQEMUDriverPtr driver);
 int qemuTranslateDiskSourcePool(virConnectPtr conn,
                                 virDomainDiskDefPtr def);
 
+int qemuSnapshotDiskGetActualType(virDomainSnapshotDiskDefPtr def);
+
+int qemuTranslateSnapshotDiskSourcePool(virConnectPtr conn,
+                                        virDomainSnapshotDiskDefPtr def);
+
 #endif /* __QEMUD_CONF_H */
-- 
1.9.0