From nobody Sun Feb 8 21:33:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1590009172; cv=none; d=zohomail.com; s=zohoarc; b=CSEbx8iJCp7hemvKcLcmXcy7Yo8rxVqc/o+AUaPWNhubvqqm5zexco8FaECat3V47kGv6SuuQvArEwoLu9/7Mjv1B4luLkDaXvrKx9FNWLo/A28JOShgEOHGzQYe6QxaSUTNMfqfpD00pYFFWMPbatJP0Ml6SEX8nCNDXqxk5j8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590009172; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=1lRiLwD0+c2KyAT8GgUgQybyYpH0KtMawoNbzHrT1nw=; b=WhgEi8LC6RKzDDjOzYOj8RucaM1aljZ7DjMXUQbcu6XI1nynjnbCGXLkUw8dWblcTGsSS21RCQyuvugk8m6nj1N2zbhGxJ1r3Pg94AW0ka1RQ0g/6HXaj0eyfeJwtpC3YeSWWj2lyNd4hQGOrZ+bhQnkWc0Z8UQTA0M37MYp6v0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1590009172047563.7814144308829; Wed, 20 May 2020 14:12:52 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-58-olti7cL0MKWw8JbEmm86vA-1; Wed, 20 May 2020 17:12:46 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4C45C835B46; Wed, 20 May 2020 21:12:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2DF4F797EF; Wed, 20 May 2020 21:12:40 +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 F2D8A54D0E; Wed, 20 May 2020 21:12:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04KLCbiu002190 for ; Wed, 20 May 2020 17:12:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 04A00202696C; Wed, 20 May 2020 21:12:37 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 007732026DFD for ; Wed, 20 May 2020 21:12:34 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CF89E811768 for ; Wed, 20 May 2020 21:12:34 +0000 (UTC) Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-113-dXJyTSgNMQGjqnIyW_Vevg-1; Wed, 20 May 2020 17:12:32 -0400 Received: by mail-qk1-f196.google.com with SMTP id s1so5134120qkf.9 for ; Wed, 20 May 2020 14:12:32 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:fbf2:bc5e:c314:af31:7070]) by smtp.gmail.com with ESMTPSA id z14sm2992031qki.83.2020.05.20.14.12.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2020 14:12:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590009170; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=1lRiLwD0+c2KyAT8GgUgQybyYpH0KtMawoNbzHrT1nw=; b=ZoAzJ+/iEohDNt9+MwOctvltD6Vikd1/YIRcICGtno6VxSxK9rWnMhdh+uzCJpTrkEFO+E 2FF3i9KcLOyLvvTiako7y9NtJ/DwKatHH19b9TvBoFI76adyGfpJ/i1yHVnYOa+O2lVjJ2 AGVM0brH1I/kXf3vwkgiRyrzhgWiNxw= X-MC-Unique: olti7cL0MKWw8JbEmm86vA-1 X-MC-Unique: dXJyTSgNMQGjqnIyW_Vevg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1lRiLwD0+c2KyAT8GgUgQybyYpH0KtMawoNbzHrT1nw=; b=BGfAaYcsS3TDzFSCCALF3i/eA+uRlTP/yY6feU1m8oQDqOFPBbbB6buGBzX/uOlVMc WkPqYFjtkMYhEE8oa/qmotDJWM+bmCdlmkJgPjO1JqEBp18szzCHK30vctkxcoze9SUW XO8kYyjmwKe/TgdTGFYShIfDCqtp6uhrDIwITh3c+7D4/IE5fvZIMm0ZPhdNxOaqVpdZ 7PK0Dr7iD9WUd/A3Vq1t4/nCnFORGaEey+Pu4Y/V4GxJHtjizd5qJ0ZMXaEje7/NNkBK K1BcgPuPAS2y418m8NELKv5o5nDpRqI/80QH2lYMHBNtfv2olTYINwlrNTG0Ksbv42Ug xcBg== X-Gm-Message-State: AOAM5339YYeELB4QawOeKNV/joNe+BSfYkj6fjf3PPk/zBZLZon6koHi MubC6SeD2cAk39KWYyZ+eWxxUDul X-Google-Smtp-Source: ABdhPJwNTqm+yuQgB9kGkITumInzjHnPHtfCeMdb5P8YaQHV7xg0Ebz+JwIbZ3+9xRBzNuGQh2e8ww== X-Received: by 2002:a37:61cf:: with SMTP id v198mr6664304qkb.54.1590009151705; Wed, 20 May 2020 14:12:31 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v3 13/21] qemu: refactor qemuDomain[Attach|Detach]DeviceLive Date: Wed, 20 May 2020 18:11:35 -0300 Message-Id: <20200520211143.2980117-14-danielhb413@gmail.com> In-Reply-To: <20200520211143.2980117-1-danielhb413@gmail.com> References: <20200520211143.2980117-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , sbhat@linux.ibm.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Shivaprasad G Bhat Helps calling multiple time per device. Signed-off-by: Shivaprasad G Bhat Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_driver.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 43a3ffea99..f880a5d6cf 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7824,9 +7824,9 @@ qemuDomainUndefine(virDomainPtr dom) } =20 static int -qemuDomainAttachDeviceLive(virDomainObjPtr vm, - virDomainDeviceDefPtr dev, - virQEMUDriverPtr driver) +qemuDomainAttachDeviceLiveInternal(virDomainObjPtr vm, + virDomainDeviceDefPtr dev, + virQEMUDriverPtr driver) { int ret =3D -1; const char *alias =3D NULL; @@ -7972,13 +7972,28 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, virObjectEventStateQueue(driver->domainEventState, event); } =20 + return ret; +} + +static int +qemuDomainAttachDeviceLive(virDomainObjPtr vm, + virDomainDeviceDefPtr dev, + virQEMUDriverPtr driver) +{ + int ret =3D -1; + + if (virDomainDefCompatibleDevice(vm->def, dev, NULL, + VIR_DOMAIN_DEVICE_ACTION_ATTACH, + false) < 0) + return -1; + + ret =3D qemuDomainAttachDeviceLiveInternal(vm, dev, driver); if (ret =3D=3D 0) ret =3D qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE= ); =20 return ret; } =20 - static int qemuDomainChangeDiskLive(virDomainObjPtr vm, virDomainDeviceDefPtr dev, --=20 2.26.2