Merge "Do not punch xcat key file to instance"

This commit is contained in:
Jenkins 2017-03-21 01:46:21 +00:00 committed by Gerrit Code Review
commit 603aabbf82
3 changed files with 0 additions and 35 deletions

View File

@ -508,7 +508,6 @@ class ZVMDriverTestCases(ZVMTestCase):
self._fake_fun())
self.stubs.Set(self.driver, '_add_nic_to_table', self._fake_fun())
self.stubs.Set(zvmutils, 'punch_adminpass_file', self._fake_fun())
self.stubs.Set(zvmutils, 'punch_xcat_auth_file', self._fake_fun())
self.stubs.Set(zvmutils, 'punch_iucv_file', self._fake_fun())
self.stubs.Set(instance.ZVMInstance, 'power_on', self._fake_fun())
self.stubs.Set(self.driver._zvm_images, 'update_last_use_date',
@ -548,7 +547,6 @@ class ZVMDriverTestCases(ZVMTestCase):
self._fake_fun())
self.stubs.Set(self.driver, '_add_nic_to_table', self._fake_fun())
self.stubs.Set(zvmutils, 'punch_adminpass_file', self._fake_fun())
self.stubs.Set(zvmutils, 'punch_xcat_auth_file', self._fake_fun())
self.stubs.Set(zvmutils, 'punch_iucv_file', self._fake_fun())
self.stubs.Set(instance.ZVMInstance, 'power_on', self._fake_fun())
self.stubs.Set(self.driver._zvm_images, 'update_last_use_date',
@ -600,7 +598,6 @@ class ZVMDriverTestCases(ZVMTestCase):
self.mox.StubOutWithMock(instance.ZVMInstance, 'deploy_node')
self.mox.StubOutWithMock(self.driver._pathutils, 'clean_temp_folder')
self.mox.StubOutWithMock(zvmutils, 'punch_adminpass_file')
self.mox.StubOutWithMock(zvmutils, 'punch_xcat_auth_file')
self.mox.StubOutWithMock(zvmutils, 'punch_iucv_file')
self.mox.StubOutWithMock(zvmutils, 'process_eph_disk')
self.stubs.Set(self.driver, '_wait_and_get_nic_direct',
@ -633,7 +630,6 @@ class ZVMDriverTestCases(ZVMTestCase):
'/temp/os000001/configdrive.tgz')
zvmutils.punch_adminpass_file(mox.IgnoreArg(), 'os000001', 'pass',
mox.IgnoreArg())
zvmutils.punch_xcat_auth_file(mox.IgnoreArg(), 'os000001')
zvmutils.punch_iucv_file('rhel6.2', 'fakehcp.fake.com',
'fakehcp', 'os000001', '/temp/os000001')
zvmutils.process_eph_disk('os000001', mox.IgnoreArg(), mox.IgnoreArg(),
@ -1235,7 +1231,6 @@ class ZVMDriverTestCases(ZVMTestCase):
self.stubs.Set(self.driver._image_api, 'get', self.fake_image_get)
self.mox.StubOutWithMock(self.driver, 'get_host_ip_addr')
self.mox.StubOutWithMock(self.driver._pathutils, 'get_instance_path')
self.mox.StubOutWithMock(self.driver._networkop,
'clean_mac_switch_host')
self.mox.StubOutWithMock(self.driver._pathutils, 'clean_temp_folder')
@ -1249,7 +1244,6 @@ class ZVMDriverTestCases(ZVMTestCase):
self.mox.StubOutWithMock(self.driver, '_wait_and_get_nic_direct')
self.mox.StubOutWithMock(self.driver._zvm_images,
'delete_image_from_xcat')
self.mox.StubOutWithMock(zvmutils, 'punch_xcat_auth_file')
self.mox.StubOutWithMock(zvmutils, 'punch_iucv_authorized_file')
self.mox.StubOutWithMock(instance.ZVMInstance, 'power_on')
self.mox.StubOutWithMock(zvmutils, 'xdsh')
@ -1257,7 +1251,6 @@ class ZVMDriverTestCases(ZVMTestCase):
farg = mox.IgnoreArg()
self.driver.get_host_ip_addr().AndReturn('10.1.1.10')
self.driver._pathutils.get_instance_path(farg, farg).AndReturn('/fake')
self.driver._networkop.clean_mac_switch_host(farg)
self.driver._pathutils.clean_temp_folder(farg)
self.driver._copy_instance(farg).AndReturn(self._fake_inst)
@ -1269,7 +1262,6 @@ class ZVMDriverTestCases(ZVMTestCase):
self.driver._deploy_root_and_ephemeral(farg, farg)
self.driver._wait_and_get_nic_direct('os000001', self._fake_inst)
self.driver._zvm_images.delete_image_from_xcat(farg)
zvmutils.punch_xcat_auth_file(mox.IgnoreArg(), 'os000001')
zvmutils.punch_iucv_authorized_file('rszos000001', 'os000001',
'fakehcp')
instance.ZVMInstance.power_on()
@ -1300,7 +1292,6 @@ class ZVMDriverTestCases(ZVMTestCase):
self.stubs.Set(self.driver._image_api, 'get', self.fake_image_get)
self.mox.StubOutWithMock(self.driver, 'get_host_ip_addr')
self.mox.StubOutWithMock(self.driver._pathutils, 'get_instance_path')
self.mox.StubOutWithMock(self.driver._networkop,
'clean_mac_switch_host')
self.mox.StubOutWithMock(self.driver, '_copy_instance')
@ -1313,7 +1304,6 @@ class ZVMDriverTestCases(ZVMTestCase):
self.mox.StubOutWithMock(self.driver, '_wait_and_get_nic_direct')
self.mox.StubOutWithMock(self.driver._zvm_images,
'delete_image_from_xcat')
self.mox.StubOutWithMock(zvmutils, 'punch_xcat_auth_file')
self.mox.StubOutWithMock(zvmutils, 'punch_iucv_authorized_file')
self.mox.StubOutWithMock(instance.ZVMInstance, 'power_on')
self.mox.StubOutWithMock(zvmutils, 'xdsh')
@ -1321,7 +1311,6 @@ class ZVMDriverTestCases(ZVMTestCase):
farg = mox.IgnoreArg()
self.driver.get_host_ip_addr().AndReturn('10.1.1.10')
self.driver._pathutils.get_instance_path(farg, farg).AndReturn('/fake')
self.driver._networkop.clean_mac_switch_host(farg)
self.driver._copy_instance(farg).AndReturn(self._fake_inst)
instance.ZVMInstance.copy_xcat_node(farg)
@ -1332,7 +1321,6 @@ class ZVMDriverTestCases(ZVMTestCase):
self.driver._deploy_root_and_ephemeral(farg, farg)
self.driver._wait_and_get_nic_direct('os000001', self._fake_inst)
self.driver._zvm_images.delete_image_from_xcat(farg)
zvmutils.punch_xcat_auth_file(mox.IgnoreArg(), 'os000001')
zvmutils.punch_iucv_authorized_file('rszos000001', 'os000001',
'fakehcp')
instance.ZVMInstance.power_on()
@ -1364,7 +1352,6 @@ class ZVMDriverTestCases(ZVMTestCase):
self.stubs.Set(self.driver._image_api, 'get', self.fake_image_get)
self.mox.StubOutWithMock(self.driver, 'get_host_ip_addr')
self.mox.StubOutWithMock(self.driver._pathutils, 'get_instance_path')
self.mox.StubOutWithMock(self.driver._networkop,
'clean_mac_switch_host')
self.mox.StubOutWithMock(self.driver._pathutils, 'clean_temp_folder')
@ -1379,14 +1366,12 @@ class ZVMDriverTestCases(ZVMTestCase):
self.mox.StubOutWithMock(self.driver, '_wait_and_get_nic_direct')
self.mox.StubOutWithMock(self.driver._zvm_images,
'delete_image_from_xcat')
self.mox.StubOutWithMock(zvmutils, 'punch_xcat_auth_file')
self.mox.StubOutWithMock(zvmutils, 'punch_iucv_authorized_file')
self.mox.StubOutWithMock(instance.ZVMInstance, 'power_on')
self.mox.StubOutWithMock(self.driver, '_attach_volume_to_instance')
farg = mox.IgnoreArg()
self.driver.get_host_ip_addr().AndReturn('10.1.1.10')
self.driver._pathutils.get_instance_path(farg, farg).AndReturn('/fake')
self.driver._networkop.clean_mac_switch_host(farg)
self.driver._pathutils.clean_temp_folder(farg)
self.driver._copy_instance(farg).AndReturn(self._fake_inst)
@ -1399,7 +1384,6 @@ class ZVMDriverTestCases(ZVMTestCase):
self.driver._deploy_root_and_ephemeral(farg, farg)
self.driver._wait_and_get_nic_direct('os000001', self._fake_inst)
self.driver._zvm_images.delete_image_from_xcat(farg)
zvmutils.punch_xcat_auth_file(mox.IgnoreArg(), 'os000001')
zvmutils.punch_iucv_authorized_file('rszos000001', 'os000001',
'fakehcp')
instance.ZVMInstance.power_on()
@ -1432,7 +1416,6 @@ class ZVMDriverTestCases(ZVMTestCase):
self.stubs.Set(self.driver._image_api, 'get', self.fake_image_get)
self.mox.StubOutWithMock(self.driver, 'get_host_ip_addr')
self.mox.StubOutWithMock(self.driver._pathutils, 'get_instance_path')
self.mox.StubOutWithMock(self.driver._networkop,
'clean_mac_switch_host')
self.mox.StubOutWithMock(self.driver._pathutils, 'clean_temp_folder')
@ -1453,7 +1436,6 @@ class ZVMDriverTestCases(ZVMTestCase):
farg = mox.IgnoreArg()
self.driver.get_host_ip_addr().AndReturn('10.1.1.10')
self.driver._pathutils.get_instance_path(farg, farg).AndReturn('/fake')
self.driver._networkop.clean_mac_switch_host(farg)
self.driver._pathutils.clean_temp_folder(farg)
self.driver._copy_instance(farg).AndReturn(self._fake_inst)
@ -1500,7 +1482,6 @@ class ZVMDriverTestCases(ZVMTestCase):
self.stubs.Set(self.driver._image_api, 'get', self.fake_image_get)
self.mox.StubOutWithMock(self.driver, 'get_host_ip_addr')
self.mox.StubOutWithMock(self.driver._pathutils, 'get_instance_path')
self.mox.StubOutWithMock(instance.ZVMInstance, 'create_xcat_node')
self.mox.StubOutWithMock(instance.ZVMInstance, 'update_node_def')
self.mox.StubOutWithMock(self.driver._zvm_images, 'put_image_to_xcat')
@ -1513,14 +1494,12 @@ class ZVMDriverTestCases(ZVMTestCase):
self.mox.StubOutWithMock(self.driver, '_wait_and_get_nic_direct')
self.mox.StubOutWithMock(self.driver._zvm_images,
'delete_image_from_xcat')
self.mox.StubOutWithMock(zvmutils, 'punch_xcat_auth_file')
self.mox.StubOutWithMock(zvmutils, 'punch_iucv_authorized_file')
self.mox.StubOutWithMock(instance.ZVMInstance, 'power_on')
self.mox.StubOutWithMock(self.driver, '_attach_volume_to_instance')
farg = mox.IgnoreArg()
self.driver.get_host_ip_addr().AndReturn('10.1.1.10')
self.driver._pathutils.get_instance_path(farg, farg).AndReturn('/fake')
instance.ZVMInstance.create_xcat_node(farg)
instance.ZVMInstance.update_node_def(farg, farg)
self.driver._zvm_images.put_image_to_xcat(farg, farg)
@ -1531,7 +1510,6 @@ class ZVMDriverTestCases(ZVMTestCase):
self.driver._deploy_root_and_ephemeral(farg, farg)
self.driver._wait_and_get_nic_direct('os000001', self._fake_inst)
self.driver._zvm_images.delete_image_from_xcat(farg)
zvmutils.punch_xcat_auth_file(farg, farg)
zvmutils.punch_iucv_authorized_file('os000001', 'os000001', 'fakehcp')
instance.ZVMInstance.power_on()
self.driver._attach_volume_to_instance(farg, self._fake_inst, [])

View File

@ -382,8 +382,6 @@ class ZVMDriver(driver.ComputeDriver):
# Change vm's admin password during spawn
zvmutils.punch_adminpass_file(instance_path, zvm_inst._name,
admin_password, linuxdist)
# Unlock the instance
zvmutils.punch_xcat_auth_file(instance_path, zvm_inst._name)
if zvmutils.xcat_support_iucv(self._xcat_version):
# Punch IUCV server files to reader.
zvmutils.punch_iucv_file(os_version, zhcp, zhcp_userid,
@ -1639,8 +1637,6 @@ class ZVMDriver(driver.ComputeDriver):
zhcp_userid = hcp_info['userid']
new_inst = ZVMInstance(self, instance)
instance_path = self._pathutils.get_instance_path(
CONF.zvm_host, new_inst._name)
if same_xcat_mn:
# Same xCAT MN
# cleanup networking, will re-configure later
@ -1741,7 +1737,6 @@ class ZVMDriver(driver.ComputeDriver):
bdm = driver.block_device_info_get_mapping(block_device_info)
try:
zvmutils.punch_xcat_auth_file(instance_path, new_inst._name)
if zvmutils.xcat_support_iucv(self._xcat_version):
if same_xcat_mn:
zvmutils.punch_iucv_authorized_file(old_inst._name,

View File

@ -763,14 +763,6 @@ def punch_adminpass_file(instance_path, instance_name, admin_password,
punch_file(instance_name, adminpass_fn, 'X', remote_host=get_host())
def punch_xcat_auth_file(instance_path, instance_name):
"""Make xCAT MN authorized by virtual machines."""
mn_pub_key = get_mn_pub_key()
auth_fn = ''.join([instance_path, '/xcatauth.sh'])
_generate_auth_file(auth_fn, mn_pub_key)
punch_file(instance_name, auth_fn, 'X', remote_host=get_host())
def _generate_iucv_cmd_file(iucv_cmd_file_path, cmd):
lines = ['#!/bin/bash\n', cmd]
with open(iucv_cmd_file_path, 'w') as f: