Re: [libvirt] [PATCH 1/4] test_driver: introduce domain-private data

2019-08-02 Thread Ilias Stamatis
On Fri, Aug 2, 2019 at 1:23 PM Erik Skultety  wrote:
>
> On Tue, Jul 09, 2019 at 09:23:21PM +0200, Ilias Stamatis wrote:
> > ---
>
> Explaining that the private data will come handy to hold the information
> whether filesystems have been frozen would be nice.

Sure, just maybe let's not make it FS-specific only since we'll use
that for other APIs too and there's nothing related to the FS APIs in
this patch anyways.

How about we add in the commit message something like:

"""
vm-specific data can be used by APIs that need to preserve some state
between calls

Some of them are:
- FS-related APIs for remembering which mountpoints are frozen
- virDomainSetTime / virDomainGetTime for maintaining time information
- virDomainSetIOThreadParams for storing the I/O thread parameters
- virDomainManagedSaveDefineXML for internally storing the VM definition
"""



>
> Reviewed-by: Erik Skultety 

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


Re: [libvirt] [PATCH 1/4] test_driver: introduce domain-private data

2019-08-02 Thread Erik Skultety
On Tue, Jul 09, 2019 at 09:23:21PM +0200, Ilias Stamatis wrote:
> ---

Explaining that the private data will come handy to hold the information
whether filesystems have been frozen would be nice.

Reviewed-by: Erik Skultety 

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


[libvirt] [PATCH 1/4] test_driver: introduce domain-private data

2019-07-09 Thread Ilias Stamatis
---
 src/test/test_driver.c | 35 ++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 49d7030d21..af3503c523 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -384,6 +384,35 @@ testBuildCapabilities(virConnectPtr conn)
 }


+typedef struct _testDomainObjPrivate testDomainObjPrivate;
+typedef testDomainObjPrivate *testDomainObjPrivatePtr;
+struct _testDomainObjPrivate {
+testDriverPtr driver;
+};
+
+
+static void *
+testDomainObjPrivateAlloc(void *opaque)
+{
+testDomainObjPrivatePtr priv;
+
+if (VIR_ALLOC(priv) < 0)
+return NULL;
+
+priv->driver = opaque;
+
+return priv;
+}
+
+
+static void
+testDomainObjPrivateFree(void *data)
+{
+testDomainObjPrivatePtr priv = data;
+VIR_FREE(priv);
+}
+
+
 static testDriverPtr
 testDriverNew(void)
 {
@@ -399,6 +428,10 @@ testDriverNew(void)
 VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT |
 VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING,
 };
+virDomainXMLPrivateDataCallbacks privatecb = {
+.alloc = testDomainObjPrivateAlloc,
+.free = testDomainObjPrivateFree,
+};
 testDriverPtr ret;

 if (testDriverInitialize() < 0)
@@ -407,7 +440,7 @@ testDriverNew(void)
 if (!(ret = virObjectLockableNew(testDriverClass)))
 return NULL;

-if (!(ret->xmlopt = virDomainXMLOptionNew(, NULL, , NULL, NULL)) 
||
+if (!(ret->xmlopt = virDomainXMLOptionNew(, , , NULL, 
NULL)) ||
 !(ret->eventState = virObjectEventStateNew()) ||
 !(ret->ifaces = virInterfaceObjListNew()) ||
 !(ret->domains = virDomainObjListNew()) ||
--
2.22.0

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