Skip to content

Commit

Permalink
Add --disklabel support to clearpart (#1078537)
Browse files Browse the repository at this point in the history
This adds an optional --disklabel=<disklabel> switch to clearpart,
allowing the kickstart to specify a supported disklabel as the default.
If the specified disklabel is not supported on the current platform a
KickstartValueError will be raised.
  • Loading branch information
bcl committed Jun 19, 2014
1 parent f985eb3 commit c0c04cc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions anaconda.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Source0: %{name}-%{version}.tar.bz2
# Also update in AM_GNU_GETTEXT_VERSION in configure.ac
%define gettextver 0.18.3
%define intltoolver 0.31.2-3
%define pykickstartver 1.99.55
%define pykickstartver 1.99.56
%define yumver 3.4.3-91
%define dnfver 0.4.18
%define partedver 1.8.1
Expand Down Expand Up @@ -91,7 +91,7 @@ The anaconda package is a metapackage for the Anaconda installer.
%package core
Summary: Core of the Anaconda installer
Requires: dnf >= %{dnfver}
Requires: python-blivet >= 0.56
Requires: python-blivet >= 0.57
Requires: python-meh >= %{mehver}
Requires: libreport-anaconda >= 2.0.21-1
Requires: libselinux-python
Expand Down
15 changes: 13 additions & 2 deletions pyanaconda/kickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from blivet.partitioning import growLVM
from blivet.size import Size
from blivet import udev
from blivet.platform import platform
import blivet.iscsi
import blivet.fcoe
import blivet.zfcp
Expand Down Expand Up @@ -508,13 +509,18 @@ def execute(self, *args):
log.info("Joined realm %s", self.join_realm)


class ClearPart(commands.clearpart.F17_ClearPart):
class ClearPart(commands.clearpart.F21_ClearPart):
def parse(self, args):
retval = commands.clearpart.F17_ClearPart.parse(self, args)
retval = commands.clearpart.F21_ClearPart.parse(self, args)

if self.type is None:
self.type = CLEARPART_TYPE_NONE

if self.disklabel and self.disklabel not in platform.diskLabelTypes:
raise KickstartValueError(formatErrorMsg(self.lineno,
msg=_("Disklabel \"%s\" given in clearpart command is not "
"supported on this platform.") % self.disklabel))

# Do any glob expansion now, since we need to have the real list of
# disks available before the execute methods run.
drives = []
Expand Down Expand Up @@ -551,6 +557,11 @@ def execute(self, storage, ksdata, instClass):
if self.initAll:
storage.config.initializeDisks = self.initAll

if self.disklabel:
if not platform.setDefaultDiskLabelType(self.disklabel):
log.warn("%s is not a supported disklabel type on this platform. "
"Using default disklabel %s instead.", self.disklabel, platform.defaultDiskLabelType)

storage.clearPartitions()

class Fcoe(commands.fcoe.F13_Fcoe):
Expand Down

0 comments on commit c0c04cc

Please sign in to comment.