mirror of https://gitee.com/openkylin/libvirt.git
qemuBuildCommandLine: Don't overwrite errors with NWFilter's one
Currently, if there has been an error in building command line process after virtual interfaces has been created, the flow jumps to 'error' label, where virDomainConfNWFilterTeardown() is called. This may report an error as well, but should not overwrite the original cause why we jumped to 'error' label.
This commit is contained in:
parent
278a833922
commit
19c345f2fe
|
@ -5903,6 +5903,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||||
virDomainSnapshotObjPtr snapshot,
|
virDomainSnapshotObjPtr snapshot,
|
||||||
enum virNetDevVPortProfileOp vmop)
|
enum virNetDevVPortProfileOp vmop)
|
||||||
{
|
{
|
||||||
|
virErrorPtr originalError = NULL;
|
||||||
int i, j;
|
int i, j;
|
||||||
const char *emulator;
|
const char *emulator;
|
||||||
char uuid[VIR_UUID_STRING_BUFLEN];
|
char uuid[VIR_UUID_STRING_BUFLEN];
|
||||||
|
@ -7833,13 +7834,16 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||||
virObjectUnref(cfg);
|
virObjectUnref(cfg);
|
||||||
return cmd;
|
return cmd;
|
||||||
|
|
||||||
no_memory:
|
no_memory:
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
error:
|
error:
|
||||||
virObjectUnref(cfg);
|
virObjectUnref(cfg);
|
||||||
/* free up any resources in the network driver */
|
/* free up any resources in the network driver
|
||||||
|
* but don't overwrite the original error */
|
||||||
|
originalError = virSaveLastError();
|
||||||
for (i = 0; i <= last_good_net; i++)
|
for (i = 0; i <= last_good_net; i++)
|
||||||
virDomainConfNWFilterTeardown(def->nets[i]);
|
virDomainConfNWFilterTeardown(def->nets[i]);
|
||||||
|
virSetError(originalError);
|
||||||
virCommandFree(cmd);
|
virCommandFree(cmd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue