[libvirt] [PATCHv3 2/4] phyp: add rudimentary storage driver

Eric Blake eblake at redhat.com
Thu Jun 24 22:32:01 UTC 2010


From: Eduardo Otubo <otubo at linux.vnet.ibm.com>

* src/phyp/phyp_driver.c (phypStorageDriver): New driver.
(phypStorageOpen, phypStorageClose): New functions.
(phypRegister): Register it.

Signed-off-by: Eric Blake <eblake at redhat.com>
---

For my sanity, I split out the creation/registration of the
driver from the addition of all the methods in the driver.

 src/phyp/phyp_driver.c |   64 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 63 insertions(+), 1 deletions(-)

diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 0912f90..341ee99 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -56,6 +56,7 @@
 #include "virterror_internal.h"
 #include "uuid.h"
 #include "domain_conf.h"
+#include "storage_conf.h"
 #include "nodeinfo.h"

 #include "phyp_driver.h"
@@ -2265,6 +2266,22 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)

 }

+static virDrvOpenStatus
+phypStorageOpen(virConnectPtr conn ATTRIBUTE_UNUSED,
+                virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+                int flags)
+{
+    virCheckFlags(0, VIR_DRV_OPEN_ERROR);
+
+    return VIR_DRV_OPEN_SUCCESS;
+}
+
+static int
+phypStorageClose(virConnectPtr conn ATTRIBUTE_UNUSED)
+{
+    return 0;
+}
+
 static virDriver phypDriver = {
     VIR_DRV_PHYP, "PHYP", phypOpen,     /* open */
     phypClose,                  /* close */
@@ -2364,9 +2381,54 @@ static virDriver phypDriver = {
     NULL,                       /* domainSnapshotDelete */
 };

+static virStorageDriver phypStorageDriver = {
+    .name = "PHYP",
+    .open = phypStorageOpen,
+    .close = phypStorageClose,
+
+    .numOfPools = NULL,
+    .listPools = NULL,
+    .numOfDefinedPools = NULL,
+    .listDefinedPools = NULL,
+    .findPoolSources = NULL,
+    .poolLookupByName = NULL,
+    .poolLookupByUUID = NULL,
+    .poolLookupByVolume = NULL,
+    .poolCreateXML = NULL,
+    .poolDefineXML = NULL,
+    .poolBuild = NULL,
+    .poolUndefine = NULL,
+    .poolCreate = NULL,
+    .poolDestroy = NULL,
+    .poolDelete = NULL,
+    .poolRefresh = NULL,
+    .poolGetInfo = NULL,
+    .poolGetXMLDesc = NULL,
+    .poolGetAutostart = NULL,
+    .poolSetAutostart = NULL,
+    .poolNumOfVolumes = NULL,
+    .poolListVolumes = NULL,
+
+    .volLookupByName = NULL,
+    .volLookupByKey = NULL,
+    .volLookupByPath = NULL,
+    .volCreateXML = NULL,
+    .volCreateXMLFrom = NULL,
+    .volDelete = NULL,
+    .volGetInfo = NULL,
+    .volGetXMLDesc = NULL,
+    .volGetPath = NULL,
+    .poolIsActive = NULL,
+    .poolIsPersistent = NULL
+};
+
 int
 phypRegister(void)
 {
-    virRegisterDriver(&phypDriver);
+    if (virRegisterDriver(&phypDriver) < 0)
+        return -1;
+    if (virRegisterStorageDriver(&phypStorageDriver) < 0)
+        return -1;
+
     return 0;
 }
-- 
1.7.0.1




More information about the libvir-list mailing list