New version: 2.1.7-1

- Require BlockDev 2.0 in the gi.require_version() call (vpodzime)
- Fix detection of 'macefi' partitions (#1393846) (awilliam)
- Use a list comprehension for _to_node_infos (awilliam)
- Device name now checked only for new devices (japokorn)
- Remove several redundant teardown calls. (dlehman)
- Cache and reuse data about multipath members (vpodzime)
- Remove some obsolete pvscan calls. (dlehman)
This commit is contained in:
Vratislav Podzimek 2016-11-21 11:56:36 +01:00
parent b861c468d9
commit a9d7906d31
7 changed files with 14 additions and 279 deletions

1
.gitignore vendored
View File

@ -101,3 +101,4 @@
/blivet-2.1.4.tar.gz
/blivet-2.1.5.tar.gz
/blivet-2.1.6.tar.gz
/blivet-2.1.7.tar.gz

View File

@ -1,28 +0,0 @@
From cf32290dd3a0561585837fddfcdb08b3389f356a Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Wed, 26 Oct 2016 16:17:46 -0700
Subject: [PATCH 1/4] Use correct type for port in GVariant tuple
The type is `(sqa{sv})`, where `q` (according to the docs) is
"an unsigned 16 bit integer", so this should be an int, not a
string.
---
blivet/iscsi.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/blivet/iscsi.py b/blivet/iscsi.py
index 8773509..14c4b9a 100644
--- a/blivet/iscsi.py
+++ b/blivet/iscsi.py
@@ -369,7 +369,7 @@ class iSCSI(object):
if r_password:
auth_info["r_password"] = GLib.Variant("s", r_password)
- args = GLib.Variant("(sqa{sv})", (ipaddr, port, auth_info))
+ args = GLib.Variant("(sqa{sv})", (ipaddr, int(port), auth_info))
nodes, _n_nodes = self._call_initiator_method("DiscoverSendTargets", args)
found_nodes = _to_node_infos(nodes)
--
2.7.4

View File

@ -1,122 +0,0 @@
From 5eaadad9218210ed2a616104a6e56665c38f9277 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Wed, 26 Oct 2016 20:42:53 -0700
Subject: [PATCH 2/4] iSCSI: Store auth info in NodeInfo tuples
This seems to have been overlooked in 9280eff7 . When we were
using libiscsi, the `node` objects were `PyIscsiNode` instances
(I think), with `getAuth` and `setAuth` methods that let you
read and set the authentication information for the node. We
used `getAuth` in `iScsiDiskDevice.dracut_setup_args()` to
include the auth information in the `netroot` arg. anaconda
also expects the `node` attribute of an `iScsiDiskDevice`
instance to be a `PyIscsiNode` and calls its `getAuth` method
to populate the kickstart data for the node.
When we ditched libiscsi and turned the `node` objects into
`NodeInfo` namedtuples, this was missed and not handled at all.
Both blivet and anaconda are still trying to call methods that
these node objects just don't have any more. The blivet call
was changed from `getAuth()` to `get_auth()` in 4e8f941b , but
apparently whoever did that didn't notice that neither method
exists at all for these objects any more...
Here's my attempt to fix this: basically, just stuff the auth
information into the `NodeInfo` instances when we log in. I
thought of several different ways to do this, but I think in
the end it always has to boil down to storing the auth details
on the node object when we log in, so let's just go with the
obvious way. We could mimic the `getAuth` and `setAuth` methods
pretty easily for 'compatibility', but it doesn't seem worth
it, we'd probably still be missing other bits of the interface.
---
blivet/devices/disk.py | 11 +++++------
blivet/iscsi.py | 33 +++++++++++++++++++++++++++++++--
2 files changed, 36 insertions(+), 8 deletions(-)
diff --git a/blivet/devices/disk.py b/blivet/devices/disk.py
index 6880e1e..acf31ee 100644
--- a/blivet/devices/disk.py
+++ b/blivet/devices/disk.py
@@ -452,12 +452,11 @@ class iScsiDiskDevice(DiskDevice, NetworkStorageDevice):
address = "[%s]" % address
netroot = "netroot=iscsi:"
- auth = self.node.get_auth()
- if auth:
- netroot += "%s:%s" % (auth.username, auth.password)
- if len(auth.reverse_username) or len(auth.reverse_password):
- netroot += ":%s:%s" % (auth.reverse_username,
- auth.reverse_password)
+ if self.node.username and self.node.password:
+ netroot += "%s:%s" % (self.node.username, self.node.password)
+ if self.node.r_username and self.node.r_password:
+ netroot += ":%s:%s" % (self.node.r_username,
+ self.node.r_password)
iface_spec = ""
if self.nic != "default":
diff --git a/blivet/iscsi.py b/blivet/iscsi.py
index 14c4b9a..1969fc8 100644
--- a/blivet/iscsi.py
+++ b/blivet/iscsi.py
@@ -66,10 +66,31 @@ def has_iscsi():
return True
-NodeInfo = namedtuple("NodeInfo", ["name", "tpgt", "address", "port", "iface"])
TargetInfo = namedtuple("TargetInfo", ["ipaddr", "port"])
+class NodeInfo(object):
+ """Simple representation of node information."""
+ def __init__(self, name, tpgt, address, port, iface):
+ self.name = name
+ self.tpgt = tpgt
+ self.address = address
+ self.port = port
+ self.iface = iface
+ # These get set by log_into_node, but *NOT* _login
+ self.username = None
+ self.password = None
+ self.r_username = None
+ self.r_password = None
+
+ @property
+ def conn_info(self):
+ """The 5-tuple of connection info (no auth info). This form
+ is useful for interacting with storaged.
+ """
+ return (self.name, self.tpgt, self.address, self.port, self.iface)
+
+
class LoginInfo(object):
def __init__(self, node, logged_in):
self.node = node
@@ -239,7 +260,7 @@ class iSCSI(object):
extra = dict()
extra["node.startup"] = GLib.Variant("s", "automatic")
- args = GLib.Variant("(sisisa{sv})", tuple(list(node_info) + [extra]))
+ args = GLib.Variant("(sisisa{sv})", node_info.conn_info + (extra,))
self._call_initiator_method("Login", args)
@storaged_iscsi_required(critical=False, eval_mode=util.EvalMode.onetime)
@@ -414,6 +435,14 @@ class iSCSI(object):
node.name, node.address, node.port, node.iface)
if not self._mark_node_active(node):
log.error("iSCSI: node not found among discovered")
+ if username:
+ node.username = username
+ if password:
+ node.password = password
+ if r_username:
+ node.r_username = r_username
+ if r_password:
+ node.r_password = r_password
except safe_dbus.DBusCallError as e:
msg = str(e)
log.warning("iSCSI: could not log into %s: %s", node.name, msg)
--
2.7.4

View File

@ -1,71 +0,0 @@
From 4d0b9f8338bfc1634340bb191058b888094ca81d Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Thu, 27 Oct 2016 15:17:29 -0700
Subject: [PATCH 3/4] iSCSI: turn `iscsi.initiator_set` into a property
The iSCSI class has an `initiator_set` attribute whose meaning
feels a bit slippery these days. It has always been set to
True in `__init__()` if iBFT is active, right after we get the
initiator name from the firmware. Prior to 9280eff7, it was
also set true by `startup()` after it wrote out INITIATOR_FILE.
In 9280eff7, that was removed, without any kind of replacement.
Now `initiator_set` will never be True unless iBFT is being
used.
This is a problem because `iscsi.write()` checks if it's True,
and immediately bails if it isn't. The result of this is that
when you do an iSCSI install with anaconda, the contents of
`/var/lib/iscsi` from the installer environment are no longer
copied in the installed system.
vpodzime asked for this fix: making it into a property which
returns True if `self._initiator` is set, otherwise False.
I used `== ""` as the test because that's what we use in other
places, though in my own code I'd normally just use
`if self._initiator:`.
Note that `if iscsi.initiator_set:` and `if iscsi.initiator:`
are not quite equivalent, as the `initiator` property will try
and read the initiator name from storaged if `self._initiator`
is not set, but `initiator_set` will not. This best matches
the previous behaviour, but I'm not sure if all of this makes
any logical sense when considered from scratch.
---
blivet/iscsi.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/blivet/iscsi.py b/blivet/iscsi.py
index 1969fc8..b221fd4 100644
--- a/blivet/iscsi.py
+++ b/blivet/iscsi.py
@@ -149,7 +149,6 @@ class iSCSI(object):
# This list contains nodes discovered through iBFT (or other firmware)
self.ibft_nodes = []
self._initiator = ""
- self.initiator_set = False
self.started = False
self.ifaces = {}
@@ -159,7 +158,6 @@ class iSCSI(object):
try:
initiatorname = self._call_initiator_method("GetFirmwareInitiatorName")[0]
self._initiator = initiatorname
- self.initiator_set = True
except Exception: # pylint: disable=broad-except
log_exception_info(fmt_str="failed to get initiator name from iscsi firmware")
@@ -197,6 +195,11 @@ class iSCSI(object):
connection=self._connection)
@property
+ def initiator_set(self):
+ """True if initiator is set at our level."""
+ return self._initiator != ""
+
+ @property
@storaged_iscsi_required(critical=False, eval_mode=util.EvalMode.onetime)
def initiator(self):
if self._initiator != "":
--
2.7.4

View File

@ -1,45 +0,0 @@
From 274b0bfb6aa923a82662e754030ebce4d8694901 Mon Sep 17 00:00:00 2001
From: Vratislav Podzimek <vpodzime@redhat.com>
Date: Thu, 3 Nov 2016 12:53:03 +0100
Subject: [PATCH 4/4] Add device symlinks to the PVs dictionary for MD RAID PVs
(#1389130)
Otherwise if the symlink is used to search for the PV info, it's not found and
everything on that PV is ignored which leads e.g. to issues when removing the PV
(as described in the bug) and others.
---
blivet/static_data/lvm_info.py | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/blivet/static_data/lvm_info.py b/blivet/static_data/lvm_info.py
index ed2e995..4f5a274 100644
--- a/blivet/static_data/lvm_info.py
+++ b/blivet/static_data/lvm_info.py
@@ -57,7 +57,23 @@ class PVsInfo(object):
def cache(self):
if self._pvs_cache is None:
pvs = blockdev.lvm.pvs()
- self._pvs_cache = dict((pv.pv_name, pv) for pv in pvs) # pylint: disable=attribute-defined-outside-init
+ self._pvs_cache = dict() # pylint: disable=attribute-defined-outside-init
+ for pv in pvs:
+ self._pvs_cache[pv.pv_name] = pv
+ # TODO: add get_all_device_symlinks() and resolve_device_symlink() functions to
+ # libblockdev and use them here
+ if pv.pv_name.startswith("/dev/md/"):
+ try:
+ md_node = blockdev.md.node_from_name(pv.pv_name[len("/dev/md/"):])
+ self._pvs_cache["/dev/" + md_node] = pv
+ except blockdev.MDRaidError:
+ pass
+ elif pv.pv_name.startswith("/dev/md"):
+ try:
+ md_named_dev = blockdev.md.name_from_node(pv.pv_name[len("/dev/"):])
+ self._pvs_cache["/dev/md/" + md_named_dev] = pv
+ except blockdev.MDRaidError:
+ pass
return self._pvs_cache
--
2.7.4

View File

@ -1,11 +1,11 @@
Summary: A python module for system storage configuration
Name: python-blivet
Url: http://fedoraproject.org/wiki/blivet
Version: 2.1.6
Version: 2.1.7
#%%global prerelease .b1
# prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2
Release: 3%{?prerelease}%{?dist}
Release: 1%{?prerelease}%{?dist}
Epoch: 1
License: LGPLv2+
Group: System Environment/Libraries
@ -13,11 +13,6 @@ Group: System Environment/Libraries
%global realversion %{version}%{?prerelease}
Source0: http://github.com/rhinstaller/blivet/archive/%{realname}-%{realversion}.tar.gz
Patch0: 0001-Use-correct-type-for-port-in-GVariant-tuple.patch
Patch1: 0002-iSCSI-Store-auth-info-in-NodeInfo-tuples.patch
Patch2: 0003-iSCSI-turn-iscsi.initiator_set-into-a-property.patch
Patch3: 0004-Add-device-symlinks-to-the-PVs-dictionary-for-MD-RAI.patch
# Versions of required components (done so we make sure the buildrequires
# match the requires versions of things).
%global pykickstartver 1.99.22
@ -26,7 +21,7 @@ Patch3: 0004-Add-device-symlinks-to-the-PVs-dictionary-for-MD-RAI.patch
%global pypartedver 3.10.4
%global e2fsver 1.41.0
%global utillinuxver 2.15.1
%global libblockdevver 1.9
%global libblockdevver 2.1
%global libbytesizever 0.3
%global pyudevver 0.18
@ -66,10 +61,6 @@ configuration.
%prep
%setup -q -n %{realname}-%{realversion}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
rm -rf %{py3dir}
cp -a . %{py3dir}
@ -89,6 +80,15 @@ make PYTHON=%{__python3} DESTDIR=%{buildroot} install
%{python3_sitelib}/*
%changelog
* Mon Nov 21 2016 Vratislav Podzimek <vpodzime@redhat.com> - 2.1.7-1
- Require BlockDev 2.0 in the gi.require_version() call (vpodzime)
- Fix detection of 'macefi' partitions (#1393846) (awilliam)
- Use a list comprehension for _to_node_infos (awilliam)
- Device name now checked only for new devices (japokorn)
- Remove several redundant teardown calls. (dlehman)
- Cache and reuse data about multipath members (vpodzime)
- Remove some obsolete pvscan calls. (dlehman)
* Mon Nov 07 2016 David Lehman <dlehman@redhat.com> - 2.1.6-3
- Never update POT file as part of rpm build.

View File

@ -1 +1 @@
a3064ce7c164a481cbfe704f823b1e2d blivet-2.1.6.tar.gz
bd44908b9f8d27bd85d9e66dde5d8414 blivet-2.1.7.tar.gz