Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deviceId to Serial parameter of the LibVirt VM definition #202

Merged
merged 2 commits into from Jan 5, 2017

Conversation

remibergsma
Copy link
Member

@remibergsma remibergsma commented Dec 29, 2016

This makes it possible to link the DeviceIds as you specify them on the Cosmic API to the devices in the OS.

Example:

(local) 馃惖 > list volumes virtualmachineid=7d66b036-270b-4ec8-9a75-99a7f8249446 filter=name,deviceid
count = 4
volume:
+----------------+----------+
|      name      | deviceid |
+----------------+----------+
|   ANOTHER-9    |    9     |
|     ROOT-5     |    0     |
|     DISK-5     |    5     |
| DISK-REMI-DATA |    8     |
+----------------+----------+

On the OS, Linux as example:

[root@vm-7d66b036-270b-4ec8-9a75-99a7f8249446 ~]# ls -l /dev/disk/by-id/
total 0
lrwxrwxrwx. 1 root root  9 Dec 29 16:38 ata-QEMU_DVD-ROM_QM00003 -> ../../sr0
lrwxrwxrwx. 1 root root  9 Dec 29 16:38 virtio-0-f043f3b303a84b8396 -> ../../vda
lrwxrwxrwx. 1 root root 10 Dec 29 16:38 virtio-0-f043f3b303a84b8396-part1 -> ../../vda1
lrwxrwxrwx. 1 root root  9 Dec 29 16:38 virtio-5-f26f05bc06cc474aa6 -> ../../vdb
lrwxrwxrwx. 1 root root  9 Dec 29 16:38 virtio-8-b9250669cc274f46a6 -> ../../vdc
lrwxrwxrwx. 1 root root  9 Dec 29 18:50 virtio-9-ea556a7ef3e341adac -> ../../vdd

It seems the max chars a VM will show is 20, even when you put more in the XML:

    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/mnt/f9160a20-70c7-38f4-a980-29f0c16f010c/f043f3b3-03a8-4b83-969f-f8cf682975ae'/>
      <target dev='vda' bus='virtio'/>
      <serial>0-f043f3b303a84b83969f</serial>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/mnt/f9160a20-70c7-38f4-a980-29f0c16f010c/f26f05bc-06cc-474a-a6f7-f8fb5bc6a3dc'/>
      <target dev='vdf' bus='virtio'/>
      <serial>5-f26f05bc06cc474aa6f7</serial>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/mnt/f9160a20-70c7-38f4-a980-29f0c16f010c/b9250669-cc27-4f46-a666-7712680a67ef'/>
      <target dev='vdi' bus='virtio'/>
      <serial>8-b9250669cc274f46a666</serial>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/mnt/f9160a20-70c7-38f4-a980-29f0c16f010c/ea556a7e-f3e3-41ad-ac25-12744b1228d8'/>
      <target dev='vdj' bus='virtio'/>
      <serial>9-ea556a7ef3e341adac25</serial>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw' cache='none'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>

So <serial>5-f26f05bc06cc474aa6f7</serial> becomes virtio-5-f26f05bc06cc474aa6. This used to be virtio-f26f05bc06cc474aa6f7. As discussed, this is what we want now.

@remibergsma remibergsma changed the title Add devideId to Serial parameter of the LibVirt VM definition Add deviceId to Serial parameter of the LibVirt VM definition Dec 29, 2016
@eliasgomes eliasgomes merged commit b261129 into master Jan 5, 2017
@eliasgomes eliasgomes deleted the feature/diskid-in-virtio-serial branch January 5, 2017 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants