From nobody Mon Feb 9 09:51:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1565622877; cv=none; d=zoho.com; s=zohoarc; b=UU11vaTctWulj+NL/IW/f8jbmSLxU5cNArfUjQbUcWlZy2Y02HP1LcjKIoWEu2FzHJMyvUCq8aDi+cjqOT0N7fpxpTS4FIIe2AF5vQAuGeUK4iTdxRP33wZMSRoKbDVWdOYzJoq/J46Woiyp4PXhDF1iqdsDBSSS6t+/OVMhCpU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565622877; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=BTOfgYiRkwDO9DsWUeCLvKki25DTRChovT8UvXnWnnE=; b=S/ybwVL+N1j/kpgL1XrtZBBhdeX/cmUq/RwMVO/k1/Vg4vOuLG5Ej47CuRW0jieKs7HsobtiFfCX5ddcZAVubqZq8y0hX+qRgXmch4NVrvzEBY08xkIEz9Ie8a69v4H2822NgAG+J9JvFiUddF1LlJI6COJMGmGPYNXuhSEbdlM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565622877343622.1612828925581; Mon, 12 Aug 2019 08:14:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D737B33026D; Mon, 12 Aug 2019 15:14:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB82E28DE2; Mon, 12 Aug 2019 15:14:35 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DE7A118005B9; Mon, 12 Aug 2019 15:14:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7CFEXLs025964 for ; Mon, 12 Aug 2019 11:14:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id DD0C3277CD; Mon, 12 Aug 2019 15:14:33 +0000 (UTC) Received: from mx1.redhat.com (ext-mx17.extmail.prod.ext.phx2.redhat.com [10.5.110.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D645329348 for ; Mon, 12 Aug 2019 15:14:31 +0000 (UTC) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DA18630605F7 for ; Mon, 12 Aug 2019 15:14:29 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id v15so12527288wml.0 for ; Mon, 12 Aug 2019 08:14:29 -0700 (PDT) Received: from archlap.localdomain ([185.32.231.210]) by smtp.gmail.com with ESMTPSA id 24sm10369223wmf.10.2019.08.12.08.14.27 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 12 Aug 2019 08:14:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=gl+3e6XdHZlxJTanl57gOoF8TSw6zl5b3a3wixZbbq0=; b=ogzjHIJqv3RINxI4kve/4GnQnZteN93JHqFkzShwW10OYtJVj+XFxS1LM+oNN2kLZW r6aTf75jJY9cKOkxo2L5ej4cD/6tIC5dbH3Xan/gxYA4EIZmNFRqztTTYXeUELJfrzhE D/DskQPswdY1ah8GR0onk5pxQRQ2Y3WU1JsiEqf1+Ieq0oS240YWOs6xRMF/ELTTZFm7 uouibcaPtoAcup1x3HW9DRA2LGqk/KB+QhlWlf5ZrhL90GdoUO6BUb7Oh9EGUMvWyL2I NOx5Ezoj102MlIFm3pdk8r6mSpFk1Vwo6PSNAuA6GESAFLP2VYYuKuqC91E0H297ducZ gY2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gl+3e6XdHZlxJTanl57gOoF8TSw6zl5b3a3wixZbbq0=; b=rw8baVu9O6peLQJzdpeMSduNbIIoN49Zf9m9xn8pX7bxiH5mRvSi2ukBIAV/lmbnkl d3DG0KaE5RkiBTCNmQ0SHjRmrfhevNqq8o38olbg3NWi8eF3ko2jVYneqhiiVHa5cL2+ ooQxC3N0VqHnilr3I1ELJ3j/0lQwl+6pouNZidz37+Vj2VfFnGOynyHUpKL2O90fDrQh cYkzq+aVWOcsMYwrG0qtz9IZvyizQStsfRSXVdUctbn0U29d/aufdn4jqzUhRLcnD047 edKiskQl7DC77fc1JAR0HubMmpeJy3zFtfy7dJEZYjAtqTrGS9VlNt398Oig7biuBKid PvZg== X-Gm-Message-State: APjAAAXH7Q57+YEzUJxL1B87x5mWEsStVmM1lEMcJ4ENFClEXEGgFkEu qjHXova0WQR7O/bDClN8r7bNPuhMUWQ= X-Google-Smtp-Source: APXvYqySKEgXWJ3a7eOcmDNo+ZGBkFv/cpZ7PMXrpLeUxJIV+mdhmG3ilrUZO/T52aWwZB6PM8yozg== X-Received: by 2002:a1c:24c3:: with SMTP id k186mr4119776wmk.126.1565622868233; Mon, 12 Aug 2019 08:14:28 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Mon, 12 Aug 2019 18:13:11 +0300 Message-Id: <20190812151313.24329-3-stamatis.iliass@gmail.com> In-Reply-To: <20190812151313.24329-1-stamatis.iliass@gmail.com> References: <20190812151313.24329-1-stamatis.iliass@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 12 Aug 2019 15:14:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 12 Aug 2019 15:14:30 +0000 (UTC) for IP:'209.85.128.68' DOMAIN:'mail-wm1-f68.google.com' HELO:'mail-wm1-f68.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.541 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS) 209.85.128.68 mail-wm1-f68.google.com 209.85.128.68 mail-wm1-f68.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.46 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 2/5] test_driver: implement virDomainDelIOThread X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 12 Aug 2019 15:14:36 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ilias Stamatis --- src/test/test_driver.c | 85 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 7acde811ef..b4a883cb54 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2963,6 +2963,90 @@ testDomainAddIOThread(virDomainPtr dom, } +static int +testDomainDelIOThread(virDomainPtr dom, + unsigned int iothread_id, + unsigned int flags) +{ + virDomainObjPtr vm =3D NULL; + virDomainDefPtr def =3D NULL; + testDomainObjPrivatePtr priv; + size_t i, j; + int ret =3D -1; + + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); + + if (iothread_id =3D=3D 0) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("invalid value of 0 for iothread_id")); + return -1; + } + + if (!(vm =3D testDomObjFromDomain(dom))) + goto cleanup; + + if (!(def =3D virDomainObjGetOneDef(vm, flags))) + goto cleanup; + + if (!virDomainIOThreadIDFind(def, iothread_id)) { + virReportError(VIR_ERR_INVALID_ARG, + _("cannot find IOThread '%u' in iothreadids list"), + iothread_id); + goto cleanup; + } + + for (i =3D 0; i < def->ndisks; i++) { + if (def->disks[i]->iothread =3D=3D iothread_id) { + virReportError(VIR_ERR_INVALID_ARG, + _("cannot remove IOThread %u since it " + "is being used by disk '%s'"), + iothread_id, def->disks[i]->dst); + goto cleanup; + } + } + + for (i =3D 0; i < def->ncontrollers; i++) { + if (def->controllers[i]->iothread =3D=3D iothread_id) { + virReportError(VIR_ERR_INVALID_ARG, + _("cannot remove IOThread '%u' since it " + "is being used by controller"), + iothread_id); + goto cleanup; + } + } + + for (i =3D 0; i < def->niothreadids; i++) { + if (def->iothreadids[i]->iothread_id =3D=3D iothread_id) { + for (j =3D i + 1; j < def->niothreadids; j++) + def->iothreadids[j]->autofill =3D false; + + virDomainIOThreadIDDefFree(def->iothreadids[i]); + VIR_DELETE_ELEMENT(def->iothreadids, i, def->niothreadids); + + break; + } + } + + /* We have already deleted the iothread from the domain definition, now + * let's delete the info structure too from the domain-private data. */ + + priv =3D vm->privateData; + + for (i =3D 0; i < priv->num_iothreads; i++) { + if (iothread_id =3D=3D priv->iothreads[i]->id) { + VIR_DELETE_ELEMENT(priv->iothreads, i, priv->num_iothreads); + break; + } + } + + ret =3D 0; + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + + static int testDomainSetUserPassword(virDomainPtr dom, const char *user ATTRIBUTE_UNUSED, @@ -9418,6 +9502,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainCoreDump =3D testDomainCoreDump, /* 0.3.2 */ .domainCoreDumpWithFormat =3D testDomainCoreDumpWithFormat, /* 1.2.3 */ .domainAddIOThread =3D testDomainAddIOThread, /* 5.7.0 */ + .domainDelIOThread =3D testDomainDelIOThread, /* 5.7.0 */ .domainSetUserPassword =3D testDomainSetUserPassword, /* 5.6.0 */ .domainPinEmulator =3D testDomainPinEmulator, /* 5.6.0 */ .domainGetEmulatorPinInfo =3D testDomainGetEmulatorPinInfo, /* 5.6.0 */ -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list