CentOS 8: Upgrade cloud-init to version 18.5

(1)Version Release Upgrade to 18.5-1.el8.4
(2)Delelte patch files as below

cloud-init-interactive-parted.patch
cloud-init/find_candidate_devs_fix.patch
cloud-init/first_boot.patch

As they are never patched to the sprm or compiled
in origin version.

Story: 2006729
Task: 37682

Change-Id: I614e676d7abe48efc0b0831658a53dd0d795ff38
Signed-off-by: Long Li <lilong-neu@neusoft.com>
This commit is contained in:
Long Li 2020-01-02 12:54:51 +08:00 committed by Lin Shuicheng
parent a7fd513689
commit 1f26b02da6
6 changed files with 9 additions and 131 deletions

View File

@ -8,15 +8,15 @@ Subject: [PATCH] Update-package-versioning-for-TIS-format
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/SPECS/cloud-init.spec b/SPECS/cloud-init.spec
index 60bf175..a873d81 100644
index c0568f2..d7dc778 100644
--- a/SPECS/cloud-init.spec
+++ b/SPECS/cloud-init.spec
@@ -6,7 +6,7 @@
Name: cloud-init
Version: 18.2
-Release: 6%{?dist}
+Release: 6.el8%{?_tis_dist}.%{tis_patch_ver}
Version: 18.5
-Release: 1%{?dist}.4
+Release: 1.el8.4%{?_tis_dist}.%{tis_patch_ver}
Summary: Cloud instance init scripts
Group: System Environment/Base

View File

@ -8,12 +8,12 @@ Subject: [PATCH] spec-include-tis-changes
1 file changed, 2 insertions(+)
diff --git a/SPECS/cloud-init.spec b/SPECS/cloud-init.spec
index a873d81..1175601 100644
index d7dc778..1842e08 100644
--- a/SPECS/cloud-init.spec
+++ b/SPECS/cloud-init.spec
@@ -38,6 +38,8 @@ Patch15: ci-Fix-string-missmatch-when-mounting-ntfs.patch
# For bz#1602784 - cloud-init: Sometimes image boots fingerprints is configured, there's a network device present but it's not configured
Patch16: ci-net-Make-sysconfig-renderer-compatible-with-Network-.patch
@@ -42,6 +42,8 @@ Patch18: ci-cc_mounts-check-if-mount-a-on-no-change-fstab-path.patch
# For bz#1648375 - [Azure] [RHEL 8] Cloud-init fixes to support fast provisioning for Azure[8.0.1]
Patch19: ci-Azure-Return-static-fallback-address-as-if-failed-to.patch
+Patch1000: cloud-init-interactive-parted.patch
+

View File

@ -1 +1 @@
mirror:Source/cloud-init-18.2-6.el8.src.rpm
mirror:Source/cloud-init-18.5-1.el8.4.src.rpm

View File

@ -1,13 +0,0 @@
Index: cloud-init-0.7.4/cloudinit/config/cc_growpart.py
===================================================================
--- cloud-init-0.7.4.orig/cloudinit/config/cc_growpart.py
+++ cloud-init-0.7.4/cloudinit/config/cc_growpart.py
@@ -97,7 +97,7 @@ class ResizeParted(object):
def resize(self, diskdev, partnum, partdev):
before = get_size(partdev)
try:
- util.subp(["parted", diskdev, "resizepart", partnum])
+ util.subp(["resizepart.sh", diskdev, partnum])
except util.ProcessExecutionError as e:
raise ResizeFailedException(e)

View File

@ -1,74 +0,0 @@
---
cloudinit/sources/DataSourceConfigDrive.py | 39 ++++++++++++++++++++---------
1 file changed, 27 insertions(+), 12 deletions(-)
--- a/cloudinit/sources/DataSourceConfigDrive.py
+++ b/cloudinit/sources/DataSourceConfigDrive.py
@@ -40,6 +40,12 @@ DEFAULT_METADATA = {
"instance-id": DEFAULT_IID,
}
VALID_DSMODES = ("local", "net", "pass", "disabled")
+FS_TYPES = ('vfat', 'iso9660')
+LABEL_TYPES = ('config-2',)
+POSSIBLE_MOUNTS = ('sr', 'cd')
+OPTICAL_DEVICES = tuple(('/dev/%s%s' % (z, i) for z in POSSIBLE_MOUNTS
+ for i in range(0, 2)))
+
class ConfigDriveHelper(object):
@@ -250,7 +256,7 @@ class BrokenConfigDriveDir(Exception):
pass
-def find_candidate_devs():
+def find_candidate_devs(probe_optical=True):
"""Return a list of devices that may contain the config drive.
The returned list is sorted by search order where the first item has
@@ -268,12 +274,20 @@ def find_candidate_devs():
"""
# Query optical drive to get it in blkid cache for 2.6 kernels
- util.find_devs_with(path="/dev/sr0")
- util.find_devs_with(path="/dev/sr1")
-
- by_fstype = (util.find_devs_with("TYPE=vfat") +
- util.find_devs_with("TYPE=iso9660"))
- by_label = util.find_devs_with("LABEL=config-2")
+ if probe_optical:
+ for device in OPTICAL_DEVICES:
+ try:
+ util.find_devs_with(path=device)
+ except util.ProcessExecutionError:
+ pass
+
+ by_fstype = []
+ for fs_type in FS_TYPES:
+ by_fstype.extend(util.find_devs_with("TYPE=%s" % (fs_type)))
+
+ by_label = []
+ for label in LABEL_TYPES:
+ by_label.extend(util.find_devs_with("LABEL=%s" % (label)))
# give preference to "last available disk" (vdb over vda)
# note, this is not a perfect rendition of that.
@@ -282,12 +296,13 @@ def find_candidate_devs():
# combine list of items by putting by-label items first
# followed by fstype items, but with dupes removed
- combined = (by_label + [d for d in by_fstype if d not in by_label])
-
- # We are looking for block device (sda, not sda1), ignore partitions
- combined = [d for d in combined if not util.is_partition(d)]
+ candidates = (by_label + [d for d in by_fstype if d not in by_label])
- return combined
+ # We are looking for a block device or partition with necessary label or
+ # an unpartitioned block device (ex sda, not sda1)
+ devices = [d for d in candidates
+ if d in by_label or not util.is_partition(d)]
+ return devices
def read_config_drive_dir(source_dir):

View File

@ -1,35 +0,0 @@
---
cloudinit/sources/DataSourceConfigDrive.py | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
--- a/cloudinit/sources/DataSourceConfigDrive.py
+++ b/cloudinit/sources/DataSourceConfigDrive.py
@@ -52,12 +52,13 @@ class ConfigDriveHelper(object):
def __init__(self, distro):
self.distro = distro
- def on_first_boot(self, data):
+ def on_first_boot(self, data, dsmode="local"):
if not data:
data = {}
- if 'network_config' in data:
- LOG.debug("Updating network interfaces from config drive")
- self.distro.apply_network(data['network_config'])
+ if dsmode == "local":
+ if 'network_config' in data:
+ LOG.debug("Updating network interfaces from config drive")
+ self.distro.apply_network(data['network_config'])
files = data.get('files')
if files:
LOG.debug("Writing %s injected files", len(files))
@@ -214,8 +215,8 @@ class DataSourceConfigDrive(sources.Data
# instance-id
prev_iid = get_previous_iid(self.paths)
cur_iid = md['instance-id']
- if prev_iid != cur_iid and self.dsmode == "local":
- self.helper.on_first_boot(results)
+ if prev_iid != cur_iid:
+ self.helper.on_first_boot(results, dsmode=self.dsmode)
# dsmode != self.dsmode here if:
# * dsmode = "pass", pass means it should only copy files and then