On a %A in %Y, Jim Fehlig wrote: > Move network device cleanup code from libxlDomainCleanup to a helper > function for use in a subsequent patch. > > Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx> > --- > src/libxl/libxl_domain.c | 49 +++++++++++++++++++++++----------------- > 1 file changed, 28 insertions(+), 21 deletions(-) > > diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c > index e906495b64..f957c29d0d 100644 > --- a/src/libxl/libxl_domain.c > +++ b/src/libxl/libxl_domain.c > @@ -923,29 +950,9 @@ libxlDomainCleanup(libxlDriverPrivate *driver, > } > } > > - if ((vm->def->nnets)) { > - size_t i; > - > - for (i = 0; i < vm->def->nnets; i++) { > - virDomainNetDef *net = vm->def->nets[i]; > - > - if (net->ifname && > - STRPREFIX(net->ifname, LIBXL_GENERATED_PREFIX_XEN)) > - VIR_FREE(net->ifname); > - > - /* cleanup actual device */ > - virDomainNetRemoveHostdev(vm->def, net); > - if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) { > - if (conn || (conn = virGetConnectNetwork())) > - virDomainNetReleaseActualDevice(conn, vm->def, net); This removes the last use of 'conn' from this function: ../src/libxl/libxl_domain.c:919:27: error: unused variable 'conn' [-Werror,-Wunused-variable] g_autoptr(virConnect) conn = NULL; ^ Jano > - else > - VIR_WARN("Unable to release network device '%s'", NULLSTR(net->ifname)); > - } > - } > - } > + libxlNetworkUnwindDevices(vm->def); > > file = g_strdup_printf("%s/%s.xml", cfg->stateDir, vm->def->name); > - > if (unlink(file) < 0 && errno != ENOENT && errno != ENOTDIR) > VIR_DEBUG("Failed to remove domain XML for %s", vm->def->name); > VIR_FREE(file); >