Question about skipping virDomainDiskDefAssignAddress

Daniel P. Berrangé berrange at redhat.com
Thu Jul 15 15:42:23 UTC 2021


On Fri, Jul 16, 2021 at 12:28:42AM +0900, Motohiro Kawahito wrote:
> Hi, is there any existing way for skipping virDomainDiskDefAssignAddress 
> for disk configuration?
> 
> I want to send the following XML to libvirt, but I got the error 
> "virDomainDiskDefAssignAddress:7642 : XML error: Unknown disk name '0A80' 
> and no address specified".
> 
> <disk type='file'>
>     <source file='/volumes_qcow2/DMRES1.qcow2'/>
>     <target dev='0A80' />
> </disk>
> 
> According to the source code, target device must be one of {"fd", "hd", 
> "vd", "sd", "xvd", "ubd"} + alphabet (+ number). Our guest OS is not 
> Linux, so I'd like to skip this limitation. Actually, I want to specify 
> 4-digits hexadecimal number in target device.

Ah, you're mis-understanding the impact of this device name field.

With the exception of paravirtualized Xen guests, this field in
libvirt XML is *completely* independant of the guest assigned
device name.

eg the XML might say /dev/vda, but the guest might decde to
call it /dev/sda, or /dev/whatever or really absolutely
anything.

The only thing that the target dev=xx does in the libvirt
XML is to establish a device ordering relationship between
disks in the XML. ie libvirt will configure /dev/vda before
/dev/vdb.  The guest will probably then probe in the this
same order, but that's entirely guest dependant - some may
probe devices in paralell.

IOW, just use /dev/NNN prefix that matches the bus type,
regardless of what your guest OS is. Your guest OS will
just do its own thing as needed.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list