The new ‘-o rhv-upload’ output mode contains a '-' character in the
name, but the regular expression which matched the output of the
virt-v2v command did not recognize '-' as a valid character. It ended
up mapping this to just "rhv" meaning two "rhv" entries would appear
in the list of output drivers.
Thanks: Ming Xie.
---
p2v/ssh.c | 7 +++++--
v2v/modules_list.ml | 11 +++++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/p2v/ssh.c b/p2v/ssh.c
index d2699fffd..15f53b692 100644
--- a/p2v/ssh.c
+++ b/p2v/ssh.c
@@ -181,8 +181,11 @@ compile_regexps (void)
0);
COMPILE (feature_libguestfs_rewrite_re, "libguestfs-rewrite", 0);
COMPILE (feature_colours_option_re, "colours-option", 0);
- COMPILE (feature_input_re, "input:((?:\\w)*)", 0);
- COMPILE (feature_output_re, "output:((?:\\w)*)", 0);
+ /* The input and output regexps must match the same pattern in
+ * v2v/modules_list.ml.
+ */
+ COMPILE (feature_input_re, "input:((?:[-\\w])+)", 0);
+ COMPILE (feature_output_re, "output:((?:[-\\w])+)", 0);
COMPILE (portfwd_re, "Allocated port ((?:\\d)+) for remote forward", 0);
}
diff --git a/v2v/modules_list.ml b/v2v/modules_list.ml
index 91b029b07..b7accc4f9 100644
--- a/v2v/modules_list.ml
+++ b/v2v/modules_list.ml
@@ -21,8 +21,15 @@ open Std_utils
let input_modules = ref []
and output_modules = ref []
-let register_input_module name = List.push_front name input_modules
-and register_output_module name = List.push_front name output_modules
+(* Must match the regular expressions in p2v/ssh.c *)
+let module_name_re = PCRE.compile ~anchored:true "[-\\w]+"
+
+let register_input_module name =
+ assert (PCRE.matches module_name_re name);
+ List.push_front name input_modules
+and register_output_module name =
+ assert (PCRE.matches module_name_re name);
+ List.push_front name output_modules
let input_modules () = List.sort compare !input_modules
and output_modules () = List.sort compare !output_modules
--
2.16.2