[PATCH] virsysinfo: Parse OEM strings

Daniel P. Berrangé berrange at redhat.com
Tue Jun 2 10:56:57 UTC 2020


On Tue, Jun 02, 2020 at 12:53:18PM +0200, Michal Privoznik wrote:
> Setting OEM strings for a domain was introduced in
> v4.1.0-rc1~315. However, any application that wanted to use them
> (e.g. to point to an URL where a config file is stored) had to
> 'dmidecode -u --oem-string N' (where N is index of the string).
> Well, we can expose them under our <sysinfo/> XML and if the
> domain is running Libvirt inside it can be obtained using
> virConnectGetSysinfo() API.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/util/virsysinfo.c               | 60 ++++++++++++++++++++++++++++-
>  tests/sysinfodata/x86sysinfo.data   | 10 +++++
>  tests/sysinfodata/x86sysinfo.expect | 10 +++++
>  3 files changed, 79 insertions(+), 1 deletion(-)

> diff --git a/tests/sysinfodata/x86sysinfo.data b/tests/sysinfodata/x86sysinfo.data
> index 426261041d..5615e144fb 100644
> --- a/tests/sysinfodata/x86sysinfo.data
> +++ b/tests/sysinfodata/x86sysinfo.data
> @@ -81,3 +81,13 @@ Memory Device
>  	Serial Number: 29057112
>  	Asset Tag: 0839
>  	Part Number: IMSH2GS13A1F1C-10F
> +
> +OEM Strings
> +        String 1: Default string
> +        String 2: Default string
> +        String 3: MIAMI
> +        String 4: Default string
> +        String 5: FFFFFFFFFFFFF
> +        String 6: FFFFFFFFFFFFF
> +        String 7: FFFFFFFFFFFFF
> +        String 8: Default string

What does dmidecode do for escaping (if anything) if I set a string
value of

    "Ha ha ha try parsing\n        String 3: this correctly\n        String 4:then"

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list