Allows io={threads|native} as an optional attribute to <driver>.
Signed-off-by: Eric Blake <eblake@redhat.com>
Marc-André Lureau <marcandre.lureau@redhat.com>
Michal Prívozník <mprivozn@redhat.com>
Juerg Haefliger <juerg.haefliger@hp.com>
+ Matthias Dahl <mdvirt@designassembly.de>
[....send patches to get your name here....]
</disk>
...
<disk type='network'>
- <driver name="qemu" type="raw"/>
+ <driver name="qemu" type="raw" io="threads"/>
<source protocol="sheepdog" name="image_name">
<host name="hostname" port="7000"/>
</source>
<span class="since">Since 0.0.3; <code>bus</code> attribute since 0.4.3;
"usb" attribute value since after 0.4.4</span></dd>
<dt><code>driver</code></dt>
- <dd>If the hypervisor supports multiple backend drivers, then the optional
- <code>driver</code> element allows them to be selected. The <code>name</code>
- attribute is the primary backend driver name, while the optional <code>type</code>
- attribute provides the sub-type. The optional <code>cache</code> attribute
- controls the cache mechanism, possible values are "default", "none",
- "writethrough" and "writeback". <span class="since">Since 0.1.8</span>
+ <dd>
+ The optional driver element allows specifying further details
+ related to the hypervisor driver used to provide the disk.
+ <span class="since">Since 0.1.8; <code>io</code> attribute
+ since 0.8.8</span>
+ <ul>
+ <li>
+ If the hypervisor supports multiple backend drivers, then
+ the <code>name</code> attribute selects the primary
+ backend driver name, while the optional <code>type</code>
+ attribute provides the sub-type. For example, xen
+ supports a name of "tap", "tap2", "phy", or "file", with a
+ type of "aio", while qemu only supports a name of "qemu",
+ but multiple types including "raw", "bochs", "qcow2", and
+ "qed".
+ </li>
+ <li>
+ The optional <code>cache</code> attribute controls the
+ cache mechanism, possible values are "default", "none",
+ "writethrough" and "writeback".
+ </li>
+ <li>
+ The optional <code>error_policy</code> attribute controls
+ how the hypervisor will behave on an error, possible
+ values are "stop", "ignore", and "enospace".
+ </li>
+ <li>
+ The optional <code>io</code> attribute controls specific
+ policies on I/O; qemu guests support "threads" and
+ "native".
+ </li>
+ </ul>
</dd>
<dt><code>boot</code></dt>
<dd>Specifies that the disk is bootable. The <code>order</code>
<optional>
<ref name="driverErrorPolicy"/>
</optional>
+ <optional>
+ <ref name="driverIO"/>
+ </optional>
<empty/>
</element>
</define>
</choice>
</attribute>
</define>
+ <define name="driverIO">
+ <attribute name="io">
+ <choice>
+ <value>threads</value>
+ <value>native</value>
+ </choice>
+ </attribute>
+ </define>
<define name="controller">
<element name="controller">
<choice>
"rbd",
"sheepdog")
+VIR_ENUM_IMPL(virDomainDiskIo, VIR_DOMAIN_DISK_IO_LAST,
+ "default",
+ "native",
+ "threads")
+
VIR_ENUM_IMPL(virDomainController, VIR_DOMAIN_CONTROLLER_TYPE_LAST,
"ide",
"fdc",
char *bus = NULL;
char *cachetag = NULL;
char *error_policy = NULL;
+ char *iotag = NULL;
char *devaddr = NULL;
virStorageEncryptionPtr encryption = NULL;
char *serial = NULL;
driverType = virXMLPropString(cur, "type");
cachetag = virXMLPropString(cur, "cache");
error_policy = virXMLPropString(cur, "error_policy");
+ iotag = virXMLPropString(cur, "io");
} else if (xmlStrEqual(cur->name, BAD_CAST "readonly")) {
def->readonly = 1;
} else if (xmlStrEqual(cur->name, BAD_CAST "shareable")) {
goto error;
}
+ if (iotag) {
+ if ((def->iomode = virDomainDiskIoTypeFromString(iotag)) < 0 ||
+ def->iomode == VIR_DOMAIN_DISK_IO_DEFAULT) {
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown disk io mode '%s'"), iotag);
+ goto error;
+ }
+ }
+
if (devaddr) {
if (virDomainParseLegacyDeviceAddress(devaddr,
&def->info.addr.pci) < 0) {
VIR_FREE(driverName);
VIR_FREE(cachetag);
VIR_FREE(error_policy);
+ VIR_FREE(iotag);
VIR_FREE(devaddr);
VIR_FREE(serial);
virStorageEncryptionFree(encryption);
const char *bus = virDomainDiskBusTypeToString(def->bus);
const char *cachemode = virDomainDiskCacheTypeToString(def->cachemode);
const char *error_policy = virDomainDiskErrorPolicyTypeToString(def->error_policy);
+ const char *iomode = virDomainDiskIoTypeToString(def->iomode);
if (!type) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected disk cache mode %d"), def->cachemode);
return -1;
}
+ if (!iomode) {
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected disk io mode %d"), def->iomode);
+ return -1;
+ }
virBufferVSprintf(buf,
" <disk type='%s' device='%s'>\n",
virBufferVSprintf(buf, " cache='%s'", cachemode);
if (def->error_policy)
virBufferVSprintf(buf, " error_policy='%s'", error_policy);
+ if (def->iomode)
+ virBufferVSprintf(buf, " io='%s'", iomode);
virBufferVSprintf(buf, "/>\n");
}
char *port;
};
+enum virDomainDiskIo {
+ VIR_DOMAIN_DISK_IO_DEFAULT,
+ VIR_DOMAIN_DISK_IO_NATIVE,
+ VIR_DOMAIN_DISK_IO_THREADS,
+
+ VIR_DOMAIN_DISK_IO_LAST
+};
+
/* Stores the virtual disk configuration */
typedef struct _virDomainDiskDef virDomainDiskDef;
typedef virDomainDiskDef *virDomainDiskDefPtr;
int cachemode;
int error_policy;
int bootIndex;
+ int iomode;
unsigned int readonly : 1;
unsigned int shared : 1;
virDomainDeviceInfo info;
VIR_ENUM_DECL(virDomainDiskCache)
VIR_ENUM_DECL(virDomainDiskErrorPolicy)
VIR_ENUM_DECL(virDomainDiskProtocol)
+VIR_ENUM_DECL(virDomainDiskIo)
VIR_ENUM_DECL(virDomainController)
VIR_ENUM_DECL(virDomainControllerModel)
VIR_ENUM_DECL(virDomainFS)
virDomainDiskDefForeachPath;
virDomainDiskDefFree;
virDomainDiskDeviceTypeToString;
+virDomainDiskErrorPolicyTypeFromString;
virDomainDiskErrorPolicyTypeToString;
virDomainDiskInsert;
virDomainDiskInsertPreAlloced;
+virDomainDiskIoTypeFromString;
+virDomainDiskIoTypeToString;
virDomainDiskRemove;
virDomainDiskTypeFromString;
virDomainDiskTypeToString;