mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
virCommandSetDryRun: Add flags to linebreak and strip prefix from the command buffer
virCommandToStringFull used internally when virCommandSetDryRun is requested allows to strip command path and wrap lines nicely. Expose these via virCommandSetDryRun so that tests can use those features instead of local hacks. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
0dffca8f95
commit
01c357a4c9
@ -158,6 +158,8 @@ struct _virCommand {
|
|||||||
|
|
||||||
/* See virCommandSetDryRun for description for this variable */
|
/* See virCommandSetDryRun for description for this variable */
|
||||||
static virBufferPtr dryRunBuffer;
|
static virBufferPtr dryRunBuffer;
|
||||||
|
static bool dryRunBufferArgLinebreaks;
|
||||||
|
static bool dryRunBufferCommandStripPath;
|
||||||
static virCommandDryRunCallback dryRunCallback;
|
static virCommandDryRunCallback dryRunCallback;
|
||||||
static void *dryRunOpaque;
|
static void *dryRunOpaque;
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
@ -2573,18 +2575,18 @@ virCommandRunAsync(virCommandPtr cmd, pid_t *pid)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = virCommandToString(cmd, false);
|
|
||||||
if (dryRunBuffer || dryRunCallback) {
|
if (dryRunBuffer || dryRunCallback) {
|
||||||
|
g_autofree char *cmdstr = NULL;
|
||||||
dryRunStatus = 0;
|
dryRunStatus = 0;
|
||||||
if (!str) {
|
|
||||||
/* error already reported by virCommandToString */
|
if (!(cmdstr = virCommandToStringFull(cmd, dryRunBufferArgLinebreaks,
|
||||||
|
dryRunBufferCommandStripPath)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (dryRunBuffer) {
|
if (dryRunBuffer) {
|
||||||
VIR_DEBUG("Dry run requested, appending stringified "
|
VIR_DEBUG("Dry run requested, appending stringified "
|
||||||
"command to dryRunBuffer=%p", dryRunBuffer);
|
"command to dryRunBuffer=%p", dryRunBuffer);
|
||||||
virBufferAdd(dryRunBuffer, str, -1);
|
virBufferAdd(dryRunBuffer, cmdstr, -1);
|
||||||
virBufferAddChar(dryRunBuffer, '\n');
|
virBufferAddChar(dryRunBuffer, '\n');
|
||||||
}
|
}
|
||||||
if (dryRunCallback) {
|
if (dryRunCallback) {
|
||||||
@ -2597,6 +2599,7 @@ virCommandRunAsync(virCommandPtr cmd, pid_t *pid)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
str = virCommandToString(cmd, false);
|
||||||
VIR_DEBUG("About to run %s", str ? str : cmd->args[0]);
|
VIR_DEBUG("About to run %s", str ? str : cmd->args[0]);
|
||||||
ret = virExec(cmd);
|
ret = virExec(cmd);
|
||||||
VIR_DEBUG("Command result %d, with PID %d",
|
VIR_DEBUG("Command result %d, with PID %d",
|
||||||
@ -3117,6 +3120,8 @@ void
|
|||||||
virCommandDryRunTokenFree(virCommandDryRunToken *tok)
|
virCommandDryRunTokenFree(virCommandDryRunToken *tok)
|
||||||
{
|
{
|
||||||
dryRunBuffer = NULL;
|
dryRunBuffer = NULL;
|
||||||
|
dryRunBufferArgLinebreaks = false;
|
||||||
|
dryRunBufferCommandStripPath = false;
|
||||||
dryRunCallback = NULL;
|
dryRunCallback = NULL;
|
||||||
dryRunOpaque = NULL;
|
dryRunOpaque = NULL;
|
||||||
g_free(tok);
|
g_free(tok);
|
||||||
@ -3127,6 +3132,8 @@ virCommandDryRunTokenFree(virCommandDryRunToken *tok)
|
|||||||
* virCommandSetDryRun:
|
* virCommandSetDryRun:
|
||||||
* @tok: a virCommandDryRunToken obtained from virCommandDryRunTokenNew
|
* @tok: a virCommandDryRunToken obtained from virCommandDryRunTokenNew
|
||||||
* @buf: buffer to store stringified commands
|
* @buf: buffer to store stringified commands
|
||||||
|
* @bufArgLinebreaks: add linebreaks after command and every argument or argument pair
|
||||||
|
* @bufCommandStripPath: strip leading paths of command
|
||||||
* @callback: callback to process input/output/args
|
* @callback: callback to process input/output/args
|
||||||
*
|
*
|
||||||
* Sometimes it's desired to not actually run given command, but
|
* Sometimes it's desired to not actually run given command, but
|
||||||
@ -3159,6 +3166,8 @@ virCommandDryRunTokenFree(virCommandDryRunToken *tok)
|
|||||||
void
|
void
|
||||||
virCommandSetDryRun(virCommandDryRunToken *tok,
|
virCommandSetDryRun(virCommandDryRunToken *tok,
|
||||||
virBufferPtr buf,
|
virBufferPtr buf,
|
||||||
|
bool bufArgLinebreaks,
|
||||||
|
bool bufCommandStripPath,
|
||||||
virCommandDryRunCallback cb,
|
virCommandDryRunCallback cb,
|
||||||
void *opaque)
|
void *opaque)
|
||||||
{
|
{
|
||||||
@ -3166,6 +3175,8 @@ virCommandSetDryRun(virCommandDryRunToken *tok,
|
|||||||
abort();
|
abort();
|
||||||
|
|
||||||
dryRunBuffer = buf;
|
dryRunBuffer = buf;
|
||||||
|
dryRunBufferArgLinebreaks = bufArgLinebreaks;
|
||||||
|
dryRunBufferCommandStripPath = bufCommandStripPath;
|
||||||
dryRunCallback = cb;
|
dryRunCallback = cb;
|
||||||
dryRunOpaque = opaque;
|
dryRunOpaque = opaque;
|
||||||
}
|
}
|
||||||
|
@ -43,5 +43,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCommandDryRunToken, virCommandDryRunTokenFree);
|
|||||||
|
|
||||||
void virCommandSetDryRun(virCommandDryRunToken *tok,
|
void virCommandSetDryRun(virCommandDryRunToken *tok,
|
||||||
virBufferPtr buf,
|
virBufferPtr buf,
|
||||||
|
bool bufArgLinebreaks,
|
||||||
|
bool bufCommandStripPath,
|
||||||
virCommandDryRunCallback cb,
|
virCommandDryRunCallback cb,
|
||||||
void *opaque);
|
void *opaque);
|
||||||
|
@ -98,7 +98,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|||||||
char *actual;
|
char *actual;
|
||||||
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, &buf, testCommandDryRun, NULL);
|
virCommandSetDryRun(dryRunToken, &buf, false, false, testCommandDryRun, NULL);
|
||||||
|
|
||||||
if (!(def = virNetworkDefParseFile(xml, NULL)))
|
if (!(def = virNetworkDefParseFile(xml, NULL)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -87,7 +87,7 @@ testMdevctlStartOrDefine(const char *virt_type,
|
|||||||
if (!cmd)
|
if (!cmd)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, &buf, testCommandDryRunCallback, &stdinbuf);
|
virCommandSetDryRun(dryRunToken, &buf, false, false, testCommandDryRunCallback, &stdinbuf);
|
||||||
if (virCommandRun(cmd, NULL) < 0)
|
if (virCommandRun(cmd, NULL) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ testMdevctlUuidCommand(const char *uuid, GetStopUndefineCmdFunc func, const char
|
|||||||
if (!cmd)
|
if (!cmd)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, &buf, NULL, NULL);
|
virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
|
||||||
if (virCommandRun(cmd, NULL) < 0)
|
if (virCommandRun(cmd, NULL) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ testMdevctlListDefined(const void *data G_GNUC_UNUSED)
|
|||||||
if (!cmd)
|
if (!cmd)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, &buf, NULL, NULL);
|
virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
|
||||||
if (virCommandRun(cmd, NULL) < 0)
|
if (virCommandRun(cmd, NULL) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ testNWFilterEBIPTablesAllTeardown(const void *opaque G_GNUC_UNUSED)
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, &buf, NULL, NULL);
|
virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
|
||||||
|
|
||||||
if (ebiptables_driver.allTeardown("vnet0") < 0)
|
if (ebiptables_driver.allTeardown("vnet0") < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -172,7 +172,7 @@ testNWFilterEBIPTablesTearOldRules(const void *opaque G_GNUC_UNUSED)
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, &buf, NULL, NULL);
|
virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
|
||||||
|
|
||||||
if (ebiptables_driver.tearOldRules("vnet0") < 0)
|
if (ebiptables_driver.tearOldRules("vnet0") < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -217,7 +217,7 @@ testNWFilterEBIPTablesRemoveBasicRules(const void *opaque G_GNUC_UNUSED)
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, &buf, NULL, NULL);
|
virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
|
||||||
|
|
||||||
if (ebiptables_driver.removeBasicRules("vnet0") < 0)
|
if (ebiptables_driver.removeBasicRules("vnet0") < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -247,7 +247,7 @@ testNWFilterEBIPTablesTearNewRules(const void *opaque G_GNUC_UNUSED)
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, &buf, NULL, NULL);
|
virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
|
||||||
|
|
||||||
if (ebiptables_driver.tearNewRules("vnet0") < 0)
|
if (ebiptables_driver.tearNewRules("vnet0") < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -315,7 +315,7 @@ testNWFilterEBIPTablesApplyBasicRules(const void *opaque G_GNUC_UNUSED)
|
|||||||
virMacAddr mac = { .addr = { 0x10, 0x20, 0x30, 0x40, 0x50, 0x60 } };
|
virMacAddr mac = { .addr = { 0x10, 0x20, 0x30, 0x40, 0x50, 0x60 } };
|
||||||
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, &buf, NULL, NULL);
|
virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
|
||||||
|
|
||||||
if (ebiptables_driver.applyBasicRules("vnet0", &mac) < 0)
|
if (ebiptables_driver.applyBasicRules("vnet0", &mac) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -401,7 +401,7 @@ testNWFilterEBIPTablesApplyDHCPOnlyRules(const void *opaque G_GNUC_UNUSED)
|
|||||||
};
|
};
|
||||||
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, &buf, NULL, NULL);
|
virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
|
||||||
|
|
||||||
if (ebiptables_driver.applyDHCPOnlyRules("vnet0", &mac, &val, false) < 0)
|
if (ebiptables_driver.applyDHCPOnlyRules("vnet0", &mac, &val, false) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -470,7 +470,7 @@ testNWFilterEBIPTablesApplyDropAllRules(const void *opaque G_GNUC_UNUSED)
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, &buf, NULL, NULL);
|
virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
|
||||||
|
|
||||||
if (ebiptables_driver.applyDropAllRules("vnet0") < 0)
|
if (ebiptables_driver.applyDropAllRules("vnet0") < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -375,7 +375,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|||||||
|
|
||||||
memset(&inst, 0, sizeof(inst));
|
memset(&inst, 0, sizeof(inst));
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, &buf, NULL, NULL);
|
virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
|
||||||
|
|
||||||
if (!vars)
|
if (!vars)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -102,7 +102,7 @@ testSysinfo(const void *data)
|
|||||||
cpuinfo = g_strdup_printf("%s/sysinfodata/%scpuinfo.data", abs_srcdir, testdata->name);
|
cpuinfo = g_strdup_printf("%s/sysinfodata/%scpuinfo.data", abs_srcdir, testdata->name);
|
||||||
expected = g_strdup_printf("%s/sysinfodata/%ssysinfo.expect", abs_srcdir, testdata->name);
|
expected = g_strdup_printf("%s/sysinfodata/%ssysinfo.expect", abs_srcdir, testdata->name);
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, NULL, testDMIDecodeDryRun, sysinfo);
|
virCommandSetDryRun(dryRunToken, NULL, false, false, testDMIDecodeDryRun, sysinfo);
|
||||||
|
|
||||||
virSysinfoSetup(sysinfo, cpuinfo);
|
virSysinfoSetup(sysinfo, cpuinfo);
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ testFirewallSingleGroup(const void *opaque)
|
|||||||
|
|
||||||
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
||||||
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD)
|
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD)
|
||||||
virCommandSetDryRun(dryRunToken, &cmdbuf, NULL, NULL);
|
virCommandSetDryRun(dryRunToken, &cmdbuf, false, false, NULL, NULL);
|
||||||
else
|
else
|
||||||
fwBuf = &cmdbuf;
|
fwBuf = &cmdbuf;
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ testFirewallRemoveRule(const void *opaque)
|
|||||||
|
|
||||||
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
||||||
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD)
|
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD)
|
||||||
virCommandSetDryRun(dryRunToken, &cmdbuf, NULL, NULL);
|
virCommandSetDryRun(dryRunToken, &cmdbuf, false, false, NULL, NULL);
|
||||||
else
|
else
|
||||||
fwBuf = &cmdbuf;
|
fwBuf = &cmdbuf;
|
||||||
|
|
||||||
@ -312,7 +312,7 @@ testFirewallManyGroups(const void *opaque G_GNUC_UNUSED)
|
|||||||
|
|
||||||
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
||||||
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD)
|
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD)
|
||||||
virCommandSetDryRun(dryRunToken, &cmdbuf, NULL, NULL);
|
virCommandSetDryRun(dryRunToken, &cmdbuf, false, false, NULL, NULL);
|
||||||
else
|
else
|
||||||
fwBuf = &cmdbuf;
|
fwBuf = &cmdbuf;
|
||||||
|
|
||||||
@ -400,7 +400,7 @@ testFirewallIgnoreFailGroup(const void *opaque G_GNUC_UNUSED)
|
|||||||
|
|
||||||
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
||||||
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD) {
|
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD) {
|
||||||
virCommandSetDryRun(dryRunToken, &cmdbuf, testFirewallRollbackHook, NULL);
|
virCommandSetDryRun(dryRunToken, &cmdbuf, false, false, testFirewallRollbackHook, NULL);
|
||||||
} else {
|
} else {
|
||||||
fwBuf = &cmdbuf;
|
fwBuf = &cmdbuf;
|
||||||
fwError = true;
|
fwError = true;
|
||||||
@ -469,7 +469,7 @@ testFirewallIgnoreFailRule(const void *opaque G_GNUC_UNUSED)
|
|||||||
|
|
||||||
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
||||||
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD) {
|
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD) {
|
||||||
virCommandSetDryRun(dryRunToken, &cmdbuf, testFirewallRollbackHook, NULL);
|
virCommandSetDryRun(dryRunToken, &cmdbuf, false, false, testFirewallRollbackHook, NULL);
|
||||||
} else {
|
} else {
|
||||||
fwBuf = &cmdbuf;
|
fwBuf = &cmdbuf;
|
||||||
fwError = true;
|
fwError = true;
|
||||||
@ -535,7 +535,7 @@ testFirewallNoRollback(const void *opaque G_GNUC_UNUSED)
|
|||||||
|
|
||||||
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
||||||
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD) {
|
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD) {
|
||||||
virCommandSetDryRun(dryRunToken, &cmdbuf, testFirewallRollbackHook, NULL);
|
virCommandSetDryRun(dryRunToken, &cmdbuf, false, false, testFirewallRollbackHook, NULL);
|
||||||
} else {
|
} else {
|
||||||
fwBuf = &cmdbuf;
|
fwBuf = &cmdbuf;
|
||||||
fwError = true;
|
fwError = true;
|
||||||
@ -599,7 +599,7 @@ testFirewallSingleRollback(const void *opaque G_GNUC_UNUSED)
|
|||||||
|
|
||||||
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
||||||
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD) {
|
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD) {
|
||||||
virCommandSetDryRun(dryRunToken, &cmdbuf, testFirewallRollbackHook, NULL);
|
virCommandSetDryRun(dryRunToken, &cmdbuf, false, false, testFirewallRollbackHook, NULL);
|
||||||
} else {
|
} else {
|
||||||
fwError = true;
|
fwError = true;
|
||||||
fwBuf = &cmdbuf;
|
fwBuf = &cmdbuf;
|
||||||
@ -679,7 +679,7 @@ testFirewallManyRollback(const void *opaque G_GNUC_UNUSED)
|
|||||||
|
|
||||||
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
||||||
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD) {
|
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD) {
|
||||||
virCommandSetDryRun(dryRunToken, &cmdbuf, testFirewallRollbackHook, NULL);
|
virCommandSetDryRun(dryRunToken, &cmdbuf, false, false, testFirewallRollbackHook, NULL);
|
||||||
} else {
|
} else {
|
||||||
fwBuf = &cmdbuf;
|
fwBuf = &cmdbuf;
|
||||||
fwError = true;
|
fwError = true;
|
||||||
@ -767,7 +767,7 @@ testFirewallChainedRollback(const void *opaque G_GNUC_UNUSED)
|
|||||||
|
|
||||||
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
||||||
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD) {
|
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD) {
|
||||||
virCommandSetDryRun(dryRunToken, &cmdbuf, testFirewallRollbackHook, NULL);
|
virCommandSetDryRun(dryRunToken, &cmdbuf, false, false, testFirewallRollbackHook, NULL);
|
||||||
} else {
|
} else {
|
||||||
fwBuf = &cmdbuf;
|
fwBuf = &cmdbuf;
|
||||||
fwError = true;
|
fwError = true;
|
||||||
@ -963,7 +963,7 @@ testFirewallQuery(const void *opaque G_GNUC_UNUSED)
|
|||||||
|
|
||||||
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
if (data->expectBackend == VIR_FIREWALL_BACKEND_DIRECT ||
|
||||||
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD) {
|
data->expectBackend == VIR_FIREWALL_BACKEND_FIREWALLD) {
|
||||||
virCommandSetDryRun(dryRunToken, &cmdbuf, testFirewallQueryHook, NULL);
|
virCommandSetDryRun(dryRunToken, &cmdbuf, false, false, testFirewallQueryHook, NULL);
|
||||||
} else {
|
} else {
|
||||||
fwBuf = &cmdbuf;
|
fwBuf = &cmdbuf;
|
||||||
fwError = true;
|
fwError = true;
|
||||||
|
@ -216,7 +216,7 @@ testISCSIGetSession(const void *data)
|
|||||||
|
|
||||||
cbData.output_version = info->output_version;
|
cbData.output_version = info->output_version;
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, NULL, testIscsiadmCb, &cbData);
|
virCommandSetDryRun(dryRunToken, NULL, false, false, testIscsiadmCb, &cbData);
|
||||||
|
|
||||||
actual_session = virISCSIGetSession(info->device_path, true);
|
actual_session = virISCSIGetSession(info->device_path, true);
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ testISCSIScanTargets(const void *data)
|
|||||||
size_t i;
|
size_t i;
|
||||||
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, NULL, testIscsiadmCb, NULL);
|
virCommandSetDryRun(dryRunToken, NULL, false, false, testIscsiadmCb, NULL);
|
||||||
|
|
||||||
if (virISCSIScanTargets(info->portal, NULL,
|
if (virISCSIScanTargets(info->portal, NULL,
|
||||||
false, &ntargets, &targets) < 0)
|
false, &ntargets, &targets) < 0)
|
||||||
@ -299,7 +299,7 @@ testISCSIConnectionLogin(const void *data)
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, NULL, testIscsiadmCb, &cbData);
|
virCommandSetDryRun(dryRunToken, NULL, false, false, testIscsiadmCb, &cbData);
|
||||||
|
|
||||||
if (virISCSIConnectionLogin(info->portal, info->initiatoriqn, info->target) < 0)
|
if (virISCSIConnectionLogin(info->portal, info->initiatoriqn, info->target) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -63,7 +63,7 @@ testKModLoad(const void *args G_GNUC_UNUSED)
|
|||||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, &buf, NULL, NULL);
|
virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
|
||||||
|
|
||||||
errbuf = virKModLoad(MODNAME);
|
errbuf = virKModLoad(MODNAME);
|
||||||
if (errbuf) {
|
if (errbuf) {
|
||||||
@ -90,7 +90,7 @@ testKModUnload(const void *args G_GNUC_UNUSED)
|
|||||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, &buf, NULL, NULL);
|
virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
|
||||||
|
|
||||||
errbuf = virKModUnload(MODNAME);
|
errbuf = virKModUnload(MODNAME);
|
||||||
if (errbuf) {
|
if (errbuf) {
|
||||||
|
@ -79,7 +79,7 @@ testVirNetDevBandwidthSet(const void *data)
|
|||||||
if (!iface)
|
if (!iface)
|
||||||
iface = "eth0";
|
iface = "eth0";
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, &buf, NULL, NULL);
|
virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
|
||||||
|
|
||||||
if (virNetDevBandwidthSet(iface, band, info->hierarchical_class, true) < 0)
|
if (virNetDevBandwidthSet(iface, band, info->hierarchical_class, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
Reference in New Issue
Block a user