[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [EXTERNAL] [PATCH 2/2] Add AutoReboot capability


  • To: "paul@xxxxxxx" <paul@xxxxxxx>, "win-pv-devel@xxxxxxxxxxxxxxxxxxxx" <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Tue, 15 Dec 2020 12:27:49 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WZi3lUzLpDY/bR3iim86PyOJi7QMTC4+XLns8I45qx4=; b=K0AnxKYu3GcFaRYwX54BSU++a1dc8n7pvOHm8q7n8adJDpNVm2OvDvHyeXJ7dgynSVryuatdyu1+Px+sAbLhXH4J73YzmClukZ0LqMg1RCfsPuY9k6CJHcXjTgUs2JX1Gn0dRCqwJsMwBpMLyENqTxe7pqe3NbIQL1UXRCeOu2Pk7WXgZhXyzzK3+AW7ChKqAJlCSI4ddiRwXTU3R1Tvdo8Vik6rEiChk+uyEXCX1PW7AxX/xQLhrudgpK6mpnz0bgKujL283q79tteRKrDhAMjEb4gUc4WAym/NgTf1lR0JMY5R1sXge738C0+OEid7TGd49wQ9iWxr40A/dElvxA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FnZlrvuz4nO2BUhC7BoZu0Jr5cA92E7jvZQdUySu53po3XCrkWX84U3IdF6A3xmK63EXnbigtDYYHv1wqpfpl5BF6sCem4qfFCeQ/TE34gPdRapjniiF5WZeTNXO/WxQeW6GBMFPysku57ElxU33bmPM15hb/wESHjeVnNjIta3dZBOsypKFuThPMk3I/J4PMLK3PPKN83nKlR9hevy1yiadn68UEFHNnxr59oxVnVcPj8gkix/HFL6VcP8gIUG967GKP1s3Eb7bMi2lq9QjVbATTzQYGqRQGYgYYKUzj8tOMcI8izlh2odlsqReyM06UwCPIdG+8Z9NEOdTrkwWPg==
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Delivery-date: Tue, 15 Dec 2020 12:28:02 +0000
  • Ironport-sdr: rj8F0NIQYiXU0Wv99bDTvKjgqUAxcVpqvuHXO263td2UWdfCD9JOvFHT9Y31CSVEoi5h9Ed8EG gzytfSHkz0DF1PpdF2zjlH5EgZUmsp2NsAC+deuRr7qKCnM9vQZgxJVTxb1UOMf2DhsBVAO5+T Ekz+1M9yVW22IuAiHzeRrcqtfco7U40NE0s4O9B5pWJyfM682WiBFpRnozYqWxK3ibLhZW/7U6 uNtuZWSCEcuUBTX9H3C6jBeAPzmFOsDyeET0hRHaCez/wZlLxhMEfe4e7t3SIn98NJ21OTsvjU A7w=
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
  • Thread-index: AQHWzi9L5KGEbcyAdUuRKTe9dtkh+KnwDe+AgAgQ52A=
  • Thread-topic: [EXTERNAL] [PATCH 2/2] Add AutoReboot capability


> -----Original Message-----
> From: Paul Durrant <xadimgnik@xxxxxxxxx>
> Sent: 10 December 2020 09:17
> To: Owen Smith <owen.smith@xxxxxxxxxx>; win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> Subject: RE: [EXTERNAL] [PATCH 2/2] Add AutoReboot capability
> 
> [CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open attachments
> unless you have verified the sender and know the content is safe.
> 
> > -----Original Message-----
> > From: win-pv-devel <win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx> On
> > Behalf Of Owen Smith
> > Sent: 09 December 2020 13:29
> > To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> > Cc: Owen Smith <owen.smith@xxxxxxxxxx>
> > Subject: [EXTERNAL] [PATCH 2/2] Add AutoReboot capability
> >
> > Setting HKLM\System\CCS\Services\xenbus_monitor\AutoReboot to non-zero
> > will allow xenbus_monitor to trigger a reboot when another driver
> > requests a reboot. AutoReboot is set to the maximum number of reboots
> > to perform. Auto reboots display a message with a 60 second timeout.
> >
> > This setting can be used to allow headless/unmonitored VMs to complete
> > the neccessary number of reboots to return to PV disks/networks.
> > Without this capability its possible to update the driver on a parent
> > device, which may prompt for a reboot. After this reboot, its likely
> > that emulated devices are used whilst drivers are rebound to the
> > device nodes. This can leave headless/unmonitored VMs in a state where
> > emulated devices are in use with a pending reboot. If network settings
> > have been changed for PV devices (e.g. static IP addressing), then the
> > VM may not be accessible over RDP or similar connections.
> >
> > Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
> > ---
> >  src/monitor/monitor.c | 133
> > ++++++++++++++++++++++++++++++++++++++++--
> >  1 file changed, 129 insertions(+), 4 deletions(-)
> >
> > diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index
> > 07bf8c1..5d58be4 100644
> > --- a/src/monitor/monitor.c
> > +++ b/src/monitor/monitor.c
> > @@ -301,7 +301,8 @@ WTSStateName(
> >
> >  static VOID
> >  DoReboot(
> > -    VOID
> > +    IN PTCHAR   Message,
> > +    IN DWORD    Timeout
> >      )
> >  {
> >      Log("waiting for pending install events..."); @@ -312,8 +313,8 @@
> > DoReboot(
> >
> >  #pragma prefast(suppress:28159)
> >      (VOID) InitiateSystemShutdownEx(NULL,
> > -                                    NULL,
> > -                                    0,
> > +                                    Message,
> > +                                    Timeout,
> >                                      TRUE,
> >                                      TRUE,
> >
> > SHTDN_REASON_MAJOR_OPERATINGSYSTEM | @@ -451,6 +452,125 @@
> fail1:
> >      return NULL;
> >  }
> >
> > +static BOOL
> > +TryAutoReboot(
> > +    IN PTCHAR           DriverName
> > +    )
> > +{
> > +    PMONITOR_CONTEXT    Context = &MonitorContext;
> > +    HRESULT             Result;
> > +    DWORD               Type;
> > +    DWORD               AutoReboot;
> > +    DWORD               RebootCount;
> > +    DWORD               Length;
> > +    PTCHAR              DisplayName;
> > +    PTCHAR              Description;
> > +    PTCHAR              Text;
> > +    DWORD               TextLength;
> > +    HRESULT             Error;
> > +
> > +    Length = sizeof (DWORD);
> > +
> > +    Error = RegQueryValueEx(Context->ParametersKey,
> > +                            "AutoReboot",
> > +                            NULL,
> > +                            &Type,
> > +                            (LPBYTE)&AutoReboot,
> > +                            &Length);
> > +    if (Error != ERROR_SUCCESS ||
> > +        Type != REG_DWORD)
> > +        AutoReboot = 0;
> > +
> > +    if (AutoReboot == 0)
> > +        goto done;
> > +
> > +    Length = sizeof (DWORD);
> > +
> > +    Error = RegQueryValueEx(Context->ParametersKey,
> > +                            "RebootCount",
> > +                            NULL,
> > +                            &Type,
> > +                            (LPBYTE)&RebootCount,
> > +                            &Length);
> > +    if (Error != ERROR_SUCCESS ||
> > +        Type != REG_DWORD)
> > +        RebootCount = 0;
> > +
> > +    if (RebootCount >= AutoReboot)
> > +        goto done;
> > +
> > +    Log("AutoRebooting (reboot %u of %u)\n",
> > +        RebootCount,
> > +        AutoReboot);
> > +
> > +    ++RebootCount;
> > +
> > +    (VOID) RegSetValueEx(Context->ParametersKey,
> > +                         "RebootCount",
> > +                         0,
> > +                         REG_DWORD,
> > +                         (const BYTE*)&RebootCount,
> > +                         (DWORD) sizeof(DWORD));
> > +
> 
> I can't see anything that zeroes/deletes this once there are no more pending
> reboots. Is there something else that does this, or am I just missing 
> something?
> 
>   Paul
> 

It seems I missed clearing the value. Patch incoming shortly

Owen




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.