<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 13/03/13 16:18, Dejan Muhamedagic wrote:
<blockquote cite="mid:20130313161838.GA3713@squib" type="cite">
  <pre wrap="">On Tue, Mar 12, 2013 at 12:58:44PM +0000, Tim Small wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">The attached patch changes the behaviour of the OpenVZ virtual machine
cluster resource agent, so that:

1. The default resource stop timeout is greater than the hardcoded
    </pre>
  </blockquote>
  <pre wrap="">
Just for the record: where is this hardcoded actually? Is it
also documented?
  </pre>
</blockquote>
<br>
Defined here:<br>
<br>
<a href="http://git.openvz.org/?p=vzctl;a=blob;f=include/env.h#l26">http://git.openvz.org/?p=vzctl;a=blob;f=include/env.h#l26</a><br>
<br>
/** Shutdown timeout.<br>
&nbsp;*/<br>
#define MAX_SHTD_TM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 120<br>
<br>
<br>
<br>
Used by env_stop() here:<br>
<br>
<a
 href="http://git.openvz.org/?p=vzctl;a=blob;f=src/lib/env.c;h=2da848d87904d9e572b7da5c0e7dc5d93217ae5b;hb=HEAD#l818">http://git.openvz.org/?p=vzctl;a=blob;f=src/lib/env.c#l821</a><br>
<br>
&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (i = 0; i &lt; MAX_SHTD_TM; i++) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(1);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!vps_is_run(h, veid)) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = 0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; goto out;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
<br>
kill_vps:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger(0, 0, "Killing container ...");<br>
<br>
<br>
<br>
Perhaps something based on wall time would be more consistent, and I
can think of cases where users might want it to be a bit higher, or a
bit lower, but currently it's just fixed at 120s.<br>
<br>
<br>
I can't find the timeout documented anywhere.<br>
<br>
<br>
<blockquote cite="mid:20130313161838.GA3713@squib" type="cite">
  <blockquote type="cite">
    <pre wrap="">2. The start operation now waits for resource startup to complete i.e.
for the VE to "boot up" (so that the cluster manager can detect VEs
which are hanging on startup, and also throttle simultaneous startups,
so as not-to overburden the node in question).  Since the start
operation now does a lot more, the default start operation timeout has
been increased.
    </pre>
  </blockquote>
  <pre wrap="">
I'm not sure if we can introduce this just like that. It changes
significantly the agent's behaviour.
  </pre>
</blockquote>
<br>
Yes.&nbsp; I think it probably makes the agent's behavour a bit more
correct, but that depends what your definition of a VE resource having
"started" is, I suppose.&nbsp; Currently with this agent the says that it
has started as soon as it has begun the boot process, whereas with the
proposed change, it would mean that it has started when it has booted
up (which should imply "is operational").<br>
<br>
Although my personal reason for the change was so that I had a
reasonable way to avoid booting tens of VEs on the host machine at the
same time, I can think of other benefits - such as making other
resources depend on the fully-booted VE, or detecting the case where a
faulty VE host node causes the VE to hang during start-up.<br>
<br>
<br>
I suppose other options are:<br>
<br>
1. Make start --wait the default, but make starting without waiting
selectable using a RA parameter.<br>
<br>
2. Make start without waiting the default, but make --wait selectable
using a RA parameter.<br>
<br>
<br>
I suppose that the change will break configurations where the
administrator has hard coded a short timeout, and this change is
introduced as part of an upgrade, which I suppose is a bad thing...<br>
<br>
<br>
<blockquote cite="mid:20130313161838.GA3713@squib" type="cite">
  <pre wrap="">BTW, how does vzctl know when the VE is started?
  </pre>
</blockquote>
<br>
The vzctl manual page says that 'vzctl start --wait' will "attempt to
wait till the default runlevel is reached" within the container.<br>
<br>
<br>
<blockquote cite="mid:20130313161838.GA3713@squib" type="cite">If the
description above matches<br>
  <pre wrap="">the code modifications, then there should be three instead of
one patch.
  </pre>
</blockquote>
<br>
Fair enough - I was being lazy!<br>
<br>
<br>
Tim.<br>
<br>
<pre class="moz-signature" cols="72">-- 
South East Open Source Solutions Limited
Registered in England and Wales with company number 06134732.  
Registered Office: 2 Powell Gardens, Redhill, Surrey, RH1 1TQ
VAT number: 900 6633 53  <a class="moz-txt-link-freetext" href="http://seoss.co.uk/">http://seoss.co.uk/</a> +44-(0)1273-808309</pre>
</body>
</html>