[Pkg-libvirt-commits] [libguestfs] 04/59: p2v: Ensure we are using virt-v2v >= 1.28.
Hilko Bengen
bengen at moszumanska.debian.org
Wed Nov 26 22:04:02 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch master
in repository libguestfs.
commit bbc68150a368ff465aed3187b3190e5c5272874a
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Tue Oct 28 08:51:06 2014 +0000
p2v: Ensure we are using virt-v2v >= 1.28.
Must NOT use:
- One of the interim versions of virt-v2v (1.27.x) that we published
during development.
- Old virt-v2v (0.9.x).
Also use the --version option (instead of -V) since old virt-v2v
required it:
$ virt-v2v -V
Option v is ambiguous (version, vmtype)
Usage:
[...]
$ virt-v2v --version
0.9.1
(cherry picked from commit cb291d7e4642547da5551f8686bbc46a911377af)
---
p2v/ssh.c | 40 ++++++++++++++++++++++++++++++++++------
1 file changed, 34 insertions(+), 6 deletions(-)
diff --git a/p2v/ssh.c b/p2v/ssh.c
index 1c0f8b7..ae45ba1 100644
--- a/p2v/ssh.c
+++ b/p2v/ssh.c
@@ -345,8 +345,12 @@ test_connection (struct config *config)
if (h == NULL)
return -1;
- /* Send 'virt-v2v -V' command and hope we get back a version string. */
- if (mexp_printf (h, "%svirt-v2v -V\n", config->sudo ? "sudo " : "") == -1) {
+ /* Send 'virt-v2v --version' command and hope we get back a version string.
+ * Note old virt-v2v did not understand -V option.
+ */
+ if (mexp_printf (h,
+ "%svirt-v2v --version\n",
+ config->sudo ? "sudo " : "") == -1) {
set_ssh_error ("mexp_printf: %m");
mexp_close (h);
return -1;
@@ -370,9 +374,12 @@ test_connection (struct config *config)
fprintf (stderr, "%s: remote virt-v2v version: %d.%d.%d\n",
program_name, v2v_major, v2v_minor, v2v_release);
#endif
- if (v2v_major < 1 || v2v_major > 1) {
+ /* This is an internal error. Need to check this here so we
+ * don't confuse it with the no-version case below.
+ */
+ if (v2v_major < 1) {
mexp_close (h);
- set_ssh_error ("invalid version major (%d)", v2v_major);
+ set_ssh_error ("could not parse version string");
return -1;
}
break;
@@ -382,12 +389,12 @@ test_connection (struct config *config)
case MEXP_EOF:
mexp_close (h);
- set_ssh_error ("unexpected end of file waiting virt-v2v -V output");
+ set_ssh_error ("unexpected end of file waiting virt-v2v --version output");
return -1;
case MEXP_TIMEOUT:
mexp_close (h);
- set_ssh_error ("timeout waiting for virt-v2v -V output");
+ set_ssh_error ("timeout waiting for virt-v2v --version output");
return -1;
case MEXP_ERROR:
@@ -411,6 +418,27 @@ test_connection (struct config *config)
return -1;
}
+ /* The major version must always be 1. */
+ if (v2v_major != 1) {
+ mexp_close (h);
+ set_ssh_error ("virt-v2v major version is not 1 (major = %d), "
+ "this version of virt-p2v is not compatible", v2v_major);
+ return -1;
+ }
+
+ /* The version of virt-v2v must be >= 1.28, just to make sure
+ * someone isn't (a) using one of the experimental 1.27 releases
+ * that we published during development, nor (b) using old virt-v2v.
+ * We should remain compatible with any virt-v2v after 1.28.
+ */
+ if (v2v_minor < 28) {
+ mexp_close (h);
+ set_ssh_error ("virt-v2v version is < 1.28 (major = %d, minor = %d), "
+ "you must upgrade to virt-v2v >= 1.28 on "
+ "the conversion server", v2v_major, v2v_minor);
+ return -1;
+ }
+
/* Get virt-v2v features. See: v2v/cmdline.ml */
if (mexp_printf (h, "%svirt-v2v --machine-readable\n",
config->sudo ? "sudo " : "") == -1) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list