Re: [PATCH 05/13] conf: utility to return alias of a controller based on type/index

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

 



On 05/08/2015 01:44 PM, John Ferlan wrote:
>
> On 05/05/2015 02:03 PM, Laine Stump wrote:
>
>
>> +
>> +    contIndex = virDomainControllerFind(def, type, idx);
>> +    if (contIndex < 0) {
>> +        virReportError(VIR_ERR_INTERNAL_ERROR,
>> +                       _("Could not find %s controller with index %d "
>> +                         "required for device"),
>> +                       contTypeStr, idx);
>> +        return NULL;
>> +    }
>> +    if (!def->controllers[contIndex]->info.alias) {
>> +        virReportError(VIR_ERR_INTERNAL_ERROR,
>> +                       _("Device alias was not set for %s controller "
>> +                         "with index %d "),
>> +                       contTypeStr, idx);
>> +        return NULL;
> So if the alias wasn't set for some reason we're going to start seeing
> errors. Is there a reason the alias wouldn't be set... (just trying to
> think/type outloud later in the day at the end of the week as my brain
> is beginning to check out).

If the alias hasn't been set at the time that we're calling this
function, that would be an error that should be remedied. Currently the
only place it is going to be called is during commandline generation,
after all devices have had their aliases assigned, and during hotplug
(also by definition after all other devices have had their aliases
assigned). So for current usage we are fine. In the future if someone
tries to use this function when they shouldn't, they will get the
internal error and learn their lesson.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]