From: Gregory (Grisha) Trubetskoy (grisha_at_ispol.com)
Date: Mon 02 Aug 2004 - 15:47:15 BST
Here is a Python version of a similar thing:
This isn't really a standalone script because it relies on some other
libs to enumerate vservers, but nonetheless, could be interesting for
someone trying to accomplish this.
The output goes to stdout, so it's up to the invoker to figure out in
which file to save it.
The end result is a shell script, so there is no need for a second script,
you just run the resulting file.
There is also a bit of code for resetting the inode count. I have not been
able to identify the source of the problem, but I am convinced there is an
inode "leak" in the code, so when the inode count approaches a certain
level, the script resets it to 0.
Another note is that we found that its a good idea to keep backups of the
disk limit counts (last hour, last day and last week, for example) -
should you by mistake boot a non-vps kernel and your vserver partition
will end up getting mounted without tagctx, you can accidently overwrite
your file.
Grisha
On Mon, 2 Aug 2004, Sebastian Ganschow wrote:
> I finished on my little script to reset the Per Context Limits. It's based on
> the script by Matt Ayres which I had to modify a little bit.
> Both scripts can be found at
>
> http://users.sg-0.de/sg/scripts/vserver
>
> Maybe it isn't the best solution, but it is working.
>
> greetings
> Sebastian
>
> --
> Sebastian Ganschow
> mailto:sebastian_at_ganschow.net
>
>
> Quoting Herbert Poetzl <herbert_at_13thfloor.at>:
>
>> On Fri, Jul 30, 2004 at 03:27:37PM +0200, Sebastian Ganschow wrote:
>>> Thank you so far.
>>>
>>> I searched the mailing list archive before, but I think I
>>> searched with the wrong keywords.
>>>
>>> I just wondered why the Limits aren't stored like regular quotas,
>>
>> simple, consider the following setup:
>>
>> /dev/hd0 /
>> /dev/hd1 /vservers/vs1
>> /dev/hd2 /vservers/vs2
>>
>> now quota is stored at the root dir of a disk, in
>> files called (a)quota.{user,group}, which in this
>> case could be /vservers/vs1/quota.user, you probably
>> do not want the disk limits to be stored in a
>> /vservers/vs1/disk.limit file inside the vserver
>> path ...
>>
>> aside from that, writing the info back to the disk
>> seems not really necessary, and can be done from
>> userspace if somebody wants to do it ...
>>
>> best,
>> Herbert
>>
>>> but the skript will be a appropriate solution for this problem.
>>>
>>> regards
>>> Sebastian
>>>
>>> --
>>> Sebastian Ganschow
>>> mailto:sebastian_at_ganschow.net
>>>
>>>
>>> Quoting Herbert Poetzl <herbert_at_13thfloor.at>:
>>>
>>>> On Fri, Jul 30, 2004 at 02:08:41PM +0200, Sebastian Ganschow wrote:
>>>>> Hello,
>>>>>
>>>>> I tried to set up Per Context Disk Limits with the documentation on
>>>>> www.linux-vserver.org. When I set the Limit with
>>>>>
>>>>> # cqhadd -x 101 -v /dev/hda6
>>>>> # cddlim -x 101 -S 0,200,0,1000,5 -v /dev/hda6
>>>>>
>>>>> the Limit ist working, but when I restart the server the Disk Limit is
>>>> away.
>>>>>
>>>>> I tried it with kernel 2.4.25 and with kernel 2.4.22. In both cases
>> the
>>>> Disk
>>>>> Limits are deleted after a restart of the system.
>>>>>
>>>>> I configured it with the following documentation:
>>>>>
>>>>
>> http://vserver.13thfloor.at/Linux2.6/index.php?page=Per+Context+Disk+Limits
>>>>>
>>>>> What could be the Problem?
>>>>
>>>> nothing, this is expected behaviour, in the 2.4
>>>> stable addon patch for quota and disk limits the
>>>> in kernel store (hash) for this information is
>>>> not persistent per se, but there are several
>>>> scripts (like the one Matt did) available (just
>>>> search the mailing list archives) to solve this
>>>> issue ...
>>>>
>>>> http://list.linux-vserver.org/archive/vserver/msg06020.html
>>>>
>>>> disk limits for the vs1.9.x branch (no quota yet)
>>>> takes a different approach, but a host reboot will
>>>> purge the settings too ...
>>>>
>>>> HTH,
>>>> Herbert
>>>>
>>>>> Regards
>>>>> Sebastian
>>>>>
>>>>> PS: Could you please answer also to my email address, because of a bug
>> it
>>>> isn't
>>>>> possible for me to subscribe to the mailing list.
>>>>>
>>>>> --
>>>>> Sebastian Ganschow
>>>>> mailto:sebastian_at_ganschow.net
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ----------------------------------------------------------------
>>>>> This message was sent using IMP, the Internet Messaging Program.
>>>>> _______________________________________________
>>>>> Vserver mailing list
>>>>> Vserver_at_list.linux-vserver.org
>>>>> http://list.linux-vserver.org/mailman/listinfo/vserver
>>>>
>>>>
>>>>
>>>
>>>
>>> ----------------------------------------------------------------
>>> This message was sent using IMP, the Internet Messaging Program.
>>
>>
>>
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> _______________________________________________
> Vserver mailing list
> Vserver_at_list.linux-vserver.org
> http://list.linux-vserver.org/mailman/listinfo/vserver
>
_______________________________________________
Vserver mailing list
Vserver_at_list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver