[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] 3/4 Add SMBIOS QEmu driver



On Thu, Oct 21, 2010 at 03:58:50PM -0600, Eric Blake wrote:
> On 10/21/2010 02:23 PM, Daniel Veillard wrote:
> >The main trouble here is that the QEmu command uses names which are
> >similar to the official names for the entries used by the DMTF, but
> >that mean we cant base on name equality. I was tempted to use
> 
> s/cant/can't/
> 
> >something like strcasestr to go fishing on the names but since we
> >never used this in libvirt yet, and I'm not sure it's available in
> >gnulib, I did the patch using strstr, assuming entries provided by the
> 
> Gnulib provides strcasestr() as LGPLv2+ (but beware - it only does
> what you want in unibyte locales); it also provides the c-strcasestr
> module (which is probably exactly what you want!), but it is
> currently LGPLv3+, although I can request on the gnulib list to have
> it relaxed if you'd like.
> 
> >users would contain the word in lower case usually except maybe for the
> >first character. The matching glue is certainly perfectible.
> 
> c_strcasestr() would certainly make it easier.
> 
> Or, is this something where STRCASEEQ() would be good enough?  That
> is, do we expect a user to always provide the full DMTF name "BIOS
> Version", or is the substring matching important because we want to
> all the user the shortcut of "Version"?

  Well coming from a QEmu usage, people will likely just expect
"version" as that's what is used on the command line. I think matching
by subset is less likely to get users wondering why this doesn't work
as expected. Since we don't do exact name checking on input, I think
it's better to be flexible.

> >Also decided that if we can't associate an entry with an existing
> >QEmu SMBIOS command we would ignore it. On the ther hand if a block
> 
> s/ther/other/
> 
> >other than type 0 or 1 is used in the XML definition we would emit
> >a warning, but still not fail.
> >
> >+    /*
> >+     * QEmu accepts only a limited set of System informations, and
> >+     * use command line arguments shortcuts from the DMTF real names
> >+     * so go fishing for those
> >+     */
> >+    cur = def->entries;
> >+    while (cur != NULL) {
> >+        /* 0:Vendor */
> >+        if ((def->type == 0)&&  (strstr(cur->name, "endor")))
> >+            virBufferVSprintf(&buf, ",vendor=\"%s\"", cur->value);
> >+        /* 0:BIOS Version */
> >+        else if ((def->type == 0)&&  (strstr(cur->name, "ersion")))
> >+            virBufferVSprintf(&buf, ",version=\"%s\"", cur->value);
> >+        /* 0:BIOS Release Date */
> >+        else if ((def->type == 0)&&  (strstr(cur->name, "ate")))
> >+            virBufferVSprintf(&buf, ",date=\"%s\"", cur->value);
> >+        /* 0:System BIOS Major Release and 0:System BIOS Minor Release */
> >+        else if ((def->type == 0)&&  (strstr(cur->name, "elease")))
> >+            virBufferVSprintf(&buf, ",date=\"%s\"", cur->value);
> 
> If the user provides both "Date" and "Major Release" names, does
> qemu complain about the doubled-up date="" option?

  No actually that's different entries :-)
But qemu will complain if release is not formated as %d.%d, it takes as
a string what is 2 byte values in the SMBIOS tables. I didn't tried to
validate that at the driver level, rather let qemu report the error
I checked it shows up back up to virt-manager if something is not
formatted to its taste like the UUID

Daniel

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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]