mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 13:35:17 +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,
|
unsigned long long qemuCmdFlags,
|
||||||
const char ***retargv,
|
const char ***retargv,
|
||||||
const char ***retenv,
|
const char ***retenv,
|
||||||
int **tapfds,
|
int **vmfds,
|
||||||
int *ntapfds,
|
int *nvmfds,
|
||||||
const char *migrateFrom,
|
const char *migrateFrom,
|
||||||
virDomainSnapshotObjPtr current_snapshot)
|
virDomainSnapshotObjPtr current_snapshot)
|
||||||
{
|
{
|
||||||
@ -4116,7 +4116,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
|||||||
if (tapfd < 0)
|
if (tapfd < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (VIR_REALLOC_N(*tapfds, (*ntapfds)+1) < 0) {
|
if (VIR_REALLOC_N(*vmfds, (*nvmfds)+1) < 0) {
|
||||||
virNWFilterTearNWFilter(net);
|
virNWFilterTearNWFilter(net);
|
||||||
close(tapfd);
|
close(tapfd);
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
@ -4124,7 +4124,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
|||||||
|
|
||||||
last_good_net = i;
|
last_good_net = i;
|
||||||
|
|
||||||
(*tapfds)[(*ntapfds)++] = tapfd;
|
(*vmfds)[(*nvmfds)++] = tapfd;
|
||||||
|
|
||||||
if (snprintf(tapfd_name, sizeof(tapfd_name), "%d", tapfd) >= sizeof(tapfd_name))
|
if (snprintf(tapfd_name, sizeof(tapfd_name), "%d", tapfd) >= sizeof(tapfd_name))
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
@ -4136,7 +4136,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
|||||||
if (tapfd < 0)
|
if (tapfd < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (VIR_REALLOC_N(*tapfds, (*ntapfds)+1) < 0) {
|
if (VIR_REALLOC_N(*vmfds, (*nvmfds)+1) < 0) {
|
||||||
virNWFilterTearNWFilter(net);
|
virNWFilterTearNWFilter(net);
|
||||||
close(tapfd);
|
close(tapfd);
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
@ -4144,7 +4144,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
|||||||
|
|
||||||
last_good_net = i;
|
last_good_net = i;
|
||||||
|
|
||||||
(*tapfds)[(*ntapfds)++] = tapfd;
|
(*vmfds)[(*nvmfds)++] = tapfd;
|
||||||
|
|
||||||
if (snprintf(tapfd_name, sizeof(tapfd_name), "%d", tapfd) >= sizeof(tapfd_name))
|
if (snprintf(tapfd_name, sizeof(tapfd_name), "%d", tapfd) >= sizeof(tapfd_name))
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
@ -4157,12 +4157,12 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
|||||||
network device */
|
network device */
|
||||||
int vhostfd = qemudOpenVhostNet(net, qemuCmdFlags);
|
int vhostfd = qemudOpenVhostNet(net, qemuCmdFlags);
|
||||||
if (vhostfd >= 0) {
|
if (vhostfd >= 0) {
|
||||||
if (VIR_REALLOC_N(*tapfds, (*ntapfds)+1) < 0) {
|
if (VIR_REALLOC_N(*vmfds, (*nvmfds)+1) < 0) {
|
||||||
close(vhostfd);
|
close(vhostfd);
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*tapfds)[(*ntapfds)++] = vhostfd;
|
(*vmfds)[(*nvmfds)++] = vhostfd;
|
||||||
if (snprintf(vhostfd_name, sizeof(vhostfd_name), "%d", vhostfd)
|
if (snprintf(vhostfd_name, sizeof(vhostfd_name), "%d", vhostfd)
|
||||||
>= sizeof(vhostfd_name))
|
>= sizeof(vhostfd_name))
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
@ -4653,12 +4653,12 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
|||||||
error:
|
error:
|
||||||
for (i = 0; i <= last_good_net; i++)
|
for (i = 0; i <= last_good_net; i++)
|
||||||
virNWFilterTearNWFilter(def->nets[i]);
|
virNWFilterTearNWFilter(def->nets[i]);
|
||||||
if (tapfds &&
|
if (vmfds &&
|
||||||
*tapfds) {
|
*vmfds) {
|
||||||
for (i = 0; i < *ntapfds; i++)
|
for (i = 0; i < *nvmfds; i++)
|
||||||
close((*tapfds)[i]);
|
close((*vmfds)[i]);
|
||||||
VIR_FREE(*tapfds);
|
VIR_FREE(*vmfds);
|
||||||
*ntapfds = 0;
|
*nvmfds = 0;
|
||||||
}
|
}
|
||||||
if (qargv) {
|
if (qargv) {
|
||||||
for (i = 0 ; i < qargc ; i++)
|
for (i = 0 ; i < qargc ; i++)
|
||||||
|
@ -198,8 +198,8 @@ int qemudBuildCommandLine (virConnectPtr conn,
|
|||||||
unsigned long long qemuCmdFlags,
|
unsigned long long qemuCmdFlags,
|
||||||
const char ***retargv,
|
const char ***retargv,
|
||||||
const char ***retenv,
|
const char ***retenv,
|
||||||
int **tapfds,
|
int **vmfds,
|
||||||
int *ntapfds,
|
int *nvmfds,
|
||||||
const char *migrateFrom,
|
const char *migrateFrom,
|
||||||
virDomainSnapshotObjPtr current_snapshot)
|
virDomainSnapshotObjPtr current_snapshot)
|
||||||
ATTRIBUTE_NONNULL(1);
|
ATTRIBUTE_NONNULL(1);
|
||||||
|
@ -3253,8 +3253,8 @@ static int qemudStartVMDaemon(virConnectPtr conn,
|
|||||||
const char **progenv = NULL;
|
const char **progenv = NULL;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
int *tapfds = NULL;
|
int *vmfds = NULL;
|
||||||
int ntapfds = 0;
|
int nvmfds = 0;
|
||||||
unsigned long long qemuCmdFlags;
|
unsigned long long qemuCmdFlags;
|
||||||
fd_set keepfd;
|
fd_set keepfd;
|
||||||
const char *emulator;
|
const char *emulator;
|
||||||
@ -3411,7 +3411,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
|
|||||||
vm->def->id = driver->nextvmid++;
|
vm->def->id = driver->nextvmid++;
|
||||||
if (qemudBuildCommandLine(conn, driver, vm->def, priv->monConfig,
|
if (qemudBuildCommandLine(conn, driver, vm->def, priv->monConfig,
|
||||||
priv->monJSON, qemuCmdFlags, &argv, &progenv,
|
priv->monJSON, qemuCmdFlags, &argv, &progenv,
|
||||||
&tapfds, &ntapfds, migrateFrom,
|
&vmfds, &nvmfds, migrateFrom,
|
||||||
vm->current_snapshot) < 0)
|
vm->current_snapshot) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -3462,8 +3462,8 @@ static int qemudStartVMDaemon(virConnectPtr conn,
|
|||||||
VIR_WARN("Unable to seek to end of logfile: %s",
|
VIR_WARN("Unable to seek to end of logfile: %s",
|
||||||
virStrerror(errno, ebuf, sizeof ebuf));
|
virStrerror(errno, ebuf, sizeof ebuf));
|
||||||
|
|
||||||
for (i = 0 ; i < ntapfds ; i++)
|
for (i = 0 ; i < nvmfds ; i++)
|
||||||
FD_SET(tapfds[i], &keepfd);
|
FD_SET(vmfds[i], &keepfd);
|
||||||
|
|
||||||
ret = virExecDaemonize(argv, progenv, &keepfd, &child,
|
ret = virExecDaemonize(argv, progenv, &keepfd, &child,
|
||||||
stdin_fd, &logfile, &logfile,
|
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 */
|
if (ret == -1) /* The VM failed to start; tear filters before taps */
|
||||||
virNWFilterTearVMNWFilters(vm);
|
virNWFilterTearVMNWFilters(vm);
|
||||||
|
|
||||||
if (tapfds) {
|
if (vmfds) {
|
||||||
for (i = 0 ; i < ntapfds ; i++) {
|
for (i = 0 ; i < nvmfds ; i++) {
|
||||||
close(tapfds[i]);
|
close(vmfds[i]);
|
||||||
}
|
}
|
||||||
VIR_FREE(tapfds);
|
VIR_FREE(vmfds);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == -1) /* The VM failed to start */
|
if (ret == -1) /* The VM failed to start */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user