From issues-return-90356-archive-asf-public=cust-asf.ponee.io@cloudstack.apache.org Mon Feb 26 15:32:06 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id B859A18066D for ; Mon, 26 Feb 2018 15:32:05 +0100 (CET) Received: (qmail 6110 invoked by uid 500); 26 Feb 2018 14:32:04 -0000 Mailing-List: contact issues-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list issues@cloudstack.apache.org Received: (qmail 6101 invoked by uid 500); 26 Feb 2018 14:32:04 -0000 Delivered-To: apmail-incubator-cloudstack-issues@incubator.apache.org Received: (qmail 6098 invoked by uid 99); 26 Feb 2018 14:32:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Feb 2018 14:32:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 44B24C0D0D for ; Mon, 26 Feb 2018 14:32:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.511 X-Spam-Level: X-Spam-Status: No, score=-109.511 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id s3exWu77A8C2 for ; Mon, 26 Feb 2018 14:32:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 183EB5FC4D for ; Mon, 26 Feb 2018 14:32:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 85DEFE0222 for ; Mon, 26 Feb 2018 14:32:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3E4DB255CE for ; Mon, 26 Feb 2018 14:32:00 +0000 (UTC) Date: Mon, 26 Feb 2018 14:32:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: cloudstack-issues@incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CLOUDSTACK-10305) Rare race condition in KVM migration MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CLOUDSTACK-10305?page=3Dcom.atl= assian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId= =3D16376953#comment-16376953 ]=20 ASF GitHub Bot commented on CLOUDSTACK-10305: --------------------------------------------- rhtyd closed pull request #2466: CLOUDSTACK-10305: Rare race condition in K= VM migration URL: https://github.com/apache/cloudstack/pull/2466 =20 =20 =20 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/= wrapper/LibvirtMigrateCommandWrapper.java b/plugins/hypervisors/kvm/src/com= /cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java index 30f0e20ddd9..ad32759a517 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper= /LibvirtMigrateCommandWrapper.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper= /LibvirtMigrateCommandWrapper.java @@ -172,13 +172,21 @@ Use VIR_DOMAIN_XML_SECURE (value =3D 1) prior to v1.0= .0. =20 // pause vm if we meet the vm.migrate.pauseafter threshold= and not already paused final int migratePauseAfter =3D libvirtComputingResource.g= etMigratePauseAfter(); - if (migratePauseAfter > 0 && sleeptime > migratePauseAfter= && dm.getInfo().state =3D=3D DomainState.VIR_DOMAIN_RUNNING ) { - s_logger.info("Pausing VM " + vmName + " due to proper= ty vm.migrate.pauseafter setting to " + migratePauseAfter+ "ms to complete = migration"); + if (migratePauseAfter > 0 && sleeptime > migratePauseAfter= ) { + DomainState state =3D null; try { - dm.suspend(); + state =3D dm.getInfo().state; } catch (final LibvirtException e) { - // pause could be racy if it attempts to pause rig= ht when vm is finished, simply warn - s_logger.info("Failed to pause vm " + vmName + " := " + e.getMessage()); + s_logger.info("Couldn't get VM domain state after = " + sleeptime + "ms: " + e.getMessage()); + } + if (state !=3D null && state =3D=3D DomainState.VIR_DO= MAIN_RUNNING) { + try { + s_logger.info("Pausing VM " + vmName + " due t= o property vm.migrate.pauseafter setting to " + migratePauseAfter + "ms to = complete migration"); + dm.suspend(); + } catch (final LibvirtException e) { + // pause could be racy if it attempts to pause= right when vm is finished, simply warn + s_logger.info("Failed to pause vm " + vmName += " : " + e.getMessage()); + } } } } =20 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. =20 For queries about this service, please contact Infrastructure at: users@infra.apache.org > Rare race condition in KVM migration > ------------------------------------ > > Key: CLOUDSTACK-10305 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-103= 05 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the defa= ult.)=20 > Reporter: Nicolas Vazquez > Priority: Major > Fix For: 4.11.1.0 > > > There is a race condition in the monitoring of the migration process on K= VM. If the monitor wakes up in the tight window after the migration succeed= s, but before the migration thread terminates, the monitor will get a Libvi= rtException =E2=80=9CDomain not found: no domain with matching uuid=E2=80= =9D when checking on the migration status. This in turn causes CloudStack t= o sync the VM state to stop, in which it issues a defensive StopCommand to = ensure it is correctly synced. > This is issue is reported under these conditions: > * VM migration has physically finished > * Migration thread executor is still not marked as terminated > From the migration monitoring process, as VM has been migrated, that doma= in cannot be found (we should get the destination domain from the migration= thread later) and the LibvirtException is thrown:=C2=A0{{LibvirtException = =E2=80=9CDomain not found: no domain with matching uuid=E2=80=9D}}. > So basically the idea is just logging the issue but not suspending the VM= as the migration has already been performed, but the migration thread is n= ot marked as finished. Once the migrarion thread is marked as finished, the= migration monitoring process (while loop) ends and the migration command w= rapper would continue its execution. > Regarding your last question, we won't need to suspend the VM in this cas= e as the migration has already been performed. VM suspension will take plac= e whenever the migration is in progress and those conditions are met -- This message was sent by Atlassian JIRA (v7.6.3#76005)