conf: Introduce <shareable> for hostdev

Unlike disk device, the scsi-generic always writethrough the data,
so no need to introduce a "cache" tag, and set "cache=off".
This commit is contained in:
Osier Yang 2013-05-04 02:07:33 +08:00
parent 95c6cc344b
commit f2c1d9a804
6 changed files with 53 additions and 0 deletions

View File

@ -2506,6 +2506,12 @@
<dd>Indicates that the device is readonly, only supported by SCSI host
device now. <span class="since">Since 1.0.6 (QEMU and KVM only)</span>
</dd>
<dt><code>shareable</code></dt>
<dd>If present, this indicates the device is expected to be shared
between domains (assuming the hypervisor and OS support this).
Only supported by SCSI host device.
<span class="since">Since 1.0.6</span>
</dd>
</dl>

View File

@ -3135,6 +3135,11 @@
<empty/>
</element>
</optional>
<optional>
<element name="shareable">
<empty/>
</element>
</optional>
</interleave>
</element>
</define>

View File

@ -8829,6 +8829,8 @@ virDomainHostdevDefParseXML(const xmlNodePtr node,
if (virXPathBoolean("boolean(./readonly)", ctxt))
def->readonly = true;
if (virXPathBoolean("boolean(./shareable)", ctxt))
def->shareable = true;
break;
}
}
@ -15457,6 +15459,8 @@ virDomainHostdevDefFormat(virBufferPtr buf,
if (def->readonly)
virBufferAddLit(buf, "<readonly/>\n");
if (def->shareable)
virBufferAddLit(buf, "<shareable/>\n");
virBufferAdjustIndent(buf, -6);
if (virDomainDeviceInfoFormat(buf, def->info,

View File

@ -462,6 +462,7 @@ struct _virDomainHostdevDef {
bool managed;
bool missing;
bool readonly;
bool shareable;
union {
virDomainHostdevSubsys subsys;
virDomainHostdevCaps caps;

View File

@ -0,0 +1,36 @@
<domain type='qemu'>
<name>QEMUGuest2</name>
<uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
<memory unit='KiB'>219100</memory>
<currentMemory unit='KiB'>219100</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu</emulator>
<disk type='block' device='disk'>
<source dev='/dev/HostVG/QEMUGuest2'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='scsi' index='0' model='virtio-scsi'/>
<controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='pci' index='0' model='pci-root'/>
<hostdev mode='subsystem' type='scsi' managed='yes'>
<source>
<adapter name='scsi_host0'/>
<address bus='0' target='0' unit='0'/>
</source>
<shareable/>
<address type='drive' controller='0' bus='0' target='4' unit='8'/>
</hostdev>
<memballoon model='virtio'/>
</devices>
</domain>

View File

@ -294,6 +294,7 @@ mymain(void)
DO_TEST("hostdev-scsi-readonly");
DO_TEST("disk-copy_on_read");
DO_TEST("hostdev-scsi-shareable");
virObjectUnref(driver.caps);
virObjectUnref(driver.xmlopt);