OpenVZ Forum


Home » Mailing lists » Users » problems with vzctl init logging patch
problems with vzctl init logging patch [message #28229] Wed, 12 March 2008 09:36 Go to next message
Dietmar Maurer is currently offline  Dietmar Maurer
Messages: 52
Registered: March 2007
Member
hi all,

my init logging patch works so far, but unfortunately it breaks
checkpointing:
---------------
>vzctl chkpnt 101
Setting up checkpoint...
        suspend...
        dump...
Can not dump container: Invalid argument
Error: d_path err=-22
Checkpointing failed
---------------

Maybe some of the developers can give me a hint whats wrong?

lsof shows (16531 id the logging process)

lt-vzctl  16531       root  cwd       DIR               0,22     4096
1226401 /var/lib/vz/root/101
lt-vzctl  16531       root  rtd       DIR               0,22     4096
1226401 /var/lib/vz/root/101
lt-vzctl  16531       root  txt       REG                8,1    98155
2047179 /home/dietmar/pve/vzctl/vzctl-3.0.22/src/.libs/lt-vzctl
lt-vzctl  16531       root  mem       REG                0,0
0 [heap] (stat: No such file or directory)
lt-vzctl  16531       root  mem       REG                8,1    97928
1896840 /lib/ld-2.3.6.so
lt-vzctl  16531       root  mem       REG                8,1   488939
2031943
/home/dietmar/pve/vzctl/vzctl-3.0.22/src/lib/.libs/libvzctl-0.0.2.so
lt-vzctl  16531       root  mem       REG                8,1    10392
1896846 /lib/libdl-2.3.6.so
lt-vzctl  16531       root  mem       REG                8,1    10520
1896843 /lib/libutil-2.3.6.so
lt-vzctl  16531       root  mem       REG                8,1  1282008
1896845 /lib/libc-2.3.6.so
lt-vzctl  16531       root    0u      CHR                1,3
1423308 /var/lib/vz/root/101/dev/null
lt-vzctl  16531       root    1w      REG               0,22     1941
1232142 /var/lib/vz/root/101/var/log/init.log
lt-vzctl  16531       root    2r     FIFO               0,22
1232141 /var/lib/vz/root/101/var/log/init.fifo
  • Attachment: env.c.diff
    (Size: 3.08KB, Downloaded 445 times)
AW: problems with vzctl init logging patch [message #28231 is a reply to message #28229] Wed, 12 March 2008 09:48 Go to previous messageGo to next message
Dietmar Maurer is currently offline  Dietmar Maurer
Messages: 52
Registered: March 2007
Member
Just a guess: its the logging proxess itself, because that process still runs on the host - I need to do a exec instead?

- Dietmar 

> -----Ursprüngliche Nachricht-----
> Von: users-bounces@openvz.org 
> [mailto:users-bounces@openvz.org] Im Auftrag von Dietmar Maurer
> Gesendet: Mittwoch, 12. März 2008 10:37
> An: users@openvz.org
> Betreff: [Users] problems with vzctl init logging patch
> 
> hi all,
> 
> my init logging patch works so far, but unfortunately it breaks
> checkpointing:
> ---------------
> >vzctl chkpnt 101
> Setting up checkpoint...
>         suspend...
>         dump...
> Can not dump container: Invalid argument
> Error: d_path err=-22
> Checkpointing failed
> ---------------
> 
> Maybe some of the developers can give me a hint whats wrong?
> 
> lsof shows (16531 id the logging process)
> 
> lt-vzctl  16531       root  cwd       DIR               0,22     4096
> 1226401 /var/lib/vz/root/101
> lt-vzctl  16531       root  rtd       DIR               0,22     4096
> 1226401 /var/lib/vz/root/101
> lt-vzctl  16531       root  txt       REG                8,1    98155
> 2047179 /home/dietmar/pve/vzctl/vzctl-3.0.22/src/.libs/lt-vzctl
> lt-vzctl  16531       root  mem       REG                0,0
> 0 [heap] (stat: No such file or directory)
> lt-vzctl  16531       root  mem       REG                8,1    97928
> 1896840 /lib/ld-2.3.6.so
> lt-vzctl  16531       root  mem       REG                8,1   488939
> 2031943
> /home/dietmar/pve/vzctl/vzctl-3.0.22/src/lib/.libs/libvzctl-0.0.2.so
> lt-vzctl  16531       root  mem       REG                8,1    10392
> 1896846 /lib/libdl-2.3.6.so
> lt-vzctl  16531       root  mem       REG                8,1    10520
> 1896843 /lib/libutil-2.3.6.so
> lt-vzctl  16531       root  mem       REG                8,1  1282008
> 1896845 /lib/libc-2.3.6.so
> lt-vzctl  16531       root    0u      CHR                1,3
> 1423308 /var/lib/vz/root/101/dev/null
> lt-vzctl  16531       root    1w      REG               0,22     1941
> 1232142 /var/lib/vz/root/101/var/log/init.log
> lt-vzctl  16531       root    2r     FIFO               0,22
> 1232141 /var/lib/vz/root/101/var/log/init.fifo
> 
> 
>
AW: problems with vzctl init logging patch [message #28242 is a reply to message #28231] Wed, 12 March 2008 13:13 Go to previous messageGo to next message
Dietmar Maurer is currently offline  Dietmar Maurer
Messages: 52
Registered: March 2007
Member
Ok, exec solves the problem. Attached is the new patch.

- Dietmar
  • Attachment: vzctl.diff
    (Size: 3.25KB, Downloaded 466 times)
Re: AW: problems with vzctl init logging patch [message #28249 is a reply to message #28242] Wed, 12 March 2008 15:09 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

This looks good. Can you
(1) make it optional, i.e. retain the old behavior by default and 
provide a way to turn init logging on (command-line switch, or VE config 
parameter)
(2) make init-logger so it would not depend on perl being available 
inside the container; i guess it can be rewritten in shell as /bin/sh 
should be there
(3) add the comment to init-logger saying that this file was copied from 
the host system to this container and so any changes made to it inside a 
container will be lost during the next container start
(4) document it all
(5) add init-logger to the vzctl.spec file

Dietmar Maurer wrote:
> Ok, exec solves the problem. Attached is the new patch.
>
AW: AW: problems with vzctl init logging patch [message #28253 is a reply to message #28249] Wed, 12 March 2008 15:56 Go to previous messageGo to next message
Dietmar Maurer is currently offline  Dietmar Maurer
Messages: 52
Registered: March 2007
Member
> This looks good. Can you
> (1) make it optional, i.e. retain the old behavior by default 
> and provide a way to turn init logging on (command-line 
> switch, or VE config
> parameter)

Ok

> (2) make init-logger so it would not depend on perl being 
> available inside the container; i guess it can be rewritten 
> in shell as /bin/sh should be there

Will try. But cant we depend on perl? Perl should be available on most
platforms. I can even add a test if perl is available, and do not start
the logger if there is no perl?

> (3) add the comment to init-logger saying that this file was 
> copied from the host system to this container and so any 
> changes made to it inside a container will be lost during the 
> next container start
> (4) document it all
> (5) add init-logger to the vzctl.spec file

Ok, will send a new patch when ready.

- Dietmar
Re: AW: AW: problems with vzctl init logging patch [message #28259 is a reply to message #28253] Wed, 12 March 2008 16:23 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

Dietmar Maurer wrote:
>> This looks good. Can you
>> (1) make it optional, i.e. retain the old behavior by default 
>> and provide a way to turn init logging on (command-line 
>> switch, or VE config
>> parameter)
>>     
>
> Ok
>
>   
>> (2) make init-logger so it would not depend on perl being 
>> available inside the container; i guess it can be rewritten 
>> in shell as /bin/sh should be there
>>     
>
> Will try. But cant we depend on perl? Perl should be available on most
> platforms. I can even add a test if perl is available, and do not start
> the logger if there is no perl?
>   

Adding a check makes sense. But first -- why do you need perl at all? Is 
there something that can't be done in shell?
>   
>> (3) add the comment to init-logger saying that this file was 
>> copied from the host system to this container and so any 
>> changes made to it inside a container will be lost during the 
>> next container start
>> (4) document it all
>> (5) add init-logger to the vzctl.spec file
>>     
>
> Ok, will send a new patch when ready.
>
> - Dietmar
>
>
AW: AW: AW: problems with vzctl init logging patch [message #28260 is a reply to message #28259] Wed, 12 March 2008 16:34 Go to previous messageGo to next message
Dietmar Maurer is currently offline  Dietmar Maurer
Messages: 52
Registered: March 2007
Member
> Adding a check makes sense. But first -- why do you need perl 
> at all? Is there something that can't be done in shell?

I guess you are right - will rewrite it.

- Dietmar
AW: AW: problems with vzctl init logging patch [message #28284 is a reply to message #28259] Thu, 13 March 2008 07:43 Go to previous messageGo to next message
Dietmar Maurer is currently offline  Dietmar Maurer
Messages: 52
Registered: March 2007
Member
> Adding a check makes sense. But first -- why do you need perl 
> at all? Is there something that can't be done in shell?
> >   

I just remembered why I hate shell programming ;-)

Please can someone tell me how to do a binary read with a shell. In perl
I simple do:

while (my $len = sysread (LOGFIFO, $buf, 4096)) {
  syswrite (LOGFILE, $buf);	
}

How to do that with a shell script? I first tried:

cat <$logfifo >>$logfile

But that spans a new process, and I do not want that. 

Using builtin commands only:

while [ 1 ]; do
        read line || break
        echo $line
done < $logfifo >>$logfile

Works, but always waits for whole lines (we want to read/write
immeniately instead)

The following code works for bash, but not for other shells:

while [ 1 ]; do
        # -n is not available everywhwere (i.e. dash)
        read -n 1 data || break
        if [ -z $data ]; then
            echo
        else
            echo -n $data
        fi
done < $logfifo >>$logfile

Any Ideas?

- Dietmar
AW: AW: problems with vzctl init logging patch [message #28294 is a reply to message #28249] Thu, 13 March 2008 11:23 Go to previous message
Dietmar Maurer is currently offline  Dietmar Maurer
Messages: 52
Registered: March 2007
Member
Attached is the new patch.

- Dietmar
  • Attachment: vzctl.diff
    (Size: 6.47KB, Downloaded 442 times)
Previous Topic: usage of swap on host server
Next Topic: State of 2.6.24
Goto Forum:
  


Current Time: Sat Jul 27 00:50:44 GMT 2024

Total time taken to generate the page: 0.03248 seconds