Enable boot from volume for Ubuntu 16
Begin to support to boot from volume for Ubuntu distro. Change-Id: I001a3bf439c579697f57fcaa33940f5803391cfd
This commit is contained in:
@@ -4264,8 +4264,9 @@ class ZVMDistTestCases(test.TestCase):
|
||||
self.rhel7 = dist.rhel7()
|
||||
self.sles11 = dist.sles11()
|
||||
self.sles12 = dist.sles12()
|
||||
self.ubuntu16 = dist.ubuntu16()
|
||||
self.support_list = [self.rhel6, self.rhel7,
|
||||
self.sles11, self.sles12]
|
||||
self.sles11, self.sles12, self.ubuntu16]
|
||||
|
||||
def test_get_znetconfig_contents(self):
|
||||
for v in self.support_list:
|
||||
@@ -4287,7 +4288,8 @@ class ZVMDistTestCases(test.TestCase):
|
||||
def test_get_network_file_path(self):
|
||||
for v in self.support_list:
|
||||
contents = v._get_network_file_path()
|
||||
self.assertTrue(len(contents) > 0)
|
||||
if v != self.ubuntu16:
|
||||
self.assertTrue(len(contents) > 0)
|
||||
|
||||
def test_get_change_passwd_command(self):
|
||||
for v in self.support_list:
|
||||
@@ -4301,7 +4303,10 @@ class ZVMDistTestCases(test.TestCase):
|
||||
|
||||
def test_get_cfg_str(self):
|
||||
for v in self.support_list:
|
||||
v._get_cfg_str('0', '0', '0', '0', '0', '0', '0')
|
||||
if v is self.ubuntu16:
|
||||
v._get_cfg_str('0', '0', '0', '0', '0')
|
||||
else:
|
||||
v._get_cfg_str('0', '0', '0', '0', '0', '0', '0')
|
||||
|
||||
def test_get_device_filename(self):
|
||||
for v in self.support_list:
|
||||
@@ -4322,7 +4327,7 @@ class ZVMDistTestCases(test.TestCase):
|
||||
wwpn = "55556666"
|
||||
lun = "11112222"
|
||||
|
||||
expected = ("=root=/dev/sda2 selinux=0 "
|
||||
expected = ("=root=/dev/sda2 selinux=0 zfcp.allow_lun_scan=0 "
|
||||
"rd_ZFCP=0.0.1faa,0x55556666,0x11112222")
|
||||
actual = self.rhel6.get_scp_string(root, fcp, wwpn, lun)
|
||||
self.assertEqual(expected, actual)
|
||||
@@ -4332,7 +4337,7 @@ class ZVMDistTestCases(test.TestCase):
|
||||
actual = self.rhel7.get_scp_string(root, fcp, wwpn, lun)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
expected = ("=root=/dev/sda2 "
|
||||
expected = ("=root=/dev/sda2 zfcp.allow_lun_scan=0 "
|
||||
"zfcp.device=0.0.1faa,0x55556666,0x11112222")
|
||||
actual = self.sles11.get_scp_string(root, fcp, wwpn, lun)
|
||||
self.assertEqual(expected, actual)
|
||||
@@ -4342,6 +4347,11 @@ class ZVMDistTestCases(test.TestCase):
|
||||
actual = self.sles12.get_scp_string(root, fcp, wwpn, lun)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
expected = ("=root=/dev/sda2 zfcp.allow_lun_scan=0 "
|
||||
"zfcp.device=0.0.1faa,0x55556666,0x11112222")
|
||||
actual = self.ubuntu16.get_scp_string(root, fcp, wwpn, lun)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_get_zipl_script_lines(self):
|
||||
image = "image"
|
||||
ramdisk = "ramdisk"
|
||||
@@ -4359,7 +4369,8 @@ class ZVMDistTestCases(test.TestCase):
|
||||
'image=image\\n'
|
||||
'ramdisk=ramdisk\\n'
|
||||
'parameters=\\"root=/dev/sda2 '
|
||||
'rd_ZFCP=0.0.1faa,0x55556666,0x11112222 selinux=0\\""'
|
||||
'rd_ZFCP=0.0.1faa,0x55556666,0x11112222 '
|
||||
'zfcp.allow_lun_scan=0 selinux=0\\""'
|
||||
'>/etc/zipl_volume.conf\n'
|
||||
'zipl -c /etc/zipl_volume.conf']
|
||||
actual = self.rhel6.get_zipl_script_lines(image, ramdisk, root,
|
||||
@@ -4391,7 +4402,8 @@ class ZVMDistTestCases(test.TestCase):
|
||||
'target = /boot/zipl\\n'
|
||||
'ramdisk=ramdisk\\n'
|
||||
'parameters=\\"root=/dev/sda2 '
|
||||
'zfcp.device=0.0.1faa,0x55556666,0x11112222\\""'
|
||||
'zfcp.device=0.0.1faa,0x55556666,0x11112222 '
|
||||
'zfcp.allow_lun_scan=0\\""'
|
||||
'>/etc/zipl_volume.conf\n'
|
||||
'mkinitrd\n'
|
||||
'zipl -c /etc/zipl_volume.conf']
|
||||
@@ -4416,6 +4428,23 @@ class ZVMDistTestCases(test.TestCase):
|
||||
fcp, wwpn, lun)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
expected = ['#!/bin/bash\n',
|
||||
'echo -e "[defaultboot]\\n'
|
||||
'default=boot-from-volume\\n'
|
||||
'[boot-from-volume]\\n'
|
||||
'image=image\\n'
|
||||
'target = /boot/zipl\\n'
|
||||
'ramdisk=ramdisk\\n'
|
||||
'parameters=\\"root=/dev/sda2 '
|
||||
'zfcp.device=0.0.1faa,0x55556666,0x11112222 '
|
||||
'zfcp.allow_lun_scan=0\\""'
|
||||
'>/etc/zipl_volume.conf\n'
|
||||
'mkinitrd\n'
|
||||
'zipl -c /etc/zipl_volume.conf']
|
||||
actual = self.ubuntu16.get_zipl_script_lines(image, ramdisk, root,
|
||||
fcp, wwpn, lun)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
|
||||
class ZVMDistRhel7TestCases(test.TestCase):
|
||||
def setUp(self):
|
||||
|
||||
@@ -243,7 +243,7 @@ class rhel6(rhel):
|
||||
return 'eth' + str(device_num)
|
||||
|
||||
def get_scp_string(self, root, fcp, wwpn, lun):
|
||||
return ("=root=%(root)s selinux=0 "
|
||||
return ("=root=%(root)s selinux=0 zfcp.allow_lun_scan=0 "
|
||||
"rd_ZFCP=0.0.%(fcp)s,0x%(wwpn)s,0x%(lun)s") % {
|
||||
'root': root, 'fcp': fcp, 'wwpn': wwpn, 'lun': lun}
|
||||
|
||||
@@ -257,7 +257,8 @@ class rhel6(rhel):
|
||||
'image=%(image)s\\n'
|
||||
'ramdisk=%(ramdisk)s\\n'
|
||||
'parameters=\\"root=%(root)s '
|
||||
'rd_ZFCP=0.0.%(fcp)s,0x%(wwpn)s,0x%(lun)s selinux=0\\""'
|
||||
'rd_ZFCP=0.0.%(fcp)s,0x%(wwpn)s,0x%(lun)s '
|
||||
'zfcp.allow_lun_scan=0 selinux=0\\""'
|
||||
'>/etc/zipl_volume.conf\n'
|
||||
'zipl -c /etc/zipl_volume.conf')
|
||||
% {'image': image, 'ramdisk': ramdisk, 'root': root,
|
||||
@@ -367,7 +368,7 @@ class sles(LinuxDist):
|
||||
return cfg_str
|
||||
|
||||
def get_scp_string(self, root, fcp, wwpn, lun):
|
||||
return ("=root=%(root)s "
|
||||
return ("=root=%(root)s zfcp.allow_lun_scan=0 "
|
||||
"zfcp.device=0.0.%(fcp)s,0x%(wwpn)s,0x%(lun)s") % {
|
||||
'root': root, 'fcp': fcp, 'wwpn': wwpn, 'lun': lun}
|
||||
|
||||
@@ -380,7 +381,8 @@ class sles(LinuxDist):
|
||||
'target = /boot/zipl\\n'
|
||||
'ramdisk=%(ramdisk)s\\n'
|
||||
'parameters=\\"root=%(root)s '
|
||||
'zfcp.device=0.0.%(fcp)s,0x%(wwpn)s,0x%(lun)s\\""'
|
||||
'zfcp.device=0.0.%(fcp)s,0x%(wwpn)s,0x%(lun)s '
|
||||
'zfcp.allow_lun_scan=0\\""'
|
||||
'>/etc/zipl_volume.conf\n'
|
||||
'mkinitrd\n'
|
||||
'zipl -c /etc/zipl_volume.conf')
|
||||
@@ -420,28 +422,6 @@ class sles12(sles):
|
||||
def get_change_passwd_command(self, admin_password):
|
||||
return "echo 'root:%s' | chpasswd" % admin_password
|
||||
|
||||
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") % {
|
||||
'root': root, 'fcp': fcp, 'wwpn': wwpn, 'lun': lun}
|
||||
|
||||
def get_zipl_script_lines(self, image, ramdisk, root, fcp, wwpn, lun):
|
||||
return ['#!/bin/bash\n',
|
||||
('echo -e "[defaultboot]\\n'
|
||||
'default=boot-from-volume\\n'
|
||||
'[boot-from-volume]\\n'
|
||||
'image=%(image)s\\n'
|
||||
'target = /boot/zipl\\n'
|
||||
'ramdisk=%(ramdisk)s\\n'
|
||||
'parameters=\\"root=%(root)s '
|
||||
'zfcp.device=0.0.%(fcp)s,0x%(wwpn)s,0x%(lun)s '
|
||||
'zfcp.allow_lun_scan=0\\""'
|
||||
'>/etc/zipl_volume.conf\n'
|
||||
'mkinitrd\n'
|
||||
'zipl -c /etc/zipl_volume.conf')
|
||||
% {'image': image, 'ramdisk': ramdisk, 'root': root,
|
||||
'fcp': fcp, 'wwpn': wwpn, 'lun': lun}]
|
||||
|
||||
|
||||
class ubuntu(LinuxDist):
|
||||
def create_network_configuration_files(self, file_path, network_info,
|
||||
@@ -543,10 +523,29 @@ class ubuntu(LinuxDist):
|
||||
pass
|
||||
|
||||
def get_scp_string(self, root, fcp, wwpn, lun):
|
||||
pass
|
||||
# Although the content is the same as SLES, I don't want to merge them.
|
||||
# Because they are NOT logically related, and it's very likely that
|
||||
# they evolve separately in the future.
|
||||
return ("=root=%(root)s zfcp.allow_lun_scan=0 "
|
||||
"zfcp.device=0.0.%(fcp)s,0x%(wwpn)s,0x%(lun)s") % {
|
||||
'root': root, 'fcp': fcp, 'wwpn': wwpn, 'lun': lun}
|
||||
|
||||
def get_zipl_script_lines(self, image, ramdisk, root, fcp, wwpn, lun):
|
||||
pass
|
||||
return ['#!/bin/bash\n',
|
||||
('echo -e "[defaultboot]\\n'
|
||||
'default=boot-from-volume\\n'
|
||||
'[boot-from-volume]\\n'
|
||||
'image=%(image)s\\n'
|
||||
'target = /boot/zipl\\n'
|
||||
'ramdisk=%(ramdisk)s\\n'
|
||||
'parameters=\\"root=%(root)s '
|
||||
'zfcp.device=0.0.%(fcp)s,0x%(wwpn)s,0x%(lun)s '
|
||||
'zfcp.allow_lun_scan=0\\""'
|
||||
'>/etc/zipl_volume.conf\n'
|
||||
'mkinitrd\n'
|
||||
'zipl -c /etc/zipl_volume.conf')
|
||||
% {'image': image, 'ramdisk': ramdisk, 'root': root,
|
||||
'fcp': fcp, 'wwpn': wwpn, 'lun': lun}]
|
||||
|
||||
def assemble_zfcp_srcdev(self, fcp, wwpn, lun):
|
||||
path = '/dev/disk/by-path/ccw-0.0.%(fcp)s-fc-0x%(wwpn)s-lun-%(lun)s'
|
||||
|
||||
Reference in New Issue
Block a user