Bug #2104

Overwriting when attaching non-persistent disk

Added by Evgeni Cherdancev almost 6 years ago. Updated almost 6 years ago.

Status:ClosedStart date:06/05/2013
Priority:NormalDue date:
Assignee:Javi Fontan% Done:

0%

Category:Drivers - Storage
Target version:Release 3.8.4
Resolution:fixed Pull request:
Affected Versions:OpenNebula 3.8

Description

Datastore: Filesystem
Transfer: Shared
Version: OpenNebula 3.8.3-1, OpenNebula 4.0.1

[~/var/datastores/102/300]$ ls -la
total 388
drwxr-xr-x 2 oneadmin cloud   4096 Jun  5 14:33 .
drwxr-xr-x 8 oneadmin cloud   4096 Jun  5 13:25 ..
-rw-r--r-- 1 oneadmin cloud    972 Jun  5 13:26 deployment.0
lrwxrwxrwx 1 oneadmin cloud     60 Jun  5 13:26 disk.0 -> /var/lib/one/datastores/103/614f4586ec261ed2eb19c7e30d4cb5bd
-rw-r--r-- 1 oneadmin cloud 374784 Jun  5 13:26 disk.1
lrwxrwxrwx 1 oneadmin cloud     38 Jun  5 13:26 disk.1.iso -> /var/lib/one/datastores/102/300/disk.1

Attaching persistent disk:
Wed Jun  5 14:35:23 2013 [VMM][D]: Message received: LOG I 300 ln: Linking /var/lib/one/datastores/103/afe0fb0981db87e9d18254846095671f in node2:/var/lib/one/datastores/102/300/disk.2
Wed Jun  5 14:35:23 2013 [VMM][D]: Message received: LOG I 300 ExitCode: 0
Wed Jun  5 14:35:23 2013 [VMM][D]: Message received: LOG I 300 Successfully execute transfer manager driver operation: tm_attach.
Wed Jun  5 14:35:28 2013 [VMM][D]: Message received: LOG I 300 ExitCode: 0
Wed Jun  5 14:35:29 2013 [VMM][D]: Message received: LOG I 300 Successfully execute virtualization driver operation: attach_disk.
----------
[~/var/datastores/102/300]$ ls -la
...
lrwxrwxrwx 1 oneadmin cloud     60 Jun  5 14:36 disk.2 -> /var/lib/one/datastores/103/afe0fb0981db87e9d18254846095671f
[~/var/datastores/102/300]$ ls -lah /var/lib/one/datastores/103/afe0fb0981db87e9d18254846095671f
-rw-rw-r-- 1 oneadmin oneadmin 546M Jun  5 14:35 /var/lib/one/datastores/103/afe0fb0981db87e9d18254846095671f

Detaching disk:
Wed Jun  5 14:38:07 2013 [VMM][D]: Message received: LOG I 300 ExitCode: 0
Wed Jun  5 14:38:07 2013 [VMM][D]: Message received: LOG I 300 Successfully execute virtualization driver operation: detach_disk.
Wed Jun  5 14:38:13 2013 [VMM][D]: Message received: LOG I 300 mvds: Moving /var/lib/one/datastores/102/300/disk.2 to datastore as /var/lib/one/datastores/103/afe0fb0981db87e9d18254846095671f
Wed Jun  5 14:38:13 2013 [VMM][D]: Message received: LOG I 300 ExitCode: 0
Wed Jun  5 14:38:13 2013 [VMM][D]: Message received: LOG I 300 Successfully execute transfer manager driver operation: tm_detach.
Wed Jun  5 14:38:13 2013 [VMM][D]: Message received: DETACHDISK SUCCESS 300 -

Symlink still exist.
Attaching non-persistent disk:
Wed Jun  5 14:40:00 2013 [VMM][D]: Message received: LOG I 300 clone: Cloning /var/lib/one/datastores/1/2448fccac11df5fc42b47a7f560fc156 in node2:/var/lib/one/datastores/102/300/disk.2
Wed Jun  5 14:40:00 2013 [VMM][D]: Message received: LOG I 300 ExitCode: 0
Wed Jun  5 14:40:00 2013 [VMM][D]: Message received: LOG I 300 Successfully execute transfer manager driver operation: tm_attach.
Wed Jun  5 14:40:06 2013 [VMM][D]: Message received: LOG I 300 ExitCode: 0
Wed Jun  5 14:40:06 2013 [VMM][D]: Message received: LOG I 300 Successfully execute virtualization driver operation: attach_disk.
Wed Jun  5 14:40:06 2013 [VMM][D]: Message received: ATTACHDISK SUCCESS 300 
-----------
[~/var/datastores/102/300]$ ls -lah /var/lib/one/datastores/103/afe0fb0981db87e9d18254846095671f
-rw-rw-r-- 1 oneadmin oneadmin 310M Jun  5 14:40 /var/lib/one/datastores/103/afe0fb0981db87e9d18254846095671f

If attach persistent image, symlink is recreating to new place.

Associated revisions

Revision 13d719a2
Added by Javi Fontan almost 6 years ago

bug #2104: delete unused persistent disk links

Revision 6016c2d6
Added by Javi Fontan almost 6 years ago

bug #2104: delete unused persistent disk links
(cherry picked from commit 13d719a2b391cf8836ae3b264aa51a6819e58a0a)

Revision 509b12a7
Added by Javi Fontan almost 6 years ago

bug #2104: delete unused persistent disk links
(cherry picked from commit 13d719a2b391cf8836ae3b264aa51a6819e58a0a)

History

#1 Updated by Javi Fontan almost 6 years ago

  • Category set to Drivers - Storage
  • Status changed from Pending to Assigned
  • Assignee set to Javi Fontan
  • Target version set to Release 3.8.4
  • Affected Versions OpenNebula 3.8 added

mvds tm script for shared drivers do nothing when the source and the destination links is the same. It should delete the links, at least for files.

The code that should do this:

if [ -d $SRC_PATH ] ; then
    if [ \( -L $SRC_PATH \) -a \( "\$SRC_READLN" = "\$DST_READLN" \) ] ;  then
        echo "Not moving files to image repo, they are the same" 
    elif [ -f $SRC_PATH/.is_persistent ]; then
        echo "Not moving files to image repo, they are the same" 
    else
        mv -f $SRC_PATH/* $DST_PATH
    fi
elif [ \( -L $SRC_PATH \) -a \( "\$SRC_READLN" = "\$DST_READLN" \) ] ; then
    echo "Not moving files to image repo, they are the same" 
else
    mv -f $SRC_PATH $DST_PATH
fi

#2 Updated by Javi Fontan almost 6 years ago

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

Done for branches 3.8, 4.0 and master

Also available in: Atom PDF