feat: improvements for createhdds (#5)

This commit is contained in:
Trevor Cooper 2022-05-19 12:53:09 -07:00 committed by GitHub
parent 2b61577caa
commit ef0d3aea14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 36 deletions

View File

@ -197,8 +197,7 @@ class GuestfsImage(object):
class VirtInstallImage(object):
"""Class representing an image created by virt-install. 'release'
is the release the image will be built for. 'variant' is the
variant whose install tree should be used. 'arch' is the arch.
is the release the image will be built for. 'arch' is the arch.
'size' is the desired image size, in gigabytes. 'imgver' is
the image 'version' - in practice it's simply a string that gets
included in the image file name if specified. 'maxage' is the
@ -207,7 +206,7 @@ class VirtInstallImage(object):
rebuild it. 'bootopts' are used to pass boot options to the
virtual image to provide better control of the VM.
"""
def __init__(self, name, release, arch, size, variant=None, imgver='', maxage=14, bootopts=None):
def __init__(self, name, release, arch, size, imgver='', maxage=14, bootopts=None):
self.name = name
self.size = size
self.filename = "disk_rocky{0}_{1}".format(str(release), name)
@ -215,16 +214,8 @@ class VirtInstallImage(object):
self.filename = "{0}_{1}".format(self.filename, imgver)
self.filename = "{0}_{1}.qcow2".format(self.filename, arch)
self.release = release
self.variant = variant
self.arch = arch
self.maxage = maxage
if variant:
self.variant = variant
else:
if str(release).isdigit() and int(release) < 24:
self.variant = "Server"
else:
self.variant = "Everything"
self.bootopts = bootopts
@property
@ -286,20 +277,10 @@ class VirtInstallImage(object):
arch = self.arch
rockydir = 'rocky/linux'
memsize = '3072'
if arch == 'i686':
arch = 'i386'
if arch in ['ppc64','ppc64le']:
rockydir = 'rocky-secondary'
memsize = '4096'
if arch == 'i386':
# i686 is in rocky-secondary (until it died)
rockydir = 'rocky-secondary'
variant = self.variant
# From F31 onwards, Workstation tree is not installable and we
# build Workstation images out of Everything
# We will always use the dvd1 ISO and the closest behavior is the Everything variant
variant = 'Everything'
try:
# loctmp is the Distribution tree installation source. Point at the good location
#loctmp = "https://download.rockylinux.org/stg/rocky/{0}/BaseOS/{1}/os"
@ -475,8 +456,6 @@ def get_virtinstall_images(imggrp, nextrel=None, releases=None):
name = imggrp['name']
# this is the second place we set a default for maxage - bit ugly
maxage = int(imggrp.get('maxage', 14))
# ditto variant
variant = imggrp.get('variant')
if not releases:
releases = imggrp['releases']
size = imggrp.get('size', 0)
@ -491,7 +470,7 @@ def get_virtinstall_images(imggrp, nextrel=None, releases=None):
continue
key = "{0}-{1}".format(rel, arch)
# using a dict here avoids dupes
imgs[key] = VirtInstallImage(name, rel, arch, variant=variant, size=size,
imgs[key] = VirtInstallImage(name, rel, arch, size=size,
imgver=imgver, maxage=maxage, bootopts=bootopts)
return list(imgs.values())

View File

@ -125,14 +125,16 @@
{
"name" : "minimal",
"releases" : {
"8.6" : ["x86_64", "aarch64"]
"8" : ["x86_64", "aarch64"],
"9" : ["x86_64", "aarch64"]
},
"size" : "15"
},
{
"name" : "minimal-uefi",
"releases" : {
"8.6" : ["x86_64", "aarch64"]
"8" : ["x86_64", "aarch64"],
"9" : ["x86_64", "aarch64"]
},
"size" : "15",
"bootopts": "uefi"
@ -140,31 +142,32 @@
{
"name" : "desktop",
"releases" : {
"8.6": ["x86_64", "aarch64"]
"8": ["x86_64", "aarch64"],
"9" : ["x86_64", "aarch64"]
},
"size" : "20",
"variant": "Workstation"
"size" : "20"
},
{
"name" : "desktopencrypt",
"releases" : {
"8.6" : ["x86_64", "aarch64"]
"8" : ["x86_64", "aarch64"],
"9" : ["x86_64", "aarch64"]
},
"size" : "20",
"variant": "Workstation"
"size" : "20"
},
{
"name" : "server",
"releases" : {
"8.6" : ["x86_64", "aarch64"]
"8" : ["x86_64", "aarch64"],
"9" : ["x86_64", "aarch64"]
},
"size" : "9",
"variant": "Server"
"size" : "9"
},
{
"name" : "support",
"releases" : {
"8.6" : ["x86_64", "aarch64"]
"8" : ["x86_64", "aarch64"],
"9" : ["x86_64", "aarch64"]
},
"size" : "15"
}