I fixed two bugs in this patch.

1) the code in the dist.py correct a display format of content in
ifcfg-xxx file to let user easy to grep and show the file content
in one line.

2)the code in driver.py fixed the bug that image name can not be
unicode.For example,when type 'tabdump osimage',if the image name is
chinese 中文 whose unicodes are '\u4e2d\u6587',it will show like this:
"rhel7-s390x-netboot-????????_0c794bba_4804_49e7_9e2f_c8ab56050b72"...
there are messy codes in the line.
we try to replace the question marks with the unicode of 中文,like:
"rhel7-s390x-netboot-4e2d6587_0c794bba_4804_49e7_9e2f_c8ab56050b72"...

if user want to know the real name,they can use steve's code to transfer
unicode to the text.

Change-Id: I26a538df00fb008b0d8ed9051f2c84a7b3c3364c
This commit is contained in:
biao cao 2016-11-03 15:31:16 +08:00 committed by Huang Rui
parent d20872580d
commit b3f5ccbbab
2 changed files with 6 additions and 1 deletions

View File

@ -53,8 +53,10 @@ class LinuxDist(object):
(cfg_str, cmd_str, dns_str,
route_str) = self._generate_network_configuration(network,
base_vdev, device_num)
LOG.debug('Network configure file content is: %s' % cfg_str)
target_net_conf_file_name = file_path + file_name
cfg_str_for_log = cfg_str.replace('\n', ' ')
LOG.debug('Network configure file[%s] content is: %s',
(target_net_conf_file_name, cfg_str_for_log))
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))

View File

@ -609,6 +609,9 @@ class ZVMDriver(driver.ComputeDriver):
LOG.debug("Generating the manifest.xml as a part of bundle file for "
"image %s" % image_meta['id'], instance=instance)
image_name = image_name.encode('unicode_escape')
image_name = image_name.replace('\u', '')
image_name = image_name.decode('utf-8')
self._zvm_images.generate_manifest_file(image_meta, image_name,
disk_file, bundle_file_path)