OpenNebula / one

The open source Cloud & Edge Computing Platform bringing real freedom to your Enterprise Cloud 🚀
http://opennebula.io
Apache License 2.0
1.23k stars 478 forks source link

UUID for disk attach #931

Open OpenNebulaProject opened 6 years ago

OpenNebulaProject commented 6 years ago

Author Name: Jimmy Goffaux (Jimmy Goffaux) Original Redmine Issue: 3871, https://dev.opennebula.org/issues/3871 Original Date: 2015-07-09


Hello,

Is it possible to force the UUID when creating a disk and trace information in the UUID Sunstone? An example or disks are reversed :(

Basic :

root@techdayhost-1124:~# fdisk -l

Disk /dev/vda: 7 GiB
[......]

Add first disk by Sunstone : Attach Disk => Volatile Disk => Type : FS, Format : ext4, Target :vdb

root@techdayhost-1124:~# fdisk -l

Disk /dev/vda: 7 GiB
[.....]

Disk /dev/vdb: 10 GiB,
[.....]

Add on 2nd disk on Sunstone : Attach Disk => Volatile Disk => Type : FS, Format : ext4, Target :vdc, Size 15G

root@techdayhost-1124:~# fdisk -l

Disk /dev/vda: 7 GiB
[.....]

Disk /dev/vdb: 10 GiB,
[.....]
Disk /dev/vdc: 15 GiB,
[.....]
root@techdayhost-1124:~# blkid
/dev/vda1: UUID="c476e966-7e42-4987-8163-fc09943e0589" TYPE="ext4" PARTUUID="77fe1b99-01"
/dev/sr0: UUID="2015-07-08-15-03-31-00" LABEL="CONTEXT" TYPE="iso9660"
/dev/vdb: UUID="10a27673-4c64-471f-8ae4-b9a905f45000" TYPE="ext4"
/dev/vdc: UUID="d3dcfeba-3d2c-4ece-a9d5-aef7484ca8da" TYPE="ext4

On XML virsh :

disk type='network' device='disk'>
[.. Ceph configuration rbd ..]
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
[..]
      <target dev='vdb' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
[..]
      <target dev='vdc' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>

Now Detach disk vdb on Sunstone

root@techdayhost-1124:~# fdisk -l

Disk /dev/vda: 7 GiB
[.....]

Disk /dev/vdc: 15 GiB,
[.....]
root@techdayhost-1124:~# blkid
/dev/vda1: UUID="c476e966-7e42-4987-8163-fc09943e0589" TYPE="ext4" PARTUUID="77fe1b99-01"
/dev/sr0: UUID="2015-07-08-15-03-31-00" LABEL="CONTEXT" TYPE="iso9660"
/dev/vdc: UUID="d3dcfeba-3d2c-4ece-a9d5-aef7484ca8da" TYPE="ext4"

XML virsh :

    <disk type='network' device='disk'>
[.. Ceph configuration rbd ..]
        <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
[..]
      <target dev='vdc' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>

Now add new disk VDE : Attach Disk => Volatile Disk => Type : FS, Format : ext4, Target :vde, Size 12G

View in Sunstone :

ID  Target  Image / Format-Size   Persistent  Save as   Actions   
0   vda   Debian Jessie 8   NO  -   Snapshot  Detach
3   vdc   15GB - ext4   NO  -   Detach
4   vde   12GB - ext4   NO  -   Detach

XML Virsh :

[.. Ceph configuration rbd ..]      
    <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
[..]
      <target dev='vdc' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
[.. vde ..]
      <target dev='vde' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>

Now we have problems relationship:

root@techdayhost-1124:~# fdisk -l

Disk /dev/vda: 7 GiB,
[..]
Disk /dev/vdc: 15 GiB,
[..]
Disk /dev/vdb: 12 GiB,
[..]
root@techdayhost-1124:~# blkid
/dev/vda1: UUID="c476e966-7e42-4987-8163-fc09943e0589" TYPE="ext4" PARTUUID="77fe1b99-01"
/dev/vdb: UUID="574d17a2-e7d9-4fd5-993c-5f28ebde675c" TYPE="ext4"
/dev/sr0: UUID="2015-07-08-15-03-31-00" LABEL="CONTEXT" TYPE="iso9660"
/dev/vdc: UUID="d3dcfeba-3d2c-4ece-a9d5-aef7484ca8da" TYPE="ext4"

I decided to shut down the VM (POWEROFF) and start the VM .. The result is worse !!!

root@techdayhost-1124:~# fdisk -l

Disk /dev/vda: 7 GiB, 
[...]
Disk /dev/vdb: 15 GiB,
[...]
Disk /dev/vdc: 12 GiB,
[...]
root@techdayhost-1124:~# blkid 
/dev/vda1: UUID="c476e966-7e42-4987-8163-fc09943e0589" TYPE="ext4" PARTUUID="77fe1b99-01"
/dev/vdb: UUID="d3dcfeba-3d2c-4ece-a9d5-aef7484ca8da" TYPE="ext4"
/dev/sr0: UUID="2015-07-08-15-03-31-00" LABEL="CONTEXT" TYPE="iso9660"
/dev/vdc: UUID="574d17a2-e7d9-4fd5-993c-5f28ebde675c" TYPE="ext4"

vdb => vdc vdc => vdb vde ?

Imagine the size of the disks in Sunstone is the same one does not even know which drive is to be deleted: /

I hope you understand what I mean;)

Thank you !! ;)

OpenNebulaProject commented 6 years ago

Original Redmine Comment Author Name: Javi Fontan (Javi Fontan) Original Date: 2017-03-16T11:34:51Z


The target given to libvirt is a hint to the OS but it's not forced to use that specific naming. That problem is caused because the systems fills the holes left in the storage bus identifiers.

There is not a simple and fast way to extract UUID from @qcow2@ images so this can not be generalized for both of the most used formats. Moreover the latest versions don't let you format the disk so this UUID or even label could not be assigned.

We will look into other ways of distinguishing the disk devices that could work for all the most common storage options.