additional debranding for rocky

This commit is contained in:
Trevor Cooper 2021-12-04 00:31:48 -08:00
parent 23c15e912f
commit cce1d6a910

View File

@ -17,7 +17,7 @@
# #
# Author: Adam Williamson <awilliam@redhat.com> # Author: Adam Williamson <awilliam@redhat.com>
"""Tool for creating hard disk images for Fedora openQA.""" """Tool for creating hard disk images for Rocky Linux openQA."""
import argparse import argparse
import logging import logging
@ -210,7 +210,7 @@ class VirtInstallImage(object):
def __init__(self, name, release, arch, size, variant=None, imgver='', maxage=14, bootopts=None): def __init__(self, name, release, arch, size, variant=None, imgver='', maxage=14, bootopts=None):
self.name = name self.name = name
self.size = size self.size = size
self.filename = "disk_f{0}_{1}".format(str(release), name) self.filename = "disk_rocky{0}_{1}".format(str(release), name)
if imgver: if imgver:
self.filename = "{0}_{1}".format(self.filename, imgver) self.filename = "{0}_{1}".format(self.filename, imgver)
self.filename = "{0}_{1}.qcow2".format(self.filename, arch) self.filename = "{0}_{1}.qcow2".format(self.filename, arch)
@ -258,14 +258,14 @@ class VirtInstallImage(object):
# figure out the best os-variant. NOTE: libosinfo >= 0.3.1 # figure out the best os-variant. NOTE: libosinfo >= 0.3.1
# properly returns 1 on failure, but using workaround for old # properly returns 1 on failure, but using workaround for old
# bug where it didn't in case EPEL doesn't have 0.3.1 # bug where it didn't in case EPEL doesn't have 0.3.1
shortid = "fedora{0}".format(self.release) shortid = "rocky{0}".format(self.release)
args = ["osinfo-query", "os", "short-id={0}".format(shortid)] args = ["osinfo-query", "os", "short-id={0}".format(shortid)]
process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
out = process.communicate()[0].decode() out = process.communicate()[0].decode()
if shortid not in out: if shortid not in out:
# this will just use the most recent fedora release number # this will just use the most recent rocky release number
# virt-install / osinfo knows # virt-install / osinfo knows
shortid = 'fedora-unknown' shortid = 'rocky-unknown'
# destroy and delete the domain we use for all virt-installs # destroy and delete the domain we use for all virt-installs
conn = libvirt.open() conn = libvirt.open()
@ -284,30 +284,31 @@ class VirtInstallImage(object):
tmpfile = "{0}.tmp".format(self.filename) tmpfile = "{0}.tmp".format(self.filename)
arch = self.arch arch = self.arch
fedoradir = 'fedora/linux' rockydir = 'rocky/linux'
memsize = '3072' memsize = '3072'
if arch == 'i686': if arch == 'i686':
arch = 'i386' arch = 'i386'
if arch in ['ppc64','ppc64le']: if arch in ['ppc64','ppc64le']:
fedoradir = 'fedora-secondary' rockydir = 'rocky-secondary'
memsize = '4096' memsize = '4096'
if arch == 'i386': if arch == 'i386':
# i686 is in fedora-secondary (until it died) # i686 is in rocky-secondary (until it died)
fedoradir = 'fedora-secondary' rockydir = 'rocky-secondary'
variant = self.variant variant = self.variant
# From F31 onwards, Workstation tree is not installable and we # From F31 onwards, Workstation tree is not installable and we
# build Workstation images out of Everything # build Workstation images out of Everything
if variant == 'Workstation' and str(self.release).isdigit() and int(self.release) > 30: # We will always use the dvd1 ISO and the closest behavior is the Everything variant
variant = 'Everything' variant = 'Everything'
try: try:
# loctmp is the Distribution tree installation source. Point at the good location
loctmp = "https://download.rockylinux.org/pub/rocky/{0}/BaseOS/{1}/os"
ksfile = self.kickstart_file ksfile = self.kickstart_file
xargs = "inst.ks=file:/{0}".format(ksfile) xargs = "inst.ks=file:/{0}".format(ksfile)
args = ["virt-install", "--disk", "size={0},path={1}".format(self.size, tmpfile), args = ["virt-install", "--disk", "size={0},path={1}".format(self.size, tmpfile),
"--os-variant", shortid, "-x", xargs, "--initrd-inject", "--os-variant", shortid, "-x", xargs, "--initrd-inject",
"{0}/{1}".format(SCRIPTDIR, ksfile), "--location", "{0}/{1}".format(SCRIPTDIR, ksfile), "--location",
loctmp.format(fedoradir, str(self.release), variant, arch), "--name", "createhdds", loctmp.format(str(self.release), arch), "--name", "createhdds",
"--memory", memsize, "--noreboot", "--wait", "-1"] "--memory", memsize, "--noreboot", "--wait", "-1"]
if logger.getEffectiveLevel() == logging.DEBUG: if logger.getEffectiveLevel() == logging.DEBUG:
# let's get virt-install debug logs too # let's get virt-install debug logs too
@ -482,12 +483,10 @@ def get_virtinstall_images(imggrp, nextrel=None, releases=None):
bootopts = imggrp.get('bootopts') bootopts = imggrp.get('bootopts')
# add an image for each release/arch combination # add an image for each release/arch combination
for (release, arches) in releases.items(): for (release, arches) in releases.items():
rels = [release]
for arch in arches: for arch in arches:
for rel in rels: for rel in rels:
# i686 images can't be created from f31 on; let's filter if arch == 'i686' and int(rel) > 8:
# out all i686 images for f31 and later. Once f30 is EOL
# we can just ditch them from hdds.json and remove this
if arch == 'i686' and (rel == 'rawhide' or int(rel) > 30):
continue continue
key = "{0}-{1}".format(rel, arch) key = "{0}-{1}".format(rel, arch)
# using a dict here avoids dupes # using a dict here avoids dupes
@ -711,7 +710,7 @@ def cli_image(args, *_):
def parse_args(hdds): def parse_args(hdds):
"""Parse arguments with argparse.""" """Parse arguments with argparse."""
parser = argparse.ArgumentParser(description=( parser = argparse.ArgumentParser(description=(
"Tool for creating hard disk images for Fedora openQA.")) "Tool for creating hard disk images for Rocky Linux openQA."))
parser.add_argument( parser.add_argument(
'-l', '--loglevel', help="The level of log messages to show", '-l', '--loglevel', help="The level of log messages to show",
choices=('debug', 'info', 'warning', 'error', 'critical'), choices=('debug', 'info', 'warning', 'error', 'critical'),