Re: [libvirt] [PATCH 1/4] test_driver: implement virDomainAddIOThread

2019-07-25 Thread Erik Skultety
On Tue, Jul 23, 2019 at 12:17:54PM +0200, Ilias Stamatis wrote:
> Signed-off-by: Ilias Stamatis 
> ---
...

> +
> +if (VIR_ALLOC(iothrid) < 0)
> +goto cleanup;
> +
> +iothrid->iothread_id = iothread_id;
> +
> +if (VIR_APPEND_ELEMENT_COPY(def->iothreadids, def->niothreadids, 
> iothrid) < 0)
> +goto cleanup;

virDomainIOThreadIDAdd could be used ^here,

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: implement virDomainAddIOThread

2019-07-25 Thread Erik Skultety
On Thu, Jul 25, 2019 at 02:09:01PM +0200, Erik Skultety wrote:
> On Tue, Jul 23, 2019 at 12:17:54PM +0200, Ilias Stamatis wrote:
> > Signed-off-by: Ilias Stamatis 
> > ---
>
> One more thing, this patch will break virsh-optparse again, more specifically
> some of the cpu-stats tests (yeah, those are very bad tests). The offending
> ones need to be removed in a standalone patch related to this one.
> Ultimately, the whole optparse thing will need to be re-written in a different
> manner.
>
> Erik

Sigh...^this response was meant for the CPUStats patch...please ignore it in
context of the iothread series.

Erik

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


Re: [libvirt] [PATCH 1/4] test_driver: implement virDomainAddIOThread

2019-07-25 Thread Erik Skultety
On Tue, Jul 23, 2019 at 12:17:54PM +0200, Ilias Stamatis wrote:
> Signed-off-by: Ilias Stamatis 
> ---

One more thing, this patch will break virsh-optparse again, more specifically
some of the cpu-stats tests (yeah, those are very bad tests). The offending
ones need to be removed in a standalone patch related to this one.
Ultimately, the whole optparse thing will need to be re-written in a different
manner.

Erik

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


[libvirt] [PATCH 1/4] test_driver: implement virDomainAddIOThread

2019-07-23 Thread Ilias Stamatis
Signed-off-by: Ilias Stamatis 
---
 src/test/test_driver.c | 51 ++
 1 file changed, 51 insertions(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 2e33a9dd55..313cf5e7ef 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2603,6 +2603,56 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned 
int nrCpus,
 }


+static int
+testDomainAddIOThread(virDomainPtr dom,
+  unsigned int iothread_id,
+  unsigned int flags)
+{
+virDomainObjPtr vm = NULL;
+virDomainDefPtr def = NULL;
+virDomainIOThreadIDDefPtr iothrid = NULL;
+int ret = -1;
+
+virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+  VIR_DOMAIN_AFFECT_CONFIG, -1);
+
+if (iothread_id == 0) {
+virReportError(VIR_ERR_INVALID_ARG, "%s",
+   _("invalid value of 0 for iothread_id"));
+return -1;
+}
+
+if (!(vm = testDomObjFromDomain(dom)))
+goto cleanup;
+
+if (!(def = virDomainObjGetOneDef(vm, flags)))
+goto cleanup;
+
+if (virDomainIOThreadIDFind(def, iothread_id)) {
+virReportError(VIR_ERR_INVALID_ARG,
+   _("an IOThread is already using iothread_id '%u'"),
+   iothread_id);
+goto cleanup;
+}
+
+if (VIR_ALLOC(iothrid) < 0)
+goto cleanup;
+
+iothrid->iothread_id = iothread_id;
+
+if (VIR_APPEND_ELEMENT_COPY(def->iothreadids, def->niothreadids, iothrid) 
< 0)
+goto cleanup;
+
+ret = 0;
+
+ cleanup:
+if (ret < 0)
+virDomainIOThreadIDDefFree(iothrid);
+virDomainObjEndAPI();
+return ret;
+}
+
+
 static int
 testDomainSetUserPassword(virDomainPtr dom,
   const char *user ATTRIBUTE_UNUSED,
@@ -7742,6 +7792,7 @@ static virHypervisorDriver testHypervisorDriver = {
 .domainSaveImageGetXMLDesc = testDomainSaveImageGetXMLDesc, /* 5.5.0 */
 .domainCoreDump = testDomainCoreDump, /* 0.3.2 */
 .domainCoreDumpWithFormat = testDomainCoreDumpWithFormat, /* 1.2.3 */
+.domainAddIOThread = testDomainAddIOThread, /* 5.6.0 */
 .domainSetUserPassword = testDomainSetUserPassword, /* 5.6.0 */
 .domainSetVcpus = testDomainSetVcpus, /* 0.1.4 */
 .domainSetVcpusFlags = testDomainSetVcpusFlags, /* 0.8.5 */
--
2.22.0

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