[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 14/25] conf: Introduce <shareable> for hostdev



On 05/03/2013 02:07 PM, Osier Yang wrote:
> Unlike disk device, the scsi-generic always writethrough the data,
> so no need to introduce a "cache" tag, and set "cache=off".
> ---
>  docs/formatdomain.html.in                          |  6 ++++
>  docs/schemas/domaincommon.rng                      |  5 +++
>  src/conf/domain_conf.c                             |  4 +++
>  src/conf/domain_conf.h                             |  1 +
>  .../qemuxml2argv-hostdev-scsi-shareable.xml        | 36 ++++++++++++++++++++++
>  tests/qemuxml2xmltest.c                            |  1 +
>  6 files changed, 53 insertions(+)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-shareable.xml
> 
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index 9cd79e5..6437d6d 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -2410,6 +2410,12 @@
>        <dd>Indicates that the device is readonly, only supported by SCSI host
>          device now. <span class="since">Since 1.0.6</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 now.

s/ now/

Missed that above too I think in the previous review.

ACK on the rest.

John

> +        <span class="since">Since 1.0.6</span>
> +      </dd>
>      </dl>
>  
>  
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index 4fdacab..ca79e67 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -3080,6 +3080,11 @@
>              <empty/>
>            </element>
>          </optional>
> +        <optional>
> +          <element name="shareable">
> +            <empty/>
> +          </element>
> +        </optional>
>        </interleave>
>      </element>
>    </define>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index cff2b46..e7b096b 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -8860,6 +8860,8 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr xmlopt,
>  
>              if (virXPathBoolean("boolean(./readonly)", ctxt))
>                  def->readonly = true;
> +            if (virXPathBoolean("boolean(./shareable)", ctxt))
> +                def->shareable = true;
>              break;
>          }
>      }
> @@ -15482,6 +15484,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,
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 5471cd3..7073967 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -462,6 +462,7 @@ struct _virDomainHostdevDef {
>      bool managed;
>      bool missing;
>      bool readonly;
> +    bool shareable;
>      union {
>          virDomainHostdevSubsys subsys;
>          virDomainHostdevCaps caps;
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-shareable.xml b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-shareable.xml
> new file mode 100644
> index 0000000..f9ce8af
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-shareable.xml
> @@ -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>
> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
> index 492ac60..d37a657 100644
> --- a/tests/qemuxml2xmltest.c
> +++ b/tests/qemuxml2xmltest.c
> @@ -288,6 +288,7 @@ mymain(void)
>      DO_TEST("hostdev-scsi-lsi");
>      DO_TEST("hostdev-scsi-virtio-scsi");
>      DO_TEST("hostdev-scsi-readonly");
> +    DO_TEST("hostdev-scsi-shareable");
>  
>      virObjectUnref(driver.caps);
>      virObjectUnref(driver.xmlopt);
> 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]