[blivet-master] Trivial fixes from going through devicelibs
by Vratislav Podzimek
These three patches do minor changes in the devicelibs modules.
Vratislav Podzimek (3):
Trivial fixes for the lvm devicelib module
Use random.choice for generating LUKS backup passphrase
Whitespace fixes for the crypto devicelib module
blivet/devicelibs/crypto.py | 39 ++++++++++++++++++---------------------
blivet/devicelibs/lvm.py | 4 ++--
2 files changed, 20 insertions(+), 23 deletions(-)
--
1.8.5.3
10 years, 2 months
[PATCH blivet rhel7-branch] fcoe: add sleep for dcbtool command (#1039223)
by Radek Vykydal
Related: rhbz#1039223
Do it as dracut.
---
blivet/fcoe.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/blivet/fcoe.py b/blivet/fcoe.py
index e7e8fef..42d7550 100644
--- a/blivet/fcoe.py
+++ b/blivet/fcoe.py
@@ -121,9 +121,12 @@ class fcoe(object):
error_msg = ""
if dcb:
self._startLldpad()
+ time.sleep(1)
util.run_program(["dcbtool", "sc", nic, "dcb", "on"])
+ time.sleep(1)
util.run_program(["dcbtool", "sc", nic, "app:fcoe",
"e:1", "a:1", "w:1"])
+ time.sleep(1)
rc, out = util.run_program_and_capture_output(["fipvlan", "-c", "-s", "-f",
"-fcoe", nic])
else:
--
1.7.11.7
10 years, 2 months
[rhel7/master] Wait for other threads to finish before sending ready (#1075103)
by Brian C. Lane
More threading fallout. In _initialize we set self._ready and send the
hub the spoke ready message. But some of the other threads may not be
quite done when the hub processes the message so it doesn't set the
Source spoke sensitive. And it stays that way until another spoke is
visited and _updateCompleteness is called on all the spokes.
This adds a loop at the end of the _initialize thread to make sure
self.ready will really be true when the hub gets the source spoke's
ready message.
Resolves: rhbz#1075103
---
pyanaconda/ui/gui/spokes/source.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index 59ff82c..3fa3234 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -646,6 +646,10 @@ class SourceSpoke(NormalSpoke):
# FIXME
self._ready = True
+ # Wait to make sure the other threads are done before sending ready, otherwise
+ # the spoke may not get be sensitive by _handleCompleteness in the hub.
+ while not self.ready:
+ time.sleep(1)
hubQ.send_ready(self.__class__.__name__, False)
def refresh(self):
--
1.8.5.3
10 years, 2 months
[PATCH 1/2] Add support for creating qcow2 images
by Brian C. Lane
---
src/pylorax/imgutils.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/pylorax/imgutils.py b/src/pylorax/imgutils.py
index 1a6c788..6d79b73 100644
--- a/src/pylorax/imgutils.py
+++ b/src/pylorax/imgutils.py
@@ -75,6 +75,19 @@ def mksparse(outfile, size):
fobj = open(outfile, "w")
os.ftruncate(fobj.fileno(), size)
+def mkqcow2(outfile, size, options=None):
+ '''use qemu-img to create a file of the given size.
+ options is a list of options passed to qemu-img
+
+ Default format is qcow2, override by passing "-f", fmt
+ in options.
+ '''
+ if not options:
+ options = []
+ if "-f" not in options:
+ options.extend(["-f", "qcow2"])
+ runcmd(["qemu-img", "create"] + options + [outfile, str(size)])
+
def loop_attach(outfile):
'''Attach a loop device to the given file. Return the loop device name.
Raises CalledProcessError if losetup fails.'''
--
1.8.5.3
10 years, 2 months
[PATCH] Add a script for listing the contents of an updates image
by Martin Kolman
Like lsinitrd but for Anaconda updates images.
Signed-off-by: Martin Kolman <mkolman(a)redhat.com>
---
scripts/lsupdates | 5 +++++
1 file changed, 5 insertions(+)
create mode 100755 scripts/lsupdates
diff --git a/scripts/lsupdates b/scripts/lsupdates
new file mode 100755
index 0000000..3dc4a94
--- /dev/null
+++ b/scripts/lsupdates
@@ -0,0 +1,5 @@
+#!/bin/bash
+#
+# List the contents of an Anaconda updates image
+
+zcat $1 | cpio -c --list
--
1.8.5.3
10 years, 2 months
[PATCH 1/2] Confirm before resetting custom partitioning selections (#970093).
by Chris Lumens
---
pyanaconda/ui/gui/spokes/custom.py | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 45ec28e..7cc1a48 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -2921,7 +2921,23 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
# This callback is for the button that just resets the UI to anaconda's
# current understanding of the disk layout.
def on_reset_clicked(self, *args):
- self.refresh()
+ msg = _("Continuing with this action will reset all your partitioning selections "
+ "to their current on-disk state.")
+
+ dlg = Gtk.MessageDialog(flags=Gtk.DialogFlags.MODAL,
+ message_type=Gtk.MessageType.WARNING,
+ buttons=Gtk.ButtonsType.NONE,
+ message_format=msg)
+ dlg.set_decorated(False)
+ dlg.add_buttons(_("_Reset selections"), 0, _("_Preserve current selections"), 1)
+ dlg.set_default_response(1)
+
+ with enlightbox(self.window, dlg):
+ rc = dlg.run()
+ dlg.destroy()
+
+ if not rc:
+ self.refresh()
# This callback is for the button that has anaconda go back and rescan the
# disks to pick up whatever changes the user made outside our control.
--
1.8.3.1
10 years, 2 months
[master][PATCH] Make vginfo work the same way as pvinfo and other LVM functions
by Vratislav Podzimek
All the other LVM devicelib functions return a dictionary.
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
blivet/devicelibs/lvm.py | 27 ++++++++++++++++++++-------
blivet/devices.py | 4 ++--
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/blivet/devicelibs/lvm.py b/blivet/devicelibs/lvm.py
index b824398..a797710 100644
--- a/blivet/devicelibs/lvm.py
+++ b/blivet/devicelibs/lvm.py
@@ -352,15 +352,28 @@ def vgreduce(vg_name, pv_list, rm=False):
raise LVMError("vgreduce failed for %s: %s" % (vg_name, msg))
def vginfo(vg_name):
- args = ["vgs", "--noheadings", "--nosuffix"] + \
- ["--units", "m"] + \
- ["-o", "uuid,size,free,extent_size,extent_count,free_count,pv_count"] + \
- _getConfigArgs(read_only_locking=True) + \
- [vg_name]
+ args = ["vgs", "--noheadings", "--nosuffix", "--nameprefixes", "--unquoted",
+ "--units", "m",
+ "-o", "uuid,size,free,extent_size,extent_count,free_count,pv_count"] + \
+ _getConfigArgs(read_only_locking=True) + [vg_name]
+ # TODO: make this a common code reused many functions
buf = util.capture_output(["lvm"] + args)
- info = buf.split()
- if len(info) != 7:
+ fields = buf.split()
+ info = {}
+ for field in fields:
+ (name, equals, value) = field.partition("=")
+ if not equals:
+ continue
+
+ if "," in value:
+ val = value.strip().split(",")
+ else:
+ val = value.strip()
+
+ info[name] = val
+
+ if len(info.keys()) != 7:
raise LVMError(_("vginfo failed for %s" % vg_name))
return info
diff --git a/blivet/devices.py b/blivet/devices.py
index fb24b10..9e6efb4 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -2724,8 +2724,8 @@ class LVMLogicalVolumeDevice(DMDevice):
# nothing more can be done, we don't know the VG's free space
return
- extent_size = Size(spec=vg_info[3] + "MiB")
- extents_free = int(vg_info[5])
+ extent_size = Size(spec=vg_info["LVM2_VG_EXTENT_SIZE"] + "MiB")
+ extents_free = int(vg_info["LVM2_VG_FREE_COUNT"])
can_use = extent_size * extents_free
if self.size > can_use:
--
1.8.5.3
10 years, 2 months
[blivet:master] Only log a warning about labeling if something is actually wrong.
by Anne Mulhern
If do_labeling is False, then we are not choosing to set a label during
filesystem creation. Probably we are deferring setting a label until
after the filesystem has been created.
If self.label is None then we are accepting the filesystem default label,
and not setting any label.
So, we only log a warning if setting a label is what ought to happen but we
don't want to risk it because it looks like the label format is not accepted
by this filesystem and that therefore, specifying the label arguments may cause
failure at filesystem creation.
Note: Some filesystem creation apps will truncate a label that is just too
long but others will fail instead. We do not want to distinguish
among filesystems based on this behavior.
Signed-off-by: mulhern <amulhern(a)redhat.com>
---
blivet/formats/fs.py | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 2e2faeb..52abef5 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -353,10 +353,13 @@ class FS(DeviceFormat):
argv.extend(self.defaultFormatOptions)
if self._fsProfileSpecifier and self.fsprofile:
argv.extend([self._fsProfileSpecifier, self.fsprofile])
- if do_labeling and self.label is not None and self.labelFormatOK(self.label):
- argv.extend(self._labelfs.labelingArgs(self.label))
- else:
- log.warning("Could not create label (%s) on filesystem %s", self.label, self.type)
+
+ if do_labeling and self.label is not None:
+ if self.labelFormatOK(self.label):
+ argv.extend(self._labelfs.labelingArgs(self.label))
+ else:
+ log.warning("Choosing not to apply label (%s) during creation of filesystem %s. Label format is unacceptable for this filesystem.", self.label, self.type)
+
argv.append(self.device)
return argv
--
1.8.3.1
10 years, 2 months
[master] First step on the way to sane Custom spoke's code
by Vratislav Podzimek
This patch splits the code that is not part of the Custom spoke out from the
custom.py file to make it shorter and less complex. The same applies to
custom.glade.
It is only a first step, more patches will come soon. I have ~30 red notes in
the printed version of the custom.py code that will probably result in quite a
lot of patches and hopefully in quite better-readable code in the custom.py
module that has grown hardly maintainable in last two years.
Vratislav Podzimek (1):
Split out helper code from the Custom partitioning spoke
pyanaconda/ui/gui/spokes/custom.glade | 988 ------------------
pyanaconda/ui/gui/spokes/custom.py | 665 +-----------
.../ui/gui/spokes/lib/custom_storage_helpers.glade | 1059 ++++++++++++++++++++
.../ui/gui/spokes/lib/custom_storage_helpers.py | 658 ++++++++++++
4 files changed, 1745 insertions(+), 1625 deletions(-)
create mode 100644 pyanaconda/ui/gui/spokes/lib/custom_storage_helpers.glade
create mode 100644 pyanaconda/ui/gui/spokes/lib/custom_storage_helpers.py
--
1.8.5.3
10 years, 2 months
[PATCH] DNFPayload: Add languageGroups().
by Ales Kozumplik
From: Ales Kozumplik <ales(a)redhat.com>
---
pyanaconda/packaging/dnfpayload.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/pyanaconda/packaging/dnfpayload.py b/pyanaconda/packaging/dnfpayload.py
index 8a91af5..23c8623 100644
--- a/pyanaconda/packaging/dnfpayload.py
+++ b/pyanaconda/packaging/dnfpayload.py
@@ -33,6 +33,7 @@ import operator
import pyanaconda.constants as constants
import pyanaconda.errors as errors
import pyanaconda.iutil
+import pyanaconda.localization
import pyanaconda.packaging as packaging
import sys
import time
@@ -515,6 +516,18 @@ class DNFPayload(packaging.PackagePayload):
except (dnf.exceptions.RepoError, KeyError):
return super(DNFPayload, self).isRepoEnabled(repo_id)
+ def languageGroups(self):
+ locales = [self.data.lang.lang] + self.data.lang.addsupport
+ match_fn = pyanaconda.localization.langcode_matches_locale
+ gids = set()
+ gl_tuples = ((g.id, g.lang_only) for g in self._base.comps.groups_iter())
+ for (gid, lang) in gl_tuples:
+ for locale in locales:
+ if match_fn(lang, locale):
+ gids.add(gid)
+ log.info('languageGroups: %s', gids)
+ return list(gids)
+
def preInstall(self, packages=None, groups=None):
super(DNFPayload, self).preInstall()
self._required_pkgs = packages
--
1.8.5.3
10 years, 2 months