mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
conf: add virtiofs-related elements and attributes
Add more elements for tuning the virtiofsd daemon and the vhost-user-fs device: <driver type='virtiofs' queue='1024' xattr='on'> <binary path='/usr/libexec/virtiofsd'> <cache mode='always'/> <lock posix='off' flock='off'/> </binary> </driver> Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com> Tested-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
ecc6ad6b90
commit
6607933984
@ -3946,7 +3946,11 @@
|
|||||||
<readonly/>
|
<readonly/>
|
||||||
</filesystem>
|
</filesystem>
|
||||||
<filesystem type='mount' accessmode='passthrough'>
|
<filesystem type='mount' accessmode='passthrough'>
|
||||||
<driver type='virtiofs'/>
|
<driver type='virtiofs queue='1024'/>
|
||||||
|
<binary path='/usr/libexec/virtiofsd' xattr='on'>
|
||||||
|
<cache mode='always'/>
|
||||||
|
<lock posix='on' flock='on'/>
|
||||||
|
</binary>
|
||||||
<source dir='/path'/>
|
<source dir='/path'/>
|
||||||
<target dir='mount_tag'/>
|
<target dir='mount_tag'/>
|
||||||
</filesystem>
|
</filesystem>
|
||||||
@ -4073,9 +4077,28 @@
|
|||||||
<a href="#elementsVirtio">Virtio-specific options</a> can also be
|
<a href="#elementsVirtio">Virtio-specific options</a> can also be
|
||||||
set. (<span class="since">Since 3.5.0</span>)
|
set. (<span class="since">Since 3.5.0</span>)
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
For <code>virtiofs</code>, the <code>queue</code> attribute can be used
|
||||||
|
to specify the queue size (i.e. how many requests can the queue fit).
|
||||||
|
(<span class="since">Since 6.2.0</span>)
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
<dt><code>binary</code></dt>
|
||||||
|
<dd>
|
||||||
|
The optional <code>binary</code> element can tune the options for virtiofsd.
|
||||||
|
All of the following attributes and elements are optional.
|
||||||
|
The attribute <code>path</code> can be used to override the path to the daemon.
|
||||||
|
Attribute <code>xattr</code> enables the use of filesystem extended attributes.
|
||||||
|
Caching can be tuned via the <code>cache</code> element, possible <code>mode</code>
|
||||||
|
values being <code>none</code> and <code>always</code>.
|
||||||
|
Locking can be controlled via the <code>lock</code>
|
||||||
|
element - attributes <code>posix</code> and <code>flock</code> both accepting
|
||||||
|
values <code>on</code> or <code>off</code>.
|
||||||
|
(<span class="since">Since 6.2.0</span>)
|
||||||
|
</dd>
|
||||||
|
|
||||||
<dt><code>source</code></dt>
|
<dt><code>source</code></dt>
|
||||||
<dd>
|
<dd>
|
||||||
The resource on the host that is being accessed in the guest. The
|
The resource on the host that is being accessed in the guest. The
|
||||||
|
@ -2500,6 +2500,9 @@
|
|||||||
<optional>
|
<optional>
|
||||||
<ref name="fsDriver"/>
|
<ref name="fsDriver"/>
|
||||||
</optional>
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<ref name="fsBinary"/>
|
||||||
|
</optional>
|
||||||
<interleave>
|
<interleave>
|
||||||
<element name="source">
|
<element name="source">
|
||||||
<attribute name="dir">
|
<attribute name="dir">
|
||||||
@ -2649,12 +2652,57 @@
|
|||||||
<attribute name="type">
|
<attribute name="type">
|
||||||
<value>virtiofs</value>
|
<value>virtiofs</value>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<optional>
|
||||||
|
<attribute name="queue">
|
||||||
|
<ref name="unsignedInt"/>
|
||||||
|
</attribute>
|
||||||
|
</optional>
|
||||||
<ref name='virtioOptions'/>
|
<ref name='virtioOptions'/>
|
||||||
</group>
|
</group>
|
||||||
<empty/>
|
<empty/>
|
||||||
</choice>
|
</choice>
|
||||||
</element>
|
</element>
|
||||||
</define>
|
</define>
|
||||||
|
<define name="fsBinary">
|
||||||
|
<element name="binary">
|
||||||
|
<optional>
|
||||||
|
<attribute name="path">
|
||||||
|
<ref name="absFilePath"/>
|
||||||
|
</attribute>
|
||||||
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<attribute name="xattr">
|
||||||
|
<ref name="virOnOff"/>
|
||||||
|
</attribute>
|
||||||
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<element name="cache">
|
||||||
|
<optional>
|
||||||
|
<attribute name="mode">
|
||||||
|
<choice>
|
||||||
|
<value>none</value>
|
||||||
|
<value>always</value>
|
||||||
|
</choice>
|
||||||
|
</attribute>
|
||||||
|
</optional>
|
||||||
|
</element>
|
||||||
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<element name="lock">
|
||||||
|
<optional>
|
||||||
|
<attribute name="posix">
|
||||||
|
<ref name="virOnOff"/>
|
||||||
|
</attribute>
|
||||||
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<attribute name="flock">
|
||||||
|
<ref name="virOnOff"/>
|
||||||
|
</attribute>
|
||||||
|
</optional>
|
||||||
|
</element>
|
||||||
|
</optional>
|
||||||
|
</element>
|
||||||
|
</define>
|
||||||
|
|
||||||
<define name="interface-network-attributes">
|
<define name="interface-network-attributes">
|
||||||
<attribute name="network">
|
<attribute name="network">
|
||||||
|
@ -501,6 +501,14 @@ VIR_ENUM_IMPL(virDomainFSModel,
|
|||||||
"virtio-non-transitional",
|
"virtio-non-transitional",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
VIR_ENUM_IMPL(virDomainFSCacheMode,
|
||||||
|
VIR_DOMAIN_FS_CACHE_MODE_LAST,
|
||||||
|
"default",
|
||||||
|
"none",
|
||||||
|
"always",
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainNet,
|
VIR_ENUM_IMPL(virDomainNet,
|
||||||
VIR_DOMAIN_NET_TYPE_LAST,
|
VIR_DOMAIN_NET_TYPE_LAST,
|
||||||
"user",
|
"user",
|
||||||
@ -2326,6 +2334,7 @@ void virDomainFSDefFree(virDomainFSDefPtr def)
|
|||||||
virDomainDeviceInfoClear(&def->info);
|
virDomainDeviceInfoClear(&def->info);
|
||||||
VIR_FREE(def->virtio);
|
VIR_FREE(def->virtio);
|
||||||
virObjectUnref(def->privateData);
|
virObjectUnref(def->privateData);
|
||||||
|
VIR_FREE(def->binary);
|
||||||
|
|
||||||
VIR_FREE(def);
|
VIR_FREE(def);
|
||||||
}
|
}
|
||||||
@ -11369,6 +11378,63 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (def->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) {
|
||||||
|
g_autofree char *queue_size = virXPathString("string(./driver/@queue)", ctxt);
|
||||||
|
g_autofree char *binary = virXPathString("string(./binary/@path)", ctxt);
|
||||||
|
g_autofree char *xattr = virXPathString("string(./binary/@xattr)", ctxt);
|
||||||
|
g_autofree char *cache = virXPathString("string(./binary/cache/@mode)", ctxt);
|
||||||
|
g_autofree char *posix_lock = virXPathString("string(./binary/lock/@posix)", ctxt);
|
||||||
|
g_autofree char *flock = virXPathString("string(./binary/lock/@flock)", ctxt);
|
||||||
|
int val;
|
||||||
|
|
||||||
|
if (queue_size && virStrToLong_ull(queue_size, NULL, 10, &def->queue_size) < 0) {
|
||||||
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
|
_("cannot parse queue size '%s' for virtiofs"),
|
||||||
|
queue_size);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (binary)
|
||||||
|
def->binary = virFileSanitizePath(binary);
|
||||||
|
|
||||||
|
if (xattr) {
|
||||||
|
if ((val = virTristateSwitchTypeFromString(xattr)) <= 0) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("unknown xattr value '%s'"), xattr);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
def->xattr = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cache) {
|
||||||
|
if ((val = virDomainFSCacheModeTypeFromString(cache)) <= 0) {
|
||||||
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
|
_("cannot parse cache mode '%s' for virtiofs"),
|
||||||
|
cache);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
def->cache = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (posix_lock) {
|
||||||
|
if ((val = virTristateSwitchTypeFromString(posix_lock)) <= 0) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("unknown posix lock value '%s'"), posix_lock);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
def->posix_lock = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flock) {
|
||||||
|
if ((val = virTristateSwitchTypeFromString(flock)) <= 0) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("unknown flock value '%s'"), flock);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
def->flock = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (format) {
|
if (format) {
|
||||||
if ((def->format = virStorageFileFormatTypeFromString(format)) <= 0) {
|
if ((def->format = virStorageFileFormatTypeFromString(format)) <= 0) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
@ -25206,6 +25272,9 @@ virDomainFSDefFormat(virBufferPtr buf,
|
|||||||
const char *wrpolicy = virDomainFSWrpolicyTypeToString(def->wrpolicy);
|
const char *wrpolicy = virDomainFSWrpolicyTypeToString(def->wrpolicy);
|
||||||
const char *src = def->src->path;
|
const char *src = def->src->path;
|
||||||
g_auto(virBuffer) driverAttrBuf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) driverAttrBuf = VIR_BUFFER_INITIALIZER;
|
||||||
|
g_auto(virBuffer) driverBuf = VIR_BUFFER_INIT_CHILD(buf);
|
||||||
|
g_auto(virBuffer) binaryAttrBuf = VIR_BUFFER_INITIALIZER;
|
||||||
|
g_auto(virBuffer) binaryBuf = VIR_BUFFER_INIT_CHILD(buf);
|
||||||
|
|
||||||
if (!type) {
|
if (!type) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -25229,6 +25298,8 @@ virDomainFSDefFormat(virBufferPtr buf,
|
|||||||
virBufferAddLit(buf, ">\n");
|
virBufferAddLit(buf, ">\n");
|
||||||
|
|
||||||
virBufferAdjustIndent(buf, 2);
|
virBufferAdjustIndent(buf, 2);
|
||||||
|
virBufferAdjustIndent(&driverBuf, 2);
|
||||||
|
virBufferAdjustIndent(&binaryBuf, 2);
|
||||||
if (def->fsdriver) {
|
if (def->fsdriver) {
|
||||||
virBufferAsprintf(&driverAttrBuf, " type='%s'", fsdriver);
|
virBufferAsprintf(&driverAttrBuf, " type='%s'", fsdriver);
|
||||||
|
|
||||||
@ -25240,11 +25311,42 @@ virDomainFSDefFormat(virBufferPtr buf,
|
|||||||
if (def->wrpolicy)
|
if (def->wrpolicy)
|
||||||
virBufferAsprintf(&driverAttrBuf, " wrpolicy='%s'", wrpolicy);
|
virBufferAsprintf(&driverAttrBuf, " wrpolicy='%s'", wrpolicy);
|
||||||
|
|
||||||
|
if (def->queue_size)
|
||||||
|
virBufferAsprintf(&driverAttrBuf, " queue='%llu'", def->queue_size);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (def->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) {
|
||||||
|
g_auto(virBuffer) lockAttrBuf = VIR_BUFFER_INITIALIZER;
|
||||||
|
virBufferEscapeString(&binaryAttrBuf, " path='%s'", def->binary);
|
||||||
|
|
||||||
|
if (def->xattr != VIR_TRISTATE_SWITCH_ABSENT) {
|
||||||
|
virBufferAsprintf(&binaryAttrBuf, " xattr='%s'",
|
||||||
|
virTristateSwitchTypeToString(def->xattr));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (def->cache != VIR_DOMAIN_FS_CACHE_MODE_DEFAULT) {
|
||||||
|
virBufferAsprintf(&binaryBuf, "<cache mode='%s'/>\n",
|
||||||
|
virDomainFSCacheModeTypeToString(def->cache));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (def->posix_lock != VIR_TRISTATE_SWITCH_ABSENT) {
|
||||||
|
virBufferAsprintf(&lockAttrBuf, " posix='%s'",
|
||||||
|
virTristateSwitchTypeToString(def->posix_lock));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (def->flock != VIR_TRISTATE_SWITCH_ABSENT) {
|
||||||
|
virBufferAsprintf(&lockAttrBuf, " flock='%s'",
|
||||||
|
virTristateSwitchTypeToString(def->flock));
|
||||||
|
}
|
||||||
|
|
||||||
|
virXMLFormatElement(&binaryBuf, "lock", &lockAttrBuf, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
virDomainVirtioOptionsFormat(&driverAttrBuf, def->virtio);
|
virDomainVirtioOptionsFormat(&driverAttrBuf, def->virtio);
|
||||||
|
|
||||||
virXMLFormatElement(buf, "driver", &driverAttrBuf, NULL);
|
virXMLFormatElement(buf, "driver", &driverAttrBuf, &driverBuf);
|
||||||
|
virXMLFormatElement(buf, "binary", &binaryAttrBuf, &binaryBuf);
|
||||||
|
|
||||||
switch (def->type) {
|
switch (def->type) {
|
||||||
case VIR_DOMAIN_FS_TYPE_MOUNT:
|
case VIR_DOMAIN_FS_TYPE_MOUNT:
|
||||||
|
@ -805,6 +805,14 @@ typedef enum {
|
|||||||
VIR_DOMAIN_FS_MODEL_LAST
|
VIR_DOMAIN_FS_MODEL_LAST
|
||||||
} virDomainFSModel;
|
} virDomainFSModel;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
VIR_DOMAIN_FS_CACHE_MODE_DEFAULT = 0,
|
||||||
|
VIR_DOMAIN_FS_CACHE_MODE_NONE,
|
||||||
|
VIR_DOMAIN_FS_CACHE_MODE_ALWAYS,
|
||||||
|
|
||||||
|
VIR_DOMAIN_FS_CACHE_MODE_LAST
|
||||||
|
} virDomainFSCacheMode;
|
||||||
|
|
||||||
struct _virDomainFSDef {
|
struct _virDomainFSDef {
|
||||||
int type;
|
int type;
|
||||||
int fsdriver; /* enum virDomainFSDriverType */
|
int fsdriver; /* enum virDomainFSDriverType */
|
||||||
@ -820,6 +828,12 @@ struct _virDomainFSDef {
|
|||||||
unsigned long long space_hard_limit; /* in bytes */
|
unsigned long long space_hard_limit; /* in bytes */
|
||||||
unsigned long long space_soft_limit; /* in bytes */
|
unsigned long long space_soft_limit; /* in bytes */
|
||||||
bool symlinksResolved;
|
bool symlinksResolved;
|
||||||
|
char *binary;
|
||||||
|
unsigned long long queue_size;
|
||||||
|
virTristateSwitch xattr;
|
||||||
|
virDomainFSCacheMode cache;
|
||||||
|
virTristateSwitch posix_lock;
|
||||||
|
virTristateSwitch flock;
|
||||||
virDomainVirtioOptionsPtr virtio;
|
virDomainVirtioOptionsPtr virtio;
|
||||||
virObjectPtr privateData;
|
virObjectPtr privateData;
|
||||||
};
|
};
|
||||||
@ -3451,6 +3465,7 @@ VIR_ENUM_DECL(virDomainFSDriver);
|
|||||||
VIR_ENUM_DECL(virDomainFSAccessMode);
|
VIR_ENUM_DECL(virDomainFSAccessMode);
|
||||||
VIR_ENUM_DECL(virDomainFSWrpolicy);
|
VIR_ENUM_DECL(virDomainFSWrpolicy);
|
||||||
VIR_ENUM_DECL(virDomainFSModel);
|
VIR_ENUM_DECL(virDomainFSModel);
|
||||||
|
VIR_ENUM_DECL(virDomainFSCacheMode);
|
||||||
VIR_ENUM_DECL(virDomainNet);
|
VIR_ENUM_DECL(virDomainNet);
|
||||||
VIR_ENUM_DECL(virDomainNetBackend);
|
VIR_ENUM_DECL(virDomainNetBackend);
|
||||||
VIR_ENUM_DECL(virDomainNetVirtioTxMode);
|
VIR_ENUM_DECL(virDomainNetVirtioTxMode);
|
||||||
|
@ -395,6 +395,7 @@ virDomainDiskSourceFormat;
|
|||||||
virDomainDiskTranslateSourcePool;
|
virDomainDiskTranslateSourcePool;
|
||||||
virDomainFeatureTypeFromString;
|
virDomainFeatureTypeFromString;
|
||||||
virDomainFeatureTypeToString;
|
virDomainFeatureTypeToString;
|
||||||
|
virDomainFSCacheModeTypeToString;
|
||||||
virDomainFSDefFree;
|
virDomainFSDefFree;
|
||||||
virDomainFSDefNew;
|
virDomainFSDefNew;
|
||||||
virDomainFSDriverTypeToString;
|
virDomainFSDriverTypeToString;
|
||||||
|
@ -27,7 +27,11 @@
|
|||||||
<controller type='usb' index='0' model='none'/>
|
<controller type='usb' index='0' model='none'/>
|
||||||
<controller type='pci' index='0' model='pci-root'/>
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<filesystem type='mount' accessmode='passthrough'>
|
<filesystem type='mount' accessmode='passthrough'>
|
||||||
<driver type='virtiofs'/>
|
<driver type='virtiofs' queue='1024'/>
|
||||||
|
<binary path='/usr/libexec/virtiofsd' xattr='on'>
|
||||||
|
<cache mode='always'/>
|
||||||
|
<lock posix='off' flock='off'/>
|
||||||
|
</binary>
|
||||||
<source dir='/path'/>
|
<source dir='/path'/>
|
||||||
<target dir='mount_tag'/>
|
<target dir='mount_tag'/>
|
||||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
</controller>
|
</controller>
|
||||||
<filesystem type='mount' accessmode='passthrough'>
|
<filesystem type='mount' accessmode='passthrough'>
|
||||||
<driver type='virtiofs'/>
|
<driver type='virtiofs'/>
|
||||||
|
<binary path='/usr/libexec/virtiofsd'/>
|
||||||
<source dir='/path'/>
|
<source dir='/path'/>
|
||||||
<target dir='mount_tag'/>
|
<target dir='mount_tag'/>
|
||||||
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
|
||||||
|
Loading…
Reference in New Issue
Block a user