[libvirt] [PATCH 3/6] phyp: Add various vir*Flags API

Eric Blake eblake at redhat.com
Tue Jul 9 03:37:00 UTC 2019


Even though we don't accept any flags, it is unfriendly to callers
that use the modern API to have to fall back to the flag-free API.

Signed-off-by: Eric Blake <eblake at redhat.com>
---
 src/phyp/phyp_driver.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index e54799dbb4..a4b440a24f 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1657,7 +1657,9 @@ phypGetVIOSFreeSCSIAdapter(virConnectPtr conn)


 static int
-phypDomainAttachDevice(virDomainPtr domain, const char *xml)
+phypDomainAttachDeviceFlags(virDomainPtr domain,
+                            const char *xml,
+                            unsigned int flags)
 {
     int result = -1;
     virConnectPtr conn = domain->conn;
@@ -1677,6 +1679,8 @@ phypDomainAttachDevice(virDomainPtr domain, const char *xml)
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     char *domain_name = NULL;

+    virCheckFlags(0, -1);
+
     if (!(def = virDomainDefNew()))
         goto cleanup;

@@ -1808,6 +1812,12 @@ phypDomainAttachDevice(virDomainPtr domain, const char *xml)
     return result;
 }

+static int
+phypDomainAttachDevice(virDomainPtr domain, const char *xml)
+{
+    return phypDomainAttachDeviceFlags(domain, xml, 0);
+}
+
 static char *
 phypStorageVolGetKey(virConnectPtr conn, const char *name)
 {
@@ -3330,7 +3340,7 @@ phypDomainReboot(virDomainPtr dom, unsigned int flags)
 }

 static int
-phypDomainShutdown(virDomainPtr dom)
+phypDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
 {
     int result = -1;
     virConnectPtr conn = dom->conn;
@@ -3342,6 +3352,8 @@ phypDomainShutdown(virDomainPtr dom)
     char *ret = NULL;
     virBuffer buf = VIR_BUFFER_INITIALIZER;

+    virCheckFlags(0, -1);
+
     virBufferAddLit(&buf, "chsysstate");
     if (system_type == HMC)
         virBufferAsprintf(&buf, " -m %s", managed_system);
@@ -3359,6 +3371,12 @@ phypDomainShutdown(virDomainPtr dom)
     return result;
 }

+static int
+phypDomainShutdown(virDomainPtr dom)
+{
+    return phypDomainShutdownFlags(dom, 0);
+}
+
 static int
 phypDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
 {
@@ -3675,6 +3693,7 @@ static virHypervisorDriver phypHypervisorDriver = {
     .domainLookupByName = phypDomainLookupByName, /* 0.7.0 */
     .domainResume = phypDomainResume, /* 0.7.0 */
     .domainShutdown = phypDomainShutdown, /* 0.7.0 */
+    .domainShutdownFlags = phypDomainShutdownFlags, /* 5.6.0 */
     .domainReboot = phypDomainReboot, /* 0.9.1 */
     .domainDestroy = phypDomainDestroy, /* 0.7.3 */
     .domainDestroyFlags = phypDomainDestroyFlags, /* 0.9.4 */
@@ -3688,6 +3707,7 @@ static virHypervisorDriver phypHypervisorDriver = {
     .connectListDefinedDomains = phypConnectListDefinedDomains, /* 0.7.0 */
     .connectNumOfDefinedDomains = phypConnectNumOfDefinedDomains, /* 0.7.0 */
     .domainAttachDevice = phypDomainAttachDevice, /* 0.8.2 */
+    .domainAttachDeviceFlags = phypDomainAttachDeviceFlags, /* 5.6.0 */
     .connectIsEncrypted = phypConnectIsEncrypted, /* 0.7.3 */
     .connectIsSecure = phypConnectIsSecure, /* 0.7.3 */
     .domainIsUpdated = phypDomainIsUpdated, /* 0.8.6 */
-- 
2.20.1




More information about the libvir-list mailing list