src/conf/domain_conf.c | 4 ++-- tests/virsystemdtest.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
According to the linked BZ, machined expects either valid
hostname or valid FQDN. While in case of multiple dots, a
trailing one doesn't violate FQDN, it does violate the rule in
case of something simple, like "domain.". But it's safe to remove
it in both cases.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1721804
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_conf.c | 4 ++--
tests/virsystemdtest.c | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 17867eeece..9371153618 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -30838,8 +30838,8 @@ virDomainMachineNameAppendValid(virBufferPtr buf,
virBufferAddChar(buf, *name);
}
- /* trailing dashes are not allowed */
- virBufferTrimChars(buf, "-");
+ /* trailing dashes or dots are not allowed */
+ virBufferTrimChars(buf, "-.");
}
#undef HOSTNAME_CHARS
diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c
index b7dfd64d06..9847f255ac 100644
--- a/tests/virsystemdtest.c
+++ b/tests/virsystemdtest.c
@@ -744,6 +744,7 @@ mymain(void)
"qemu-100-kstest-network-device-default-httpksc9eed63e-981e-48ec");
TEST_MACHINE("kstest-network-device-default-httpks_(c9eed63e-981e-48ec--cdc-56b3f8c5f678)", 10,
"qemu-10-kstest-network-device-default-httpksc9eed63e-981e-48ec");
+ TEST_MACHINE("demo.test.", 11, "qemu-11-demo.test");
# define TESTS_PM_SUPPORT_HELPER(name, function) \
do { \
--
2.24.1
On 2/28/20 5:22 PM, Michal Privoznik wrote: > According to the linked BZ, machined expects either valid > hostname or valid FQDN. While in case of multiple dots, a > trailing one doesn't violate FQDN, it does violate the rule in > case of something simple, like "domain.". But it's safe to remove > it in both cases. > > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1721804 In the end, I've cloned the bug. The new URL is: https://bugzilla.redhat.com/show_bug.cgi?id=1808499 Fixed locally. Michal
s/with a dot/ending with a dot/ in the summary? On a Friday in 2020, Michal Privoznik wrote: >According to the linked BZ, machined expects either valid >hostname or valid FQDN. While in case of multiple dots, a >trailing one doesn't violate FQDN, it does violate the rule in >case of something simple, like "domain.". But it's safe to remove >it in both cases. > Please mention my libvirt commit 45464db8ba502764cf37ec9335770248bdb3d9a8 and systemd commit d65652f1f21a4b0c59711320f34266c635393c89 here. >Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1721804 > >Signed-off-by: Michal Privoznik <mprivozn@redhat.com> >--- > src/conf/domain_conf.c | 4 ++-- > tests/virsystemdtest.c | 1 + > 2 files changed, 3 insertions(+), 2 deletions(-) If you care about all the possible use cases: * the above-mentioned systemd commit also forbids hyphens on either side of a dot * even before that commit, leading dots were not allowed Using any of the above (including the trailing dot which this commit fixes) is equally odd to me. (unlike the quick fix I did for the dashes, which were a result of libvirt cutting of sensible UUIDs in half) So even after this patch libvirt is able to generate invalid machines. names. I simply do not care. Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
© 2016 - 2024 Red Hat, Inc.