Re: [rhinstaller/blivet/pulls/291 master] Translation tests
by dashea
> @@ -42,29 +42,92 @@
> _DECIMAL_FACTOR = 10 ** 3
> _BINARY_FACTOR = 2 ** 10
>
> +# TRANSLATORS: 'B' for "Bytes"
> _BYTES_SYMBOL = N_("B")
> _BYTES_WORDS = (N_("bytes"), N_("byte"))
>
> # Symbolic constants for units
> B = _Prefix(1, "", "")
>
> -KB = _Prefix(_DECIMAL_FACTOR ** 1, N_("kilo"), N_("k"))
> -MB = _Prefix(_DECIMAL_FACTOR ** 2, N_("mega"), N_("M"))
> -GB = _Prefix(_DECIMAL_FACTOR ** 3, N_("giga"), N_("G"))
> -TB = _Prefix(_DECIMAL_FACTOR ** 4, N_("tera"), N_("T"))
> -PB = _Prefix(_DECIMAL_FACTOR ** 5, N_("peta"), N_("P"))
> -EB = _Prefix(_DECIMAL_FACTOR ** 6, N_("exa"), N_("E"))
> -ZB = _Prefix(_DECIMAL_FACTOR ** 7, N_("zetta"), N_("Z"))
> -YB = _Prefix(_DECIMAL_FACTOR ** 8, N_("yotta"), N_("Y"))
> -
> -KiB = _Prefix(_BINARY_FACTOR ** 1, N_("kibi"), N_("Ki"))
> -MiB = _Prefix(_BINARY_FACTOR ** 2, N_("mebi"), N_("Mi"))
> -GiB = _Prefix(_BINARY_FACTOR ** 3, N_("gibi"), N_("Gi"))
> -TiB = _Prefix(_BINARY_FACTOR ** 4, N_("tebi"), N_("Ti"))
> -PiB = _Prefix(_BINARY_FACTOR ** 5, N_("pebi"), N_("Pi"))
> -EiB = _Prefix(_BINARY_FACTOR ** 6, N_("exbi"), N_("Ei"))
> -ZiB = _Prefix(_BINARY_FACTOR ** 7, N_("zebi"), N_("Zi"))
> -YiB = _Prefix(_BINARY_FACTOR ** 8, N_("yobi"), N_("Yi"))
> +KB = _Prefix(_DECIMAL_FACTOR ** 1,
> + N_("kilo"),
> + # TRANSLATORS: "k" for "kilo-" (x 1,000)
I think it would be better to use the scientific notation like you do for the binary units, eg: `10^3` since some places use the comma where we use the decimal point.
--
To view this pull request on github, visit https://github.com/rhinstaller/blivet/pull/291#discussion_r48864136
8 years, 5 months
[PATCH rhel6-branch] Create symlink for NM ibft plugin rather then relocate iscsiadm (#831002)
by Radek Vykydal
Although ifcfg-rh ibft config parser using /usr/sbin/iscsiadm is replaced by NM
ibft plugin, we don't want to remove iscsiadm from that location [1] so we
don't risk breaking existing setups relying on the tool path (see also bug
1292789).
[1] commit 0eb6b5e33ccee460c6e3641d9097b5ac6c83349b
Related: rhbz#831002
---
scripts/mk-images | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/mk-images b/scripts/mk-images
index 3e5657d..2acec51 100755
--- a/scripts/mk-images
+++ b/scripts/mk-images
@@ -1000,8 +1000,10 @@ makeinitrd() {
( cd $IMGPATH/usr/share/dbus-1/system-services
cp -a org.freedesktop.nm_dispatcher.service $MBD_DIR/usr/share/dbus-1/system-services
)
- # for NM ibft plugin
- instbin $IMGPATH /usr/sbin/iscsiadm $MBD_DIR /sbin/iscsiadm
+ # for BOOTPROTO=ibft option
+ instbin $IMGPATH /usr/sbin/iscsiadm $MBD_DIR /usr/sbin/iscsiadm
+ # for NM ibft plugin which replaces BOOTPROTO=ibft
+ ln -s ../usr/sbin/iscsiadm $MBD_DIR/sbin/iscsiadm
# mdadm
instbin $IMGPATH /usr/sbin/mdadm $MBD_DIR /sbin/mdadm
--
2.4.3
8 years, 5 months
[master 27/27] Improve logging of failure to validate new default
fstype.
by dashea
From: David Lehman <dlehman(a)redhat.com>
---
blivet/blivet.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/blivet/blivet.py b/blivet/blivet.py
index fbe6296..94d23b7 100644
--- a/blivet/blivet.py
+++ b/blivet/blivet.py
@@ -1506,7 +1506,7 @@ def _check_valid_fstype(self, newtype):
if (not fmt.mountable or not fmt.formattable or not fmt.supported or
not fmt.linux_native):
- log.debug("invalid default fstype: %r", fmt)
+ log.debug("invalid default fstype (%s): %r", newtype, fmt)
raise ValueError("new value %s is not valid as a default fs type" % newtype)
self._default_fstype = newtype # pylint: disable=attribute-defined-outside-init
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/a33212667c6aa449b60753fda94b...
8 years, 5 months
[master 26/27] Remove unused populated attribute from Populator.
by dashea
From: David Lehman <dlehman(a)redhat.com>
---
blivet/populator/populator.py | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/blivet/populator/populator.py b/blivet/populator/populator.py
index 76a1d06..cba8edc 100644
--- a/blivet/populator/populator.py
+++ b/blivet/populator/populator.py
@@ -75,9 +75,6 @@ def __init__(self, conf=None, passphrase=None, luks_dict=None):
self.reset(conf=conf, passphrase=passphrase, luks_dict=luks_dict)
def reset(self, conf=None, passphrase=None, luks_dict=None):
- # indicates whether or not the tree has been fully populated
- self.populated = False
-
self.disk_images = {}
images = getattr(conf, "disk_images", {})
if images:
@@ -510,10 +507,6 @@ def _populate(self):
self.setup_disk_images()
- # mark the tree as unpopulated so exception handlers can tell the
- # exception originated while finding storage devices
- self.populated = False
-
self._resolve_protected_device_specs()
self._find_live_backing_device()
@@ -539,8 +532,6 @@ def _populate(self):
for dev in devices:
self.handle_device(dev)
- self.populated = True
-
# After having the complete tree we make sure that the system
# inconsistencies are ignored or resolved.
self._handle_inconsistencies()
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/396f53f64e4989bc96e426a55af2...
8 years, 5 months
[master 25/27] Stop passing around the iscsi singleton.
by dashea
From: David Lehman <dlehman(a)redhat.com>
---
blivet/blivet.py | 13 +++++--------
blivet/devicetree.py | 9 ++++-----
blivet/populator/populator.py | 10 +++-------
3 files changed, 12 insertions(+), 20 deletions(-)
diff --git a/blivet/blivet.py b/blivet/blivet.py
index 795a775..fbe6296 100644
--- a/blivet/blivet.py
+++ b/blivet/blivet.py
@@ -48,7 +48,7 @@
from .formats import get_format
from .osinstall import FSSet, find_existing_installations
from . import arch
-from . import iscsi
+from .iscsi import iscsi
from . import fcoe
from . import zfcp
from . import devicefactory
@@ -140,7 +140,6 @@ def __init__(self, ksdata=None):
self.set_default_fstype(get_default_filesystem_type())
self._default_boot_fstype = None
- self.iscsi = iscsi.iscsi()
self.fcoe = fcoe.fcoe()
self.zfcp = zfcp.ZFCP()
@@ -150,8 +149,7 @@ def __init__(self, ksdata=None):
# these will both be empty until our reset method gets called
self.devicetree = DeviceTree(conf=self.config,
passphrase=self.encryption_passphrase,
- luks_dict=self.__luks_devs,
- iscsi=self.iscsi)
+ luks_dict=self.__luks_devs)
self.fsset = FSSet(self.devicetree)
self.roots = []
self.services = set()
@@ -267,14 +265,13 @@ def reset(self, cleanup_only=False):
self.config.update(self.ksdata)
if flags.installer_mode and not flags.image_install:
- self.iscsi.startup()
+ iscsi.startup()
self.fcoe.startup()
self.zfcp.startup()
self.devicetree.reset(conf=self.config,
passphrase=self.encryption_passphrase,
- luks_dict=self.__luks_devs,
- iscsi=self.iscsi)
+ luks_dict=self.__luks_devs)
self.devicetree.populate(cleanup_only=cleanup_only)
self.fsset = FSSet(self.devicetree)
self.edd_dict = get_edd_dict(self.partitioned)
@@ -1381,7 +1378,7 @@ def write(self):
self.fsset.write()
self.make_mtab()
- self.iscsi.write(get_sysroot(), self)
+ iscsi.write(get_sysroot(), self)
self.fcoe.write(get_sysroot())
self.zfcp.write(get_sysroot())
self.write_dasd_conf(get_sysroot())
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index bc4db12..a6df5df 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -897,12 +897,11 @@ def _hide_ignored_disks(self):
class DeviceTree(DeviceTreeBase, PopulatorMixin):
- def __init__(self, conf=None, passphrase=None, luks_dict=None, iscsi=None):
+ def __init__(self, conf=None, passphrase=None, luks_dict=None):
DeviceTreeBase.__init__(self, conf=conf)
- PopulatorMixin.__init__(self, passphrase=passphrase, luks_dict=luks_dict, iscsi=iscsi)
+ PopulatorMixin.__init__(self, passphrase=passphrase, luks_dict=luks_dict)
# pylint: disable=arguments-differ
- def reset(self, conf=None, passphrase=None, luks_dict=None, iscsi=None):
+ def reset(self, conf=None, passphrase=None, luks_dict=None):
DeviceTreeBase.reset(self, conf=conf)
- PopulatorMixin.reset(self, conf=conf, passphrase=passphrase, luks_dict=luks_dict,
- iscsi=iscsi)
+ PopulatorMixin.reset(self, conf=conf, passphrase=passphrase, luks_dict=luks_dict)
diff --git a/blivet/populator/populator.py b/blivet/populator/populator.py
index 8a0a47b..76a1d06 100644
--- a/blivet/populator/populator.py
+++ b/blivet/populator/populator.py
@@ -63,25 +63,21 @@ def parted_exn_handler(exn_type, exn_options, exn_msg):
class PopulatorMixin(object):
- def __init__(self, conf=None, passphrase=None, luks_dict=None, iscsi=None):
+ def __init__(self, conf=None, passphrase=None, luks_dict=None):
"""
:keyword conf: storage discovery configuration
:type conf: :class:`~.StorageDiscoveryConfig`
:keyword passphrase: default LUKS passphrase
:keyword luks_dict: a dict with UUID keys and passphrase values
:type luks_dict: dict
- :keyword iscsi: ISCSI control object
- :type iscsi: :class:`~.iscsi.iscsi`
"""
- self.reset(conf=conf, passphrase=passphrase, luks_dict=luks_dict, iscsi=iscsi)
+ self.reset(conf=conf, passphrase=passphrase, luks_dict=luks_dict)
- def reset(self, conf=None, passphrase=None, luks_dict=None, iscsi=None):
+ def reset(self, conf=None, passphrase=None, luks_dict=None):
# indicates whether or not the tree has been fully populated
self.populated = False
- self.iscsi = iscsi
-
self.disk_images = {}
images = getattr(conf, "disk_images", {})
if images:
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/650505fb0118b8b076e006fb558c...
8 years, 5 months
[master 24/27] Make the iscsi singleton satisfactory to pylint.
by dashea
From: David Lehman <dlehman(a)redhat.com>
---
blivet/iscsi.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/blivet/iscsi.py b/blivet/iscsi.py
index 26b0aa0..2f6caf8 100644
--- a/blivet/iscsi.py
+++ b/blivet/iscsi.py
@@ -121,7 +121,7 @@ def _call_discover_targets(con_write, con_recv, ipaddr, port, authinfo):
con_write.send((False, ex))
-class iscsi(object):
+class _iSCSI(object):
""" iSCSI utility class.
@@ -542,6 +542,6 @@ def get_node_disks(self, node, storage):
return node_disks
# Create iscsi singleton
-iscsi = iscsi()
+iscsi = _iSCSI()
# vim:tw=78:ts=4:et:sw=4
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/7ca7a2feb8f5c428f433920e97a6...
8 years, 5 months
[master 23/27] Remove the various DASD lists from Blivet and
DeviceTree.
by dashea
From: David Lehman <dlehman(a)redhat.com>
See Blivet.write_dasd_conf for an example of how to get
a list of the DASDs.
---
blivet/blivet.py | 22 ++++++---------
blivet/devicetree.py | 58 +++++-----------------------------------
blivet/populator/helpers/disk.py | 3 ---
blivet/populator/populator.py | 9 +++----
4 files changed, 17 insertions(+), 75 deletions(-)
diff --git a/blivet/blivet.py b/blivet/blivet.py
index 710da61..795a775 100644
--- a/blivet/blivet.py
+++ b/blivet/blivet.py
@@ -134,7 +134,6 @@ def __init__(self, ksdata=None):
self.autopart_add_backup_passphrase = False
self.autopart_requests = []
self.edd_dict = {}
- self.dasd = []
self.__luks_devs = {}
self.size_sets = []
@@ -152,8 +151,7 @@ def __init__(self, ksdata=None):
self.devicetree = DeviceTree(conf=self.config,
passphrase=self.encryption_passphrase,
luks_dict=self.__luks_devs,
- iscsi=self.iscsi,
- dasd=self.dasd)
+ iscsi=self.iscsi)
self.fsset = FSSet(self.devicetree)
self.roots = []
self.services = set()
@@ -272,17 +270,11 @@ def reset(self, cleanup_only=False):
self.iscsi.startup()
self.fcoe.startup()
self.zfcp.startup()
- self.dasd = self.devicetree.make_dasd_list(self.dasd, self.devices)
-
- if self.dasd:
- # Reset the internal dasd list (823534)
- self.dasd = []
self.devicetree.reset(conf=self.config,
passphrase=self.encryption_passphrase,
luks_dict=self.__luks_devs,
- iscsi=self.iscsi,
- dasd=self.dasd)
+ iscsi=self.iscsi)
self.devicetree.populate(cleanup_only=cleanup_only)
self.fsset = FSSet(self.devicetree)
self.edd_dict = get_edd_dict(self.partitioned)
@@ -1392,17 +1384,19 @@ def write(self):
self.iscsi.write(get_sysroot(), self)
self.fcoe.write(get_sysroot())
self.zfcp.write(get_sysroot())
- self.write_dasd_conf(self.dasd, get_sysroot())
+ self.write_dasd_conf(get_sysroot())
- def write_dasd_conf(self, disks, root):
+ def write_dasd_conf(self, root):
""" Write /etc/dasd.conf to target system for all DASD devices
configured during installation.
"""
- if not (arch.is_s390() and disks):
+ dasds = self.devicetree.get_devices_by_type("dasd")
+ dasds.sort(key=lambda d: d.name)
+ if not (arch.is_s390() and dasds):
return
with open(os.path.realpath(root + "/etc/dasd.conf"), "w") as f:
- for dasd in sorted(disks, key=lambda d: d.name):
+ for dasd in dasds:
fields = [dasd.busid] + dasd.get_opts()
f.write("%s\n" % " ".join(fields),)
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index fb9b146..bc4db12 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -31,9 +31,9 @@
from .actionlist import ActionList
from .errors import DeviceError, DeviceTreeError, StorageError
from .deviceaction import ActionDestroyDevice, ActionDestroyFormat
-from .devices import BTRFSDevice, DASDDevice, NoDevice, PartitionDevice
+from .devices import BTRFSDevice, NoDevice, PartitionDevice
from .devices import LVMLogicalVolumeDevice, LVMVolumeGroupDevice
-from . import formats, arch
+from . import formats
from .devicelibs import lvm
from . import util
from .populator import PopulatorMixin
@@ -719,45 +719,6 @@ def resolve_device(self, devspec, blkid_tab=None, crypt_tab=None, options=None):
return device
#
- # DASD
- #
- def make_dasd_list(self, dasds, disks):
- """ Create a list of DASDs recognized by the system
-
- :param list dasds: a list of DASD devices
- :param list disks: a list of disks on the system
- :returns: a list of DASD devices identified on the system
- :rtype: list of :class:
- """
- if not arch.is_s390():
- return
-
- log.info("Generating DASD list....")
- for dev in (disk for disk in disks if disk.type == "dasd"):
- if dev not in dasds:
- dasds.append(dev)
-
- return dasds
-
- def make_unformatted_dasd_list(self, dasds):
- """ Create a list of DASDs which are detected to require dasdfmt.
-
- :param list dasds: a list of DASD devices
- :returns: a list of DASDs which need dasdfmt in order to be used
- :rtype: list of :class:
- """
- if not arch.is_s390():
- return
-
- unformatted = []
-
- for dasd in dasds:
- if blockdev.s390.dasd_needs_format(dasd.busid):
- unformatted.append(dasd)
-
- return unformatted
-
- #
# Conveniences
#
@property
@@ -885,10 +846,6 @@ def hide(self, device):
self._hidden.append(device)
lvm.lvm_cc_addFilterRejectRegexp(device.name)
- if isinstance(device, DASDDevice):
- # pylint: disable=no-member
- self.dasd.remove(device)
-
if device.name not in self.names:
self.names.append(device.name)
@@ -917,9 +874,6 @@ def unhide(self, device):
self._devices.append(hidden)
hidden.add_hook(new=False)
lvm.lvm_cc_removeFilterRejectRegexp(hidden.name)
- if isinstance(device, DASDDevice):
- # pylint: disable=no-member
- self.dasd.append(device)
def _is_ignored_disk(self, disk):
return ((self.ignored_disks and disk.name in self.ignored_disks) or
@@ -943,12 +897,12 @@ def _hide_ignored_disks(self):
class DeviceTree(DeviceTreeBase, PopulatorMixin):
- def __init__(self, conf=None, passphrase=None, luks_dict=None, iscsi=None, dasd=None):
+ def __init__(self, conf=None, passphrase=None, luks_dict=None, iscsi=None):
DeviceTreeBase.__init__(self, conf=conf)
- PopulatorMixin.__init__(self, passphrase=passphrase, luks_dict=luks_dict, iscsi=iscsi, dasd=dasd)
+ PopulatorMixin.__init__(self, passphrase=passphrase, luks_dict=luks_dict, iscsi=iscsi)
# pylint: disable=arguments-differ
- def reset(self, conf=None, passphrase=None, luks_dict=None, iscsi=None, dasd=None):
+ def reset(self, conf=None, passphrase=None, luks_dict=None, iscsi=None):
DeviceTreeBase.reset(self, conf=conf)
PopulatorMixin.reset(self, conf=conf, passphrase=passphrase, luks_dict=luks_dict,
- iscsi=iscsi, dasd=dasd)
+ iscsi=iscsi)
diff --git a/blivet/populator/helpers/disk.py b/blivet/populator/helpers/disk.py
index fb93721..69045e5 100644
--- a/blivet/populator/helpers/disk.py
+++ b/blivet/populator/helpers/disk.py
@@ -72,9 +72,6 @@ def run(self):
kwargs = self._get_kwargs()
device = self._device_class(name, **kwargs)
- if self._device_class == DASDDevice:
- self._devicetree.dasd.append(device)
-
self._devicetree._add_device(device)
return device
diff --git a/blivet/populator/populator.py b/blivet/populator/populator.py
index 7f2c243..8a0a47b 100644
--- a/blivet/populator/populator.py
+++ b/blivet/populator/populator.py
@@ -63,7 +63,7 @@ def parted_exn_handler(exn_type, exn_options, exn_msg):
class PopulatorMixin(object):
- def __init__(self, conf=None, passphrase=None, luks_dict=None, iscsi=None, dasd=None):
+ def __init__(self, conf=None, passphrase=None, luks_dict=None, iscsi=None):
"""
:keyword conf: storage discovery configuration
:type conf: :class:`~.StorageDiscoveryConfig`
@@ -72,18 +72,15 @@ def __init__(self, conf=None, passphrase=None, luks_dict=None, iscsi=None, dasd=
:type luks_dict: dict
:keyword iscsi: ISCSI control object
:type iscsi: :class:`~.iscsi.iscsi`
- :keyword dasd: DASD control object
- :type dasd: :class:`~.dasd.DASD`
"""
- self.reset(conf=conf, passphrase=passphrase, luks_dict=luks_dict, iscsi=iscsi, dasd=dasd)
+ self.reset(conf=conf, passphrase=passphrase, luks_dict=luks_dict, iscsi=iscsi)
- def reset(self, conf=None, passphrase=None, luks_dict=None, iscsi=None, dasd=None):
+ def reset(self, conf=None, passphrase=None, luks_dict=None, iscsi=None):
# indicates whether or not the tree has been fully populated
self.populated = False
self.iscsi = iscsi
- self.dasd = dasd
self.disk_images = {}
images = getattr(conf, "disk_images", {})
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/7523d41266849dc9d617c6dc0623...
8 years, 5 months