Add MSVSphere support

i9-beta changed/i9-beta/cloud-init-23.1.1-11.el9.inferit
Sergey Cherevko 1 year ago
parent dad26ce57f
commit 8c73068a9d
Signed by: scherevko
GPG Key ID: D87CBBC16D2E4A72

@ -0,0 +1,685 @@
From 4849336bdd183b8e712b0d44b0be3745561dc907 Mon Sep 17 00:00:00 2001
From: Sergey Cherevko <s.cherevko@msvsphere-os.ru>
Date: Fri, 6 Oct 2023 16:54:42 +0300
Subject: [PATCH] Add MSVSphere support
---
README.md | 2 +-
cloudinit/config/cc_ca_certs.py | 8 ++++
cloudinit/config/cc_ntp.py | 9 ++++
cloudinit/config/cc_yum_add_repo.py | 1 +
cloudinit/distros/__init__.py | 1 +
cloudinit/distros/msvsphere.py | 10 ++++
cloudinit/net/sysconfig.py | 1 +
cloudinit/settings.py | 2 +-
cloudinit/sources/DataSourceRbxCloud.py | 2 +-
cloudinit/util.py | 1 +
config/cloud.cfg.tmpl | 2 +-
doc/rtd/reference/availability.rst | 2 +-
doc/rtd/reference/network-config.rst | 4 +-
packages/pkg-deps.json | 14 ++++++
systemd/cloud-config.service.tmpl | 2 +-
systemd/cloud-final.service.tmpl | 4 +-
systemd/cloud-init-generator.tmpl | 2 +-
systemd/cloud-init-local.service.tmpl | 12 ++---
systemd/cloud-init.service.tmpl | 6 +--
templates/chrony.conf.msvsphere.tmpl | 45 ++++++++++++++++++
templates/ntp.conf.msvsphere.tmpl | 61 +++++++++++++++++++++++++
tests/unittests/test_net.py | 1 +
tests/unittests/test_render_cloudcfg.py | 1 +
tests/unittests/test_util.py | 44 ++++++++++++++++++
tools/read-dependencies | 5 +-
tools/render-cloudcfg | 1 +
tools/run-container | 4 +-
27 files changed, 224 insertions(+), 23 deletions(-)
create mode 100644 cloudinit/distros/msvsphere.py
create mode 100644 templates/chrony.conf.msvsphere.tmpl
create mode 100644 templates/ntp.conf.msvsphere.tmpl
diff --git a/README.md b/README.md
index 45a5bd9..fff93c9 100644
--- a/README.md
+++ b/README.md
@@ -39,7 +39,7 @@ get in contact with that distribution and send them our way!
| Supported OSes | Supported Public Clouds | Supported Private Clouds |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| --- | --- |
-| Alpine Linux<br />Arch Linux<br />Container-Optimized OS<br />Debian<br />DragonFlyBSD<br />Fedora<br />FreeBSD<br />Gentoo Linux<br />NetBSD<br />OpenBSD<br />openEuler<br />OpenCloudOS<br />OpenMandriva<br />RHEL/CentOS/AlmaLinux/Rocky/PhotonOS/Virtuozzo/EuroLinux/CloudLinux/MIRACLE LINUX/MarinerOS<br />SLES/openSUSE<br />TencentOS<br />Ubuntu<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> | Amazon Web Services<br />Microsoft Azure<br />Google Cloud Platform<br />Oracle Cloud Infrastructure<br />Softlayer<br />Rackspace Public Cloud<br />IBM Cloud<br />DigitalOcean<br />Bigstep<br />Hetzner<br />Joyent<br />CloudSigma<br />Alibaba Cloud<br />Huawei Cloud<br />OVH<br />OpenNebula<br />Exoscale<br />Scaleway<br />CloudStack<br />AltCloud<br />SmartOS<br />HyperOne<br />Vultr<br />Rootbox<br /> | Bare metal installs<br />OpenStack<br />LXD<br />KVM<br />Metal-as-a-Service (MAAS)<br />VMware<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />|
+| Alpine Linux<br />Arch Linux<br />Container-Optimized OS<br />Debian<br />DragonFlyBSD<br />Fedora<br />FreeBSD<br />Gentoo Linux<br />NetBSD<br />OpenBSD<br />openEuler<br />OpenCloudOS<br />OpenMandriva<br />RHEL/CentOS/AlmaLinux/Rocky/PhotonOS/Virtuozzo/EuroLinux/CloudLinux/MIRACLE LINUX/MarinerOS/MSVSphere<br />SLES/openSUSE<br />TencentOS<br />Ubuntu<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> | Amazon Web Services<br />Microsoft Azure<br />Google Cloud Platform<br />Oracle Cloud Infrastructure<br />Softlayer<br />Rackspace Public Cloud<br />IBM Cloud<br />DigitalOcean<br />Bigstep<br />Hetzner<br />Joyent<br />CloudSigma<br />Alibaba Cloud<br />Huawei Cloud<br />OVH<br />OpenNebula<br />Exoscale<br />Scaleway<br />CloudStack<br />AltCloud<br />SmartOS<br />HyperOne<br />Vultr<br />Rootbox<br /> | Bare metal installs<br />OpenStack<br />LXD<br />KVM<br />Metal-as-a-Service (MAAS)<br />VMware<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />|
## To start developing cloud-init
diff --git a/cloudinit/config/cc_ca_certs.py b/cloudinit/config/cc_ca_certs.py
index 4dc0868..e6e9a56 100644
--- a/cloudinit/config/cc_ca_certs.py
+++ b/cloudinit/config/cc_ca_certs.py
@@ -32,6 +32,13 @@ DISTRO_OVERRIDES = {
"ca_cert_config": None,
"ca_cert_update_cmd": ["update-ca-trust"],
},
+ "msvsphere": {
+ "ca_cert_path": "/usr/share/pki/ca-trust-source/",
+ "ca_cert_filename": "anchors/cloud-init-ca-certs.crt",
+ "ca_cert_config": None,
+ "ca_cert_system_path": "/etc/pki/ca-trust/",
+ "ca_cert_update_cmd": ["update-ca-trust"],
+ },
"opensuse": {
"ca_cert_path": "/etc/pki/trust/",
"ca_cert_local_path": "/usr/share/pki/trust/",
@@ -68,6 +75,7 @@ configuration option ``remove_defaults``.
distros = [
"alpine",
"debian",
+ "msvsphere",
"rhel",
"opensuse",
"opensuse-microos",
diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py
index b5620f3..e5e685c 100644
--- a/cloudinit/config/cc_ntp.py
+++ b/cloudinit/config/cc_ntp.py
@@ -35,6 +35,7 @@ distros = [
"freebsd",
"mariner",
"miraclelinux",
+ "msvsphere",
"openbsd",
"openEuler",
"OpenCloudOS",
@@ -173,6 +174,14 @@ DISTRO_CLIENT_CONFIG = {
"check_exe": "/lib/systemd/systemd-timesyncd",
},
},
+ "msvsphere": {
+ "chrony": {
+ "service_name": "chronyd",
+ },
+ "ntp": {
+ "service_name": "ntpd",
+ },
+ },
"opensuse": {
"chrony": {
"service_name": "chronyd",
diff --git a/cloudinit/config/cc_yum_add_repo.py b/cloudinit/config/cc_yum_add_repo.py
index 3087b22..12e678b 100644
--- a/cloudinit/config/cc_yum_add_repo.py
+++ b/cloudinit/config/cc_yum_add_repo.py
@@ -31,6 +31,7 @@ distros = [
"cloudlinux",
"eurolinux",
"fedora",
+ "msvsphere",
"mariner",
"openEuler",
"OpenCloudOS",
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 12fae0a..30c5845 100644
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -57,6 +57,7 @@ OSFAMILIES = {
"fedora",
"mariner",
"miraclelinux",
+ "msvsphere",
"openmandriva",
"photon",
"rhel",
diff --git a/cloudinit/distros/msvsphere.py b/cloudinit/distros/msvsphere.py
new file mode 100644
index 0000000..3dc0a34
--- /dev/null
+++ b/cloudinit/distros/msvsphere.py
@@ -0,0 +1,10 @@
+# This file is part of cloud-init. See LICENSE file for license information.
+
+from cloudinit.distros import rhel
+
+
+class Distro(rhel.Distro):
+ pass
+
+
+# vi: ts=4 expandtab
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
index f2c7c92..9468a34 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -27,6 +27,7 @@ KNOWN_DISTROS = [
"eurolinux",
"fedora",
"miraclelinux",
+ "msvsphere",
"openEuler",
"OpenCloudOS",
"openmandriva",
diff --git a/cloudinit/settings.py b/cloudinit/settings.py
index edbb217..b6e5623 100644
--- a/cloudinit/settings.py
+++ b/cloudinit/settings.py
@@ -60,7 +60,7 @@ CFG_BUILTIN = {
"cloud_dir": "/var/lib/cloud",
"templates_dir": "/etc/cloud/templates/",
},
- "distro": "rhel",
+ "distro": "msvsphere",
"network": {"renderers": None},
},
"vendor_data": {"enabled": True, "prefix": []},
diff --git a/cloudinit/sources/DataSourceRbxCloud.py b/cloudinit/sources/DataSourceRbxCloud.py
index 6890562..e0ba46a 100644
--- a/cloudinit/sources/DataSourceRbxCloud.py
+++ b/cloudinit/sources/DataSourceRbxCloud.py
@@ -60,7 +60,7 @@ def _sub_arp(cmd):
def gratuitous_arp(items, distro):
source_param = "-S"
- if distro.name in ["fedora", "centos", "rhel"]:
+ if distro.name in ["fedora", "centos", "msvsphere","rhel"]:
source_param = "-s"
for item in items:
try:
diff --git a/cloudinit/util.py b/cloudinit/util.py
index af617e7..470c185 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -639,6 +639,7 @@ def _get_variant(info):
"fedora",
"mariner",
"miraclelinux",
+ "msvsphere",
"openeuler",
"opencloudos",
"openmandriva",
diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
index 020340f..7cd3336 100644
--- a/config/cloud.cfg.tmpl
+++ b/config/cloud.cfg.tmpl
@@ -4,7 +4,7 @@
# and base configuration.
{% set is_bsd = variant in ["dragonfly", "freebsd", "netbsd", "openbsd"] %}
{% set is_rhel = variant in ["almalinux", "centos", "cloudlinux", "eurolinux",
- "miraclelinux", "rhel", "rocky", "virtuozzo" ] %}
+ "miraclelinux", "msvsphere", "rhel", "rocky", "virtuozzo" ] %}
{% if is_bsd %}
syslog_fix_perms: root:wheel
{% elif variant in ["suse"] %}
diff --git a/doc/rtd/reference/availability.rst b/doc/rtd/reference/availability.rst
index b70342a..8137508 100644
--- a/doc/rtd/reference/availability.rst
+++ b/doc/rtd/reference/availability.rst
@@ -27,7 +27,7 @@ NetBSD, OpenBSD and DragonFlyBSD:
- NetBSD
- OpenBSD
- Photon OS
-- RHEL/CentOS/AlmaLinux/Rocky Linux/EuroLinux
+- RHEL/CentOS/AlmaLinux/Rocky Linux/EuroLinux/MSVSphere
- SLES/openSUSE
- Ubuntu
diff --git a/doc/rtd/reference/network-config.rst b/doc/rtd/reference/network-config.rst
index ea331f1..08dcca9 100644
--- a/doc/rtd/reference/network-config.rst
+++ b/doc/rtd/reference/network-config.rst
@@ -267,7 +267,7 @@ Example output:
.. code-block::
usage: /usr/bin/cloud-init devel net-convert [-h] -p PATH -k {eni,network_data.json,yaml,azure-imds,vmware-imc} -d PATH -D
- {alpine,arch,debian,ubuntu,freebsd,dragonfly,gentoo,cos,netbsd,openbsd,almalinux,amazon,centos,cloudlinux,eurolinux,fedora,mariner,miraclelinux,openmandriva,photon,rhel,rocky,virtuozzo,opensuse,sles,openEuler}
+ {alpine,arch,debian,ubuntu,freebsd,dragonfly,gentoo,cos,netbsd,openbsd,almalinux,amazon,centos,cloudlinux,eurolinux,fedora,mariner,miraclelinux,msvsphere,openmandriva,photon,rhel,rocky,virtuozzo,opensuse,sles,openEuler}
[-m name,mac] [--debug] -O {eni,netplan,networkd,sysconfig,network-manager}
options:
@@ -278,7 +278,7 @@ Example output:
The format of the given network config
-d PATH, --directory PATH
directory to place output in
- -D {alpine,arch,debian,ubuntu,freebsd,dragonfly,gentoo,cos,netbsd,openbsd,almalinux,amazon,centos,cloudlinux,eurolinux,fedora,mariner,miraclelinux,openmandriva,photon,rhel,rocky,virtuozzo,opensuse,sles,openEuler}, --distro {alpine,arch,debian,ubuntu,freebsd,dragonfly,gentoo,cos,netbsd,openbsd,almalinux,amazon,centos,cloudlinux,eurolinux,fedora,mariner,miraclelinux,openmandriva,photon,rhel,rocky,virtuozzo,opensuse,sles,openEuler}
+ -D {alpine,arch,debian,ubuntu,freebsd,dragonfly,gentoo,cos,netbsd,openbsd,almalinux,amazon,centos,cloudlinux,eurolinux,fedora,mariner,miraclelinux,msvsphere,openmandriva,photon,rhel,rocky,virtuozzo,opensuse,sles,openEuler}, --distro {alpine,arch,debian,ubuntu,freebsd,dragonfly,gentoo,cos,netbsd,openbsd,almalinux,amazon,centos,cloudlinux,eurolinux,fedora,mariner,miraclelinux,msvsphere,openmandriva,photon,rhel,rocky,virtuozzo,opensuse,sles,openEuler}
-m name,mac, --mac name,mac
interface name to mac mapping
--debug enable debug logging to stderr.
diff --git a/packages/pkg-deps.json b/packages/pkg-deps.json
index 4ee0982..df7596c 100644
--- a/packages/pkg-deps.json
+++ b/packages/pkg-deps.json
@@ -41,6 +41,20 @@
"sudo"
]
},
+ "msvsphere" : {
+ "build-requires" : [
+ "python3-devel"
+ ],
+ "requires" : [
+ "e2fsprogs",
+ "iproute",
+ "net-tools",
+ "procps",
+ "rsyslog",
+ "shadow-utils",
+ "sudo"
+ ]
+ },
"redhat" : {
"build-requires" : [
"python3-devel"
diff --git a/systemd/cloud-config.service.tmpl b/systemd/cloud-config.service.tmpl
index d5568a6..3e416a4 100644
--- a/systemd/cloud-config.service.tmpl
+++ b/systemd/cloud-config.service.tmpl
@@ -4,7 +4,7 @@ Description=Apply the settings specified in cloud-config
After=network-online.target cloud-config.target
After=snapd.seeded.service
Wants=network-online.target cloud-config.target
-{% if variant == "rhel" %}
+{% if variant in ["msvsphere", "rhel"] %}
ConditionPathExists=!/etc/cloud/cloud-init.disabled
ConditionKernelCommandLine=!cloud-init=disabled
{% endif %}
diff --git a/systemd/cloud-final.service.tmpl b/systemd/cloud-final.service.tmpl
index 85f423a..10b7e72 100644
--- a/systemd/cloud-final.service.tmpl
+++ b/systemd/cloud-final.service.tmpl
@@ -7,7 +7,7 @@ After=multi-user.target
Before=apt-daily.service
{% endif %}
Wants=network-online.target cloud-config.service
-{% if variant == "rhel" %}
+{% if variant in ["msvsphere", "rhel"] %}
ConditionPathExists=!/etc/cloud/cloud-init.disabled
ConditionKernelCommandLine=!cloud-init=disabled
{% endif %}
@@ -19,7 +19,7 @@ ExecStart=/usr/bin/cloud-init modules --mode=final
RemainAfterExit=yes
TimeoutSec=0
KillMode=process
-{% if variant == "rhel" %}
+{% if variant in ["msvsphere", "rhel"] %}
# Restart NetworkManager if it is present and running.
ExecStartPost=/bin/sh -c 'u=NetworkManager.service; \
out=$(systemctl show --property=SubState $u) || exit; \
diff --git a/systemd/cloud-init-generator.tmpl b/systemd/cloud-init-generator.tmpl
index d71e3b8..e9ca226 100644
--- a/systemd/cloud-init-generator.tmpl
+++ b/systemd/cloud-init-generator.tmpl
@@ -21,7 +21,7 @@ CLOUD_SYSTEM_TARGET="/usr/lib/systemd/system/cloud-init.target"
CLOUD_SYSTEM_TARGET="/lib/systemd/system/cloud-init.target"
{% endif %}
{% if variant in ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora",
- "miraclelinux", "openEuler", "OpenCloudOS", "openmandriva", "rhel", "rocky", "TencentOS", "virtuozzo"] %}
+ "miraclelinux", "openEuler", "OpenCloudOS", "openmandriva", "msvsphere", "rhel", "rocky", "TencentOS", "virtuozzo"] %}
dsidentify="/usr/libexec/cloud-init/ds-identify"
{% else %}
dsidentify="/usr/lib/cloud-init/ds-identify"
diff --git a/systemd/cloud-init-local.service.tmpl b/systemd/cloud-init-local.service.tmpl
index 6f3f9d8..b371ca4 100644
--- a/systemd/cloud-init-local.service.tmpl
+++ b/systemd/cloud-init-local.service.tmpl
@@ -1,23 +1,23 @@
## template:jinja
[Unit]
Description=Initial cloud-init job (pre-networking)
-{% if variant in ["ubuntu", "unknown", "debian", "rhel" ] %}
+{% if variant in ["ubuntu", "unknown", "debian", "msvsphere", "rhel" ] %}
DefaultDependencies=no
{% endif %}
Wants=network-pre.target
After=hv_kvp_daemon.service
After=systemd-remount-fs.service
-{% if variant == "rhel" %}
+{% if variant in ["msvsphere", "rhel"] %}
Requires=dbus.socket
After=dbus.socket
{% endif %}
Before=NetworkManager.service
-{% if variant == "rhel" %}
+{% if variant in ["msvsphere", "rhel"] %}
Before=network.service
{% endif %}
Before=network-pre.target
Before=shutdown.target
-{% if variant == "rhel" %}
+{% if variant in ["msvsphere", "rhel"] %}
Before=firewalld.target
Conflicts=shutdown.target
{% endif %}
@@ -26,14 +26,14 @@ Before=sysinit.target
Conflicts=shutdown.target
{% endif %}
RequiresMountsFor=/var/lib/cloud
-{% if variant == "rhel" %}
+{% if variant in ["msvsphere", "rhel"] %}
ConditionPathExists=!/etc/cloud/cloud-init.disabled
ConditionKernelCommandLine=!cloud-init=disabled
{% endif %}
[Service]
Type=oneshot
-{% if variant == "rhel" %}
+{% if variant in ["msvsphere", "rhel"] %}
ExecStartPre=/bin/mkdir -p /run/cloud-init
ExecStartPre=/sbin/restorecon /run/cloud-init
ExecStartPre=/usr/bin/touch /run/cloud-init/enabled
diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl
index 1b1f9a8..be5c6f6 100644
--- a/systemd/cloud-init.service.tmpl
+++ b/systemd/cloud-init.service.tmpl
@@ -1,7 +1,7 @@
## template:jinja
[Unit]
Description=Initial cloud-init job (metadata service crawler)
-{% if variant not in ["photon", "rhel"] %}
+{% if variant not in ["photon", "msvsphere", "rhel"] %}
DefaultDependencies=no
{% endif %}
Wants=cloud-init-local.service
@@ -13,7 +13,7 @@ After=systemd-networkd-wait-online.service
After=networking.service
{% endif %}
{% if variant in ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora",
- "miraclelinux", "openEuler", "OpenCloudOS", "openmandriva", "rhel", "rocky",
+ "miraclelinux", "msvsphere", "openEuler", "OpenCloudOS", "openmandriva", "rhel", "rocky",
"suse", "TencentOS", "virtuozzo"] %}
After=network.service
@@ -39,7 +39,7 @@ Before=shutdown.target
Conflicts=shutdown.target
{% endif %}
Before=systemd-user-sessions.service
-{% if variant == "rhel" %}
+{% if variant in ["msvsphere", "rhel"] %}
ConditionPathExists=!/etc/cloud/cloud-init.disabled
ConditionKernelCommandLine=!cloud-init=disabled
{% endif %}
diff --git a/templates/chrony.conf.msvsphere.tmpl b/templates/chrony.conf.msvsphere.tmpl
new file mode 100644
index 0000000..5b3542e
--- /dev/null
+++ b/templates/chrony.conf.msvsphere.tmpl
@@ -0,0 +1,45 @@
+## template:jinja
+# Use public servers from the pool.ntp.org project.
+# Please consider joining the pool (http://www.pool.ntp.org/join.html).
+{% if pools %}# pools
+{% endif %}
+{% for pool in pools -%}
+pool {{pool}} iburst
+{% endfor %}
+{%- if servers %}# servers
+{% endif %}
+{% for server in servers -%}
+server {{server}} iburst
+{% endfor %}
+
+# Record the rate at which the system clock gains/losses time.
+driftfile /var/lib/chrony/drift
+
+# Allow the system clock to be stepped in the first three updates
+# if its offset is larger than 1 second.
+makestep 1.0 3
+
+# Enable kernel synchronization of the real-time clock (RTC).
+rtcsync
+
+# Enable hardware timestamping on all interfaces that support it.
+#hwtimestamp *
+
+# Increase the minimum number of selectable sources required to adjust
+# the system clock.
+#minsources 2
+
+# Allow NTP client access from local network.
+#allow 192.168.0.0/16
+
+# Serve time even if not synchronized to a time source.
+#local stratum 10
+
+# Specify file containing keys for NTP authentication.
+#keyfile /etc/chrony.keys
+
+# Specify directory for log files.
+logdir /var/log/chrony
+
+# Select which information is logged.
+#log measurements statistics tracking
diff --git a/templates/ntp.conf.msvsphere.tmpl b/templates/ntp.conf.msvsphere.tmpl
new file mode 100644
index 0000000..62b4776
--- /dev/null
+++ b/templates/ntp.conf.msvsphere.tmpl
@@ -0,0 +1,61 @@
+## template:jinja
+
+# For more information about this file, see the man pages
+# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
+
+driftfile /var/lib/ntp/drift
+
+# Permit time synchronization with our time source, but do not
+# permit the source to query or modify the service on this system.
+restrict default kod nomodify notrap nopeer noquery
+restrict -6 default kod nomodify notrap nopeer noquery
+
+# Permit all access over the loopback interface. This could
+# be tightened as well, but to do so would effect some of
+# the administrative functions.
+restrict 127.0.0.1
+restrict -6 ::1
+
+# Hosts on local network are less restricted.
+#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
+
+# Use public servers from the pool.ntp.org project.
+# Please consider joining the pool (http://www.pool.ntp.org/join.html).
+{% if pools %}# pools
+{% endif %}
+{% for pool in pools -%}
+pool {{pool}} iburst
+{% endfor %}
+{%- if servers %}# servers
+{% endif %}
+{% for server in servers -%}
+server {{server}} iburst
+{% endfor %}
+
+#broadcast 192.168.1.255 autokey # broadcast server
+#broadcastclient # broadcast client
+#broadcast 224.0.1.1 autokey # multicast server
+#multicastclient 224.0.1.1 # multicast client
+#manycastserver 239.255.254.254 # manycast server
+#manycastclient 239.255.254.254 autokey # manycast client
+
+# Enable public key cryptography.
+#crypto
+
+includefile /etc/ntp/crypto/pw
+
+# Key file containing the keys and key identifiers used when operating
+# with symmetric key cryptography.
+keys /etc/ntp/keys
+
+# Specify the key identifiers which are trusted.
+#trustedkey 4 8 42
+
+# Specify the key identifier to use with the ntpdc utility.
+#requestkey 8
+
+# Specify the key identifier to use with the ntpq utility.
+#controlkey 8
+
+# Enable writing of statistics records.
+#statistics clockstats cryptostats loopstats peerstats
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index d49da69..8249f48 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -7892,6 +7892,7 @@ class TestNetRenderers(CiTestCase):
"eurolinux",
"fedora",
"rhel",
+ "msvsphere",
]
for distro_name in variants:
m_info.return_value = {"variant": distro_name}
diff --git a/tests/unittests/test_render_cloudcfg.py b/tests/unittests/test_render_cloudcfg.py
index d3aeb1b..51cd167 100644
--- a/tests/unittests/test_render_cloudcfg.py
+++ b/tests/unittests/test_render_cloudcfg.py
@@ -17,6 +17,7 @@ DISTRO_VARIANTS = [
"fedora",
"freebsd",
"gentoo",
+ "msvsphere",
"mariner",
"netbsd",
"openbsd",
diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py
index 289a423..58856a4 100644
--- a/tests/unittests/test_util.py
+++ b/tests/unittests/test_util.py
@@ -209,6 +209,28 @@ OS_RELEASE_MIRACLELINUX_8 = dedent(
"""
)
+OS_RELEASE_MSVSPHERE_9 = dedent(
+ """\
+ NAME="MSVSphere"
+ VERSION="9.3 (Inferit)"
+ ID="msvsphere"
+ ID_LIKE="rhel centos fedora"
+ VERSION_ID="9.3"
+ PLATFORM_ID="platform:el9"
+ PRETTY_NAME="MSVSphere 9.3 (Inferit)"
+ ANSI_COLOR="0;34"
+ LOGO="fedora-logo-icon"
+ CPE_NAME="cpe:/o:ncsd:msvsphere:9::baseos"
+ HOME_URL="https://msvsphere-os.ru/"
+ BUG_REPORT_URL="https://bugs.msvsphere-os.ru/"
+
+ MSVSPHERE_MANTISBT_PROJECT="MSVSphere-9"
+ MSVSPHERE_MANTISBT_PROJECT_VERSION="9.3"
+ REDHAT_SUPPORT_PRODUCT="MSVSphere"
+ REDHAT_SUPPORT_PRODUCT_VERSION="9.3"
+"""
+)
+
OS_RELEASE_ROCKY_8 = dedent(
"""\
NAME="Rocky Linux"
@@ -310,6 +332,7 @@ REDHAT_RELEASE_ALMALINUX_8 = "AlmaLinux release 8.3 (Purple Manul)"
REDHAT_RELEASE_EUROLINUX_7 = "EuroLinux release 7.9 (Minsk)"
REDHAT_RELEASE_EUROLINUX_8 = "EuroLinux release 8.4 (Vaduz)"
REDHAT_RELEASE_MIRACLELINUX_8 = "MIRACLE LINUX release 8.4 (Peony)"
+REDHAT_RELEASE_MSVSPHERE_9 = "MSVSphere release 9.3 (Inferit)"
REDHAT_RELEASE_ROCKY_8 = "Rocky Linux release 8.3 (Green Obsidian)"
REDHAT_RELEASE_VIRTUOZZO_8 = "Virtuozzo Linux release 8"
REDHAT_RELEASE_CLOUDLINUX_8 = "CloudLinux release 8.4 (Valery Rozhdestvensky)"
@@ -1096,6 +1119,26 @@ class TestGetLinuxDistro(CiTestCase):
dist = util.get_linux_distro()
self.assertEqual(("miraclelinux", "8", "Peony"), dist)
+ @mock.patch("cloudinit.util.load_file")
+ def test_get_linux_msvsphere9_rhrelease(
+ self, m_os_release, m_path_exists
+ ):
+ """Verify msvsphere 9 read from redhat-release."""
+ m_os_release.return_value = REDHAT_RELEASE_MSVSPHERE_9
+ m_path_exists.side_effect = TestGetLinuxDistro.redhat_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(("msvsphere", "9.3", "Inferit"), dist)
+
+ @mock.patch("cloudinit.util.load_file")
+ def test_get_linux_msvsphere9_osrelease(
+ self, m_os_release, m_path_exists
+ ):
+ """Verify msvsphere 9 read from os-release."""
+ m_os_release.return_value = OS_RELEASE_MSVSPHERE_9
+ m_path_exists.side_effect = TestGetLinuxDistro.os_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(("msvsphere", "9.3", "Inferit"), dist)
+
@mock.patch(M_PATH + "load_file")
def test_get_linux_rocky8_rhrelease(self, m_os_release, m_path_exists):
"""Verify rocky linux 8 read from redhat-release."""
@@ -1302,6 +1345,7 @@ class TestGetVariant:
({"system": "linux", "dist": ("ubuntu",)}, "ubuntu"),
({"system": "linux", "dist": ("linuxmint",)}, "ubuntu"),
({"system": "linux", "dist": ("mint",)}, "ubuntu"),
+ ({"system": "linux", "dist": ("msvsphere",)}, "msvsphere"),
({"system": "linux", "dist": ("redhat",)}, "rhel"),
({"system": "linux", "dist": ("opensuse",)}, "suse"),
({"system": "linux", "dist": ("opensuse-tumbleweed",)}, "suse"),
diff --git a/tools/read-dependencies b/tools/read-dependencies
index 87485c2..db9f495 100755
--- a/tools/read-dependencies
+++ b/tools/read-dependencies
@@ -26,6 +26,7 @@ DISTRO_PKG_TYPE_MAP = {
"centos": "redhat",
"eurolinux": "redhat",
"miraclelinux": "redhat",
+ "msvsphere": "redhat",
"rocky": "redhat",
"redhat": "redhat",
"debian": "debian",
@@ -95,6 +96,7 @@ CI_SYSTEM_BASE_PKGS = {
"common": ["make", "sudo", "tar"],
"eurolinux": ["python3-tox"],
"miraclelinux": ["python3-tox"],
+ "msvsphere": ["python3-tox"],
"redhat": ["python3-tox"],
"centos": ["python3-tox"],
"ubuntu": ["devscripts", "python3-dev", "libssl-dev", "tox", "sbuild"],
@@ -333,12 +335,13 @@ def pkg_install(pkg_list, distro, test_distro=False, dry_run=False):
cmd = DISTRO_INSTALL_PKG_CMD[distro_family]
install_cmd.extend(cmd)
- if distro in ["centos", "redhat", "rocky", "eurolinux"]:
+ if distro in ["centos", "redhat", "rocky", "eurolinux", "msvsphere"]:
# CentOS and Redhat need epel-release to access oauthlib and jsonschema
subprocess.check_call(install_cmd + ["epel-release"])
if distro in [
"suse",
"opensuse",
+ "msvsphere",
"redhat",
"rocky",
"centos",
diff --git a/tools/render-cloudcfg b/tools/render-cloudcfg
index 3cd394f..df48076 100755
--- a/tools/render-cloudcfg
+++ b/tools/render-cloudcfg
@@ -23,6 +23,7 @@ def main():
"gentoo",
"mariner",
"miraclelinux",
+ "msvsphere",
"netbsd",
"openbsd",
"openEuler",
diff --git a/tools/run-container b/tools/run-container
index 328ed93..284d607 100755
--- a/tools/run-container
+++ b/tools/run-container
@@ -248,7 +248,7 @@ apt_install() {
install_packages() {
get_os_info || return
case "$OS_NAME" in
- centos|rocky*) yum_install "$@";;
+ centos|msvsphere|rocky*) yum_install "$@";;
opensuse*) zypper_install "$@";;
debian|ubuntu) apt_install "$@";;
*) error "Do not know how to install packages on ${OS_NAME}";
@@ -497,7 +497,7 @@ main() {
local build_pkg="" build_srcpkg="" pkg_ext="" distflag=""
case "$OS_NAME" in
- centos|rocky*) distflag="--distro=redhat";;
+ centos|msvsphere|rocky*) distflag="--distro=redhat";;
opensuse*) distflag="--distro=suse";;
esac
--
2.41.0

@ -1,6 +1,6 @@
Name: cloud-init
Version: 23.1.1
Release: 11%{?dist}
Release: 11%{?dist}.inferit
Summary: Cloud instance init scripts
License: ASL 2.0 or GPLv3
URL: http://launchpad.net/cloud-init
@ -39,6 +39,9 @@ Patch28: 0028-logging-keep-current-file-mode-of-log-file-if-its-st.patch
Patch29: 0029-DS-VMware-modify-a-few-log-level-4284.patch
Patch30: 0030-NM-renderer-set-default-IPv6-addr-gen-mode-for-all-i.patch
# MSVSphere patches
Patch100: 0001-Add-MSVSphere-support.patch
BuildArch: noarch
BuildRequires: pkgconfig(systemd)
@ -258,6 +261,10 @@ fi
%config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf
%changelog
* Fri Oct 06 2023 Sergey Cherevko <s.cherevko@msvsphere-os.ru> - 23.1.1-11.inferit
- Add MSVSphere support
- Rebuilt for MSVSphere 9.3
* Thu Aug 17 2023 Miroslav Rezanina <mrezanin@redhat.com> - 23.1.1-11
- Resolves: bz#2232296

Loading…
Cancel
Save