From nobody Sun May 5 07:34:31 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1533484497058587.9160987739768; Sun, 5 Aug 2018 08:54:57 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 444E74E4C0; Sun, 5 Aug 2018 15:54:54 +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 E1C505E7A6; Sun, 5 Aug 2018 15:54:51 +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 796D118052EA; Sun, 5 Aug 2018 15:54:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w75FskFe018862 for ; Sun, 5 Aug 2018 11:54:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 97D38A0B27; Sun, 5 Aug 2018 15:54:46 +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 8D1A3A0B24 for ; Sun, 5 Aug 2018 15:54:43 +0000 (UTC) Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) (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 AE24730E6845 for ; Sun, 5 Aug 2018 15:54:42 +0000 (UTC) Received: by mail-ed1-f66.google.com with SMTP id f23-v6so3887697edr.11 for ; Sun, 05 Aug 2018 08:54:42 -0700 (PDT) Received: from kloomba.my.domain ([95.104.131.95]) by smtp.gmail.com with ESMTPSA id v56-v6sm7090895edm.97.2018.08.05.08.54.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Aug 2018 08:54:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=C6JK4PQRyFNaEOCUkUdZZq49VjBrxovzW4OBJu3ewBQ=; b=OIATqynJEmVt/Sqin7BBMTzpzvv1PG1T3T6j5ZvD9BN9C622y5PgaHZOfsaNHY3BJ+ y8R+c67/SAwSvlDhOS1oM0r8hRHduyUD4xmfH2lMgx9Ye9x0NFCDO2w2gvpM8CjBoDj5 hqeBZiDuFcNFM0Pn71wY0h0ruQ6JHwJ6RnVgkS6KqIaEryppkL8Dv0mcC0RqwaABcQ0V MgrXS7jb/Ol1mGtP6i+Xtr6dBh1wTxqfbMSRXuluORob9NIsjUauimhcxSNHyMJW7blU fdLFl9IaKrAT6OUbH4mrkE4PPL9EodGneaRexKNoB2NM3gvrQvefK3/pY9xB7nwKmzQ8 rU8A== 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; bh=C6JK4PQRyFNaEOCUkUdZZq49VjBrxovzW4OBJu3ewBQ=; b=imM8YWQObG/yRjNjJphVvFpWuvSwUKRgXRMO9Hflvr3QchdghX/C7hsB+xket4PZpL ruC2d20uHBg6F/U92jW3lZzugk0zB+J3xwZXVqrO2c7ukQCa59aMvEFcxTXQLUtQm3x+ FzcB6m6vQsCfMgANaBKqnxpXw87+ZVS7aHqvlZ0qDZp7J/mB7kWCeyGnt8TGYgh1J0XS 0FUYhtE0vxmUHbH7q31LOv/tWYjFaOF9ep1clUTfdnvxoR0HhSfhGo9Xpay9vZYGwf/K 5pU49rzJbbXPpFLL+OQDc7POjaOj6QTN/XkdXtF3g2F4IBmXemeNhjc6W/6EVxMaG8oW 5p5Q== X-Gm-Message-State: AOUpUlFaG21vnHQZ7dulMS4uPJGB3BdnvpR1V0VlYY2JfgXOG/pbWsKf A2iAgnCPocO5wUW5bKpeh1SJ/2Br X-Google-Smtp-Source: AAOMgpdSuhMDPR9f3sug9klweWPA8tuwV/6DRiRqQUnG+4KXTSZEWnWUrLPtkr2V7HC9V8LN8qfZBQ== X-Received: by 2002:a50:ef09:: with SMTP id m9-v6mr14864685eds.136.1533484481202; Sun, 05 Aug 2018 08:54:41 -0700 (PDT) From: Roman Bogorodskiy To: libvir-list@redhat.com Date: Sun, 5 Aug 2018 19:54:28 +0400 Message-Id: <20180805155428.40866-1-bogorodskiy@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Sun, 05 Aug 2018 15:54:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Sun, 05 Aug 2018 15:54:43 +0000 (UTC) for IP:'209.85.208.66' DOMAIN:'mail-ed1-f66.google.com' HELO:'mail-ed1-f66.google.com' FROM:'bogorodskiy@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.111 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.208.66 mail-ed1-f66.google.com 209.85.208.66 mail-ed1-f66.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.46 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Cc: ivan@conquex.com, Roman Bogorodskiy Subject: [libvirt] [PATCH] bhyve: fix process reconnect 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sun, 05 Aug 2018 15:54:55 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" To reconnect to the bhyve process after deamon restart, a process VM's pid points to is checked to have proctitle equal to 'bhyve: $vmname'. However, there could be a bug in bhyve(8) which prevents it from setting proctitle, so process arguments will look like: ['/usr/sbin/bhyve', ..., 'vmname', NULL] Fall back to checking this format if proctitle doesn't match as a workaround for this bug. --- src/bhyve/bhyve_process.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index 9276d7d364..78d6ff1389 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -416,18 +416,28 @@ virBhyveProcessReconnect(virDomainObjPtr vm, if (proc_argv && proc_argv[0]) { if (STREQ(expected_proctitle, proc_argv[0])) { ret =3D 0; - priv->mon =3D bhyveMonitorOpen(vm, data->driver); - if (vm->def->ngraphics =3D=3D 1 && - vm->def->graphics[0]->type =3D=3D VIR_DOMAIN_GRAPHICS_TYP= E_VNC) { - int vnc_port =3D vm->def->graphics[0]->data.vnc.port; - if (virPortAllocatorSetUsed(vnc_port) < 0) { - VIR_WARN("Failed to mark VNC port '%d' as used by '%s= '", - vnc_port, vm->def->name); - } + } else { + if (STREQ(BHYVE, proc_argv[0])) { + int i =3D 0; + for (; proc_argv[i+1]; i++); + if ((i !=3D 0) && (STREQ(vm->def->name, proc_argv[i]))) + ret =3D 0; } } } =20 + if (ret =3D=3D 0) { + priv->mon =3D bhyveMonitorOpen(vm, data->driver); + if (vm->def->ngraphics =3D=3D 1 && + vm->def->graphics[0]->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_VNC= ) { + int vnc_port =3D vm->def->graphics[0]->data.vnc.port; + if (virPortAllocatorSetUsed(vnc_port) < 0) { + VIR_WARN("Failed to mark VNC port '%d' as used by '%s'", + vnc_port, vm->def->name); + } + } + } + cleanup: if (ret < 0) { /* If VM is reported to be in active state, but we cannot find --=20 2.18.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list