1
0
mirror of https://pagure.io/fedora-qa/createhdds.git synced 2024-11-15 21:13:07 +00:00

Re-order VirtInstallImage.create() a bit to avoid bugs

Various things were being set in odd orders and not used right
later on, this is a general clean-up that solves that and makes
things a bit easier to read (I hope).
This commit is contained in:
Adam Williamson 2017-09-04 12:18:40 -07:00
parent 12e3a050b7
commit 7e5db6a426

View File

@ -250,41 +250,42 @@ class VirtInstallImage(object):
tmpfile = "{0}.tmp".format(self.filename) tmpfile = "{0}.tmp".format(self.filename)
arch = self.arch arch = self.arch
try: fedoradir = ''
# different url path between primary and secondary arch if arch == 'i686':
arch = self.arch arch = 'i386'
if arch in ['ppc64','ppc64le']: if arch in ['ppc64','ppc64le']:
fedoradir = 'fedora-secondary' fedoradir = 'fedora-secondary'
memsize = '4096' memsize = '4096'
else: else:
fedoradir = 'fedora/linux' fedoradir = 'fedora/linux'
memsize = '2048' memsize = '2048'
# this is almost complex enough to need fedfind but not
# quite, I think. also fedfind can't find the 'transient'
# rawhide and branched locations at present
if self.release == 'rawhide':
loctmp = "https://dl.fedoraproject.org/pub/{0}/development/rawhide/{1}/{2}/os".format(fedoradir, self.variant, self.arch)
elif int(self.release) > fedfind.helpers.get_current_release(branched=False):
# branched
loctmp = "https://dl.fedoraproject.org/pub/{3}/development/{0}/{1}/{2}/os/".format(self.release, self.variant, self.arch, fedoradir)
else:
if arch == 'i686' and int(self.release) > 25:
# from F26 onwards, i686 is in fedora-secondary
fedoradir = 'fedora-secondary'
loctmp = "https://download.fedoraproject.org/pub/{3}/releases/{0}/{1}/{2}/os/".format(self.release, self.variant, self.arch, fedoradir)
if arch == 'i686':
arch = 'i386'
xargs = "inst.ks=file:/{0}.ks".format(self.name)
variant = self.variant variant = self.variant
# For F26, the installer images in the Workstation tree seem to be # For F26, the installer images in the Workstation tree seem to be
# the OStree installer (they're much bigger than they should be), # the OStree installer (they're much bigger than they should be),
# so use Everything instead of Workstation for F26 # so use Everything instead of Workstation for F26
if int(self.release) == 26 and variant == "Workstation": if int(self.release) == 26 and variant == "Workstation":
variant = "Everything" variant = "Everything"
try:
# this is almost complex enough to need fedfind but not
# quite, I think. also fedfind can't find the 'transient'
# rawhide and branched locations at present
if self.release == 'rawhide':
loctmp = "https://dl.fedoraproject.org/pub/{0}/development/rawhide/{2}/{3}/os"
elif int(self.release) > fedfind.helpers.get_current_release(branched=False):
# branched
loctmp = "https://dl.fedoraproject.org/pub/{0}/development/{0}/{1}/{2}/os/"
else:
loctmp = "https://download.fedoraproject.org/pub/{0}/releases/{1}/{2}/{3}/os/"
if arch == 'i686' and int(self.release) > 25:
# from F26 onwards, i686 is in fedora-secondary
fedoradir = 'fedora-secondary'
xargs = "inst.ks=file:/{0}.ks".format(self.name)
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}.ks".format(SCRIPTDIR, self.name), "--location", "{0}/{1}.ks".format(SCRIPTDIR, self.name), "--location",
loctmp.format(str(self.release), variant, arch), "--name", "createhdds", loctmp.format(fedoradir, str(self.release), variant, arch), "--name", "createhdds",
"--memory", memsize , "--noreboot", "--wait", "-1"] "--memory", memsize , "--noreboot", "--wait", "-1"]
if textinst: if textinst:
args.extend(("--graphics", "none", "--extra-args", "console=ttyS0")) args.extend(("--graphics", "none", "--extra-args", "console=ttyS0"))