So that we can activate more than one network device in installer
environment using kickstart.
Note: I am using flag option instead of option with (yes/no) values
because the point of the option is allowing device activation.
Moreover, we can't guarantee honoring of "no" setting in these two cases:
1) --onboot=yes activates device as side effect when we write out
ifcfg files before packages are downloaded.
2) If there is no active device and network method (repo) is used,
first device in ks will be activated.
---
isys/isys.py | 2 ++
kickstart.py | 12 ++++++++++--
network.py | 43 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 55 insertions(+), 2 deletions(-)
class AnacondaKSHandler(superclass):
def __init__ (self, anaconda):
diff --git a/network.py b/network.py
index 3d9d014..ced7d60 100644
--- a/network.py
+++ b/network.py
@@ -317,6 +317,49 @@ class NetworkDevice(IfcfgFile):
return True
return False
+ def activate(self):
+
+ bus = dbus.SystemBus()
+ nm = bus.get_object(isys.NM_SERVICE, isys.NM_MANAGER_PATH)
+
+ # get dbus path of connection setting object
+ settings = bus.get_object(isys.NM_SETTINGS_SERVICE,
+ isys.NM_SETTINGS_PATH)
+ connection_paths = settings.ListConnections()
+ for con_path in connection_paths:
+ con = bus.get_object(isys.NM_SERVICE, con_path)
+ cs = con.GetSettings()
+ try:
+ mac_bytes = cs[cs['connection']['type']]['mac-address']
+ except KeyError as e:
+ log.info("exception caught: %s" % e)
+ mac_addr = '{0:02X}:{1:02X}:{2:02X}:{3:02X}:{4:02X}:{5:02X}'. format(*mac_bytes)
+ if mac_addr == self.get('HWADDR'):
+ break
+ else:
+ log.info("DBus connection path for device %s not found" % self.iface)
+ return False
+
+ # get dbus path of this device
+ device_object_path = None
+ device_paths = nm.GetDevices()
+ for device_path in device_paths:
+ device = bus.get_object(isys.NM_SERVICE, device_path)
+ device_props_iface = dbus.Interface(device, isys.DBUS_PROPS_IFACE)
+ iface = str(device_props_iface.Get(isys.NM_DEVICE_IFACE, "Interface"))
+ if iface == self.iface:
+ device_object_path = device_path
+ break
+ else:
+ log.info("DBus object path of device %s not found" % self.iface)
+ return False
+
+ nm.ActivateConnection(isys.NM_SETTINGS_SERVICE,
+ con_path,
+ device_path,
+ dbus.ObjectPath("/"))
+ return True
+
class Network:
def __init__(self):
--
1.7.2
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
12-03-2010, 01:35 PM
Radek Vykydal
Add network --activate option (#638131)
So that we can activate more than one network device in installer
environment using kickstart.
Note: I am using flag option instead of option with (yes/no) values
because the point of the option is allowing device activation.
Moreover we can't guarantee honoring of "no" setting in these two cases:
1) --onboot=yes activates device as side effect when we write out
ifcfg files before packages are downloaded.
2) If there is no active device and network method (repo) is used,
first device in ks will be activated.
If/when acked, I'd duplicate the bug for pykickstart so we can track
pykickstart build the bug is fixed in.
This is a leftover from my testing, instead
DEVEL=RHEL6 should be changed in pykickstart/version.py
of rhel6-branch?
I agree, hitting this too with another patchset.
Ales
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
01-04-2011, 12:53 PM
Radek Vykydal
Add network --activate option (#638131)
So that we can activate more than one network device in installer
environment using kickstart.
The activating happens in loader (stage 2 is too late for iscsi).
---
pykickstart/commands/network.py | 30 ++++++++++++++++++++++++++++++
pykickstart/handlers/control.py | 4 ++--
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/pykickstart/commands/network.py b/pykickstart/commands/network.py
index e2a3101..b0a7026 100644
--- a/pykickstart/commands/network.py
+++ b/pykickstart/commands/network.py
@@ -156,6 +156,22 @@ class RHEL4_NetworkData(FC3_NetworkData):
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
01-04-2011, 02:38 PM
Chris Lumens
Add network --activate option (#638131)
> So that we can activate more than one network device in installer
> environment using kickstart.
> The activating happens in loader (stage 2 is too late for iscsi).
The three pykickstart patches look fine. Can you clone bug 638131 for
pykickstart and make sure it gets its flags, though? Otherwise things
will get complicated.
- Chris
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
01-04-2011, 02:46 PM
Radek Vykydal
Add network --activate option (#638131)
On 01/04/2011 04:38 PM, Chris Lumens wrote:
The three pykickstart patches look fine. Can you clone bug 638131 for
pykickstart and make sure it gets its flags, though? Otherwise things
will get complicated.
Thanks, I will.
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
01-04-2011, 03:44 PM
Radek Vykydal
Add network --activate option (#638131)
On 12/03/2010 03:35 PM, Radek Vykydal wrote:
So that we can activate more than one network device in installer
environment using kickstart.
This patchset is obsoleted by a new one. The devices need
to be activated already in loader (for iSCSI).
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list