mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
lib: domain: Convert to virErrorRestore/virErrorPreserveLast
Replaced all virSaveLastError and virSetError/virFreeError usages to virErrorPreserveLast and virErrorRestore respectively. Reviewed-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Syed Humaid <syedhumaidbinharoon@gmail.com>
This commit is contained in:
parent
d0a160d645
commit
aa9d4d27c1
@ -2894,7 +2894,7 @@ virDomainMigrateVersion2(virDomainPtr domain,
|
|||||||
_("domainMigratePrepare2 did not set uri"));
|
_("domainMigratePrepare2 did not set uri"));
|
||||||
cancelled = 1;
|
cancelled = 1;
|
||||||
/* Make sure Finish doesn't overwrite the error */
|
/* Make sure Finish doesn't overwrite the error */
|
||||||
orig_err = virSaveLastError();
|
virErrorPreserveLast(&orig_err);
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
if (uri_out)
|
if (uri_out)
|
||||||
@ -2909,7 +2909,7 @@ virDomainMigrateVersion2(virDomainPtr domain,
|
|||||||
|
|
||||||
/* Perform failed. Make sure Finish doesn't overwrite the error */
|
/* Perform failed. Make sure Finish doesn't overwrite the error */
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
orig_err = virSaveLastError();
|
virErrorPreserveLast(&orig_err);
|
||||||
|
|
||||||
/* If Perform returns < 0, then we need to cancel the VM
|
/* If Perform returns < 0, then we need to cancel the VM
|
||||||
* startup on the destination
|
* startup on the destination
|
||||||
@ -2929,10 +2929,7 @@ virDomainMigrateVersion2(virDomainPtr domain,
|
|||||||
VIR_ERROR(_("finish step ignored that migration was cancelled"));
|
VIR_ERROR(_("finish step ignored that migration was cancelled"));
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (orig_err) {
|
virErrorRestore(&orig_err);
|
||||||
virSetError(orig_err);
|
|
||||||
virFreeError(orig_err);
|
|
||||||
}
|
|
||||||
VIR_FREE(uri_out);
|
VIR_FREE(uri_out);
|
||||||
VIR_FREE(cookie);
|
VIR_FREE(cookie);
|
||||||
return ddomain;
|
return ddomain;
|
||||||
@ -3076,7 +3073,7 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
|
|||||||
/* Begin already started a migration job so we need to cancel it by
|
/* Begin already started a migration job so we need to cancel it by
|
||||||
* calling Confirm while making sure it doesn't overwrite the error
|
* calling Confirm while making sure it doesn't overwrite the error
|
||||||
*/
|
*/
|
||||||
orig_err = virSaveLastError();
|
virErrorPreserveLast(&orig_err);
|
||||||
goto confirm;
|
goto confirm;
|
||||||
} else {
|
} else {
|
||||||
goto done;
|
goto done;
|
||||||
@ -3091,7 +3088,7 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
|
|||||||
VIR_MIGRATE_PARAM_URI,
|
VIR_MIGRATE_PARAM_URI,
|
||||||
uri_out) < 0) {
|
uri_out) < 0) {
|
||||||
cancelled = 1;
|
cancelled = 1;
|
||||||
orig_err = virSaveLastError();
|
virErrorPreserveLast(&orig_err);
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
} else if (!uri &&
|
} else if (!uri &&
|
||||||
@ -3100,7 +3097,7 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("domainMigratePrepare3 did not set uri"));
|
_("domainMigratePrepare3 did not set uri"));
|
||||||
cancelled = 1;
|
cancelled = 1;
|
||||||
orig_err = virSaveLastError();
|
virErrorPreserveLast(&orig_err);
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3136,7 +3133,7 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
|
|||||||
|
|
||||||
/* Perform failed. Make sure Finish doesn't overwrite the error */
|
/* Perform failed. Make sure Finish doesn't overwrite the error */
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
orig_err = virSaveLastError();
|
virErrorPreserveLast(&orig_err);
|
||||||
/* Perform failed so we don't need to call confirm to let source know
|
/* Perform failed so we don't need to call confirm to let source know
|
||||||
* about the failure.
|
* about the failure.
|
||||||
*/
|
*/
|
||||||
@ -3222,7 +3219,7 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
|
|||||||
* one we need to preserve it in case confirm3 overwrites
|
* one we need to preserve it in case confirm3 overwrites
|
||||||
*/
|
*/
|
||||||
if (!orig_err)
|
if (!orig_err)
|
||||||
orig_err = virSaveLastError();
|
virErrorPreserveLast(&orig_err);
|
||||||
|
|
||||||
confirm:
|
confirm:
|
||||||
/*
|
/*
|
||||||
@ -3256,10 +3253,7 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (orig_err) {
|
virErrorRestore(&orig_err);
|
||||||
virSetError(orig_err);
|
|
||||||
virFreeError(orig_err);
|
|
||||||
}
|
|
||||||
VIR_FREE(dom_xml);
|
VIR_FREE(dom_xml);
|
||||||
VIR_FREE(uri_out);
|
VIR_FREE(uri_out);
|
||||||
VIR_FREE(cookiein);
|
VIR_FREE(cookiein);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user