From 575b18c0f08bb01063d308da39987da46e6dbf27 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Tue, 1 Sep 2009 21:37:42 +0100 Subject: [PATCH] Misc fixes to secrets API code * proxy/Makefile.am: Build storage_encryption_conf.c since its a dependancy of domain_conf.c * src/storage_encryption_conf.c: Disable XML parsing APis when build under proxy * src/test.c: Add a dummy no-op secrets driver for test suite --- proxy/Makefile.am | 1 + src/storage_encryption_conf.c | 4 ++++ src/test.c | 21 +++++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/proxy/Makefile.am b/proxy/Makefile.am index d4a2fc495a..48678c3bab 100644 --- a/proxy/Makefile.am +++ b/proxy/Makefile.am @@ -16,6 +16,7 @@ libvirt_proxy_SOURCES = libvirt_proxy.c @top_srcdir@/src/xend_internal.c \ @top_srcdir@/src/xs_internal.c @top_srcdir@/src/buf.c \ @top_srcdir@/src/capabilities.c \ @top_srcdir@/src/memory.c \ + @top_srcdir@/src/storage_encryption_conf.c \ @top_srcdir@/src/domain_conf.c \ @top_srcdir@/src/util.c \ @top_srcdir@/src/event.c \ diff --git a/src/storage_encryption_conf.c b/src/storage_encryption_conf.c index df4b2e1796..7ec24afc55 100644 --- a/src/storage_encryption_conf.c +++ b/src/storage_encryption_conf.c @@ -64,6 +64,8 @@ virStorageEncryptionFree(virStorageEncryptionPtr enc) VIR_FREE(enc); } +#ifndef PROXY + static virStorageEncryptionSecretPtr virStorageEncryptionSecretParse(virConnectPtr conn, xmlXPathContextPtr ctxt, xmlNodePtr node) @@ -191,6 +193,8 @@ virStorageEncryptionParseNode(virConnectPtr conn, xmlXPathFreeContext(ctxt); return enc; } +#endif /* ! PROXY */ + static int virStorageEncryptionSecretFormat(virConnectPtr conn, diff --git a/src/test.c b/src/test.c index 305f2c940a..7c8f85b0ea 100644 --- a/src/test.c +++ b/src/test.c @@ -4173,6 +4173,20 @@ static void testDomainEventQueue(testConnPtr driver, virEventUpdateTimeout(driver->domainEventTimer, 0); } +static virDrvOpenStatus testSecretOpen(virConnectPtr conn, + virConnectAuthPtr auth ATTRIBUTE_UNUSED, + int flags ATTRIBUTE_UNUSED) { + if (STRNEQ(conn->driver->name, "Test")) + return VIR_DRV_OPEN_DECLINED; + + conn->secretPrivateData = conn->privateData; + return VIR_DRV_OPEN_SUCCESS; +} + +static int testSecretClose(virConnectPtr conn) { + conn->secretPrivateData = NULL; + return 0; +} static virDriver testDriver = { VIR_DRV_TEST, @@ -4328,6 +4342,11 @@ static virDeviceMonitor testDevMonitor = { .close = testDevMonClose, }; +static virSecretDriver testSecretDriver = { + .name = "Test", + .open = testSecretOpen, + .close = testSecretClose, +}; /** @@ -4348,6 +4367,8 @@ testRegister(void) return -1; if (virRegisterDeviceMonitor(&testDevMonitor) < 0) return -1; + if (virRegisterSecretDriver(&testSecretDriver) < 0) + return -1; return 0; }