在 2018/9/17 下午8:40, Andrea Bolognani 写道:
>>>
>>> qemuDomainObjEnterMonitor(driver, vm);
>>> - ret = qemuMonitorAddDevice(priv->mon, devstr);
>>> +
>>> + if (qemuDomainAttachExtensionDevice(priv->mon,
&controller->info) < 0) {
>>> + ignore_value(qemuDomainObjExitMonitor(driver, vm));
>>> + goto cleanup;
>>> + }
>> I'm not sure this is entirely safe. Perhaps you should introduce an
>> exit_monitor label that ensures failure to exit the monitor is also
>> taken into account, and jump to that one instead?
> I see there're a lot of code ignoring monitor exit failure. Of course,
> taking it into account
> is proper. Do you strongly suggest to add that?
As mentioned a while ago, I'm not particularly comfortable around
this part of libvirt, so we should definitely have someone with
more experience look it over before merging.
That said, while there are indeed a few existing places where the
return value of qemuDomainObjExitMonitor() is ignored, it seems
like it's far more common to take it into account, so I would say
do that unless you have a very good reason not to.
I will take it into account in next version.
--
Yi Min