[systemd-devel] [PATCH v2] detect-virt: detect User-Mode Linux

Lennart Poettering lennart at poettering.net
Tue Jul 16 04:07:24 PDT 2013


On Tue, 16.07.13 12:50, Ramkumar Ramachandra (artagnon at gmail.com) wrote:

> --- a/man/systemd-detect-virt.xml
> +++ b/man/systemd-detect-virt.xml
> @@ -70,6 +70,7 @@
>                  <varname>microsoft</varname>,
>                  <varname>oracle</varname>, <varname>xen</varname>,
>                  <varname>bochs</varname>, <varname>chroot</varname>,
> +                <varname>uml</varname>,
>                  <varname>openvz</varname>, <varname>lxc</varname>,
>                  <varname>lxc-libvirt</varname>,
>                  <varname>systemd-nspawn</varname>.</para>

Please also update the docs in systemd.unit(5), for ConditionVirtualization.

> +        r = read_full_file("/proc/cpuinfo", &cpuinfo_contents, NULL);
> +        if (r < 0)
> +                return r;
> +        if (strstr(cpuinfo_contents, "vendor_id\t: User Mode Linux\n")) {
> +                *id = "uml";
> +                return 1;
> +        }

Could you also look for the \n before the line? I'd really like to make
sure this detects this on a separate line only:

   strstr(cpuinfo_contents, "\nvendor_id\t: User Mode Linux\n")

(I'd just make the change myself and commit it, but I don't want to
commit this without testing, and I have no UML machine around, so I can
test this.)

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list