Objects such as domain, pool, etc re-define the regex for the format.
Add more generic types for objects with/without a slash which we'll be
able to reuse also for other objects.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
docs/schemas/basictypes.rng | 13 +++++++++++++
docs/schemas/domaincommon.rng | 17 +++++------------
docs/schemas/storagecommon.rng | 6 ------
docs/schemas/storagepool.rng | 4 ++--
4 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
index fc52799466..a221ff6295 100644
--- a/docs/schemas/basictypes.rng
+++ b/docs/schemas/basictypes.rng
@@ -261,6 +261,19 @@
</choice>
</define>
+ <!-- objectName represents any generic string for naming objects like domain -->
+ <define name="objectNameWithSlash">
+ <data type="string">
+ <param name="pattern">[^\n]+</param>
+ </data>
+ </define>
+
+ <define name="objectName">
+ <data type="string">
+ <param name="pattern">[^/\n]+</param>
+ </data>
+ </define>
+
<define name="genericName">
<data type="string">
<param name="pattern">[a-zA-Z0-9_\+\-]+</param>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 39bed92115..4fc6a7ee7a 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -18,9 +18,7 @@
<define name="title">
<element name="title">
- <data type="string">
- <param name="pattern">[^\n]+</param>
- </data>
+ <ref name="objectNameWithSlash"/>
</element>
</define>
@@ -559,7 +557,7 @@
</optional>
<interleave>
<element name="name">
- <ref name="domainName"/>
+ <ref name="objectNameWithSlash"/>
</element>
<optional>
<element name="uuid">
@@ -1391,7 +1389,7 @@
<optional>
<element name="backenddomain">
<attribute name="name">
- <ref name="domainName"/>
+ <ref name="objectNameWithSlash"/>
</attribute>
<empty/>
</element>
@@ -2056,7 +2054,7 @@
<element name="source">
<interleave>
<attribute name="pool">
- <ref name="poolName"/>
+ <ref name="objectName"/>
</attribute>
<attribute name="volume">
<ref name="volName"/>
@@ -3269,7 +3267,7 @@
<optional>
<element name="backenddomain">
<attribute name="name">
- <ref name="domainName"/>
+ <ref name="objectNameWithSlash"/>
</attribute>
<empty/>
</element>
@@ -6944,11 +6942,6 @@
<param name="maxInclusive">1000</param>
</data>
</define>
- <define name="domainName">
- <data type="string">
- <param name="pattern">[^\n]+</param>
- </data>
- </define>
<define name="diskSerial">
<data type="string">
<param name="pattern">[A-Za-z0-9_\.\+\- ]+</param>
diff --git a/docs/schemas/storagecommon.rng b/docs/schemas/storagecommon.rng
index 54619d4cb0..e3d08a8410 100644
--- a/docs/schemas/storagecommon.rng
+++ b/docs/schemas/storagecommon.rng
@@ -6,12 +6,6 @@
<!-- This schema is not designed for standalone use; another file
must include both this file and basictypes.rng -->
- <define name="poolName">
- <data type="string">
- <param name="pattern">[^/\n]+</param>
- </data>
- </define>
-
<define name="encryption">
<element name="encryption">
<attribute name="format">
diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng
index a87d22f6fc..bd24b8b8d0 100644
--- a/docs/schemas/storagepool.rng
+++ b/docs/schemas/storagepool.rng
@@ -247,7 +247,7 @@
<interleave>
<optional>
<element name="name">
- <ref name="poolName"/>
+ <ref name="objectName"/>
</element>
</optional>
<optional>
@@ -261,7 +261,7 @@
<define name="commonmetadata">
<interleave>
<element name="name">
- <ref name="poolName"/>
+ <ref name="objectName"/>
</element>
<optional>
<element name="uuid">
--
2.29.2
On a Wednesday in 2021, Peter Krempa wrote:
>Objects such as domain, pool, etc re-define the regex for the format.
>Add more generic types for objects with/without a slash which we'll be
>able to reuse also for other objects.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> docs/schemas/basictypes.rng | 13 +++++++++++++
> docs/schemas/domaincommon.rng | 17 +++++------------
> docs/schemas/storagecommon.rng | 6 ------
> docs/schemas/storagepool.rng | 4 ++--
> 4 files changed, 20 insertions(+), 20 deletions(-)
>
>diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
>index fc52799466..a221ff6295 100644
>--- a/docs/schemas/basictypes.rng
>+++ b/docs/schemas/basictypes.rng
>@@ -261,6 +261,19 @@
> </choice>
> </define>
>
>+ <!-- objectName represents any generic string for naming objects like domain -->
>+ <define name="objectNameWithSlash">
>+ <data type="string">
>+ <param name="pattern">[^\n]+</param>
>+ </data>
>+ </define>
>+
>+ <define name="objectName">
>+ <data type="string">
>+ <param name="pattern">[^/\n]+</param>
>+ </data>
>+ </define>
>+
> <define name="genericName">
> <data type="string">
> <param name="pattern">[a-zA-Z0-9_\+\-]+</param>
>diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
>index 39bed92115..4fc6a7ee7a 100644
>--- a/docs/schemas/domaincommon.rng
>+++ b/docs/schemas/domaincommon.rng
>@@ -18,9 +18,7 @@
>
> <define name="title">
> <element name="title">
>- <data type="string">
>- <param name="pattern">[^\n]+</param>
>- </data>
>+ <ref name="objectNameWithSlash"/>
> </element>
> </define>
>
>@@ -559,7 +557,7 @@
> </optional>
> <interleave>
> <element name="name">
>- <ref name="domainName"/>
>+ <ref name="objectNameWithSlash"/>
This is the domain name and cannot contain a slash.
> </element>
> <optional>
> <element name="uuid">
>@@ -1391,7 +1389,7 @@
> <optional>
> <element name="backenddomain">
> <attribute name="name">
>- <ref name="domainName"/>
>+ <ref name="objectNameWithSlash"/>
Added by:
conf: support backend domain name in disk and network devices
At least Xen supports backend drivers in another domain (aka "driver
domain"). This patch introduces an XML config option for specifying the
backend domain name for <disk> and <interface> devices. E.g.
<disk>
<backenddomain name='diskvm'/>
...
</disk>
<interface type='bridge'>
<backenddomain name='netvm'/>
...
</interface>
I see no need to relax this to allow a slash.
> </attribute>
> <empty/>
> </element>
>@@ -2056,7 +2054,7 @@
> <element name="source">
> <interleave>
> <attribute name="pool">
>- <ref name="poolName"/>
>+ <ref name="objectName"/>
> </attribute>
> <attribute name="volume">
> <ref name="volName"/>
>@@ -3269,7 +3267,7 @@
> <optional>
> <element name="backenddomain">
> <attribute name="name">
>- <ref name="domainName"/>
>+ <ref name="objectNameWithSlash"/>
Same here.
> </attribute>
> <empty/>
> </element>
>@@ -6944,11 +6942,6 @@
> <param name="maxInclusive">1000</param>
> </data>
> </define>
>- <define name="domainName">
>- <data type="string">
>- <param name="pattern">[^\n]+</param>
>- </data>
>- </define>
> <define name="diskSerial">
> <data type="string">
> <param name="pattern">[A-Za-z0-9_\.\+\- ]+</param>
Jano
On Wed, Jan 06, 2021 at 21:59:21 +0100, Ján Tomko wrote: > On a Wednesday in 2021, Peter Krempa wrote: > > Objects such as domain, pool, etc re-define the regex for the format. > > Add more generic types for objects with/without a slash which we'll be > > able to reuse also for other objects. > > > > Signed-off-by: Peter Krempa <pkrempa@redhat.com> > > --- > > docs/schemas/basictypes.rng | 13 +++++++++++++ > > docs/schemas/domaincommon.rng | 17 +++++------------ > > docs/schemas/storagecommon.rng | 6 ------ > > docs/schemas/storagepool.rng | 4 ++-- > > 4 files changed, 20 insertions(+), 20 deletions(-) [...] > > diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng > > index 39bed92115..4fc6a7ee7a 100644 > > --- a/docs/schemas/domaincommon.rng > > +++ b/docs/schemas/domaincommon.rng [...] > > @@ -559,7 +557,7 @@ > > </optional> > > <interleave> > > <element name="name"> > > - <ref name="domainName"/> > > + <ref name="objectNameWithSlash"/> > > This is the domain name and cannot contain a slash. This is not true entirely. The check in the code that enforces that '/' is not in the domain name is conditional. It's based on the VIR_DOMAIN_DEF_FEATURE_NAME_SLASH flag being asserted by the hypervisors which don't refuse slash in domain name. The following drivers use it: src/openvz/openvz_conf.c: .features = VIR_DOMAIN_DEF_FEATURE_NAME_SLASH, src/vbox/vbox_common.c: .features = VIR_DOMAIN_DEF_FEATURE_NAME_SLASH, src/vmx/vmx.c: VIR_DOMAIN_DEF_FEATURE_NAME_SLASH | > > </element> > > <optional> > > <element name="uuid"> > > @@ -1391,7 +1389,7 @@ > > <optional> > > <element name="backenddomain"> > > <attribute name="name"> > > - <ref name="domainName"/> > > + <ref name="objectNameWithSlash"/> > > Added by: > > conf: support backend domain name in disk and network devices > > At least Xen supports backend drivers in another domain (aka "driver > domain"). This patch introduces an XML config option for specifying the > backend domain name for <disk> and <interface> devices. E.g. > > <disk> > <backenddomain name='diskvm'/> > ... > </disk> > <interface type='bridge'> > <backenddomain name='netvm'/> > ... > </interface> > > I see no need to relax this to allow a slash. This isn't relaxing it, but merely keeping it as it was, since 'domainName' rng type allows slash. On the other hand, nothing actually uses 'backenddomain', so we can use the stricter version without any problem. > > > </attribute> > > <empty/> > > </element>
On a Thursday in 2021, Peter Krempa wrote:
>On Wed, Jan 06, 2021 at 21:59:21 +0100, Ján Tomko wrote:
>> On a Wednesday in 2021, Peter Krempa wrote:
>> > Objects such as domain, pool, etc re-define the regex for the format.
>> > Add more generic types for objects with/without a slash which we'll be
>> > able to reuse also for other objects.
>> >
>> > Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>> > ---
>> > docs/schemas/basictypes.rng | 13 +++++++++++++
>> > docs/schemas/domaincommon.rng | 17 +++++------------
>> > docs/schemas/storagecommon.rng | 6 ------
>> > docs/schemas/storagepool.rng | 4 ++--
>> > 4 files changed, 20 insertions(+), 20 deletions(-)
>
>[...]
>
>> > diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
>> > index 39bed92115..4fc6a7ee7a 100644
>> > --- a/docs/schemas/domaincommon.rng
>> > +++ b/docs/schemas/domaincommon.rng
>
>[...]
>
>> > @@ -559,7 +557,7 @@
>> > </optional>
>> > <interleave>
>> > <element name="name">
>> > - <ref name="domainName"/>
>> > + <ref name="objectNameWithSlash"/>
>>
>> This is the domain name and cannot contain a slash.
>
>This is not true entirely. The check in the code that enforces that '/'
>is not in the domain name is conditional.
>
Right, I did not realize that.
>It's based on the VIR_DOMAIN_DEF_FEATURE_NAME_SLASH flag being asserted
>by the hypervisors which don't refuse slash in domain name. The
>following drivers use it:
>
>src/openvz/openvz_conf.c: .features = VIR_DOMAIN_DEF_FEATURE_NAME_SLASH,
>src/vbox/vbox_common.c: .features = VIR_DOMAIN_DEF_FEATURE_NAME_SLASH,
>src/vmx/vmx.c: VIR_DOMAIN_DEF_FEATURE_NAME_SLASH |
>
>
>> > </element>
>> > <optional>
>> > <element name="uuid">
>> > @@ -1391,7 +1389,7 @@
>> > <optional>
>> > <element name="backenddomain">
>> > <attribute name="name">
>> > - <ref name="domainName"/>
>> > + <ref name="objectNameWithSlash"/>
>>
>> Added by:
>>
>> conf: support backend domain name in disk and network devices
>>
>> At least Xen supports backend drivers in another domain (aka "driver
>> domain"). This patch introduces an XML config option for specifying the
>> backend domain name for <disk> and <interface> devices. E.g.
>>
>> <disk>
>> <backenddomain name='diskvm'/>
>> ...
>> </disk>
>> <interface type='bridge'>
>> <backenddomain name='netvm'/>
>> ...
>> </interface>
>>
>> I see no need to relax this to allow a slash.
>
>This isn't relaxing it, but merely keeping it as it was, since
>'domainName' rng type allows slash.
>
>On the other hand, nothing actually uses 'backenddomain', so we can use
>the stricter version without any problem.
>
it is passed to libxl:
src/libxl/libxl_conf.c: if (l_disk->domain_name) {
src/libxl/libxl_conf.c: x_disk->backend_domname = g_strdup(l_disk->domain_name);
src/libxl/libxl_conf.c: if (l_nic->domain_name) {
src/libxl/libxl_conf.c: x_nic->backend_domname = g_strdup(l_nic->domain_name);
Jano
>>
>> > </attribute>
>> > <empty/>
>> > </element>
© 2016 - 2026 Red Hat, Inc.