Merge "For SLES system, to keep the NIC setting persistent When boot a system with a NIC which is different from the master system, NIC qeth device will not be initialized when system re-ipl."
This commit is contained in:
commit
ca90ca4306
|
@ -61,6 +61,7 @@ class LinuxDist(object):
|
|||
cfg_files.append((target_net_conf_file_name, cfg_str))
|
||||
udev_cfg_str += self._get_udev_configuration(device_num,
|
||||
'0.0.' + str(base_vdev).zfill(4))
|
||||
self._append_udev_rules_file(cfg_files, base_vdev)
|
||||
if cmd_str is not None:
|
||||
cmd_strings += cmd_str
|
||||
if len(dns_str) > 0:
|
||||
|
@ -164,11 +165,20 @@ class LinuxDist(object):
|
|||
"""construct udev configuration info."""
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def _get_udev_rules(self, channel_read, channel_write, channel_data):
|
||||
"""construct udev rules info."""
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def _append_udev_info(self, cfg_files, file_name_route, route_cfg_str,
|
||||
udev_cfg_str):
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def _append_udev_rules_file(self, cfg_files, base_vdev):
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_scp_string(self, root, fcp, wwpn, lun):
|
||||
"""construct scp_data string for ipl parameter"""
|
||||
|
@ -220,6 +230,13 @@ class rhel(LinuxDist):
|
|||
udev_cfg_str):
|
||||
pass
|
||||
|
||||
def _get_udev_rules(self, channel_read, channel_write, channel_data):
|
||||
"""construct udev rules info."""
|
||||
return ''
|
||||
|
||||
def _append_udev_rules_file(self, cfg_files, base_vdev):
|
||||
pass
|
||||
|
||||
|
||||
class rhel6(rhel):
|
||||
def get_znetconfig_contents(self):
|
||||
|
@ -338,6 +355,10 @@ class sles(LinuxDist):
|
|||
cmd_str = 'qeth_configure -l 0.0.%s ' % address_read.lower()
|
||||
cmd_str += '0.0.%(write)s 0.0.%(data)s 1\n' % {'write':
|
||||
address_write.lower(), 'data': address_data.lower()}
|
||||
cmd_str += ('echo "0.0.%(read)s,0.0.%(write)s,0.0.%(data)s #`date`"'
|
||||
' >>/boot/zipl/active_devices.txt\n' % {'read':
|
||||
address_read.lower(), 'write': address_write.lower(),
|
||||
'data': address_data.lower()})
|
||||
return cmd_str
|
||||
|
||||
def _get_dns_filename(self):
|
||||
|
@ -363,6 +384,67 @@ class sles(LinuxDist):
|
|||
|
||||
return cfg_str
|
||||
|
||||
def _append_udev_rules_file(self, cfg_files, base_vdev):
|
||||
rules_file_name = '/etc/udev/rules.d/51-qeth-0.0.%s.rules' % base_vdev
|
||||
read_ch = '0.0.' + base_vdev
|
||||
write_ch = '0.0.' + str(hex(int(base_vdev, 16) + 1))[2:]
|
||||
data_ch = '0.0.' + str(hex(int(base_vdev, 16) + 2))[2:]
|
||||
udev_rules_str = self._get_udev_rules(read_ch, write_ch, data_ch)
|
||||
cfg_files.append((rules_file_name, udev_rules_str))
|
||||
|
||||
def _get_udev_rules(self, channel_read, channel_write, channel_data):
|
||||
"""construct udev rules info."""
|
||||
sub_str = '%(read)s %%k %(read)s %(write)s %(data)s qeth' % {
|
||||
'read': channel_read,
|
||||
'read': channel_read,
|
||||
'write': channel_write,
|
||||
'data': channel_data}
|
||||
rules_str = '# Configure qeth device at'
|
||||
rules_str += ' %(read)s/%(write)s/%(data)s\n' % {
|
||||
'read': channel_read,
|
||||
'write': channel_write,
|
||||
'data': channel_data}
|
||||
rules_str += ('ACTION==\"add\", SUBSYSTEM==\"drivers\", KERNEL=='
|
||||
'\"qeth\", IMPORT{program}=\"collect %s\"\n') % sub_str
|
||||
rules_str += ('ACTION==\"add\", SUBSYSTEM==\"ccw\", KERNEL==\"'
|
||||
'%(read)s\", IMPORT{program}="collect %(channel)s\"\n') % {
|
||||
'read': channel_read, 'channel': sub_str}
|
||||
rules_str += ('ACTION==\"add\", SUBSYSTEM==\"ccw\", KERNEL==\"'
|
||||
'%(write)s\", IMPORT{program}=\"collect %(channel)s\"\n') % {
|
||||
'write': channel_write, 'channel': sub_str}
|
||||
rules_str += ('ACTION==\"add\", SUBSYSTEM==\"ccw\", KERNEL==\"'
|
||||
'%(data)s\", IMPORT{program}=\"collect %(channel)s\"\n') % {
|
||||
'data': channel_data, 'channel': sub_str}
|
||||
rules_str += ('ACTION==\"remove\", SUBSYSTEM==\"drivers\", KERNEL==\"'
|
||||
'qeth\", IMPORT{program}=\"collect --remove %s\"\n') % sub_str
|
||||
rules_str += ('ACTION==\"remove\", SUBSYSTEM==\"ccw\", KERNEL==\"'
|
||||
'%(read)s\", IMPORT{program}=\"collect --remove %(channel)s\"\n'
|
||||
) % {'read': channel_read, 'channel': sub_str}
|
||||
rules_str += ('ACTION==\"remove\", SUBSYSTEM==\"ccw\", KERNEL==\"'
|
||||
'%(write)s\", IMPORT{program}=\"collect --remove %(channel)s\"\n'
|
||||
) % {'write': channel_write, 'channel': sub_str}
|
||||
rules_str += ('ACTION==\"remove\", SUBSYSTEM==\"ccw\", KERNEL==\"'
|
||||
'%(data)s\", IMPORT{program}=\"collect --remove %(channel)s\"\n'
|
||||
) % {'data': channel_data, 'channel': sub_str}
|
||||
rules_str += ('TEST==\"[ccwgroup/%(read)s]\", GOTO=\"qeth-%(read)s'
|
||||
'-end\"\n') % {'read': channel_read, 'read': channel_read}
|
||||
rules_str += ('ACTION==\"add\", SUBSYSTEM==\"ccw\", ENV{COLLECT_'
|
||||
'%(read)s}==\"0\", ATTR{[drivers/ccwgroup:qeth]group}=\"'
|
||||
'%(read)s,%(write)s,%(data)s\"\n') % {
|
||||
'read': channel_read, 'read': channel_read,
|
||||
'write': channel_write, 'data': channel_data}
|
||||
rules_str += ('ACTION==\"add\", SUBSYSTEM==\"drivers\", KERNEL==\"qeth'
|
||||
'\", ENV{COLLECT_%(read)s}==\"0\", ATTR{[drivers/'
|
||||
'ccwgroup:qeth]group}=\"%(read)s,%(write)s,%(data)s\"\n'
|
||||
'LABEL=\"qeth-%(read)s-end\"\n') % {
|
||||
'read': channel_read, 'read': channel_read, 'write': channel_write,
|
||||
'data': channel_data, 'read': channel_read}
|
||||
rules_str += ('ACTION==\"add\", SUBSYSTEM==\"ccwgroup\", KERNEL=='
|
||||
'\"%s\", ATTR{layer2}=\"1\"\n') % channel_read
|
||||
rules_str += ('ACTION==\"add\", SUBSYSTEM==\"ccwgroup\", KERNEL=='
|
||||
'\"%s\", ATTR{online}=\"1\"\n') % channel_read
|
||||
return rules_str
|
||||
|
||||
def get_scp_string(self, root, fcp, wwpn, lun):
|
||||
return ("=root=%(root)s zfcp.allow_lun_scan=0 "
|
||||
"zfcp.device=0.0.%(fcp)s,0x%(wwpn)s,0x%(lun)s") % {
|
||||
|
@ -543,6 +625,13 @@ class ubuntu(LinuxDist):
|
|||
srcdev = path % {'fcp': fcp, 'wwpn': wwpn, 'lun': lun}
|
||||
return srcdev
|
||||
|
||||
def _get_udev_rules(self, channel_read, channel_write, channel_data):
|
||||
"""construct udev rules info."""
|
||||
return ''
|
||||
|
||||
def _append_udev_rules_file(self, cfg_files, base_vdev):
|
||||
pass
|
||||
|
||||
|
||||
class ubuntu16(ubuntu):
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue