From owner-freebsd-virtualization@freebsd.org Wed Apr 24 14:45:27 2019 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACCF4159AA1D for ; Wed, 24 Apr 2019 14:45:27 +0000 (UTC) (envelope-from stephen.stuart@gmail.com) Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2EC578FC7C for ; Wed, 24 Apr 2019 14:45:27 +0000 (UTC) (envelope-from stephen.stuart@gmail.com) Received: by mail-wr1-x429.google.com with SMTP id s18so722623wrp.0 for ; Wed, 24 Apr 2019 07:45:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2NPc3vaNMb3DxxrPKjZH3PWvL3MT0DbPIA3/0q+JmhQ=; b=PFBEKMzHysS2BzC2qVvz3txlpZqJyxSFSvzjSYVffMImt+rh02O6dgoGHsUAOQqovX oGoSvn0v/oVsg4aqBCHXpV73Za2A1tK8DWmQeko0an+FCWZ78ptjzeDZG7TWjveoeJpN F5Q/MYicvYno/3WNoSiC4QRI0kmLkkhA5BIm5c6bowEHANHGzpdHLpykVrN5x09ji9/z HnZZIOgtqhusHQY6aamnSMkK2CpCHDdWTuq6uDQwg+lAwDEOOgh9rqEjy3V0IgM9V4nF NcIG8oHzpUTMQFAK4SF/D2YOkxxNO9Sy1MzHdjCuhh21ZtNR4SYtbmMlPwrKLO4s8z2H H12w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2NPc3vaNMb3DxxrPKjZH3PWvL3MT0DbPIA3/0q+JmhQ=; b=FeIjFzcTO2eY3WELu3xt2tx36sTUYbHRU2q85nzxKliuuXqMo01z1Hrw55S8Q0B2GV 1LLvEJ4Ny7SZ6WSCn8+DogGG8HAF7lWI/RwPTwW8NUhQUL9+fZD8c0Y202IQQiqVHCyE azYJsEgiajC1CIba5QAHc7OGXFSeOD19fvqYJ36rd7uW+yqm3p90SmQUYLVtJcV4r2vr 8bRBdrCbsU287IDfZAvwO4mTCHm7aBZl3Uxjlllo5wlJ8jFQ8Dd/9ne/C2NdIUecZqJ4 UCePhdIIaZCmRvmsOy0AgbMVMo+/aj+CYiDbfLcJIfeOpLvp6IiQqYYy5u2i1POpTkHM ttCw== X-Gm-Message-State: APjAAAVaiJ4qrJ9eO+VIJu8M7QoSG6qA6wSj3PfoowJpdLGM/r1qJNbk v8zIIhI98us9VziiC0vGoowtevUO8RZUaUJy8RWU6SiJ X-Google-Smtp-Source: APXvYqxOoySDnqihP+blay3tIl37XSUo0JqN3FSDXRaZdSMFpzjwPWw4poHlp15Kzlujgf3VvTYzVhhXeFSyAQ8H8LQ= X-Received: by 2002:a5d:68c4:: with SMTP id p4mr13116043wrw.37.1556117125213; Wed, 24 Apr 2019 07:45:25 -0700 (PDT) MIME-Version: 1.0 References: <20190424043656.GA25754@admin.sibptus.ru> <201904240557.x3O5v6AK041737@gndrsh.dnsmgr.net> <20190424065223.GA28138@admin.sibptus.ru> In-Reply-To: <20190424065223.GA28138@admin.sibptus.ru> From: Stephen Stuart Date: Wed, 24 Apr 2019 07:45:13 -0700 Message-ID: Subject: Re: [vm-bhyve] Windows 2012 and 2016 servers guests would not stop To: Victor Sudakov Cc: freebsd-virtualization@freebsd.org X-Rspamd-Queue-Id: 2EC578FC7C X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.983,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Apr 2019 14:45:27 -0000 I call this in /etc/rc.shutdown.local to shut all VMs down gracefully and wait, perhaps a variant would help you. #!/bin/sh INTERVAL=5 /usr/bin/killall -TERM bhyve echo -n "/dev/vmm:" while test -d /dev/vmm ; do echo -n "" $(/bin/ls /dev/vmm | /usr/bin/wc -w) /bin/sleep $INTERVAL done echo " 0" Stephen On Tue, Apr 23, 2019 at 11:53 PM Victor Sudakov wrote: > Rodney W. Grimes wrote: > > > > > > > > I've noticed that it takes too long for Windows 2012 and 2016 servers > > > > guests to shutdown when I issue "vm stopall," several minutes even. > > > > > > > > Does vm-bhyve provide a way to power them off ungracefully if they > would > > > > not stop within a predefined time? > > > > > > > > Or is there perhaps a way to tune the guest OSes to react more > promptly > > > > to an ACPI shutdown? > > > > > > > > My primary concern is that my UPS and "apcupsd --kill-on-powerfail" > give > > > > me about 30 seconds of grace time before the power supply is cut > out. It > > > > is not sufficient for the bhyve box to shutdown shutdown properly > > > > because it waits for the guests to shutdown. > > > > > > For the present I think I've found a workaround not directly related to > > > vm-bhyve. I'm going to insert "service vm stop" into the doshutdown() > > > procedure in /usr/local/etc/apcupsd/apccontrol before the actual > > > ${SHUTDOWN}. It should give the VMs sufficient time to shutdown before > > > the actual /sbin/shutdown is executed. > > > > Make sure it does not do the waitall for pids or your going to > > sit here waiting for that to complete for a long time, ie until > > all vm's go to power off. > > In fact, this is my intention to sit here waiting for all VM's to go power > off. > > I can configure apcupsd to start the doshutdown() routine when there is > enough power in the UPS, like maybe for 20-30 minutes. > > > > > If you know of a better way to configure apcupsd so that it powers > down > > > > the UPS only after all the guest OSes and other daemons are safely > down, > > > > I'd appreciate that too. > > > > > > Do you think the above hack would have any negative effects? > > > > I think this is a reasonable approach given the current situation. > > > > -- > Victor Sudakov, VAS4-RIPE, VAS47-RIPN > 2:5005/49@fidonet http://vas.tomsk.ru/ >