mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 05:25:18 +00:00
Rename qemuBuildCommandLine tapfds -> vmfds.
There doesn't seem to be anything specific to tap devices for this array of file descriptors which need to stay open of the guest to use. Rename then for others to make use of. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Chris Lalancette <clalance@redhat.com>
This commit is contained in:
parent
97d5c95d8e
commit
7e1249f259
@ -3422,8 +3422,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
||||
unsigned long long qemuCmdFlags,
|
||||
const char ***retargv,
|
||||
const char ***retenv,
|
||||
int **tapfds,
|
||||
int *ntapfds,
|
||||
int **vmfds,
|
||||
int *nvmfds,
|
||||
const char *migrateFrom,
|
||||
virDomainSnapshotObjPtr current_snapshot)
|
||||
{
|
||||
@ -4116,7 +4116,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
||||
if (tapfd < 0)
|
||||
goto error;
|
||||
|
||||
if (VIR_REALLOC_N(*tapfds, (*ntapfds)+1) < 0) {
|
||||
if (VIR_REALLOC_N(*vmfds, (*nvmfds)+1) < 0) {
|
||||
virNWFilterTearNWFilter(net);
|
||||
close(tapfd);
|
||||
goto no_memory;
|
||||
@ -4124,7 +4124,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
||||
|
||||
last_good_net = i;
|
||||
|
||||
(*tapfds)[(*ntapfds)++] = tapfd;
|
||||
(*vmfds)[(*nvmfds)++] = tapfd;
|
||||
|
||||
if (snprintf(tapfd_name, sizeof(tapfd_name), "%d", tapfd) >= sizeof(tapfd_name))
|
||||
goto no_memory;
|
||||
@ -4136,7 +4136,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
||||
if (tapfd < 0)
|
||||
goto error;
|
||||
|
||||
if (VIR_REALLOC_N(*tapfds, (*ntapfds)+1) < 0) {
|
||||
if (VIR_REALLOC_N(*vmfds, (*nvmfds)+1) < 0) {
|
||||
virNWFilterTearNWFilter(net);
|
||||
close(tapfd);
|
||||
goto no_memory;
|
||||
@ -4144,7 +4144,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
||||
|
||||
last_good_net = i;
|
||||
|
||||
(*tapfds)[(*ntapfds)++] = tapfd;
|
||||
(*vmfds)[(*nvmfds)++] = tapfd;
|
||||
|
||||
if (snprintf(tapfd_name, sizeof(tapfd_name), "%d", tapfd) >= sizeof(tapfd_name))
|
||||
goto no_memory;
|
||||
@ -4157,12 +4157,12 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
||||
network device */
|
||||
int vhostfd = qemudOpenVhostNet(net, qemuCmdFlags);
|
||||
if (vhostfd >= 0) {
|
||||
if (VIR_REALLOC_N(*tapfds, (*ntapfds)+1) < 0) {
|
||||
if (VIR_REALLOC_N(*vmfds, (*nvmfds)+1) < 0) {
|
||||
close(vhostfd);
|
||||
goto no_memory;
|
||||
}
|
||||
|
||||
(*tapfds)[(*ntapfds)++] = vhostfd;
|
||||
(*vmfds)[(*nvmfds)++] = vhostfd;
|
||||
if (snprintf(vhostfd_name, sizeof(vhostfd_name), "%d", vhostfd)
|
||||
>= sizeof(vhostfd_name))
|
||||
goto no_memory;
|
||||
@ -4653,12 +4653,12 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
||||
error:
|
||||
for (i = 0; i <= last_good_net; i++)
|
||||
virNWFilterTearNWFilter(def->nets[i]);
|
||||
if (tapfds &&
|
||||
*tapfds) {
|
||||
for (i = 0; i < *ntapfds; i++)
|
||||
close((*tapfds)[i]);
|
||||
VIR_FREE(*tapfds);
|
||||
*ntapfds = 0;
|
||||
if (vmfds &&
|
||||
*vmfds) {
|
||||
for (i = 0; i < *nvmfds; i++)
|
||||
close((*vmfds)[i]);
|
||||
VIR_FREE(*vmfds);
|
||||
*nvmfds = 0;
|
||||
}
|
||||
if (qargv) {
|
||||
for (i = 0 ; i < qargc ; i++)
|
||||
|
@ -198,8 +198,8 @@ int qemudBuildCommandLine (virConnectPtr conn,
|
||||
unsigned long long qemuCmdFlags,
|
||||
const char ***retargv,
|
||||
const char ***retenv,
|
||||
int **tapfds,
|
||||
int *ntapfds,
|
||||
int **vmfds,
|
||||
int *nvmfds,
|
||||
const char *migrateFrom,
|
||||
virDomainSnapshotObjPtr current_snapshot)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
@ -3253,8 +3253,8 @@ static int qemudStartVMDaemon(virConnectPtr conn,
|
||||
const char **progenv = NULL;
|
||||
int i, ret;
|
||||
struct stat sb;
|
||||
int *tapfds = NULL;
|
||||
int ntapfds = 0;
|
||||
int *vmfds = NULL;
|
||||
int nvmfds = 0;
|
||||
unsigned long long qemuCmdFlags;
|
||||
fd_set keepfd;
|
||||
const char *emulator;
|
||||
@ -3411,7 +3411,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
|
||||
vm->def->id = driver->nextvmid++;
|
||||
if (qemudBuildCommandLine(conn, driver, vm->def, priv->monConfig,
|
||||
priv->monJSON, qemuCmdFlags, &argv, &progenv,
|
||||
&tapfds, &ntapfds, migrateFrom,
|
||||
&vmfds, &nvmfds, migrateFrom,
|
||||
vm->current_snapshot) < 0)
|
||||
goto cleanup;
|
||||
|
||||
@ -3462,8 +3462,8 @@ static int qemudStartVMDaemon(virConnectPtr conn,
|
||||
VIR_WARN("Unable to seek to end of logfile: %s",
|
||||
virStrerror(errno, ebuf, sizeof ebuf));
|
||||
|
||||
for (i = 0 ; i < ntapfds ; i++)
|
||||
FD_SET(tapfds[i], &keepfd);
|
||||
for (i = 0 ; i < nvmfds ; i++)
|
||||
FD_SET(vmfds[i], &keepfd);
|
||||
|
||||
ret = virExecDaemonize(argv, progenv, &keepfd, &child,
|
||||
stdin_fd, &logfile, &logfile,
|
||||
@ -3504,11 +3504,11 @@ static int qemudStartVMDaemon(virConnectPtr conn,
|
||||
if (ret == -1) /* The VM failed to start; tear filters before taps */
|
||||
virNWFilterTearVMNWFilters(vm);
|
||||
|
||||
if (tapfds) {
|
||||
for (i = 0 ; i < ntapfds ; i++) {
|
||||
close(tapfds[i]);
|
||||
if (vmfds) {
|
||||
for (i = 0 ; i < nvmfds ; i++) {
|
||||
close(vmfds[i]);
|
||||
}
|
||||
VIR_FREE(tapfds);
|
||||
VIR_FREE(vmfds);
|
||||
}
|
||||
|
||||
if (ret == -1) /* The VM failed to start */
|
||||
|
Loading…
x
Reference in New Issue
Block a user