"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ironic/tests/unit/common/test_pxe_utils.py" between
ironic-17.0.2.tar.gz and ironic-17.0.3.tar.gz

About: OpenStack Ironic (Optional Service: Bare-Metal Provisioning) aims to provision bare metal machines instead of virtual machines, forked from the Nova baremetal driver.
The "Wallaby" series (latest release).

test_pxe_utils.py  (ironic-17.0.2):test_pxe_utils.py  (ironic-17.0.3)
skipping to change at line 17 skipping to change at line 17
# a copy of the License at # a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import collections
import os import os
import tempfile import tempfile
from unittest import mock from unittest import mock
from ironic_lib import utils as ironic_utils from ironic_lib import utils as ironic_utils
from oslo_config import cfg from oslo_config import cfg
from oslo_utils import fileutils from oslo_utils import fileutils
from oslo_utils import uuidutils from oslo_utils import uuidutils
from ironic.common import exception from ironic.common import exception
skipping to change at line 1451 skipping to change at line 1452
'driver_info': DRV_INFO_DICT, 'driver_info': DRV_INFO_DICT,
'driver_internal_info': DRV_INTERNAL_INFO_DICT, 'driver_internal_info': DRV_INTERNAL_INFO_DICT,
} }
self.config_temp_dir('http_root', group='deploy') self.config_temp_dir('http_root', group='deploy')
self.node = object_utils.create_test_node(self.context, **n) self.node = object_utils.create_test_node(self.context, **n)
@mock.patch('ironic.common.utils.render_template', autospec=True) @mock.patch('ironic.common.utils.render_template', autospec=True)
def _test_build_pxe_config_options_pxe(self, render_mock, def _test_build_pxe_config_options_pxe(self, render_mock,
whle_dsk_img=False, whle_dsk_img=False,
debug=False, mode='deploy', debug=False, mode='deploy',
ramdisk_params=None): ramdisk_params=None,
expected_pxe_params=None):
self.config(debug=debug) self.config(debug=debug)
self.config(pxe_append_params='test_param', group='pxe') self.config(pxe_append_params='test_param', group='pxe')
driver_internal_info = self.node.driver_internal_info driver_internal_info = self.node.driver_internal_info
driver_internal_info['is_whole_disk_image'] = whle_dsk_img driver_internal_info['is_whole_disk_image'] = whle_dsk_img
self.node.driver_internal_info = driver_internal_info self.node.driver_internal_info = driver_internal_info
self.node.save() self.node.save()
tftp_server = CONF.pxe.tftp_server tftp_server = CONF.pxe.tftp_server
skipping to change at line 1497 skipping to change at line 1499
'kernel': ('kernel_id', 'kernel': ('kernel_id',
os.path.join(root_dir, os.path.join(root_dir,
self.node.uuid, self.node.uuid,
'kernel')), 'kernel')),
'ramdisk': ('ramdisk_id', 'ramdisk': ('ramdisk_id',
os.path.join(root_dir, os.path.join(root_dir,
self.node.uuid, self.node.uuid,
'ramdisk')) 'ramdisk'))
}) })
expected_pxe_params = 'test_param' if expected_pxe_params is None:
expected_pxe_params = 'test_param'
if debug: if debug:
expected_pxe_params += ' ipa-debug=1' expected_pxe_params += ' ipa-debug=1'
if ramdisk_params:
expected_pxe_params += ' ' + ' '.join(
'%s=%s' % tpl for tpl in ramdisk_params.items())
expected_pxe_params += ( expected_pxe_params += (
" ipa-global-request-id=%s" % self.context.global_id) " ipa-global-request-id=%s" % self.context.global_id)
expected_options = { expected_options = {
'deployment_ari_path': pxe_ramdisk, 'deployment_ari_path': pxe_ramdisk,
'pxe_append_params': expected_pxe_params, 'pxe_append_params': expected_pxe_params,
'deployment_aki_path': pxe_kernel, 'deployment_aki_path': pxe_kernel,
'tftp_server': tftp_server, 'tftp_server': tftp_server,
'ipxe_timeout': 0, 'ipxe_timeout': 0,
'ari_path': ramdisk, 'ari_path': ramdisk,
skipping to change at line 1554 skipping to change at line 1554
self.node.instance_info = i_info self.node.instance_info = i_info
self.node.save() self.node.save()
self._test_build_pxe_config_options_pxe(whle_dsk_img=False) self._test_build_pxe_config_options_pxe(whle_dsk_img=False)
def test_build_pxe_config_options_pxe_without_is_whole_disk_image(self): def test_build_pxe_config_options_pxe_without_is_whole_disk_image(self):
del self.node.driver_internal_info['is_whole_disk_image'] del self.node.driver_internal_info['is_whole_disk_image']
self.node.save() self.node.save()
self._test_build_pxe_config_options_pxe(whle_dsk_img=False) self._test_build_pxe_config_options_pxe(whle_dsk_img=False)
def test_build_pxe_config_options_ramdisk_params(self): def test_build_pxe_config_options_ramdisk_params(self):
self._test_build_pxe_config_options_pxe(whle_dsk_img=True, self._test_build_pxe_config_options_pxe(
ramdisk_params={'foo': 'bar'}) whle_dsk_img=True,
ramdisk_params=collections.OrderedDict([('foo', 'bar'),
('banana', None)]),
expected_pxe_params='test_param foo=bar banana')
def test_build_pxe_config_options_pxe_no_kernel_no_ramdisk(self): def test_build_pxe_config_options_pxe_no_kernel_no_ramdisk(self):
del self.node.driver_internal_info['is_whole_disk_image'] del self.node.driver_internal_info['is_whole_disk_image']
self.node.save() self.node.save()
pxe_params = 'my-pxe-append-params ipa-debug=0' pxe_params = 'my-pxe-append-params ipa-debug=0'
self.config(group='pxe', pxe_append_params=pxe_params) self.config(group='pxe', pxe_append_params=pxe_params)
self.config(group='pxe', tftp_server='my-tftp-server') self.config(group='pxe', tftp_server='my-tftp-server')
self.config(group='pxe', tftp_root='/tftp-path/') self.config(group='pxe', tftp_root='/tftp-path/')
image_info = { image_info = {
'deploy_kernel': ('deploy_kernel', 'deploy_kernel': ('deploy_kernel',
 End of changes. 5 change blocks. 
7 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)