render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c401cc
From 2a2ab8c8b8fe774a5cde91eef099d21e2d792101 Mon Sep 17 00:00:00 2001
c401cc
Message-Id: <2a2ab8c8b8fe774a5cde91eef099d21e2d792101@dist-git>
c401cc
From: Peter Krempa <pkrempa@redhat.com>
c401cc
Date: Wed, 26 Feb 2014 14:54:53 +0100
c401cc
Subject: [PATCH] qemu: snapshot: Add functions similar to disk source pool
c401cc
 translation
c401cc
c401cc
https://bugzilla.redhat.com/show_bug.cgi?id=1032370
c401cc
c401cc
To avoid future pain, add placeholder functions to get the actual
c401cc
snapshot disk type.
c401cc
c401cc
(cherry picked from commit 7e6242e9a7cf4b1f57402015fe7e93c8da71bee5)
c401cc
c401cc
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c401cc
---
c401cc
 src/qemu/qemu_conf.c | 23 +++++++++++++++++++++++
c401cc
 src/qemu/qemu_conf.h |  6 ++++++
c401cc
 2 files changed, 29 insertions(+)
c401cc
c401cc
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
c401cc
index ec5a895..eb20228 100644
c401cc
--- a/src/qemu/qemu_conf.c
c401cc
+++ b/src/qemu/qemu_conf.c
c401cc
@@ -1371,3 +1371,26 @@ cleanup:
c401cc
     virStoragePoolDefFree(pooldef);
c401cc
     return ret;
c401cc
 }
c401cc
+
c401cc
+
c401cc
+int
c401cc
+qemuSnapshotDiskGetActualType(virDomainSnapshotDiskDefPtr def)
c401cc
+{
c401cc
+    if (def->type == -1)
c401cc
+        return VIR_DOMAIN_DISK_TYPE_FILE;
c401cc
+
c401cc
+    return def->type;
c401cc
+}
c401cc
+
c401cc
+
c401cc
+int
c401cc
+qemuTranslateSnapshotDiskSourcePool(virConnectPtr conn ATTRIBUTE_UNUSED,
c401cc
+                                    virDomainSnapshotDiskDefPtr def)
c401cc
+{
c401cc
+    if (def->type != VIR_DOMAIN_DISK_TYPE_VOLUME)
c401cc
+        return 0;
c401cc
+
c401cc
+    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
c401cc
+                   _("Snapshots are not yet supported with 'pool' volumes"));
c401cc
+    return -1;
c401cc
+}
c401cc
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
c401cc
index 576a2e2..e03be95 100644
c401cc
--- a/src/qemu/qemu_conf.h
c401cc
+++ b/src/qemu/qemu_conf.h
c401cc
@@ -29,6 +29,7 @@
c401cc
 # include "capabilities.h"
c401cc
 # include "network_conf.h"
c401cc
 # include "domain_conf.h"
c401cc
+# include "snapshot_conf.h"
c401cc
 # include "domain_event.h"
c401cc
 # include "virthread.h"
c401cc
 # include "security/security_manager.h"
c401cc
@@ -302,4 +303,9 @@ virDomainXMLOptionPtr virQEMUDriverCreateXMLConf(virQEMUDriverPtr driver);
c401cc
 int qemuTranslateDiskSourcePool(virConnectPtr conn,
c401cc
                                 virDomainDiskDefPtr def);
c401cc
 
c401cc
+int qemuSnapshotDiskGetActualType(virDomainSnapshotDiskDefPtr def);
c401cc
+
c401cc
+int qemuTranslateSnapshotDiskSourcePool(virConnectPtr conn,
c401cc
+                                        virDomainSnapshotDiskDefPtr def);
c401cc
+
c401cc
 #endif /* __QEMUD_CONF_H */
c401cc
-- 
c401cc
1.9.0
c401cc