mirror of
https://github.com/kubevirt/containerized-data-importer.git
synced 2025-06-03 06:30:22 +00:00
Separate nbdkit plugin arguments. (#1701)
VDDK imports do not work with all the plugin-specific parameters specified in one command line argument, so split them into their own. Also validate the expected number of parameters from the VDDK test plugin, so similar errors will get caught in functional tests. Signed-off-by: Matthew Arnold <marnold@redhat.com>
This commit is contained in:
parent
4c14368c26
commit
24d6fd6d3c
@ -188,8 +188,20 @@ func (n *Nbdkit) StartNbdkit(source string) error {
|
||||
argsNbdkit = append(argsNbdkit, a)
|
||||
}
|
||||
// append nbdkit plugin arguments
|
||||
argsNbdkit = append(argsNbdkit, string(n.plugin), strings.Join(n.pluginArgs, " "), n.getSourceArg(source))
|
||||
klog.V(3).Infof("Start nbdkit with: %v", argsNbdkit)
|
||||
argsNbdkit = append(argsNbdkit, string(n.plugin))
|
||||
argsNbdkit = append(argsNbdkit, n.pluginArgs...)
|
||||
argsNbdkit = append(argsNbdkit, n.getSourceArg(source))
|
||||
|
||||
quotedArgs := make([]string, len(argsNbdkit))
|
||||
for index, value := range argsNbdkit {
|
||||
if strings.HasPrefix(value, "password=") {
|
||||
quotedArgs[index] = "'password=*****'"
|
||||
} else {
|
||||
quotedArgs[index] = "'" + value + "'"
|
||||
}
|
||||
}
|
||||
klog.V(3).Infof("Start nbdkit with: %v", quotedArgs)
|
||||
|
||||
n.c = exec.Command("nbdkit", argsNbdkit...)
|
||||
var stdout io.ReadCloser
|
||||
stdout, err = n.c.StdoutPipe()
|
||||
|
@ -20,16 +20,25 @@
|
||||
|
||||
#define THREAD_MODEL NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS
|
||||
|
||||
#define EXPECTED_ARG_COUNT 7
|
||||
int arg_count = 0;
|
||||
|
||||
void fakevddk_close(void *handle) {
|
||||
close(*((int *) handle));
|
||||
}
|
||||
|
||||
int fakevddk_config(const char *key, const char *value) {
|
||||
arg_count++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fakevddk_config_complete(void) {
|
||||
return 0;
|
||||
if (arg_count == EXPECTED_ARG_COUNT) {
|
||||
return 0;
|
||||
} else {
|
||||
nbdkit_error("Expected %d arguments to fake VDDK test plugin, but got %d!\n", EXPECTED_ARG_COUNT, arg_count);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
void *fakevddk_open(int readonly) {
|
||||
|
Loading…
Reference in New Issue
Block a user