| 1 |
Name |
| 2 |
---- |
| 3 |
|
| 4 |
xen-vbd-interface - Xen paravirtualised block device protocol |
| 5 |
|
| 6 |
Xen guest interface |
| 7 |
------------------- |
| 8 |
|
| 9 |
A Xen guest can be provided with block devices. These are always |
| 10 |
provided as Xen VBDs; for HVM guests they may also be provided as |
| 11 |
emulated IDE, AHCI or SCSI disks. |
| 12 |
|
| 13 |
The abstract interface involves specifying, for each block device: |
| 14 |
|
| 15 |
* Nominal disk type: Xen virtual disk (aka xvd*, the default); SCSI |
| 16 |
(sd*); IDE or AHCI (hd*). |
| 17 |
|
| 18 |
For HVM guests, each whole-disk hd* and and sd* device is made |
| 19 |
available _both_ via emulated IDE resp. SCSI controller, _and_ as a |
| 20 |
Xen VBD. The HVM guest is entitled to assume that the IDE or SCSI |
| 21 |
disks available via the emulated IDE controller target the same |
| 22 |
underlying devices as the corresponding Xen VBD (ie, multipath). |
| 23 |
In hd* case with hdtype=ahci, disk will be AHCI via emulated |
| 24 |
ich9 disk controller. |
| 25 |
|
| 26 |
For PV guests every device is made available to the guest only as a |
| 27 |
Xen VBD. For these domains the type is advisory, for use by the |
| 28 |
guest's device naming scheme. |
| 29 |
|
| 30 |
The Xen interface does not specify what name a device should have |
| 31 |
in the guest (nor what major/minor device number it should have in |
| 32 |
the guest, if the guest has such a concept). |
| 33 |
|
| 34 |
* Disk number, which is a nonnegative integer, |
| 35 |
conventionally starting at 0 for the first disk. |
| 36 |
|
| 37 |
* Partition number, which is a nonnegative integer where by |
| 38 |
convention partition 0 indicates the "whole disk". |
| 39 |
|
| 40 |
Normally for any disk _either_ partition 0 should be supplied in |
| 41 |
which case the guest is expected to treat it as they would a native |
| 42 |
whole disk (for example by putting or expecting a partition table |
| 43 |
or disk label on it); |
| 44 |
|
| 45 |
_Or_ only non-0 partitions should be supplied in which case the |
| 46 |
guest should expect storage management to be done by the host and |
| 47 |
treat each vbd as it would a partition or slice or LVM volume (for |
| 48 |
example by putting or expecting a filesystem on it). |
| 49 |
|
| 50 |
Non-whole disk devices cannot be passed through to HVM guests via |
| 51 |
the emulated IDE or SCSI controllers. |
| 52 |
|
| 53 |
|
| 54 |
Configuration file syntax |
| 55 |
------------------------- |
| 56 |
|
| 57 |
The config file syntaxes are, for example |
| 58 |
|
| 59 |
d0 d0p0 xvda Xen virtual disk 0 partition 0 (whole disk) |
| 60 |
d1p2 xvdb2 Xen virtual disk 1 partition 2 |
| 61 |
d536p37 xvdtq37 Xen virtual disk 536 partition 37 |
| 62 |
sdb3 SCSI disk 1 partition 3 |
| 63 |
hdc2 IDE disk 2 partition 2 |
| 64 |
|
| 65 |
The d*p* syntax is not supported by xm/xend. |
| 66 |
|
| 67 |
To cope with guests which predate this specification we preserve the |
| 68 |
existing facility to specify the xenstore numerical value directly by |
| 69 |
putting a single number (hex, decimal or octal) in the domain config |
| 70 |
file instead of the disk identifier; this number is written directly |
| 71 |
to xenstore (after conversion to the canonical decimal format). |
| 72 |
|
| 73 |
|
| 74 |
Concrete encoding in the VBD interface (in xenstore) |
| 75 |
---------------------------------------------------- |
| 76 |
|
| 77 |
The information above is encoded in the concrete interface as an |
| 78 |
integer (in a canonical decimal format in xenstore), whose value |
| 79 |
encodes the information above as follows: |
| 80 |
|
| 81 |
1 << 28 | disk << 8 | partition xvd, disks or partitions 16 onwards |
| 82 |
202 << 8 | disk << 4 | partition xvd, disks and partitions up to 15 |
| 83 |
8 << 8 | disk << 4 | partition sd, disks and partitions up to 15 |
| 84 |
3 << 8 | disk << 6 | partition hd, disks 0..1, partitions 0..63 |
| 85 |
22 << 8 | (disk-2) << 6 | partition hd, disks 2..3, partitions 0..63 |
| 86 |
2 << 28 onwards reserved for future use |
| 87 |
other values less than 1 << 28 deprecated / reserved |
| 88 |
|
| 89 |
The 1<<28 format handles disks up to (1<<20)-1 and partitions up to |
| 90 |
255. It will be used only where the 202<<8 format does not have |
| 91 |
enough bits. |
| 92 |
|
| 93 |
Guests MAY support any subset of the formats above except that if they |
| 94 |
support 1<<28 they MUST also support 202<<8. PV-on-HVM drivers MUST |
| 95 |
support at least one of 3<<8 or 8<<8; 3<<8 is recommended. |
| 96 |
|
| 97 |
Some software has used or understood Linux-specific encodings for SCSI |
| 98 |
disks beyond disk 15 partition 15, and IDE disks beyond disk 3 |
| 99 |
partition 63. These vbds, and the corresponding encoded integers, are |
| 100 |
deprecated. |
| 101 |
|
| 102 |
Guests SHOULD ignore numbers that they do not understand or |
| 103 |
recognise. They SHOULD check supplied numbers for validity. |
| 104 |
|
| 105 |
|
| 106 |
Notes on Linux as a guest |
| 107 |
------------------------- |
| 108 |
|
| 109 |
Very old Linux guests (PV and PV-on-HVM) are able to "steal" the |
| 110 |
device numbers and names normally used by the IDE and SCSI |
| 111 |
controllers, so that writing "hda1" in the config file results in |
| 112 |
/dev/hda1 in the guest. These systems interpret the xenstore integer |
| 113 |
as |
| 114 |
major << 8 | minor |
| 115 |
where major and minor are the Linux-specific device numbers. Some old |
| 116 |
configurations may depend on deprecated high-numbered SCSI and IDE |
| 117 |
disks. This does not work in recent versions of Linux. |
| 118 |
|
| 119 |
So for Linux PV guests, users are recommended to supply xvd* devices |
| 120 |
only. Modern PV drivers will map these to identically-named devices |
| 121 |
in the guest. |
| 122 |
|
| 123 |
For Linux HVM guests using PV-on-HVM drivers, users are recommended to |
| 124 |
supply as few hd* devices as possible, and for the rest of the disks, |
| 125 |
to use pure xvd* devices starting at xvde. Modern PV-on-HVM drivers |
| 126 |
will map provided hd* devices to the corresponding /dev/xvd* (for |
| 127 |
example, hda is presented also as /dev/xvda). |
| 128 |
|
| 129 |
Some Linux HVM guests with broken PV-on-HVM drivers do not cope |
| 130 |
properly if both hda and hdc are supplied, nor with both hda and xvda, |
| 131 |
because they directly map the bottom 8 bits of the xenstore integer |
| 132 |
directly to the Linux guest's device number and throw away the rest; |
| 133 |
they can crash due to minor number clashes. With these guests, the |
| 134 |
workaround is not to supply problematic combinations of devices. |
| 135 |
|
| 136 |
|
| 137 |
Other frontend and backend options |
| 138 |
---------------------------------- |
| 139 |
|
| 140 |
See xen/include/public/io/blkif.h for the full list of options. |