Re: [Libguestfs] [PATCH v9] v2v: Add -o rhv-upload output mode (RHBZ#1557273).
On Tue, 10 Apr 2018 12:46:32 +0100 "Richard W.M. Jones" wrote: > This adds a new output mode to virt-v2v. virt-v2v -o rhv-upload > streams images directly to an oVirt or RHV >= 4 Data Domain using the > oVirt SDK v4. It is more efficient than -o rhv because it does not > need to go via the Export Storage Domain, and is possible for humans > to use unlike -o vdsm. > > The implementation uses the Python SDK (‘ovirtsdk4’ module). An > nbdkit Python 3 plugin translates NBD calls from qemu into HTTPS > requests to oVirt via the SDK. > --- > .gitignore| 3 + > TODO | 27 ++ > v2v/Makefile.am | 30 +- > v2v/cmdline.ml| 41 +++ > v2v/embed.sh | 48 > v2v/output_rhv_upload.ml | 401 +++ > v2v/output_rhv_upload.mli | 33 +++ > v2v/output_rhv_upload_createvm_source.mli | 19 ++ > v2v/output_rhv_upload_plugin_source.mli | 19 ++ > v2v/output_rhv_upload_precheck_source.mli | 19 ++ > v2v/rhv-upload-createvm.py| 86 ++ > v2v/rhv-upload-plugin.py | 445 > ++ > v2v/rhv-upload-precheck.py| 73 + > v2v/test-v2v-o-rhv-upload-oo-query.sh | 38 +++ > v2v/test-v2v-python-syntax.sh | 45 +++ > v2v/virt-v2v.pod | 138 +++-- > 16 files changed, 1447 insertions(+), 18 deletions(-) LGTM ___ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs
[Libguestfs] [PATCH] v2v: Give better diagnostics if filesystem falls back to read-only (RHBZ#1567763).
Some filesystems fall back silently to read-only if there are problems such a dirty filesystem and an unrecoverable journal. Almost all conversions involve writing to the root filesystem, so these will inevitably fail later on with a strange error message. Test the root filesystem is writable by creating and deleting a temporary file, and if the creation fails then give better diagnostics. Reported-by: Piotr Kliczewski --- generator/OCaml.ml| 1 + v2v/inspect_source.ml | 37 +++-- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/generator/OCaml.ml b/generator/OCaml.ml index e58f387cc..467a1f0d8 100644 --- a/generator/OCaml.ml +++ b/generator/OCaml.ml @@ -40,6 +40,7 @@ let ocaml_errnos = [ "EPERM"; "ESRCH"; "ENOENT"; + "EROFS"; ] (* Generate the OCaml bindings interface. *) diff --git a/v2v/inspect_source.ml b/v2v/inspect_source.ml index bd382cb11..c1a7e5737 100644 --- a/v2v/inspect_source.ml +++ b/v2v/inspect_source.ml @@ -41,16 +41,33 @@ let rec inspect_source root_choice g = let mps = List.sort cmp mps in List.iter ( fun (mp, dev) -> - try g#mount dev mp - with G.Error msg -> -if mp = "/" then ( (* RHBZ#1145995 *) - if String.find msg "Windows" >= 0 && String.find msg "NTFS partition is in an unsafe state" >= 0 then -error (f_"unable to mount the disk image for writing. This has probably happened because Windows Hibernation or Fast Restart is being used in this guest. You have to disable this (in the guest) in order to use virt-v2v.\n\nOriginal error message: %s") msg - else -error "%s" msg -) -else - warning (f_"%s (ignored)") msg + (try g#mount dev mp + with G.Error msg -> + if mp = "/" then ( (* RHBZ#1145995 *) + if String.find msg "Windows" >= 0 && String.find msg "NTFS partition is in an unsafe state" >= 0 then + error (f_"unable to mount the disk image for writing. This has probably happened because Windows Hibernation or Fast Restart is being used in this guest. You have to disable this (in the guest) in order to use virt-v2v.\n\nOriginal error message: %s") msg + else + error "%s" msg + ) + else + warning (f_"%s (ignored)") msg + ); + + (* Some filesystems (hello, ntfs-3g) can silently fall back to + * a read-only mount. Check the root filesystem is really writable. + * RHBZ#1567763 + *) + if mp = "/" then ( +let file = sprintf "/%s" (String.random8 ()) in +(try g#touch file + with G.Error msg -> + if g#last_errno () = G.Errno.errno_EROFS then + error (f_"filesystem was mounted read-only, even though we asked for it to be mounted read-write. This usually means that the filesystem was not cleanly unmounted. Possible causes include trying to convert a guest which is running, or using Windows Hibernation or Fast Restart.\n\nOriginal error message: %s") msg + else + error (f_"could not write to the guest filesystem: %s") msg +); +g#rm file + ) ) mps; (* Get list of applications/packages installed. *) -- 2.16.2 ___ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs
Re: [Libguestfs] [PATCH v2 2/2] resize: expand f2fs partitions
ACK series. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html ___ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs
Re: [Libguestfs] [PATCH] v2v: Give better diagnostics if filesystem falls back to read-only (RHBZ#1567763).
On Monday, 16 April 2018 11:48:08 CEST Richard W.M. Jones wrote: > Some filesystems fall back silently to read-only if there are problems > such a dirty filesystem and an unrecoverable journal. Almost all > conversions involve writing to the root filesystem, so these will > inevitably fail later on with a strange error message. > > Test the root filesystem is writable by creating and deleting a > temporary file, and if the creation fails then give better > diagnostics. Another possibility here could be to use the "norecover" mount option. -- Pino Toscano signature.asc Description: This is a digitally signed message part. ___ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs
Re: [Libguestfs] [PATCH] v2v: Give better diagnostics if filesystem falls back to read-only (RHBZ#1567763).
On Mon, Apr 16, 2018 at 12:28:58PM +0200, Pino Toscano wrote: > On Monday, 16 April 2018 11:48:08 CEST Richard W.M. Jones wrote: > > Some filesystems fall back silently to read-only if there are problems > > such a dirty filesystem and an unrecoverable journal. Almost all > > conversions involve writing to the root filesystem, so these will > > inevitably fail later on with a strange error message. > > > > Test the root filesystem is writable by creating and deleting a > > temporary file, and if the creation fails then give better > > diagnostics. > > Another possibility here could be to use the "norecover" mount option. Unfortunately I don't have an actual test case covering this bug. But one problem with the norecover option seems to be that it's only understood by ntfs-3g and other filesystems give an error: $ guestfish -N fs -m /dev/sda1:/:norecover libguestfs: error: mount_options: mount exited with status 32: mount: /sysroot: wrong fs type, bad option, bad superblock on /dev/sda1, missing codepage or helper program, or other error. guestfish: ‘/dev/sda1’ could not be mounted. guestfish: Check mount(8) man page to ensure options ‘norecover’ guestfish: are supported by the filesystem that is being mounted. guestfish: Did you mean to mount one of these filesystems? guestfish: /dev/sda1 (ext2) So that would entail some more complex logic to determine if the filesystem is ntfs or not. It's a tricky call. You could equally argue that the ‘norecover’ option is important for data integrity, or that what we currently do (‘recover’, the default) allows us to convert guests with less fuss. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v ___ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs
Re: [Libguestfs] Windows v2v
So assuming the answer to the previous question was _yes_ ... Then there are various ways to force a full shutdown either one-off or permanently. Can you work out what works and submit a documentation patch to improve things for Windows >= 8? (1) Try this command: shutdown /s /t 0 Because the /hybrid option is not present it should force a full shutdown. (2) From the GUI use [Shift] + shutdown option: (https://blogs.technet.microsoft.com/askperf/2012/10/25/windows-8-windows-server-2012-faster-boot-process/) For permanently disabling hibernation: (3) Use: powercfg /hibernate off (4) Use: reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled /t REG_DWORD /d "0" /f (3) & (4) might be equivalent, I'm not very clear and don't have a convenient way to test right now. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/ ___ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs
Re: [Libguestfs] Windows v2v
On Mon, Apr 16, 2018 at 2:57 PM, Richard W.M. Jones wrote: > So assuming the answer to the previous question was _yes_ ... > > Then there are various ways to force a full shutdown either one-off or > permanently. Can you work out what works and submit a documentation > patch to improve things for Windows >= 8? > > (1) Try this command: shutdown /s /t 0 > > Because the /hybrid option is not present it should force a full shutdown. > > (2) From the GUI use [Shift] + shutdown option: > > (https://blogs.technet.microsoft.com/askperf/2012/10/ > 25/windows-8-windows-server-2012-faster-boot-process/) > > For permanently disabling hibernation: > > (3) Use: powercfg /hibernate off > > (4) Use: reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session > Manager\Power" /v HiberbootEnabled /t REG_DWORD /d "0" /f > > (3) & (4) might be equivalent, I'm not very clear and don't have a > convenient way to test right now. > Verified with (3) and it seems to work. Still the message is not indicating what is the issue when hibernate is enabled so thank you for opening BZ. > > Rich. > > -- > Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~ > rjones > Read my programming and virtualization blog: http://rwmj.wordpress.com > virt-df lists disk usage of guests without needing to install any > software inside the virtual machine. Supports Linux and Windows. > http://people.redhat.com/~rjones/virt-df/ > ___ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs