Add support for dhcpcd in the renew_lease method
In Cirros 0.6.0 and newer there is dhcpcd client used instead of old udhcpc. This patch adds support to that new client in the remote_client's renew_lease method. Related-Bug: #2003063 Change-Id: I5d5648332e1c84221e708c29a904fcaaffdb451e
This commit is contained in:
parent
7c8b49bece
commit
49163f9156
@ -145,15 +145,20 @@ class RemoteClient(remote_client.RemoteClient):
|
|||||||
cmd = "sudo /sbin/dhclient -r && sudo /sbin/dhclient"
|
cmd = "sudo /sbin/dhclient -r && sudo /sbin/dhclient"
|
||||||
self.exec_command(cmd)
|
self.exec_command(cmd)
|
||||||
|
|
||||||
|
def _renew_lease_dhcpcd(self, fixed_ip=None):
|
||||||
|
"""Renews DHCP lease via dhcpcd client. """
|
||||||
|
cmd = "sudo /sbin/dhcpcd --rebind"
|
||||||
|
self.exec_command(cmd)
|
||||||
|
|
||||||
def renew_lease(self, fixed_ip=None, dhcp_client='udhcpc'):
|
def renew_lease(self, fixed_ip=None, dhcp_client='udhcpc'):
|
||||||
"""Wrapper method for renewing DHCP lease via given client
|
"""Wrapper method for renewing DHCP lease via given client
|
||||||
|
|
||||||
Supporting:
|
Supporting:
|
||||||
* udhcpc
|
* udhcpc
|
||||||
* dhclient
|
* dhclient
|
||||||
|
* dhcpcd
|
||||||
"""
|
"""
|
||||||
# TODO(yfried): add support for dhcpcd
|
supported_clients = ['udhcpc', 'dhclient', 'dhcpcd']
|
||||||
supported_clients = ['udhcpc', 'dhclient']
|
|
||||||
if dhcp_client not in supported_clients:
|
if dhcp_client not in supported_clients:
|
||||||
raise tempest.lib.exceptions.InvalidConfiguration(
|
raise tempest.lib.exceptions.InvalidConfiguration(
|
||||||
'%s DHCP client unsupported' % dhcp_client)
|
'%s DHCP client unsupported' % dhcp_client)
|
||||||
|
@ -1203,10 +1203,10 @@ ScenarioGroup = [
|
|||||||
# TODO(yfried): add support for dhcpcd
|
# TODO(yfried): add support for dhcpcd
|
||||||
cfg.StrOpt('dhcp_client',
|
cfg.StrOpt('dhcp_client',
|
||||||
default='udhcpc',
|
default='udhcpc',
|
||||||
choices=["udhcpc", "dhclient", ""],
|
choices=["udhcpc", "dhclient", "dhcpcd", ""],
|
||||||
help='DHCP client used by images to renew DCHP lease. '
|
help='DHCP client used by images to renew DCHP lease. '
|
||||||
'If left empty, update operation will be skipped. '
|
'If left empty, update operation will be skipped. '
|
||||||
'Supported clients: "udhcpc", "dhclient"'),
|
'Supported clients: "udhcpc", "dhclient", "dhcpcd"'),
|
||||||
cfg.StrOpt('protocol',
|
cfg.StrOpt('protocol',
|
||||||
default='icmp',
|
default='icmp',
|
||||||
choices=('icmp', 'tcp', 'udp'),
|
choices=('icmp', 'tcp', 'udp'),
|
||||||
|
Loading…
Reference in New Issue
Block a user