From nobody Wed May 8 18:36:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1583137075; cv=none; d=zohomail.com; s=zohoarc; b=ldyTthJ7WW/PkondwakyA4fds/oUCzMxEnX/DckiqDPEhNJjCZpkLs7/yHzQFlcoCq5BzmmVKzIBJZWJIhjqJsSix2mM7wGTu64L3VNHIN1O1MI+TPbZFSdk0avBoj2iJSEPtE+mt1PKuawqC6HSzDew3NIHmaJuiajIM36cXYk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583137075; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Re43UclNao88xdnKkUsIMosBAkSiCXX3ANneSVV7y+U=; b=N4UwA6nSiZcINMlPGZ7e3Nhn0DNKgX7w3fwKc81/x4vwDmcxetF6PWcSPKUz8Z/1Kvfzqk3unegTKrbl7AxLyGPt3zAd80/Wuz8WPy+gsF3Y8vd01mWbw/JmNJkC8AIMo2i/rPDsK6J4ylstYFgEl4ETX3cmyv9NtNq4bkYgEro= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1583137075021880.7625505261595; Mon, 2 Mar 2020 00:17:55 -0800 (PST) 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-395-7iFga15qOGCOycQBewP6GQ-1; Mon, 02 Mar 2020 03:17:51 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C24D107ACC4; Mon, 2 Mar 2020 08:17:45 +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 BAA309051B; Mon, 2 Mar 2020 08:17:42 +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 8CB6084468; Mon, 2 Mar 2020 08:17:36 +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 0228HYCM015272 for ; Mon, 2 Mar 2020 03:17:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 02E78390; Mon, 2 Mar 2020 08:17:34 +0000 (UTC) Received: from moe.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DCA1385 for ; Mon, 2 Mar 2020 08:17:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583137073; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Re43UclNao88xdnKkUsIMosBAkSiCXX3ANneSVV7y+U=; b=I8VU/F7RRJWSDzJuJb3z0TBGgdAJ0OaKbIdkvGM2ygidhv18vejUvzwkvt4J4S6TM7Obg5 fmzSx0nCOATFGpu4JE24aeJTd79xeH69xuWTTkpJlc5zDappEZYxbmRX2/RcexXdrqB/zD ZI39qcIoHduH2dYUBAVXRmPBpAul5z4= X-MC-Unique: 7iFga15qOGCOycQBewP6GQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] qemu: Don't compare local and remote hostnames on migration Date: Mon, 2 Mar 2020 09:17:27 +0100 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.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.13 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" Libvirt tries to forbid migration onto the same host and it does that by checking if local and remote hostnames are the same and whether local and remote UUIDs are the same. Well, the latter makes sense but the former doesn't really because libvirtd can be running inside an UTS namespace and hostnames can appear the same on both sides of migration. On the other hand, host UUIDs are unique, so rely on them when trying to prevent migration onto the same host. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1639596 Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_migration_cookie.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_coo= kie.c index a5a9edffc3..1d88ac1d22 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -1230,19 +1230,17 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr = mig, } VIR_FREE(tmp); =20 - /* Check & forbid "localhost" migration */ if (!(mig->remoteHostname =3D virXPathString("string(./hostname[1])", = ctxt))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing hostname element in migration data= ")); goto error; } - if (STREQ(mig->remoteHostname, mig->localHostname)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Attempt to migrate guest to the same host %s"), - mig->remoteHostname); - goto error; - } + /* Historically, this is the place where we checked whether remoteHost= name + * and localHostname are the same. But even if they were, it doesn't m= ean + * the domain is migrating onto the same host. Rely on UUID which can = tell + * for sure. */ =20 + /* Check & forbid localhost migration */ if (!(tmp =3D virXPathString("string(./hostuuid[1])", ctxt))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing hostuuid element in migration data= ")); --=20 2.24.1