[PATCHv2] Trivially support DomainHasManagedSaveImage

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

 



Return 0 instead of ERR_NO_SUPPORT in each driver
where we don't support managed save.

This avoids spamming daemon logs when 'virsh dominfo' is run.

https://bugzilla.redhat.com/show_bug.cgi?id=1095637
---
 src/bhyve/bhyve_driver.c         | 25 ++++++++++++++++++++++++-
 src/esx/esx_driver.c             | 11 ++++++++++-
 src/lxc/lxc_driver.c             | 26 +++++++++++++++++++++++++-
 src/openvz/openvz_driver.c       | 12 +++++++++++-
 src/parallels/parallels_driver.c | 11 ++++++++++-
 src/phyp/phyp_driver.c           | 11 ++++++++++-
 src/uml/uml_driver.c             | 33 ++++++++++++++++++++++++++++++++-
 src/vbox/vbox_common.c           | 11 ++++++++++-
 src/vmware/vmware_driver.c       | 11 ++++++++++-
 src/xenapi/xenapi_driver.c       | 11 ++++++++++-
 10 files changed, 152 insertions(+), 10 deletions(-)

diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 56cc8ab..ae39917 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -2,7 +2,7 @@
  * bhyve_driver.c: core driver methods for managing bhyve guests
  *
  * Copyright (C) 2014 Roman Bogorodskiy
- * Copyright (C) 2014 Red Hat, Inc.
+ * Copyright (C) 2014-2015 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -1430,6 +1430,28 @@ bhyveConnectDomainEventDeregisterAny(virConnectPtr conn,
     return 0;
 }
 
+static int
+bhyveDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags)
+{
+    virDomainObjPtr vm = NULL;
+    int ret = -1;
+
+    virCheckFlags(0, -1);
+
+    if (!(vm = bhyveDomObjFromDomain(domain)))
+        goto cleanup;
+
+    if (virDomainHasManagedSaveImageEnsureACL(domain->conn, vm->def) < 0)
+        goto cleanup;
+
+    ret = 0;
+
+ cleanup:
+    if (vm)
+        virObjectUnlock(vm);
+    return ret;
+}
+
 static virHypervisorDriver bhyveHypervisorDriver = {
     .name = "bhyve",
     .connectOpen = bhyveConnectOpen, /* 1.2.2 */
@@ -1476,6 +1498,7 @@ static virHypervisorDriver bhyveHypervisorDriver = {
     .connectCompareCPU = bhyveConnectCompareCPU, /* 1.2.4 */
     .connectDomainEventRegisterAny = bhyveConnectDomainEventRegisterAny, /* 1.2.5 */
     .connectDomainEventDeregisterAny = bhyveConnectDomainEventDeregisterAny, /* 1.2.5 */
+    .domainHasManagedSaveImage = bhyveDomainHasManagedSaveImage, /* 1.2.13 */
 };
 
 
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 6b9965f..53d31e3 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -1,7 +1,7 @@
 /*
  * esx_driver.c: core driver functions for managing VMware ESX hosts
  *
- * Copyright (C) 2010-2014 Red Hat, Inc.
+ * Copyright (C) 2010-2015 Red Hat, Inc.
  * Copyright (C) 2009-2014 Matthias Bolte <matthias.bolte@xxxxxxxxxxxxxx>
  * Copyright (C) 2009 Maximilian Wilhelm <max@xxxxxxxxxxx>
  *
@@ -5147,6 +5147,14 @@ esxConnectListAllDomains(virConnectPtr conn,
 }
 #undef MATCH
 
+static int
+esxDomainHasManagedSaveImage(virDomainPtr dom ATTRIBUTE_UNUSED, unsigned int flags)
+{
+    virCheckFlags(0, -1);
+
+    return 0;
+}
+
 
 static virHypervisorDriver esxHypervisorDriver = {
     .name = "ESX",
@@ -5226,6 +5234,7 @@ static virHypervisorDriver esxHypervisorDriver = {
     .domainSnapshotHasMetadata = esxDomainSnapshotHasMetadata, /* 0.9.13 */
     .domainSnapshotDelete = esxDomainSnapshotDelete, /* 0.8.0 */
     .connectIsAlive = esxConnectIsAlive, /* 0.9.8 */
+    .domainHasManagedSaveImage = esxDomainHasManagedSaveImage, /* 1.2.13 */
 };
 
 
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 487e2a2..3adb21d 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2014 Red Hat, Inc.
+ * Copyright (C) 2010-2015 Red Hat, Inc.
  * Copyright IBM Corp. 2008
  *
  * lxc_driver.c: linux container driver functions
@@ -5726,6 +5726,29 @@ lxcNodeAllocPages(virConnectPtr conn,
 }
 
 
+static int
+lxcDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags)
+{
+    virDomainObjPtr vm = NULL;
+    int ret = -1;
+
+    virCheckFlags(0, -1);
+
+    if (!(vm = lxcDomObjFromDomain(dom)))
+        return ret;
+
+    if (virDomainHasManagedSaveImageEnsureACL(dom->conn, vm->def) < 0)
+        goto cleanup;
+
+    ret = 0;
+
+ cleanup:
+    if (vm)
+        virObjectUnlock(vm);
+    return ret;
+}
+
+
 /* Function Tables */
 static virHypervisorDriver lxcHypervisorDriver = {
     .name = LXC_DRIVER_NAME,
@@ -5818,6 +5841,7 @@ static virHypervisorDriver lxcHypervisorDriver = {
     .domainLxcOpenNamespace = lxcDomainLxcOpenNamespace, /* 1.0.2 */
     .nodeGetFreePages = lxcNodeGetFreePages, /* 1.2.6 */
     .nodeAllocPages = lxcNodeAllocPages, /* 1.2.9 */
+    .domainHasManagedSaveImage = lxcDomainHasManagedSaveImage, /* 1.2.13 */
 };
 
 static virConnectDriver lxcConnectDriver = {
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 556f626..4ce5a41 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1,7 +1,7 @@
 /*
  * openvz_driver.c: core driver methods for managing OpenVZ VEs
  *
- * Copyright (C) 2010-2014 Red Hat, Inc.
+ * Copyright (C) 2010-2015 Red Hat, Inc.
  * Copyright (C) 2006, 2007 Binary Karma
  * Copyright (C) 2006 Shuveb Hussain
  * Copyright (C) 2007 Anoop Joe Cyriac
@@ -2567,6 +2567,15 @@ openvzDomainMigrateConfirm3Params(virDomainPtr domain,
     return ret;
 }
 
+static int
+openvzDomainHasManagedSaveImage(virDomainPtr dom ATTRIBUTE_UNUSED, unsigned int flags)
+{
+    virCheckFlags(0, -1);
+
+    return 0;
+}
+
+
 
 static virHypervisorDriver openvzHypervisorDriver = {
     .name = "OPENVZ",
@@ -2632,6 +2641,7 @@ static virHypervisorDriver openvzHypervisorDriver = {
     .domainMigratePerform3Params = openvzDomainMigratePerform3Params, /* 1.2.8 */
     .domainMigrateFinish3Params = openvzDomainMigrateFinish3Params, /* 1.2.8 */
     .domainMigrateConfirm3Params = openvzDomainMigrateConfirm3Params, /* 1.2.8 */
+    .domainHasManagedSaveImage = openvzDomainHasManagedSaveImage, /* 1.2.13 */
 };
 
 static virConnectDriver openvzConnectDriver = {
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index b569160..819f662 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -2,7 +2,7 @@
  * parallels_driver.c: core driver functions for managing
  * Parallels Cloud Server hosts
  *
- * Copyright (C) 2014 Red Hat, Inc.
+ * Copyright (C) 2014-2015 Red Hat, Inc.
  * Copyright (C) 2012 Parallels, Inc.
  *
  * This library is free software; you can redistribute it and/or
@@ -956,6 +956,14 @@ parallelsDomainUndefine(virDomainPtr domain)
     return parallelsDomainUndefineFlags(domain, 0);
 }
 
+static int
+parallelsDomainHasManagedSaveImage(virDomainPtr dom ATTRIBUTE_UNUSED, unsigned int flags)
+{
+    virCheckFlags(0, -1);
+
+    return 0;
+}
+
 static virHypervisorDriver parallelsDriver = {
     .name = "Parallels",
     .connectOpen = parallelsConnectOpen,            /* 0.10.0 */
@@ -997,6 +1005,7 @@ static virHypervisorDriver parallelsDriver = {
     .connectIsEncrypted = parallelsConnectIsEncrypted, /* 1.2.5 */
     .connectIsSecure = parallelsConnectIsSecure, /* 1.2.5 */
     .connectIsAlive = parallelsConnectIsAlive, /* 1.2.5 */
+    .domainHasManagedSaveImage = parallelsDomainHasManagedSaveImage, /* 1.2.13 */
 };
 
 static virConnectDriver parallelsConnectDriver = {
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 6c5a91e..d392709 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2014 Red Hat, Inc.
+ * Copyright (C) 2010-2015 Red Hat, Inc.
  * Copyright IBM Corp. 2009
  *
  * phyp_driver.c: ssh layer to access Power Hypervisors
@@ -3669,6 +3669,14 @@ phypDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
     return phypDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
 }
 
+static int
+phypDomainHasManagedSaveImage(virDomainPtr dom ATTRIBUTE_UNUSED, unsigned int flags)
+{
+    virCheckFlags(0, -1);
+
+    return 0;
+}
+
 static virHypervisorDriver phypHypervisorDriver = {
     .name = "PHYP",
     .connectOpen = phypConnectOpen, /* 0.7.0 */
@@ -3698,6 +3706,7 @@ static virHypervisorDriver phypHypervisorDriver = {
     .connectIsSecure = phypConnectIsSecure, /* 0.7.3 */
     .domainIsUpdated = phypDomainIsUpdated, /* 0.8.6 */
     .connectIsAlive = phypConnectIsAlive, /* 0.9.8 */
+    .domainHasManagedSaveImage = phypDomainHasManagedSaveImage, /* 1.2.13 */
 };
 
 static virStorageDriver phypStorageDriver = {
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 6ca038a..68efd18 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -1,7 +1,7 @@
 /*
  * uml_driver.c: core driver methods for managing UML guests
  *
- * Copyright (C) 2006-2014 Red Hat, Inc.
+ * Copyright (C) 2006-2015 Red Hat, Inc.
  * Copyright (C) 2006-2008 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -2943,6 +2943,36 @@ umlNodeAllocPages(virConnectPtr conn,
 }
 
 
+static int
+umlDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags)
+{
+    struct uml_driver *driver = dom->conn->privateData;
+    int ret = -1;
+    virDomainObjPtr vm;
+
+    virCheckFlags(0, -1);
+
+    umlDriverLock(driver);
+    vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
+    umlDriverUnlock(driver);
+
+    if (!vm) {
+        virReportError(VIR_ERR_NO_DOMAIN, NULL);
+        goto cleanup;
+    }
+
+    if (virDomainHasManagedSaveImageEnsureACL(dom->conn, vm->def) < 0)
+        goto cleanup;
+
+    ret = 0;
+
+ cleanup:
+    if (vm)
+        virObjectUnlock(vm);
+    return ret;
+}
+
+
 static virHypervisorDriver umlHypervisorDriver = {
     .name = "UML",
     .connectOpen = umlConnectOpen, /* 0.5.0 */
@@ -3006,6 +3036,7 @@ static virHypervisorDriver umlHypervisorDriver = {
     .nodeSetMemoryParameters = umlNodeSetMemoryParameters, /* 0.10.2 */
     .nodeGetFreePages = umlNodeGetFreePages, /* 1.2.6 */
     .nodeAllocPages = umlNodeAllocPages, /* 1.2.9 */
+    .domainHasManagedSaveImage = umlDomainHasManagedSaveImage, /* 1.2.13 */
 };
 
 static virConnectDriver umlConnectDriver = {
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index bd3f50c..76fcc72 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014, Taowei Luo (uaedante@xxxxxxxxx)
- * Copyright (C) 2010-2014 Red Hat, Inc.
+ * Copyright (C) 2010-2015 Red Hat, Inc.
  * Copyright (C) 2008-2009 Sun Microsystems, Inc.
  *
  * This library is free software; you can redistribute it and/or
@@ -7588,6 +7588,14 @@ vboxNodeAllocPages(virConnectPtr conn ATTRIBUTE_UNUSED,
                           startCell, cellCount, add);
 }
 
+static int
+vboxDomainHasManagedSaveImage(virDomainPtr dom ATTRIBUTE_UNUSED, unsigned int flags)
+{
+    virCheckFlags(0, -1);
+
+    return 0;
+}
+
 
 /**
  * Function Tables
@@ -7661,6 +7669,7 @@ virHypervisorDriver vboxCommonDriver = {
     .connectIsAlive = vboxConnectIsAlive, /* 0.9.8 */
     .nodeGetFreePages = vboxNodeGetFreePages, /* 1.2.6 */
     .nodeAllocPages = vboxNodeAllocPages, /* 1.2.9 */
+    .domainHasManagedSaveImage = vboxDomainHasManagedSaveImage, /* 1.2.13 */
 };
 
 static void updateDriver(void)
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index 2d7ba04..22d0c91 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -1,6 +1,6 @@
 /*---------------------------------------------------------------------------*/
 /*
- * Copyright (C) 2011-2012 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
  * Copyright 2010, diateam (www.diateam.net)
  * Copyright (C) 2013. Doug Goldstein <cardoe@xxxxxxxxxx>
  *
@@ -1195,6 +1195,14 @@ vmwareConnectListAllDomains(virConnectPtr conn,
     return ret;
 }
 
+static int
+vmwareDomainHasManagedSaveImage(virDomainPtr dom ATTRIBUTE_UNUSED, unsigned int flags)
+{
+    virCheckFlags(0, -1);
+
+    return 0;
+}
+
 
 
 static virHypervisorDriver vmwareHypervisorDriver = {
@@ -1233,6 +1241,7 @@ static virHypervisorDriver vmwareHypervisorDriver = {
     .domainIsActive = vmwareDomainIsActive, /* 0.8.7 */
     .domainIsPersistent = vmwareDomainIsPersistent, /* 0.8.7 */
     .connectIsAlive = vmwareConnectIsAlive, /* 0.9.8 */
+    .domainHasManagedSaveImage = vmwareDomainHasManagedSaveImage, /* 1.2.13 */
 };
 
 static virConnectDriver vmwareConnectDriver = {
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index 0902f9a..c7b9798 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -1,6 +1,6 @@
 /*
  * xenapi_driver.c: Xen API driver.
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
  * Copyright (C) 2009, 2010 Citrix Ltd.
  *
  * This library is free software; you can redistribute it and/or
@@ -1977,6 +1977,14 @@ xenapiConnectIsAlive(virConnectPtr conn)
         return 0;
 }
 
+static int
+xenapiDomainHasManagedSaveImage(virDomainPtr dom ATTRIBUTE_UNUSED, unsigned int flags)
+{
+    virCheckFlags(0, -1);
+
+    return 0;
+}
+
 /* The interface which we export upwards to libvirt.c. */
 static virHypervisorDriver xenapiHypervisorDriver = {
     .name = "XenAPI",
@@ -2029,6 +2037,7 @@ static virHypervisorDriver xenapiHypervisorDriver = {
     .nodeGetFreeMemory = xenapiNodeGetFreeMemory, /* 0.8.0 */
     .domainIsUpdated = xenapiDomainIsUpdated, /* 0.8.6 */
     .connectIsAlive = xenapiConnectIsAlive, /* 0.9.8 */
+    .domainHasManagedSaveImage = xenapiDomainHasManagedSaveImage, /* 1.2.13 */
 };
 
 
-- 
2.0.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]