mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
storage: treat 'aio' like 'raw' at parse time
We have historically allowed 'aio' as a synonym for 'raw' for back-compat to xen, but since a future patch will move to using an enum value, we have to pick one to be our preferred output name. This is a slight change in the output XML, but the sexpr and xm outputs should still be identical, and the input XML can still use either form. * src/conf/domain_conf.c (virDomainDiskDefForeachPath): Move aio back-compat... (virDomainDiskDefParseXML): ...to parse time. * src/xenxs/xen_sxpr.c (xenParseSxprDisks, xenFormatSxprDisk): ...and to output time. * src/xenxs/xen_xm.c (xenParseXM, xenFormatXMDisk): Likewise. * tests/sexpr2xmldata/sexpr2xml-*.xml: Update tests.
This commit is contained in:
parent
f772b3d91f
commit
41e0edaf84
@ -3728,6 +3728,12 @@ virDomainDiskDefParseXML(virCapsPtr caps,
|
||||
xmlStrEqual(cur->name, BAD_CAST "driver")) {
|
||||
driverName = virXMLPropString(cur, "name");
|
||||
driverType = virXMLPropString(cur, "type");
|
||||
if (STREQ_NULLABLE(driverType, "aio")) {
|
||||
/* In-place conversion to "raw", for Xen back-compat */
|
||||
driverType[0] = 'r';
|
||||
driverType[1] = 'a';
|
||||
driverType[2] = 'w';
|
||||
}
|
||||
cachetag = virXMLPropString(cur, "cache");
|
||||
error_policy = virXMLPropString(cur, "error_policy");
|
||||
rerror_policy = virXMLPropString(cur, "rerror_policy");
|
||||
@ -14844,8 +14850,6 @@ int virDomainDiskDefForeachPath(virDomainDiskDefPtr disk,
|
||||
|
||||
if (disk->driverType) {
|
||||
const char *formatStr = disk->driverType;
|
||||
if (STREQ(formatStr, "aio"))
|
||||
formatStr = "raw"; /* Xen compat */
|
||||
|
||||
if ((format = virStorageFileFormatTypeFromString(formatStr)) <= 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
|
@ -443,6 +443,12 @@ xenParseSxprDisks(virDomainDefPtr def,
|
||||
src);
|
||||
goto error;
|
||||
}
|
||||
if (STREQ(disk->driverType, "aio")) {
|
||||
/* In-place conversion to "raw" */
|
||||
disk->driverType[0] = 'r';
|
||||
disk->driverType[1] = 'a';
|
||||
disk->driverType[2] = 'w';
|
||||
}
|
||||
|
||||
src = offset + 1;
|
||||
/* Its possible to use blktap driver for block devs
|
||||
@ -1831,9 +1837,11 @@ xenFormatSxprDisk(virDomainDiskDefPtr def,
|
||||
if (def->driverName) {
|
||||
if (STREQ(def->driverName, "tap") ||
|
||||
STREQ(def->driverName, "tap2")) {
|
||||
const char *type = def->driverType ? def->driverType : "aio";
|
||||
if (STREQ(type, "raw"))
|
||||
type = "aio";
|
||||
virBufferEscapeSexpr(buf, "(uname '%s:", def->driverName);
|
||||
virBufferEscapeSexpr(buf, "%s:",
|
||||
def->driverType ? def->driverType : "aio");
|
||||
virBufferEscapeSexpr(buf, "%s:", type);
|
||||
virBufferEscapeSexpr(buf, "%s')", def->src);
|
||||
} else {
|
||||
virBufferEscapeSexpr(buf, "(uname '%s:", def->driverName);
|
||||
|
@ -566,6 +566,12 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
|
||||
disk->src);
|
||||
goto cleanup;
|
||||
}
|
||||
if (STREQ(disk->driverType, "aio")) {
|
||||
/* In-place conversion to "raw" */
|
||||
disk->driverType[0] = 'r';
|
||||
disk->driverType[1] = 'a';
|
||||
disk->driverType[2] = 'w';
|
||||
}
|
||||
|
||||
/* Strip the prefix we found off the source file name */
|
||||
memmove(disk->src, disk->src+(tmp-disk->src)+1,
|
||||
@ -1203,9 +1209,12 @@ static int xenFormatXMDisk(virConfValuePtr list,
|
||||
|
||||
if(disk->src) {
|
||||
if (disk->driverName) {
|
||||
const char *type = disk->driverType ? disk->driverType : "aio";
|
||||
if (STREQ(type, "raw"))
|
||||
type = "aio";
|
||||
virBufferAsprintf(&buf, "%s:", disk->driverName);
|
||||
if (STREQ(disk->driverName, "tap"))
|
||||
virBufferAsprintf(&buf, "%s:", disk->driverType ? disk->driverType : "aio");
|
||||
virBufferAsprintf(&buf, "%s:", type);
|
||||
} else {
|
||||
switch (disk->type) {
|
||||
case VIR_DOMAIN_DISK_TYPE_FILE:
|
||||
|
@ -17,7 +17,7 @@
|
||||
<on_crash>restart</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='tap' type='aio'/>
|
||||
<driver name='tap' type='raw'/>
|
||||
<source file='/xen/rhel5.img'/>
|
||||
<target dev='xvda' bus='xen'/>
|
||||
</disk>
|
||||
|
@ -14,7 +14,7 @@
|
||||
<on_crash>restart</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='tap' type='aio'/>
|
||||
<driver name='tap' type='raw'/>
|
||||
<source file='/var/lib/xen/images/rhel5pv.img'/>
|
||||
<target dev='xvda' bus='xen'/>
|
||||
<shareable/>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='tap' type='aio'/>
|
||||
<driver name='tap' type='raw'/>
|
||||
<source file='/root/some.img'/>
|
||||
<target dev='xvda' bus='xen'/>
|
||||
</disk>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='tap2' type='aio'/>
|
||||
<driver name='tap2' type='raw'/>
|
||||
<source file='/root/some.img'/>
|
||||
<target dev='xvda' bus='xen'/>
|
||||
</disk>
|
||||
|
Loading…
Reference in New Issue
Block a user