Skip to content

Commit

Permalink
Sleep the network for the duration of the install in stage 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Limonciello authored and Mario Limonciello committed Apr 7, 2011
1 parent ffd48d7 commit 8223cce
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Dell/recovery_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,22 @@ def start_pulsable_progress_thread(self, input_str):
#
# Client API (through D-BUS)
#

@dbus.service.method(DBUS_INTERFACE_NAME,
in_signature = 'b', out_signature = 'b', sender_keyword = 'sender',
connection_keyword = 'conn')
def force_network(self, enable, sender=None, conn=None):
"""Forces a network manager disable request as root"""
self._check_polkit_privilege(sender, conn, 'com.dell.recoverymedia.force_network')
bus = dbus.SystemBus()
obj = bus.get_object('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager')
int = dbus.Interface(obj, 'org.freedesktop.NetworkManager')
if not enable:
return int.sleep()
else:
return int.wake()


@dbus.service.method(DBUS_INTERFACE_NAME,
in_signature = '', out_signature = '', sender_keyword = 'sender',
connection_keyword = 'conn')
Expand Down
10 changes: 10 additions & 0 deletions backend/com.dell.recoverymedia.policy.in
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,15 @@
<allow_active>yes</allow_active>
</defaults>
</action>

<action id="com.dell.recoverymedia.force_network">
<_description>Toggle Network Connectivity</_description>
<_message>System policy prohibits changing network without user consent</_message>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
</policyconfig>

1 change: 1 addition & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
dell-recovery (0.93) UNRELEASED; urgency=low

* Fix missing OIE argument in recovery media generation from OOBE.
* Sleep the network for the duration of the install in stage 2.

-- Mario Limonciello <Mario_Limonciello@Dell.com> Thu, 07 Apr 2011 12:59:43 -0500

Expand Down
23 changes: 23 additions & 0 deletions ubiquity/dell-bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,14 @@ def test_oie(self):
with open('/tmp/oie', 'w') as wfd:
pass

def sleep_network(self):
"""Requests the network be disabled for the duration of install to
prevent conflicts"""
bus = dbus.SystemBus()
backend_iface = dbus.Interface(bus.get_object(magic.DBUS_BUS_NAME, '/RecoveryMedia'), magic.DBUS_INTERFACE_NAME)
backend_iface.force_network(False)
backend_iface.request_exit()

def clean_recipe(self):
"""Cleans up the recipe to remove swap if we have a small drive"""

Expand Down Expand Up @@ -1149,6 +1157,7 @@ def cleanup(self):

# Factory install, and booting from RP
else:
self.sleep_network()
self.disable_swap()
self.test_oie()
self.clean_recipe()
Expand Down Expand Up @@ -1688,6 +1697,18 @@ def g2ldr(self):
if os.path.exists(os.path.join(mount, 'grub', 'grub.cfg')):
os.unlink(os.path.join(mount, 'grub', 'grub.cfg'))

def wake_network(self):
"""Wakes the network back up"""
bus = dbus.SystemBus()
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
try:
backend_iface = dbus.Interface(bus.get_object(magic.DBUS_BUS_NAME, '/RecoveryMedia'), magic.DBUS_INTERFACE_NAME)
backend_iface.force_network(True)
backend_iface.request_exit()
except Exception:
pass


def install(self, target, progress, *args, **kwargs):
'''This is highly dependent upon being called AFTER configure_apt
in install. If that is ever converted into a plugin, we'll
Expand Down Expand Up @@ -1843,6 +1864,8 @@ def install(self, target, progress, *args, **kwargs):

self.propagate_kernel_parameters()

self.wake_network()

install_misc.record_installed(to_install)
install_misc.record_removed(to_remove)

Expand Down

0 comments on commit 8223cce

Please sign in to comment.