]> xenbits.xensource.com Git - libvirt.git/commit
virCapabilitiesDomainDataLookup: Produce saner error message
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 11 Jun 2015 14:15:46 +0000 (16:15 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 15 Jun 2015 05:29:37 +0000 (07:29 +0200)
commitf8867012900ab124a7b09b0022155b4f1d950d52
treef4d3cea1ac730c2af22ce296db556936f80c340c
parentbcf1349bb180d2a3aab6906aea524e2d6aa7e52a
virCapabilitiesDomainDataLookup: Produce saner error message

During a review, I've noticed this error message that was eventually
produced when I was trying to define a domain:

error: invalid argument: could not find capabilities for arch=mips64el
domaintype=(null)

Look at the (null). Why is it there? Well, during XML parsing, we try
to look up the default emulator for given OS type and possibly virt
type too. And this is the problem, because if we don't want to look up
by virt type, a -1 is passed to note this fact. Later, the code
handles -1 just right. Except for error message. When it is
constructed (in a very fabulous way I must say), the value is compared
to zero, not -1. And since we don't have any translation from -1 to a
virt type string, we just print (null).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/capabilities.c