For traversing a backing chain of VMDK descriptor files over ssh, two
things are necessary:
- qemu-nbd with the ssh block driver, rather than nbdkit-ssh-plugin,
- a remote SSH URL (for qemu-nbd) without a query string appended, as
qemu-nbd cannot update the last pathname component (for tracking the
relative pathnames of VMDK descriptor files) if a query string is
appended.
Before commit 7a6f6113a25f ("v2v: -i vmx -it ssh: Replace qemu block ssh
driver with nbdkit-ssh-plugin.", 2019-10-08), we passed the
"?host_key_check=no" query string in the URL to qemu-nbd, so we can't just
return to that, for accessing snapshotted guests with vmx+ssh.
But, we shouldn't return to qemu-nbd for vmx+ssh even without a query
string, as that would undo the other benefit(s) of commit 7a6f6113a25f.
Instead, clearly document that snapshotted guests are not supported over
vmx+ssh, and cleanly reject this situation in the code as well. Recommend
the two alternative transports that allow the user to convert such guests.
Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=1774386
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
---
input/input_vmx.ml | 23 +++++---------------
docs/virt-v2v-input-vmware.pod | 9 +++++++-
2 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/input/input_vmx.ml b/input/input_vmx.ml
index 9921419b5a85..a22ea288b4a7 100644
--- a/input/input_vmx.ml
+++ b/input/input_vmx.ml
@@ -81,23 +81,12 @@ module VMX = struct
let vmx_path = path_of_uri uri in
let abs_path = absolute_path_from_other_file vmx_path filename in
- let format = "vmdk" in
+ let flat_vmdk = PCRE.replace (PCRE.compile "\\.vmdk$")
+ "-flat.vmdk" abs_path in
- (* XXX This is a hack to work around qemu / VMDK limitation
- * "Cannot use relative extent paths with VMDK descriptor file"
- * We can remove this if the above is fixed.
- *)
- let abs_path, format =
- let flat_vmdk =
- PCRE.replace (PCRE.compile "\\.vmdk$") "-flat.vmdk"
abs_path in
- if remote_file_exists uri flat_vmdk then (flat_vmdk, "raw")
- else (abs_path, format) in
-
- (* XXX In virt-v2v 1.42+ importing from VMX over SSH
- * was broken if the -flat.vmdk file did not exist.
- * It is still broken here.
- *)
- ignore format;
+ (* RHBZ#1774386 *)
+ if not (remote_file_exists uri flat_vmdk) then
+ failwith "this transport does not support guests with
snapshots";
let server = server_of_uri uri in
let port = Option.map string_of_int (port_of_uri uri) in
@@ -110,7 +99,7 @@ module VMX = struct
let cor = dir // "convert" in
let bandwidth = options.bandwidth in
let nbdkit = Nbdkit_ssh.create_ssh ?bandwidth ~cor ~password
- ~server ?port ?user abs_path in
+ ~server ?port ?user flat_vmdk in
let _, pid = Nbdkit.run_unix socket nbdkit in
On_exit.kill pid
) filenames
diff --git a/docs/virt-v2v-input-vmware.pod b/docs/virt-v2v-input-vmware.pod
index 2c90e0afc7cd..468d1ce06224 100644
--- a/docs/virt-v2v-input-vmware.pod
+++ b/docs/virt-v2v-input-vmware.pod
@@ -51,6 +51,11 @@ to ESXi to read the F<GUEST.vmx> file and associated disks.
This
requires that you have enabled SSH access to the VMware ESXi
hypervisor - in the default ESXi configuration this is turned off.
+Note that when using this transport, a guest that has snapshots present
+on the ESXi hypervisor cannot be converted. For such guests, use
+just B<-i vmx> (above), or B<-ic vpx://...> B<-it vddk> or
+B<-ic esx://...> B<-it vddk> (below).
+
=item B<-ic vpx://...> B<-it vddk>
=item B<-ic esx://...> B<-it vddk>
@@ -106,7 +111,9 @@ a C</vmfs/volumes> folder containing the virtual machines.
If you find a folder of files called F<I<guest>.vmx>,
F<I<guest>.vmxf>, F<I<guest>.nvram> and one or more
F<.vmdk> disk
-images, then you can use this method.
+images, then you can use this method. The SSH transport is not usable
+if the guest has snapshots (files called F<I<guest>-000001.vmdk> and
+similar); refer to
L<https://bugzilla.redhat.com/1774386>.
=head2 VMX: Guest must be shut down
--
2.19.1.3.g30247aa5d201