提交 f2c1d9a8 编写于 作者: O Osier Yang

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".
上级 95c6cc34
...@@ -2506,6 +2506,12 @@ ...@@ -2506,6 +2506,12 @@
<dd>Indicates that the device is readonly, only supported by SCSI host <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> device now. <span class="since">Since 1.0.6 (QEMU and KVM only)</span>
</dd> </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> </dl>
......
...@@ -3135,6 +3135,11 @@ ...@@ -3135,6 +3135,11 @@
<empty/> <empty/>
</element> </element>
</optional> </optional>
<optional>
<element name="shareable">
<empty/>
</element>
</optional>
</interleave> </interleave>
</element> </element>
</define> </define>
......
...@@ -8829,6 +8829,8 @@ virDomainHostdevDefParseXML(const xmlNodePtr node, ...@@ -8829,6 +8829,8 @@ virDomainHostdevDefParseXML(const xmlNodePtr node,
if (virXPathBoolean("boolean(./readonly)", ctxt)) if (virXPathBoolean("boolean(./readonly)", ctxt))
def->readonly = true; def->readonly = true;
if (virXPathBoolean("boolean(./shareable)", ctxt))
def->shareable = true;
break; break;
} }
} }
...@@ -15457,6 +15459,8 @@ virDomainHostdevDefFormat(virBufferPtr buf, ...@@ -15457,6 +15459,8 @@ virDomainHostdevDefFormat(virBufferPtr buf,
if (def->readonly) if (def->readonly)
virBufferAddLit(buf, "<readonly/>\n"); virBufferAddLit(buf, "<readonly/>\n");
if (def->shareable)
virBufferAddLit(buf, "<shareable/>\n");
virBufferAdjustIndent(buf, -6); virBufferAdjustIndent(buf, -6);
if (virDomainDeviceInfoFormat(buf, def->info, if (virDomainDeviceInfoFormat(buf, def->info,
......
...@@ -462,6 +462,7 @@ struct _virDomainHostdevDef { ...@@ -462,6 +462,7 @@ struct _virDomainHostdevDef {
bool managed; bool managed;
bool missing; bool missing;
bool readonly; bool readonly;
bool shareable;
union { union {
virDomainHostdevSubsys subsys; virDomainHostdevSubsys subsys;
virDomainHostdevCaps caps; virDomainHostdevCaps caps;
......
<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>
...@@ -294,6 +294,7 @@ mymain(void) ...@@ -294,6 +294,7 @@ mymain(void)
DO_TEST("hostdev-scsi-readonly"); DO_TEST("hostdev-scsi-readonly");
DO_TEST("disk-copy_on_read"); DO_TEST("disk-copy_on_read");
DO_TEST("hostdev-scsi-shareable");
virObjectUnref(driver.caps); virObjectUnref(driver.caps);
virObjectUnref(driver.xmlopt); virObjectUnref(driver.xmlopt);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册