|
|
fbe740 |
From f9fdeb29a61a98868d1a9f5284a85c57f826d6d1 Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <f9fdeb29a61a98868d1a9f5284a85c57f826d6d1@dist-git>
|
|
|
fbe740 |
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
|
fbe740 |
Date: Fri, 13 Mar 2020 13:08:08 +0100
|
|
|
fbe740 |
Subject: [PATCH] conf: do not generate machine names ending with a dash
|
|
|
fbe740 |
MIME-Version: 1.0
|
|
|
fbe740 |
Content-Type: text/plain; charset=UTF-8
|
|
|
fbe740 |
Content-Transfer-Encoding: 8bit
|
|
|
fbe740 |
|
|
|
fbe740 |
As of systemd commit:
|
|
|
fbe740 |
|
|
|
fbe740 |
commit d65652f1f21a4b0c59711320f34266c635393c89
|
|
|
fbe740 |
Author: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
|
|
|
fbe740 |
CommitDate: 2018-12-10 09:56:56 +0100
|
|
|
fbe740 |
|
|
|
fbe740 |
Partially unify hostname_is_valid() and dns_name_is_valid()
|
|
|
fbe740 |
|
|
|
fbe740 |
Dashes are no longer allowed at the end of machine names.
|
|
|
fbe740 |
|
|
|
fbe740 |
Trim the trailing dashes from the generated name before passing
|
|
|
fbe740 |
it to machined.
|
|
|
fbe740 |
|
|
|
fbe740 |
Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1790409
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Erik Skultety <eskultet@redhat.com>
|
|
|
fbe740 |
(cherry picked from commit 45464db8ba502764cf37ec9335770248bdb3d9a8)
|
|
|
fbe740 |
|
|
|
fbe740 |
Prerequisite for: https://bugzilla.redhat.com/show_bug.cgi?id=1808499
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
fbe740 |
Message-Id: <ae17f80d69ee7772d32dd5c34c332be6b77e7afb.1584101247.git.mprivozn@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
---
|
|
|
fbe740 |
src/conf/domain_conf.c | 3 +++
|
|
|
fbe740 |
tests/virsystemdtest.c | 4 ++++
|
|
|
fbe740 |
2 files changed, 7 insertions(+)
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
fbe740 |
index 77e3d25a2d..4b297c96bc 100644
|
|
|
fbe740 |
--- a/src/conf/domain_conf.c
|
|
|
fbe740 |
+++ b/src/conf/domain_conf.c
|
|
|
fbe740 |
@@ -30708,6 +30708,9 @@ virDomainMachineNameAppendValid(virBufferPtr buf,
|
|
|
fbe740 |
|
|
|
fbe740 |
virBufferAddChar(buf, *name);
|
|
|
fbe740 |
}
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ /* trailing dashes are not allowed */
|
|
|
fbe740 |
+ virBufferTrimChars(buf, "-");
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
#undef HOSTNAME_CHARS
|
|
|
fbe740 |
diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c
|
|
|
fbe740 |
index 9b95ca6789..26876850b8 100644
|
|
|
fbe740 |
--- a/tests/virsystemdtest.c
|
|
|
fbe740 |
+++ b/tests/virsystemdtest.c
|
|
|
fbe740 |
@@ -740,6 +740,10 @@ mymain(void)
|
|
|
fbe740 |
"qemu-7-123456789012345678901234567890123456789012345678901234567");
|
|
|
fbe740 |
TEST_MACHINE("123456789012345678901234567890123456789012345678901234567890", 8,
|
|
|
fbe740 |
"qemu-8-123456789012345678901234567890123456789012345678901234567");
|
|
|
fbe740 |
+ TEST_MACHINE("kstest-network-device-default-httpks_(c9eed63e-981e-48ec-acdc-56b3f8c5f678)", 100,
|
|
|
fbe740 |
+ "qemu-100-kstest-network-device-default-httpksc9eed63e-981e-48ec");
|
|
|
fbe740 |
+ TEST_MACHINE("kstest-network-device-default-httpks_(c9eed63e-981e-48ec--cdc-56b3f8c5f678)", 10,
|
|
|
fbe740 |
+ "qemu-10-kstest-network-device-default-httpksc9eed63e-981e-48ec");
|
|
|
fbe740 |
|
|
|
fbe740 |
# define TESTS_PM_SUPPORT_HELPER(name, function) \
|
|
|
fbe740 |
do { \
|
|
|
fbe740 |
--
|
|
|
fbe740 |
2.25.1
|
|
|
fbe740 |
|