OpenVZ Forum


Home » Mailing lists » Users » Skipping quota at start and doing it later?
Skipping quota at start and doing it later? [message #30102] Sun, 11 May 2008 17:10 Go to next message
Gregor Mosheh is currently offline  Gregor Mosheh
Messages: 62
Registered: April 2007
Member
From: openvz.org
Hey guys.
Some of our VPSs take well over an hour to start up after an unexpected 
shutdown, thanks to vzquota. Reading the man page, it seems that vzquota 
cannot be skipped and then done later once the services are up. Am I 
correct about that, or IS there a way to skip quota checking until after 
the VPS has started?

-- 
Gregor Mosheh / Greg Allensworth, BS, A+
System Administrator
HostGIS cartographic development & hosting services
http://www.HostGIS.com/

"Remember that no one cares if you can back up,
  only if you can restore." - AMANDA
Re: Skipping quota at start and doing it later? [message #30107 is a reply to message #30102] Mon, 12 May 2008 03:19 Go to previous messageGo to next message
TheWiseOne is currently offline  TheWiseOne
Messages: 66
Registered: September 2005
Location: Pennsylvania
Member
From: openvz.org
Gregor Mosheh wrote:
> Hey guys.
> Some of our VPSs take well over an hour to start up after an 
> unexpected shutdown, thanks to vzquota. Reading the man page, it seems 
> that vzquota cannot be skipped and then done later once the services 
> are up. Am I correct about that, or IS there a way to skip quota 
> checking until after the VPS has started?
>
All you have to do is set VZFASTBOOT=yes in /etc/vz/vz.conf and VPS's 
will be started without quota and then will be restarted to calculate 
the quota after all have been started.
Re: Skipping quota at start and doing it later? [message #30108 is a reply to message #30107] Mon, 12 May 2008 03:30 Go to previous messageGo to next message
Gregor Mosheh is currently offline  Gregor Mosheh
Messages: 62
Registered: April 2007
Member
From: openvz.org
Matt Ayres wrote:
> All you have to do is set VZFASTBOOT=yes in /etc/vz/vz.conf and VPS's 
> will be started without quota and then will be restarted to calculate 
> the quota after all have been started.

Interesting. I saw FASTBOOT in the /etc/init.d/vz script and that's not 
what I saw. I'll give it a try, though. Thanks for the note.

-- 
Gregor Mosheh / Greg Allensworth, BS, A+
System Administrator
HostGIS cartographic development & hosting services
http://www.HostGIS.com/

"Remember that no one cares if you can back up,
  only if you can restore." - AMANDA
Re: Skipping quota at start and doing it later? [message #30110 is a reply to message #30108] Mon, 12 May 2008 14:50 Go to previous messageGo to next message
TheWiseOne is currently offline  TheWiseOne
Messages: 66
Registered: September 2005
Location: Pennsylvania
Member
From: openvz.org
Gregor Mosheh wrote:
> Matt Ayres wrote:
>> All you have to do is set VZFASTBOOT=yes in /etc/vz/vz.conf and VPS's 
>> will be started without quota and then will be restarted to calculate 
>> the quota after all have been started.
>
> Interesting. I saw FASTBOOT in the /etc/init.d/vz script and that's 
> not what I saw. I'll give it a try, though. Thanks for the note.
>
Which version of the vzctl RPM do you have installed?  On my 
vzctl-3.0.22-1 I see the following in /etc/init.d/vz:

                if [ "x${VZFASTBOOT}" = "xyes" -a "x${DISK_QUOTA}" = 
"xyes" ];
                then
                        $VZQUOTA stat ${veid} >/dev/null 2>&1
                        if [ $? -eq 6 ]; then
                                if $VZQUOTA show ${veid} 2>&1 | grep 
"vzquota : (warning) Quota is running" >/dev/null 2>&1; then
                                        $VZQUOTA on ${veid} --nocheck 
 >/dev/null 2>&1
                                        need_restart="${need_restart} 
${veid}"
                                fi
                        fi
                fi


There is further code down to process the need_restart VPS's.
Re: Skipping quota at start and doing it later? [message #30111 is a reply to message #30110] Mon, 12 May 2008 15:30 Go to previous messageGo to next message
Gregor Mosheh is currently offline  Gregor Mosheh
Messages: 62
Registered: April 2007
Member
From: openvz.org
Matt Ayres wrote:
> Which version of the vzctl RPM do you have installed?  On my 
> vzctl-3.0.22-1 I see the following in /etc/init.d/vz:

My versions:
vzctl-3.0.22-1
vzctl-lib-3.0.22-1
ovzkernel-2.6.18-53.1.13.el5.028stab053.10
vzquota-3.0.11-1

I have the same paragraph in the init script.
What I read is:
   If fastboot and disk_quota are both yes,
   make sure that quota isn't already running,
   then run vzquota on.

In our case, neither FASTBOOT nor DISK_QUOTA are set in the conf files, 
yet vzquota runs anyway (normally good, but after a power failure very 
time consuming). The --nocheck option is not mentioned in the man pages 
nor does it seem effective. What am I missing here?

My hack was to add a "vzquota off" line right above the "vzquota on" 
line. It's effective, but not as great as a "real" solution.

-- 
Gregor Mosheh / Greg Allensworth, BS, A+
System Administrator
HostGIS cartographic development & hosting services
http://www.HostGIS.com/

"Remember that no one cares if you can back up,
  only if you can restore." - AMANDA
Re: Skipping quota at start and doing it later? [message #30113 is a reply to message #30107] Mon, 12 May 2008 16:27 Go to previous messageGo to next message
Gregor Mosheh is currently offline  Gregor Mosheh
Messages: 62
Registered: April 2007
Member
From: openvz.org
Matt Ayres wrote:
> All you have to do is set VZFASTBOOT=yes in /etc/vz/vz.conf and VPS's 
> will be started without quota and then will be restarted to calculate 
> the quota after all have been started.

I think I see where we're misconnecting. You say that FASTBOOT will 
cause all VPSs to start, then those with fastboot will be re-started 
later so their quota info can run?

What I'd really like it to skip the quota recalculation entirely, 
achieve the same effect I currently do with vzquota off (repairing quota 
file without recalculating) and vzquota on (turning quota on).

-- 
Gregor Mosheh / Greg Allensworth, BS, A+
System Administrator
HostGIS cartographic development & hosting services
http://www.HostGIS.com/

"Remember that no one cares if you can back up,
  only if you can restore." - AMANDA
Re: Skipping quota at start and doing it later? [message #30114 is a reply to message #30113] Mon, 12 May 2008 16:41 Go to previous messageGo to next message
TheWiseOne is currently offline  TheWiseOne
Messages: 66
Registered: September 2005
Location: Pennsylvania
Member
From: openvz.org
Gregor Mosheh wrote:
> Matt Ayres wrote:
>> All you have to do is set VZFASTBOOT=yes in /etc/vz/vz.conf and VPS's 
>> will be started without quota and then will be restarted to calculate 
>> the quota after all have been started.
>
> I think I see where we're misconnecting. You say that FASTBOOT will 
> cause all VPSs to start, then those with fastboot will be re-started 
> later so their quota info can run?
>
> What I'd really like it to skip the quota recalculation entirely, 
> achieve the same effect I currently do with vzquota off (repairing 
> quota file without recalculating) and vzquota on (turning quota on).
>
VZFASTBOOT is the option.  /etc/vz/vz.conf is the main Virtuozzo config, 
not a VPS/Container config file -- it is a global option, it cannot be 
set per-Container.  If you set that option in vz.conf then you will 
achieve the effect you desire.

If you look at the code, it checks in VZFASTBOOT is set to yes, if it is 
then it starts the VPS with vzquota nocheck.  Once all VPS's are started 
it will iterate over all VPS's stopping them, calculating the quota, and 
starting the VPS back up. 

---
              if [ "x${VZFASTBOOT}" = "xyes" -a "x${DISK_QUOTA}" = 
"xyes" ];
               then
                       $VZQUOTA stat ${veid} >/dev/null 2>&1
                       if [ $? -eq 6 ]; then
                               if $VZQUOTA show ${veid} 2>&1 | grep 
"vzquota : (warning) Quota is running" >/dev/null 2>&1; then
                                       $VZQUOTA on ${veid} --nocheck 
 >/dev/null 2>&1
---

That does the check I stated above, VPS's are started with an 
out-of-sync quota.

---
                                       need_restart="${need_restart} 
${veid}"
---

This sets a flag that this VPS needs to be restarted normally later on 
in the script.  The normal restart will cause the quota to be fully checked.

I assure you this is the option you want enabled.

Thanks,
Matt
Re: Skipping quota at start and doing it later? [message #30115 is a reply to message #30114] Mon, 12 May 2008 17:11 Go to previous messageGo to next message
Gregor Mosheh is currently offline  Gregor Mosheh
Messages: 62
Registered: April 2007
Member
From: openvz.org
Matt Ayres wrote:
> VZFASTBOOT is the option.  /etc/vz/vz.conf is the main Virtuozzo config, 
> not a VPS/Container config file

Ah; my mistake. I misread you and the script.


> This sets a flag that this VPS needs to be restarted normally later on 
> in the script.  The normal restart will cause the quota to be fully 
> checked.
> I assure you this is the option you want enabled.

Hm, I'll take your word for it, though it doesn't sound right. I don't 
want them to be restarted with a full quota recalculation - I don't want 
quota recalculation at all. These fellas have 250 GB quotas and are 
using most of it, so the recalculation takes 60+ minutes per VPS.

-- 
Gregor Mosheh / Greg Allensworth, BS, A+
System Administrator
HostGIS cartographic development & hosting services
http://www.HostGIS.com/

"Remember that no one cares if you can back up,
  only if you can restore." - AMANDA
Re: Skipping quota at start and doing it later? [message #30116 is a reply to message #30115] Mon, 12 May 2008 17:20 Go to previous messageGo to next message
TheWiseOne is currently offline  TheWiseOne
Messages: 66
Registered: September 2005
Location: Pennsylvania
Member
From: openvz.org
Gregor Mosheh wrote:
>
> Hm, I'll take your word for it, though it doesn't sound right. I don't 
> want them to be restarted with a full quota recalculation - I don't 
> want quota recalculation at all. These fellas have 250 GB quotas and 
> are using most of it, so the recalculation takes 60+ minutes per VPS.
>
What you want is not possible with any existing options.  You could 
possibly edit the vz init script and removed the needs_restart line.
Re: Skipping quota at start and doing it later? [message #30117 is a reply to message #30116] Mon, 12 May 2008 17:42 Go to previous messageGo to next message
Gregor Mosheh is currently offline  Gregor Mosheh
Messages: 62
Registered: April 2007
Member
From: openvz.org
Matt Ayres wrote:
> What you want is not possible with any existing options.  You could 
> possibly edit the vz init script and removed the needs_restart line.

Ahhhh, okay. Then I guess my hack to /etc/init.d/vz is the best way to 
accomplish what I want. We already have a policy of never bypassing the 
tmpfs, so the quota stats before a power outage are good enough for our 
needs.


FYI, the fix I have applied is probably not the best, but here it is for 
posterity:

start_ves()
{
         local veid
         local velist
         local msg
         local need_restart

         need_restart=""
         cd ${CONFIG_DIR} || return
         velist=`grep -l '^ONBOOT=yes\|^ONBOOT=\"yes\"' [0-9]*.conf 
2>/dev/null |
                 sed -e 's/.conf//g' | sort -n`
         cd - >/dev/null
         sysctl -q -w net.ipv4.route.src_check=0
         for veid in $velist; do
                 [ "${veid}" = "0" ] && continue
                 __echo "Starting VE ${veid}: "
                 if [ "x${VZFASTBOOT}" = "xyes" -a "x${DISK_QUOTA}" = 
"xyes" ]; then
                         $VZQUOTA off ${veid} >/dev/null 2>&1
                 fi
                 msg=`$VZCTL start ${veid} 2>&1`
                 print_result "$msg"
         done
}



-- 
Gregor Mosheh / Greg Allensworth, BS, A+
System Administrator
HostGIS cartographic development & hosting services
http://www.HostGIS.com/

"Remember that no one cares if you can back up,
  only if you can restore." - AMANDA
Re: Skipping quota at start and doing it later? [message #30118 is a reply to message #30115] Mon, 12 May 2008 18:00 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

From: openvz.org
Gregor Mosheh wrote:
> Matt Ayres wrote:
>> VZFASTBOOT is the option.  /etc/vz/vz.conf is the main Virtuozzo 
>> config, not a VPS/Container config file
>
> Ah; my mistake. I misread you and the script.
>
>
>> This sets a flag that this VPS needs to be restarted normally later 
>> on in the script.  The normal restart will cause the quota to be 
>> fully checked.
>> I assure you this is the option you want enabled.
>
> Hm, I'll take your word for it, though it doesn't sound right. I don't 
> want them to be restarted with a full quota recalculation - I don't 
> want quota recalculation at all. These fellas have 250 GB quotas and 
> are using most of it, so the recalculation takes 60+ minutes per VPS.
>
I guess that if you can live w/o disk quotas you can disable this 
entirely and forget about the problem you have. Option to set is 
DISK_QUOTA=no (in /etc/vz/vz.conf)
Re: Skipping quota at start and doing it later? [message #30119 is a reply to message #30118] Mon, 12 May 2008 18:14 Go to previous messageGo to next message
Gregor Mosheh is currently offline  Gregor Mosheh
Messages: 62
Registered: April 2007
Member
From: openvz.org
Kir Kolyshkin wrote:
> I guess that if you can live w/o disk quotas you can disable this 
> entirely and forget about the problem you have. Option to set is 
> DISK_QUOTA=no (in /etc/vz/vz.conf)

Sure, but we DO want quotas to be enforced. I just don't want to wait 90 
minutes for recalculating disk usage at startup, when I know that the 
usage hasn't changed since the power went out.

-- 
Gregor Mosheh / Greg Allensworth, BS, A+
System Administrator
HostGIS cartographic development & hosting services
http://www.HostGIS.com/

"Remember that no one cares if you can back up,
  only if you can restore." - AMANDA
Re: Skipping quota at start and doing it later? [message #30197 is a reply to message #30119] Thu, 15 May 2008 13:07 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

From: openvz.org
Gregor Mosheh wrote:
> Kir Kolyshkin wrote:
>   
>> I guess that if you can live w/o disk quotas you can disable this
>> entirely and forget about the problem you have. Option to set is
>> DISK_QUOTA=no (in /etc/vz/vz.conf)
>>     
>
> Sure, but we DO want quotas to be enforced. I just don't want to wait 90
> minutes for recalculating disk usage at startup, when I know that the
> usage hasn't changed since the power went out.
It was suggested earlier in this thread that if you will comment out the 
following line

need_restart="${need_restart} ${veid}"

in /etc/init.d/vz you get the exact behavior you ask for. Can you 
confirm (or deny) this?

If you can confirm, a parameter can be added to vz.conf making this 
restart optional.
Re: Skipping quota at start and doing it later? [message #30200 is a reply to message #30197] Thu, 15 May 2008 17:00 Go to previous message
Gregor Mosheh is currently offline  Gregor Mosheh
Messages: 62
Registered: April 2007
Member
From: openvz.org
Gregor wrote:
>> Sure, but we DO want quotas to be enforced. I just don't want to wait
>> for recalculating disk usage at startup, when I know that the
>> usage hasn't changed since the power went out.

Kir Kolyshkin wrote:
> It was suggested earlier in this thread that if you will comment out the 
> following line
> need_restart="${need_restart} ${veid}"
> in /etc/init.d/vz you get the exact behavior you ask for. Can you 
> confirm (or deny) this?

I did not try that mechanism. I didn't see "--nocheck" in the vzquota 
man page, and when running it manually during the initial steps of the 
problem, the flag had no effect (quota checking still ran). As such, I 
didn't accept that "vzquota on --nocheck" would accomplish my goal, even 
if the later step of restarting were skipped.

I already had in place a change to the init script, which runs "vzquota 
off" before running "vzquota on" in order to repair the quota file and 
then come back up.

It goes something like this, and I'd be glad to provide the complete script.
     # fastboot means to turn quota off,
     # effectively repairing the quota file or doing nothing
     if QUOTA and VZFASTBOOT; then vzquota off $VEID ; fi
     # now turn quota on as usual
     if QUOTA; vzquota on $VEID ; fi

I'm sure some folks actually like the current behavior, of their VPSs 
starting, then restarting over the course of an hour to recalculate disk 
usage, but this hack worked great for my needs.

-- 
Gregor Mosheh / Greg Allensworth, BS, A+
System Administrator
HostGIS cartographic development & hosting services
http://www.HostGIS.com/

"Remember that no one cares if you can back up,
  only if you can restore." - AMANDA
Previous Topic: linux vlan + ipv6 tunnel
Next Topic: 2.6.24-ovz004 kernel BUG at net/8021q/vlan.c:182 with 'modprobe -r 8021q'
Goto Forum:
  


Current Time: Mon Oct 15 21:01:51 GMT 2018