Add PowerPC support in createhdds script and json

Assumption createhdds executed on a PowerPC ppc64le host
to create the PowerPC specific images.

Detect current CPU arch of host machine to create virt-install images
only for supported architectures. (hardcoded lists)

hdds.json specific changes for PowerPC
* no desktop or kde images

Signed-off-by: Michel Normand <normand@linux.vnet.ibm.com>
This commit is contained in:
Michel Normand 2017-02-20 11:08:19 -05:00
parent 658e082418
commit eec1f1ae6e
2 changed files with 30 additions and 10 deletions

View File

@ -31,6 +31,7 @@ import time
import fedfind.helpers import fedfind.helpers
import guestfs import guestfs
import libvirt import libvirt
import platform
from six.moves.urllib.request import urlopen from six.moves.urllib.request import urlopen
@ -40,6 +41,7 @@ from six.moves.urllib.request import urlopen
# as the script itself. images are checked/created in the working # as the script itself. images are checked/created in the working
# directory. # directory.
SCRIPTDIR = os.path.abspath(os.path.dirname(sys.argv[0])) SCRIPTDIR = os.path.abspath(os.path.dirname(sys.argv[0]))
CPUARCH = platform.processor()
logger = logging.getLogger('createhdds') logger = logging.getLogger('createhdds')
def handle_size(size): def handle_size(size):
@ -230,20 +232,25 @@ class VirtInstallImage(object):
tmpfile = "{0}.tmp".format(self.filename) tmpfile = "{0}.tmp".format(self.filename)
arch = self.arch arch = self.arch
try: try:
# different url path between primary and secondary arch
arch = self.arch
if arch in ['ppc64','ppc64le']:
fedoradir = 'fedora-secondary'
else:
fedoradir = 'fedora/linux'
# this is almost complex enough to need fedfind but not # this is almost complex enough to need fedfind but not
# quite, I think. also fedfind can't find the 'transient' # quite, I think. also fedfind can't find the 'transient'
# rawhide and branched locations at present # rawhide and branched locations at present
if self.release == 'rawhide': if self.release == 'rawhide':
loctmp = "https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/{1}/{2}/os/" 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): elif int(self.release) > fedfind.helpers.get_current_release(branched=False):
# branched # branched
loctmp = "https://dl.fedoraproject.org/pub/fedora/linux/development/{0}/{1}/{2}/os/" loctmp = "https://dl.fedoraproject.org/pub/{3}/development/{0}/{1}/{2}/os/".format(self.release, self.variant, self.arch, fedoradir)
else: else:
if arch == 'i686' and int(self.release) > 25: if arch == 'i686' and int(self.release) > 25:
# from F26 onwards, i686 is in fedora-secondary # from F26 onwards, i686 is in fedora-secondary
loctmp = "https://download.fedoraproject.org/pub/fedora-secondary/releases/{0}/{1}/{2}/os/" fedoradir = 'fedora-secondary'
else: loctmp = "https://download.fedoraproject.org/pub/{3}/releases/{0}/{1}/{2}/os/".format(self.release, self.variant, self.arch, fedoradir)
loctmp = "https://download.fedoraproject.org/pub/fedora/linux/releases/{0}/{1}/{2}/os/"
if arch == 'i686': if arch == 'i686':
arch = 'i386' arch = 'i386'
xargs = "inst.ks=file:/{0}.ks".format(self.name) xargs = "inst.ks=file:/{0}.ks".format(self.name)
@ -397,6 +404,16 @@ def get_virtinstall_images(imggrp, nextrel=None, releases=None):
-2 means 'two releases lower than the "next" release', and so on. -2 means 'two releases lower than the "next" release', and so on.
The values are the arches to build for that release. The values are the arches to build for that release.
""" """
powerpc_arches = ['ppc64', 'ppc64le']
intel_arches = ['i686', 'x86_64']
if CPUARCH in powerpc_arches:
supported_arches = powerpc_arches
elif CPUARCH in intel_arches:
supported_arches = intel_arches
else:
supported_arches = []
logger.info("Need to add a list of supported arches for %s CPU", CPUARCH)
imgs = [] imgs = []
# Set this here so if we need to calculate it, we only do it once # Set this here so if we need to calculate it, we only do it once
if not nextrel: if not nextrel:
@ -436,6 +453,9 @@ def get_virtinstall_images(imggrp, nextrel=None, releases=None):
# assume a single integer release number # assume a single integer release number
rels = [release] rels = [release]
for arch in arches: for arch in arches:
if arch not in supported_arches:
logger.debug("%s arch ignored on %s CPU machine", arch, CPUARCH)
continue
for rel in rels: for rel in rels:
imgs.append( imgs.append(
VirtInstallImage(name, rel, arch, variant=variant, size=size, imgver=imgver, VirtInstallImage(name, rel, arch, variant=variant, size=size, imgver=imgver,

View File

@ -127,8 +127,8 @@
{ {
"name" : "minimal", "name" : "minimal",
"releases" : { "releases" : {
"-1" : ["x86_64"], "-1" : ["x86_64", "ppc64le", "ppc64"],
"-2" : ["x86_64"] "-2" : ["x86_64", "ppc64le", "ppc64"]
}, },
"size" : "6", "size" : "6",
"imgver": "2" "imgver": "2"
@ -155,8 +155,8 @@
{ {
"name" : "server", "name" : "server",
"releases" : { "releases" : {
"stable" : ["x86_64"], "stable" : ["x86_64", "ppc64le", "ppc64"],
"branched": ["x86_64"] "branched": ["x86_64", "ppc64le", "ppc64"]
}, },
"size" : "6", "size" : "6",
"imgver": "3", "imgver": "3",
@ -174,7 +174,7 @@
{ {
"name" : "support", "name" : "support",
"releases" : { "releases" : {
"current" : ["x86_64"] "current" : ["x86_64", "ppc64le", "ppc64"]
}, },
"size" : "6", "size" : "6",
"imgver" : "3" "imgver" : "3"