[libvirt] [PATCH] Don't overwrite virDomainAssignDef errors.
Chris Lalancette
clalance at redhat.com
Thu May 20 17:54:04 UTC 2010
On 05/20/2010 12:24 PM, Cole Robinson wrote:
> On 05/20/2010 11:14 AM, Chris Lalancette wrote:
>> Signed-off-by: Chris Lalancette <clalance at redhat.com>
>> ---
>> src/qemu/qemu_driver.c | 9 +++------
>> 1 files changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>> index f2139c0..6df2356 100644
>> --- a/src/qemu/qemu_driver.c
>> +++ b/src/qemu/qemu_driver.c
>> @@ -6100,8 +6100,7 @@ static int qemudDomainRestore(virConnectPtr conn,
>> if (!(vm = virDomainAssignDef(driver->caps,
>> &driver->domains,
>> def, true))) {
>> - qemuReportError(VIR_ERR_OPERATION_FAILED,
>> - "%s", _("failed to assign new VM"));
>> + /* virDomainAssignDef already set the error */
>> goto cleanup;
>> }
>> def = NULL;
>> @@ -9909,8 +9908,7 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn,
>> if (!(vm = virDomainAssignDef(driver->caps,
>> &driver->domains,
>> def, true))) {
>> - qemuReportError(VIR_ERR_OPERATION_FAILED,
>> - "%s", _("failed to assign new VM"));
>> + /* virDomainAssignDef already set the error */
>> goto cleanup;
>> }
>> def = NULL;
>> @@ -10140,8 +10138,7 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
>> if (!(vm = virDomainAssignDef(driver->caps,
>> &driver->domains,
>> def, true))) {
>> - qemuReportError(VIR_ERR_OPERATION_FAILED,
>> - "%s", _("failed to assign new VM"));
>> + /* virDomainAssignDef already set the error */
>> goto cleanup;
>> }
>> def = NULL;
>
> ACK to the change, but I don't think it needs a comment, I think all
> virDomain functions that can fail report their error.
That's true. The thing is that there isn't a clear policy on this, so
I like to put the comments in to remind me when I'm looking back at the
code later (and wondering why we aren't setting the error). But I'm fine
either way.
--
Chris Lalancette
More information about the libvir-list
mailing list