Skip to content

Commit 137853f

Browse files
committed
(in progress)
1 parent ea70f0c commit 137853f

File tree

1 file changed

+38
-23
lines changed

1 file changed

+38
-23
lines changed

zvmsdk/dist.py

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -681,9 +681,6 @@ class rhcos4(rhcos):
681681

682682

683683
class sles(LinuxDist):
684-
def _get_network_file_path(self):
685-
return '/etc/sysconfig/network/'
686-
687684
def _get_cfg_str(self, device, broadcast_v4, gateway_v4, ip_v4,
688685
netmask_v4, address_read, subchannels, dns_v4, mtu):
689686
cfg_str = "BOOTPROTO=\'static\'\n"
@@ -717,12 +714,6 @@ def _get_cmd_str(self, address_read, address_write, address_data):
717714
def _get_dns_filename(self):
718715
return '/etc/resolv.conf'
719716

720-
def _get_device_filename(self, vdev):
721-
return 'ifcfg-eth' + str(vdev).zfill(4)
722-
723-
def _get_all_device_filename(self):
724-
return 'ifcfg-eth*'
725-
726717
def _get_device_name(self, vdev):
727718
return 'eth' + str(vdev).zfill(4)
728719

@@ -830,8 +821,17 @@ def get_zipl_script_lines(self, image, ramdisk, root, fcp, wwpn, lun):
830821
% {'image': image, 'ramdisk': ramdisk, 'root': root,
831822
'fcp': fcp, 'wwpn': wwpn, 'lun': lun}]
832823

824+
def create_active_net_interf_cmd(self):
825+
return 'systemctl start zvmguestconfigure.service'
826+
833827
def _enable_network_interface(self, device, ip, broadcast):
834-
return ''
828+
if len(broadcast) > 0:
829+
activeIP_str = 'ip addr add %s broadcast %s dev %s\n' % (ip,
830+
broadcast, device)
831+
else:
832+
activeIP_str = 'ip addr add %s dev %s\n' % (ip, device)
833+
activeIP_str += 'ip link set dev %s up\n' % device
834+
return activeIP_str
835835

836836
def _get_clean_command(self):
837837
files = os.path.join(self._get_network_file_path(),
@@ -889,6 +889,15 @@ def get_volume_detach_configuration_cmds(self, fcp_list, target_wwpns,
889889

890890

891891
class sles12(sles):
892+
def _get_network_file_path(self):
893+
return '/etc/sysconfig/network/'
894+
895+
def _get_device_filename(self, vdev):
896+
return 'ifcfg-eth' + str(vdev).zfill(4)
897+
898+
def _get_all_device_filename(self):
899+
return 'ifcfg-eth*'
900+
892901
def get_znetconfig_contents(self):
893902
remove_route = 'rm -f %s/ifroute-eth*' % self._get_network_file_path()
894903
return '\n'.join(('cio_ignore -R',
@@ -924,18 +933,6 @@ def get_zipl_script_lines(self, image, ramdisk, root, fcp, wwpn, lun):
924933
% {'image': image, 'ramdisk': ramdisk, 'root': root,
925934
'fcp': fcp, 'wwpn': wwpn, 'lun': lun}]
926935

927-
def create_active_net_interf_cmd(self):
928-
return 'systemctl start zvmguestconfigure.service'
929-
930-
def _enable_network_interface(self, device, ip, broadcast):
931-
if len(broadcast) > 0:
932-
activeIP_str = 'ip addr add %s broadcast %s dev %s\n' % (ip,
933-
broadcast, device)
934-
else:
935-
activeIP_str = 'ip addr add %s dev %s\n' % (ip, device)
936-
activeIP_str += 'ip link set dev %s up\n' % device
937-
return activeIP_str
938-
939936

940937
class sles15(sles12):
941938
def get_znetconfig_contents(self):
@@ -978,7 +975,25 @@ def get_znetconfig_contents(self):
978975

979976
class sles16(sles):
980977
# TODO: ADD MODERN DISTRIBUTIONS
981-
pass
978+
def _get_network_file_path(self):
979+
return '/etc/NetworkManager/system-connections/'
980+
981+
def _get_device_filename(self, vdev):
982+
return 'qeth-' + str(vdev).zfill(4) + '.nmconnection'
983+
984+
def _get_all_device_filename(self):
985+
return 'qeth-*.nmconnection'
986+
987+
def get_znetconfig_contents(self):
988+
return '\n'.join(('cio_ignore -R',
989+
'znetconf -R -n',
990+
'sleep 2',
991+
'udevadm trigger',
992+
'udevadm settle',
993+
'sleep 2',
994+
'znetconf -A',
995+
'cio_ignore -u',
996+
'nmcli connection reload'))
982997

983998

984999
class ubuntu(LinuxDist):

0 commit comments

Comments
 (0)