mirror of https://gitee.com/openkylin/libvirt.git
qemu: use virDomainNetRemove instead of inline code
The code being replaced is exactly identical to the newly global function, right down to the comment.
This commit is contained in:
parent
ac9ca01cc4
commit
16520d6555
|
@ -2158,19 +2158,7 @@ qemuDomainDetachNetDevice(struct qemud_driver *driver,
|
||||||
detach->ifname));
|
detach->ifname));
|
||||||
|
|
||||||
networkReleaseActualDevice(detach);
|
networkReleaseActualDevice(detach);
|
||||||
if (vm->def->nnets > 1) {
|
virDomainNetRemove(vm->def, i);
|
||||||
memmove(vm->def->nets + i,
|
|
||||||
vm->def->nets + i + 1,
|
|
||||||
sizeof(*vm->def->nets) *
|
|
||||||
(vm->def->nnets - (i + 1)));
|
|
||||||
vm->def->nnets--;
|
|
||||||
if (VIR_REALLOC_N(vm->def->nets, vm->def->nnets) < 0) {
|
|
||||||
/* ignore, harmless */
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
VIR_FREE(vm->def->nets);
|
|
||||||
vm->def->nnets = 0;
|
|
||||||
}
|
|
||||||
virDomainNetDefFree(detach);
|
virDomainNetDefFree(detach);
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
Loading…
Reference in New Issue