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