[libvirt-users] How to device port on the controller

Hi, I am adding a disk to my KVM virtual server, but for some reason it refuses to honor the <address> I have tried the following 3: <disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/nbd2'/> <target dev='vdb' bus='virtio'/> <serial>my-fake-serial</serial> <address type='drive' controller='0' bus='1' target='3' unit='2'/> </disk> <disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/nbd2'/> <target dev='vdb' bus='virtio'/> <serial>my-fake-serial</serial> <address type='pci' bus='0x00' slot='0x08' function='0x0'/> </disk> <disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/nbd2'/> <target dev='vdb' bus='virtio'/> <serial>my-fake-serial</serial> <address type='virtio-serial' controller='0' bus='0' port='8'/> </disk> I would assume the last one is the one to use, as I am using a "virtio" bus. However, the <address> attribute is simply ignored and the disk is always attached as this: pci-0000:00:05.0 Further, how do I read the "my-fake-serial" from within the virtual machine? I have tried using this: udevadm info -a -p $(udevadm info -q path -n /dev/vdb) But it does not show the serial string there anywhere. Regards, Daniele

On 04/08/2013 11:58 PM, Daniele Testa wrote:
Hi,
I am adding a disk to my KVM virtual server, but for some reason it refuses to honor the <address>
I have tried the following 3:
<disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/nbd2'/> <target dev='vdb' bus='virtio'/> <serial>my-fake-serial</serial> <address type='drive' controller='0' bus='1' target='3' unit='2'/> </disk>
<disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/nbd2'/> <target dev='vdb' bus='virtio'/> <serial>my-fake-serial</serial> <address type='pci' bus='0x00' slot='0x08' function='0x0'/> </disk>
<disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/nbd2'/> <target dev='vdb' bus='virtio'/> <serial>my-fake-serial</serial> <address type='virtio-serial' controller='0' bus='0' port='8'/> </disk>
I would assume the last one is the one to use, as I am using a "virtio" bus. However, the <address> attribute is simply ignored and the disk is always attached as this:
pci-0000:00:05.0
Further, how do I read the "my-fake-serial" from within the virtual machine?
The serial for vdb for example is in /sys/class/block/vdb/serial I know I haven't helped with the addresses, don't know much about that, but try attaching your libvirt version and the log of /var/log/libvirt/qemu/<machine_name>.log. I'll see when I'll get to you. Maybe somebody will found out in the meantime. If not, feel free to create a bug for this. Martin

Hi, Actually, the serial is not there :) root@ubuntu:/sys/class/block/vdi# fdisk -l Disk /dev/vda: 7516 MB, 7516192768 bytes 4 heads, 32 sectors/track, 114688 cylinders Units = cylinders of 128 * 512 = 65536 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000bb520 Device Boot Start End Blocks Id System /dev/vda1 * 17 114688 7339008 83 Linux Disk /dev/vdi: 1073 MB, 1073741824 bytes 16 heads, 63 sectors/track, 2080 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x525f45d3 Device Boot Start End Blocks Id System /dev/vdi1 1 2080 1048288+ 83 Linux root@ubuntu:/sys/class/block/vdi# ls -al total 0 drwxr-xr-x 8 root root 0 2013-04-08 21:51 . drwxr-xr-x 3 root root 0 2013-04-08 21:51 .. -r--r--r-- 1 root root 4096 2013-04-08 21:51 alignment_offset lrwxrwxrwx 1 root root 0 2013-04-08 21:51 bdi -> ../../../../../virtual/bdi/252:128 -r--r--r-- 1 root root 4096 2013-04-08 21:51 capability -r--r--r-- 1 root root 4096 2013-04-09 13:09 dev lrwxrwxrwx 1 root root 0 2013-04-08 21:51 device -> ../../../virtio9 -r--r--r-- 1 root root 4096 2013-04-08 21:51 ext_range drwxr-xr-x 2 root root 0 2013-04-08 21:51 holders -r--r--r-- 1 root root 4096 2013-04-08 21:51 inflight drwxr-xr-x 2 root root 0 2013-04-08 21:51 power drwxr-xr-x 3 root root 0 2013-04-08 21:51 queue -r--r--r-- 1 root root 4096 2013-04-08 21:51 range -r--r--r-- 1 root root 4096 2013-04-08 21:51 removable -r--r--r-- 1 root root 4096 2013-04-08 21:51 ro -r--r--r-- 1 root root 4096 2013-04-08 21:51 size drwxr-xr-x 2 root root 0 2013-04-08 21:51 slaves -r--r--r-- 1 root root 4096 2013-04-08 21:51 stat lrwxrwxrwx 1 root root 0 2013-04-08 21:51 subsystem -> ../../../../../../class/block drwxr-xr-x 2 root root 0 2013-04-08 21:51 trace -rw-r--r-- 1 root root 4096 2013-04-08 21:51 uevent drwxr-xr-x 5 root root 0 2013-04-08 21:51 vdi1 (root@h2)-(/var/log/libvirt/qemu)# virsh dumpxml vps_99 <domain type='kvm' id='231'> <name>vps_99</name> <uuid>8d19d3a4-f1b4-1030-ac57-0050560018a2</uuid> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <vcpu>2</vcpu> <os> <type arch='x86_64' machine='pc-0.12'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <clock offset='utc'/> <on_poweroff>restart</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/kvm</emulator> <disk type='block' device='disk'> <driver name='qemu' type='raw'/> <source dev='/dev/nbd1'/> <target dev='vda' bus='virtio'/> </disk> <disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/nbd2'/> <target dev='vdb' bus='virtio'/> <serial>my-fake-serial</serial> </disk> <interface type='bridge'> <mac address='00:50:56:00:1b:24'/> <source bridge='br0'/> <target dev='vnet3'/> <model type='virtio'/> </interface> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='5999' autoport='no' keymap='en-us'/> <video> <model type='cirrus' vram='9216' heads='1'/> </video> </devices> <seclabel type='dynamic' model='apparmor'> <label>libvirt-8d19d3a4-f1b4-1030-ac57-0050560018a2</label> <imagelabel>libvirt-8d19d3a4-f1b4-1030-ac57-0050560018a2</imagelabel> </seclabel> </domain> Btw, as you can see in the XML, libvirt and/or KVM is completely ignoring my target="vdb" and attaches the drive to "/dev/vdi" inside the virtual server. (root@h2)-(/)# virsh --version 0.7.5 (root@h2)-(/)# kvm --version QEMU PC emulator version 0.12.3 (qemu-kvm-0.12.3), Copyright (c) 2003-2008 Fabrice Bellard The log-file only shows the command used to start the virtual server. It does not contain any of the commands I used to attache the additional disk. Regards, Daniele 2013/4/9 Martin Kletzander <mkletzan@redhat.com>
On 04/08/2013 11:58 PM, Daniele Testa wrote:
Hi,
I am adding a disk to my KVM virtual server, but for some reason it refuses to honor the <address>
I have tried the following 3:
<disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/nbd2'/> <target dev='vdb' bus='virtio'/> <serial>my-fake-serial</serial> <address type='drive' controller='0' bus='1' target='3' unit='2'/> </disk>
<disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/nbd2'/> <target dev='vdb' bus='virtio'/> <serial>my-fake-serial</serial> <address type='pci' bus='0x00' slot='0x08' function='0x0'/> </disk>
<disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/nbd2'/> <target dev='vdb' bus='virtio'/> <serial>my-fake-serial</serial> <address type='virtio-serial' controller='0' bus='0' port='8'/> </disk>
I would assume the last one is the one to use, as I am using a "virtio" bus. However, the <address> attribute is simply ignored and the disk is always attached as this:
pci-0000:00:05.0
Further, how do I read the "my-fake-serial" from within the virtual machine?
The serial for vdb for example is in /sys/class/block/vdb/serial
I know I haven't helped with the addresses, don't know much about that, but try attaching your libvirt version and the log of /var/log/libvirt/qemu/<machine_name>.log. I'll see when I'll get to you. Maybe somebody will found out in the meantime. If not, feel free to create a bug for this.
Martin

[please don't top-post on technical lists] On 04/09/2013 03:19 PM, Daniele Testa wrote:
Hi,
Actually, the serial is not there :)
Works for me, but that's a new qemu, new libvirt and new fedora guest, see below.
Btw, as you can see in the XML, libvirt and/or KVM is completely ignoring my target="vdb" and attaches the drive to "/dev/vdi" inside the virtual server.
Yes, this is an issue, but we do state in the documentation that the target attribute is just a hint as to where to plug the disk and we currently cannot guarantee the disk name precisely.
(root@h2)-(/)# virsh --version 0.7.5
This version is very old and even though the serial element is supported, ...
(root@h2)-(/)# kvm --version QEMU PC emulator version 0.12.3 (qemu-kvm-0.12.3), Copyright (c) 2003-2008 Fabrice Bellard
... it might not be for such old qemu.
The log-file only shows the command used to start the virtual server. It does not contain any of the commands I used to attache the additional disk.
And that command would help identify whether we start qemu with the serial parameter (which I doubt with such old implementation) or not.
Regards, Daniele
2013/4/9 Martin Kletzander <mkletzan@redhat.com>
On 04/08/2013 11:58 PM, Daniele Testa wrote:
Hi,
I am adding a disk to my KVM virtual server, but for some reason it refuses to honor the <address>
I have tried the following 3:
<disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/nbd2'/> <target dev='vdb' bus='virtio'/> <serial>my-fake-serial</serial> <address type='drive' controller='0' bus='1' target='3' unit='2'/> </disk>
<disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/nbd2'/> <target dev='vdb' bus='virtio'/> <serial>my-fake-serial</serial> <address type='pci' bus='0x00' slot='0x08' function='0x0'/> </disk>
<disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/nbd2'/> <target dev='vdb' bus='virtio'/> <serial>my-fake-serial</serial> <address type='virtio-serial' controller='0' bus='0' port='8'/> </disk>
I would assume the last one is the one to use, as I am using a "virtio" bus. However, the <address> attribute is simply ignored and the disk is always attached as this:
pci-0000:00:05.0
Further, how do I read the "my-fake-serial" from within the virtual machine?
The serial for vdb for example is in /sys/class/block/vdb/serial
I know I haven't helped with the addresses, don't know much about that, but try attaching your libvirt version and the log of /var/log/libvirt/qemu/<machine_name>.log. I'll see when I'll get to you. Maybe somebody will found out in the meantime. If not, feel free to create a bug for this.
Martin
_______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users
participants (2)
-
Daniele Testa
-
Martin Kletzander