diff --git a/virt-v2v/cmd/entrypoint.go b/virt-v2v/cmd/entrypoint.go index 58a2f1d79..ca9b34a58 100644 --- a/virt-v2v/cmd/entrypoint.go +++ b/virt-v2v/cmd/entrypoint.go @@ -134,12 +134,6 @@ func virtV2vBuildCommand() (args []string, err error) { args = append(args, "-i", "ova", os.Getenv("V2V_diskPath")) } - // When converting VM with name that do not meet DNS1123 RFC requirements, - // it should be changed to supported one to ensure the conversion does not fail. - if utils.CheckEnvVariablesSet("V2V_NewName") { - args = append(args, "-on", os.Getenv("V2V_NewName")) - } - return args, nil } @@ -158,6 +152,12 @@ func virtV2vVsphereArgs() (args []string, err error) { ) } + // When converting VM with name that do not meet DNS1123 RFC requirements, + // it should be changed to supported one to ensure the conversion does not fail. + if utils.CheckEnvVariablesSet("V2V_NewName") { + args = append(args, "-on", os.Getenv("V2V_NewName")) + } + args = append(args, "--", os.Getenv("V2V_vmName")) return args, nil }