Fixes unicode issue in the Hyper-V driver

The XML string returned by the WMI API calls requires unicode
conversion before further processing, e.g. with ElementTree.

This affects the vhdutilsv2._get_vhd_info_xml method due to
the textual description. The issue came to light using the
host with Chinese locale, while not present on a en_US host.

Fixes bug: #1229671

Change-Id: I09435a205abfc8ae9470c53c5446cbb28dee0115
(cherry picked from commit c8c7c01d68)
This commit is contained in:
Alessandro Pilotti 2013-09-25 17:28:53 +03:00 committed by Gary Kotton
parent 6bf7e78a6d
commit 88cfe5a0ae
1 changed files with 1 additions and 1 deletions

View File

@ -114,7 +114,7 @@ class VHDUtilsV2(vhdutils.VHDUtils):
self._vmutils.check_ret_val(ret_val, job_path)
return vhd_info_xml
return vhd_info_xml.encode('utf8', 'xmlcharrefreplace')
def get_vhd_info(self, vhd_path):
image_man_svc = self._conn.Msvm_ImageManagementService()[0]