Bug #995

transfer manager problems when source and destination are equal

Added by Jochem Ippers over 9 years ago. Updated over 9 years ago.

Status:ClosedStart date:11/21/2011
Priority:HighDue date:
Assignee:Javi Fontan% Done:

0%

Category:Drivers - Auth
Target version:Release 3.2 - Beta1
Resolution:fixed Pull request:
Affected Versions:OpenNebula 3.0

Description

Hi,
I put this as a new issue although it is the same problem as with bug #845.

If for example the frontend is used as a host also and you stop a VM the VM state does not get saved and the VM does not get "transferred back along with the disk images to the front-end" etc.. It gets deleted completely (ouch!) - after a useless local copy operation in the VM's folder; an example:

Mon Nov 21 23:31:14 2011 [LCM][I]: New VM state is EPILOG_STOP
Mon Nov 21 23:34:29 2011 [TM][I]: tm_mv.sh: Moving /var/lib/one/4/images
Mon Nov 21 23:34:29 2011 [TM][I]: tm_mv.sh: Executed "ssh b006 mkdir p /var/lib/one".
Mon Nov 21 23:34:29 2011 [TM][I]: tm_mv.sh: Executed "scp -r b006:/var/lib/one/4/images b006:/var/lib/one/4". # useless local copy on host b006 on /var/lib/one/4/images
Mon Nov 21 23:34:29 2011 [TM][I]: tm_mv.sh: Executed "ssh b006 rm -rf /var/lib/one/4/images". # and now everything gets deleted! uuuh! ;
)
Mon Nov 21 23:34:29 2011 [TM][I]: ExitCode: 0
Mon Nov 21 23:34:29 2011 [DiM][I]: New VM state is STOPPED

This could be avoided by testing for equality of source and destination host (or the corresponding complete URLS with their full paths) or something similar so that nothing or only the correct operations happen in case of equality.

Kind regards
Jochem


Related issues

Related to Bug #845: tm_mv.sh error with KVM in RC1 on Debian Squeeze Closed 09/28/2011

Associated revisions

Revision f4324981
Added by Javi Fontan over 9 years ago

bug #845 and #995: compare src and dst in mv from ssh tm driver

Revision bb4b0c6c
Added by Javi Fontan over 9 years ago

bug #845 and #995: fix extra slash in sed command

Revision 3082d9c9
Added by Javi Fontan over 9 years ago

bug #845 and #995: compare src and dst in mv from ssh tm driver

Revision 2e9029b7
Added by Javi Fontan over 9 years ago

bug #845 and #995: fix extra slash in sed command

History

#1 Updated by Jochem Ippers over 9 years ago

Oh, the the striked out lines above shouldn't have been striked out of course. They contain the problematic commands.

#2 Updated by Ruben S. Montero over 9 years ago

  • Assignee set to Javi Fontan
  • Target version changed from Release 3.4 to Release 3.2 - Beta1

#3 Updated by Jochem Ippers over 9 years ago

Hi,
I just saw that there is already a test for equality of source and destination host in the tm_mv.sh-script of the "shared" tm-driver. But it is not in the tm_mv.sh-script of the "ssh" tm-driver = where the problem described above happened (=on my testhost I use the ssh-tm-driver). The test probably should be included in all or most types of tm-driver's tm_mv.sh scripts.

By the way: Opennebula = great concepts, very well structured, I love the clear cli, and the rest. ;-)

Greetings from Aachen, germany
Jochem

#4 Updated by Jochem Ippers over 9 years ago

It's me again,
the equality test in tm_mv.sh doesnt't work right because the compared paths "$SRC_PATH" == "$DST_PATH" always differ like this:
SRC_PATH = .../<VM_ID>/images
DST_PATH = .../<VM_ID>
So the end of SRC_PATH has to be truncated for the test, for example (not elegant!):

...
if [ "$(echo "$SRC_PATH" | sed s/\\/images$//)" == "$DST_PATH" ]; then
...


Kind regards
Jochem

#5 Updated by Jochem Ippers over 9 years ago

ah, crap line before,too many double quotes, better this way (assuming path strings have no spaces):

...
if [ "$(echo $SRC_PATH | sed s/\\/images$//)" == "$(echo $DST_PATH | sed s/\\/images$//)" ]; then
...

#6 Updated by Javi Fontan over 9 years ago

Thanks for noticing and making the patch. I'm reviewing it so we can add it to the main repository.

#7 Updated by Javi Fontan over 9 years ago

I'm using your strip-image-directory recipe in f432498. Hopefully this fixes the problem for tm_ssh.

#8 Updated by Javi Fontan over 9 years ago

  • Status changed from New to Closed
  • Resolution set to fixed

Also available in: Atom PDF