(improved) Wait for all devices activated by nm-c-e (#520146).
Radek Vykydal wrote:
Improved patch:
Subject: [PATCH] Wait for specific activated network devices (#520146).
We used to activate just one device when enabling network,
so it was ok to use waitForConnection (wait just for any
connection). Now that more devices can be set to be activated
in nm-c-e (by checking [] Connect automatically), we should
(1) Wait for all devices activated by nm-c-e this way, otherwise
we can fail with traceback in next steps reading device
configuration.
(2) When enabling network make sure the device selected by user
in combobox was activated, not just any device.
---
gui.py | 39 +++++++++++++++++++++++++++------------
isys/isys.py | 1 +
network.py | 29 ++++++++++++++++++++++++++++-
3 files changed, 56 insertions(+), 13 deletions(-)
diff --git a/gui.py b/gui.py
index d381c0b..29d8810 100755
--- a/gui.py
+++ b/gui.py
@@ -1005,35 +1005,50 @@ class InstallInterface(InstallInterfaceBase):
self.anaconda.id.network.update()
.
if just_setup:
- # TODORV check which devices were actually activated by
nmce
- # and which we should wait for (the case for more than one
- # device)
- onboot_devs = self.anaconda.id.network.getOnbootIfaces()
- if onboot_devs:
- install_device = onboot_devs[0]
+ waited_devs = self.anaconda.id.network.getOnbootIfaces()
+ else:
+ waited_devs = [install_device]
.
self.anaconda.id.network.write()
.
- if install_device:
+ if waited_devs:
w = WaitWindow(_("Waiting for NetworkManager"),
- _("Waiting for NetworkManager to get
connection."))
- networkEnabled =
self.anaconda.id.network.waitForConnection()
- if not networkEnabled and not just_setup:
- self._handleNetworkError(install_device)
+ _("Waiting for NetworkManager to activate "
+ "these devices: %s" %
",".join(waited_devs)))
+ failed_devs =
self.anaconda.id.network.waitForDevicesActivation( waited_devs)
+ if iface in devices:
+ waited_devs_props[iface] = device_props_iface
+
+ i = 0
+ while True:
+ for dev, device_props_iface in waited_devs_props.items():
+ state = device_props_iface.Get(isys.NM_MANAGER_IFACE,
"State")
+ if state == isys.NM_DEVICE_STATE_ACTIVATED:
+ waited_devs_props.pop(dev)
+ if len(waited_devs_props) == 0:
+ return []
+ if i >= CONNECTION_TIMEOUT:
+ return waited_devs_props.keys()
+ i += 1
+ time.sleep(1)
+
# write out current configuration state and wait for NetworkManager
# to bring the device up, watch NM state and return to the caller
# once we have a state
@@ -760,7 +787,7 @@ class Network:
props = dbus.Interface(nm, isys.DBUS_PROPS_IFACE)
.
i = 0
- while i < 45:
+ while i < CONNECTION_TIMEOUT:
state = props.Get(isys.NM_SERVICE, "State")
if int(state) == isys.NM_STATE_CONNECTED:
isys.resetResolv()
--.
1.6.0.6
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
05-11-2010, 12:15 AM
David Cantrell
(improved) Wait for all devices activated by nm-c-e (#520146).
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ack.
On Thu, 6 May 2010, Radek Vykydal wrote:
Radek Vykydal wrote:
Improved patch:
Subject: [PATCH] Wait for specific activated network devices (#520146).
We used to activate just one device when enabling network,
so it was ok to use waitForConnection (wait just for any
connection). Now that more devices can be set to be activated
in nm-c-e (by checking [] Connect automatically), we should
(1) Wait for all devices activated by nm-c-e this way, otherwise
we can fail with traceback in next steps reading device
configuration.
(2) When enabling network make sure the device selected by user
in combobox was activated, not just any device.
---
gui.py | 39 +++++++++++++++++++++++++++------------
isys/isys.py | 1 +
network.py | 29 ++++++++++++++++++++++++++++-
3 files changed, 56 insertions(+), 13 deletions(-)
diff --git a/gui.py b/gui.py
index d381c0b..29d8810 100755
--- a/gui.py
+++ b/gui.py
@@ -1005,35 +1005,50 @@ class InstallInterface(InstallInterfaceBase):
self.anaconda.id.network.update()
.
if just_setup:
- # TODORV check which devices were actually activated by nmce
- # and which we should wait for (the case for more than one
- # device)
- onboot_devs = self.anaconda.id.network.getOnbootIfaces()
- if onboot_devs:
- install_device = onboot_devs[0]
+ waited_devs = self.anaconda.id.network.getOnbootIfaces()
+ else:
+ waited_devs = [install_device]
.
self.anaconda.id.network.write()
.
- if install_device:
+ if waited_devs:
w = WaitWindow(_("Waiting for NetworkManager"),
- _("Waiting for NetworkManager to get
connection."))
- networkEnabled =
self.anaconda.id.network.waitForConnection()
- if not networkEnabled and not just_setup:
- self._handleNetworkError(install_device)
+ _("Waiting for NetworkManager to activate "
+ "these devices: %s" %
",".join(waited_devs)))
+ failed_devs =
self.anaconda.id.network.waitForDevicesActivation( waited_devs)
+ if iface in devices:
+ waited_devs_props[iface] = device_props_iface
+
+ i = 0
+ while True:
+ for dev, device_props_iface in waited_devs_props.items():
+ state = device_props_iface.Get(isys.NM_MANAGER_IFACE,
"State")
+ if state == isys.NM_DEVICE_STATE_ACTIVATED:
+ waited_devs_props.pop(dev)
+ if len(waited_devs_props) == 0:
+ return []
+ if i >= CONNECTION_TIMEOUT:
+ return waited_devs_props.keys()
+ i += 1
+ time.sleep(1)
+
# write out current configuration state and wait for NetworkManager
# to bring the device up, watch NM state and return to the caller
# once we have a state
@@ -760,7 +787,7 @@ class Network:
props = dbus.Interface(nm, isys.DBUS_PROPS_IFACE)
.
i = 0
- while i < 45:
+ while i < CONNECTION_TIMEOUT:
state = props.Get(isys.NM_SERVICE, "State")
if int(state) == isys.NM_STATE_CONNECTED:
isys.resetResolv()
--.
1.6.0.6
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list