[libvirt] [PATCH] esx: Explictly declare VMX file content as UTF-8

Daniel Veillard veillard at redhat.com
Thu Oct 14 09:42:01 UTC 2010


On Thu, Oct 14, 2010 at 08:59:18AM +0200, Matthias Bolte wrote:
> ---
>  src/esx/esx_vmx.c                                  |    3 +++
>  tests/xml2vmxdata/xml2vmx-annotation.vmx           |    1 +
>  tests/xml2vmxdata/xml2vmx-cdrom-ide-device.vmx     |    1 +
>  tests/xml2vmxdata/xml2vmx-cdrom-ide-file.vmx       |    1 +
>  tests/xml2vmxdata/xml2vmx-cdrom-scsi-device.vmx    |    1 +
>  tests/xml2vmxdata/xml2vmx-cdrom-scsi-file.vmx      |    1 +
>  tests/xml2vmxdata/xml2vmx-esx-in-the-wild-1.vmx    |    1 +
>  tests/xml2vmxdata/xml2vmx-esx-in-the-wild-2.vmx    |    1 +
>  tests/xml2vmxdata/xml2vmx-esx-in-the-wild-3.vmx    |    1 +
>  tests/xml2vmxdata/xml2vmx-esx-in-the-wild-4.vmx    |    1 +
>  tests/xml2vmxdata/xml2vmx-ethernet-bridged.vmx     |    1 +
>  tests/xml2vmxdata/xml2vmx-ethernet-custom.vmx      |    1 +
>  tests/xml2vmxdata/xml2vmx-ethernet-e1000.vmx       |    1 +
>  tests/xml2vmxdata/xml2vmx-ethernet-generated.vmx   |    1 +
>  tests/xml2vmxdata/xml2vmx-ethernet-other.vmx       |    1 +
>  tests/xml2vmxdata/xml2vmx-ethernet-static.vmx      |    1 +
>  tests/xml2vmxdata/xml2vmx-ethernet-vmxnet2.vmx     |    1 +
>  tests/xml2vmxdata/xml2vmx-ethernet-vpx.vmx         |    1 +
>  tests/xml2vmxdata/xml2vmx-floppy-device.vmx        |    1 +
>  tests/xml2vmxdata/xml2vmx-floppy-file.vmx          |    1 +
>  tests/xml2vmxdata/xml2vmx-graphics-vnc.vmx         |    1 +
>  tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-1.vmx    |    1 +
>  tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-2.vmx    |    1 +
>  tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-3.vmx    |    1 +
>  tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-4.vmx    |    1 +
>  tests/xml2vmxdata/xml2vmx-harddisk-ide-file.vmx    |    1 +
>  tests/xml2vmxdata/xml2vmx-harddisk-scsi-file.vmx   |    1 +
>  tests/xml2vmxdata/xml2vmx-minimal-64bit.vmx        |    1 +
>  tests/xml2vmxdata/xml2vmx-minimal.vmx              |    1 +
>  tests/xml2vmxdata/xml2vmx-parallel-device.vmx      |    1 +
>  tests/xml2vmxdata/xml2vmx-parallel-file.vmx        |    1 +
>  tests/xml2vmxdata/xml2vmx-scsi-driver.vmx          |    1 +
>  tests/xml2vmxdata/xml2vmx-scsi-writethrough.vmx    |    1 +
>  tests/xml2vmxdata/xml2vmx-serial-device.vmx        |    1 +
>  tests/xml2vmxdata/xml2vmx-serial-file.vmx          |    1 +
>  .../xml2vmxdata/xml2vmx-serial-network-client.vmx  |    1 +
>  .../xml2vmxdata/xml2vmx-serial-network-server.vmx  |    1 +
>  tests/xml2vmxdata/xml2vmx-serial-pipe.vmx          |    1 +
>  38 files changed, 40 insertions(+), 0 deletions(-)
> 
> diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
> index e17e1e7..7dc8e60 100644
> --- a/src/esx/esx_vmx.c
> +++ b/src/esx/esx_vmx.c
> @@ -2475,6 +2475,9 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps, virDomainDefPtr def,
>          return NULL;
>      }
>  
> +    /* vmx:.encoding */
> +    virBufferAddLit(&buffer, ".encoding = \"UTF-8\"\n");
> +
>      /* vmx:config.version */
>      virBufferAddLit(&buffer, "config.version = \"8\"\n");
>  

  Good idea ! Nice that they though about the need for an encoding there,

ACK

Now the question is do we check for encoding when reading a vmx ?
Some iconv (or maybe we can reuse libxml2 conversion functions) might
be in order.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list