Bind mounts
by Richard W.M. Jones
The test program below demonstrates how to use bind mounts to mount a
subdirectory over the root directory. It is using the debug backdoor,
but I guess we could consider adding a bind-mount API instead.
[Note that guestfs_mount_options doesn't work because it expects the
third argument to be a device, not a directory name.]
Rich.
----------------------------------------------------------------------
guestfish -N fs -m /dev/sda1 <<EOF
mkdir /root
touch /root/test
# Use -o rbind if there are submounts.
debug sh "mount -o bind /sysroot/root /sysroot"
ls /
# The above command prints "test" as expected.
# Check that umount-all still works.
umount-all
debug sh "grep /sysroot /proc/mounts ||:"
EOF
--
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/
10 years, 2 months
missing symbol
by Hilko Bengen
Hi,
when pushing libguestfs 1.27.53 (1:1.27.53-1) through my build setup
befor uploading it to Debian, I noticed that
"guestfs_internal_lstatlist@Base", a symbol that has been there since
1.20, is now missing. This causes dpkg-gensymbols(1) whose job it is to
compare the symbols from the newly-built libraries to the known state
to fail.
If the guestfs_internal_* functions are not considered to be part of the
ABI (as explained in the 8664337cc39c8575ccb60abb8c6e30f92828ea51 commit
message), why are they exported?
Cheers,
-Hilko
10 years, 2 months
virt-v2v -ic question
by Shahar Havivi
Hi,
I am trying to convert from esx server to local directory a VM names CSB,
Its build from source 77b371b18b6a7ad37105a595931514f542a04396
When running:
LIBGUESTFS_BACKEND=direct ./run ./v2v/virt-v2v -ic "esx://root@10.35.5.45/?no_verify=1" -o local -of raw -os /tmp/v2v CSB
I get the following:
---------------------------------------------------------------------------
[ 0.0] Opening the source -i libvirt -ic esx://root@10.35.5.45/?no_verify=1 CSB
Enter root's password for 10.35.5.45:
Enter host password for user 'root':
[ 4.0] Creating an overlay to protect the source from being modified
qemu-img: /tmp/v2vovl2305ba.qcow2: Could not open 'json: { "file.cookie" : "vmware_soap_session=\"52d44642-3451-51db-dc36-7621bbc387bd\"", "file.sslverify" : "off", "file.driver" : "https", "file.url" : "https://10.35.5.45/folder/CSB/CSB-flat.vmdk?dcPath=ha-datacenter&dsName=d...", "file.timeout" : 60 }': Unknown driver 'https': No such file or directory
virt-v2v: error: qemu-img command failed, see earlier errors
If reporting bugs, run virt-v2v with debugging enabled and include the
complete output:
virt-v2v -v -x [...]
---------------------------------------------------------------------------
As you can see first I am propmt twice for roots password,
I am able to connect with the same uri via 'vish -c' cli.
Thanks,
Shahar Havivi.
10 years, 3 months
Virt-v2v conversion issue
by VONDRA Alain
Hi,
I am running virt-v2v under CentOS 7, I use the new libguestfs-1.27.48-1.1, and when I try to import my Windows 2008 (running perfectly using virt-manager) in my cloud oVirt, I encounter this issue :
........
libguestfs: trace: mkdir_p = 0
libguestfs: trace: case_sensitive_path "/Windows/system32/drivers/viostor.sys"
libguestfs: trace: case_sensitive_path = "/Windows/System32/drivers/viostor.sys"
libguestfs: trace: cp "/usr/share/virtio-win/drivers/amd64/Win2008/viostor.sys" "/Windows/System32/drivers/viostor.sys"
libguestfs: trace: cp = -1 (error)
libguestfs: trace: hivex_close
libguestfs: trace: hivex_close = 0
virt-v2v: error: libguestfs error: cp: cp: cannot stat
'/sysroot/usr/share/virtio-win/drivers/amd64/Win2008/viostor.sys': No such
file or directory
If reporting bugs, run virt-v2v with debugging enabled and include the
complete output:
virt-v2v -v -x [...]
libguestfs: trace: close
libguestfs: trace: internal_autosync
libguestfs: trace: internal_autosync = 0
The virtio-win folder is present and viostor.sys also.
Can you help me to debug this issue ?
Thank you and have a nice day
Alain
________________________________
Alain VONDRA
Charg? d'exploitation des Syst?mes d'Information
Direction Administrative et Financi?re
+33 1 44 39 77 76
UNICEF France
3 rue Duguay Trouin 75006 PARIS
www.unicef.fr<http://www.unicef.fr/>
[cid:urgence_ebola258bf0]<http://www.unicef.fr>
________________________________
10 years, 3 months
Another possible bug in the preview version of virt-v2v for RHEL/CentOS 7.1
by Jeff Forbes
I have been able to get a litle further with converting a windows VM.
After getting the updated virt-v2v code and rhsrvany, I now get this error:
libguestfs: trace: hivex_node_set_value = 0
libguestfs: trace: upload "/usr/share/virtio-win/drivers/amd64/Win2012R2/netkvm.cat" "/Windows/Drivers/VirtIO"
guestfsd: main_loop: proc 365 (hivex_node_set_value) took 0.01 seconds
guestfsd: main_loop: new request, len 0x44
guestfsd: receive_file: reading length word
libguestfs: got daemon cancellation
guestfsd: receive_file: got chunk: cancel = 0x1, len = 0, buf = (nil)
guestfsd: receive_file: received cancellation from library
guestfsd: error: /Windows/Drivers/VirtIO: Is a directory
libguestfs: trace: upload = -1 (error)
libguestfs: trace: hivex_close
guestfsd: main_loop: proc 66 (upload) took 0.03 seconds
guestfsd: main_loop: new request, len 0x28
hivex: hivex_close: hivex_close
guestfsd: main_loop: proc 351 (hivex_close) took 0.00 seconds
libguestfs: trace: hivex_close = 0
virt-v2v: error: libguestfs error: upload: /Windows/Drivers/VirtIO: Is a
directory
10 years, 3 months
Why is virt-resize designed to involve two disks?
by Zhi Yong Wu
HI,
As you've known, vhd-util and qemu-img both provide the capacity for
resizing the original disk, but why is virt-resize designed to involve
two disks, not only original disk? Is there any concern? Is it
possible that only one original disk is involved in virt-resize?
--
Regards,
Zhi Yong Wu
10 years, 3 months
[PATCH 00/13] syntax-check
by Hu Tao
Hi Rich,
This series includes patches to make `make syntax-check` pass.
Some of the fix require change to maint.mk, but the file is not in git
repo. Is it intended?
Thanks!
Hu Tao (13):
syntax-check: dirty hack to pass bindtextdomain check
syntax-check: fix error_message_period check
syntax-check: fix makefile_at_at_check
syntax-check: fix prohibit_assert_without_use check
syntax-check: fix prohibit_c_ctype_without_use check
syntax-check: fix prohibit_dirent_without_use check
syntax-check: fix prohibit_empty_lines_at_EOF check
syntax-check: fix prohibit_getopt_without_use check
syntax-check: fix prohibit_path_max_allocation check
syntax-check: fix prohibit_test_minus_ao check
syntax-check: fix prohibit_undesirable_word_seq check
syntax-check: fix require_config_h_first check
syntax-check: fix trailing_blank check
BUGS | 6 +-
align/Makefile.am | 2 +-
align/test-virt-alignment-scan-guests.sh | 2 +-
align/test-virt-alignment-scan.sh | 2 +-
builder/Makefile.am | 2 +-
builder/test-virt-builder-planner.sh | 2 +-
builder/website/Makefile.am | 2 +-
builder/website/debian.preseed | 2 +-
builder/website/index | 120 +++----
builder/website/index.asc | 120 +++----
builder/website/ubuntu.preseed | 1 -
builder/website/ubuntu.sh | 2 +-
cat/Makefile.am | 4 +-
cat/cat.c | 2 -
cat/log.c | 2 -
common-rules.mk | 8 +-
configure.ac | 2 +-
customize/Makefile.am | 2 +-
customize/customize_run.mli | 2 +-
daemon/inotify.c | 12 +-
daemon/mount.c | 2 +-
df/Makefile.am | 4 +-
diff/Makefile.am | 2 +-
edit/edit.c | 1 -
erlang/examples/Makefile.am | 4 +-
examples/Makefile.am | 16 +-
fish/Makefile.am | 2 +-
fish/test-file-attrs.sh | 10 +-
fish/test-mount-local.sh | 2 +-
format/Makefile.am | 2 +-
generator/c.ml | 2 +-
golang/examples/Makefile.am | 4 +-
guestfs-release-notes.pod | 8 +-
guestfs-release-notes.txt | 529 +++++++++++++++----------------
inspector/Makefile.am | 4 +-
java/examples/Makefile.am | 4 +-
lua/Makefile.am | 2 +-
lua/examples/Makefile.am | 4 +-
make-fs/Makefile.am | 2 +-
make-fs/test-virt-make-fs.sh | 2 +-
mllib/Makefile.am | 2 +-
ocaml/Makefile.am | 2 +-
ocaml/examples/Makefile.am | 4 +-
p2v/config.c | 1 -
p2v/conversion.c | 1 -
p2v/gui.c | 3 +-
p2v/issue | 1 -
p2v/main.c | 1 -
perl/examples/Makefile.am | 4 +-
po-docs/ja.po | 8 +-
po-docs/libguestfs-docs.pot | 8 +-
po-docs/uk.po | 8 +-
podwrapper.pl.in | 6 +-
python/examples/Makefile.am | 4 +-
python/guestfs-py-byhand.c | 4 +-
rescue/Makefile.am | 2 +-
resize/Makefile.am | 2 +-
resize/resize.ml | 10 +-
ruby/examples/Makefile.am | 4 +-
sparsify/Makefile.am | 2 +-
sparsify/copying.ml | 2 +-
src/Makefile.am | 2 +-
src/api-support/update-from-tarballs.sh | 2 +-
src/appliance.c | 1 -
src/fuse.c | 2 +-
src/launch-libvirt.c | 4 +-
src/libvirt-domain.c | 2 +-
sysprep/Makefile.am | 4 +-
sysprep/test-virt-sysprep-script.sh | 2 +-
test-tool/Makefile.am | 2 +-
tests/c-api/Makefile.am | 2 +-
tests/fuzz/Makefile.am | 2 +-
tests/guests/guest-aux/debian-packages | 1 -
tests/mount-local/Makefile.am | 2 +-
tests/parallel/Makefile.am | 2 +-
tests/qemu/qemu-snapshot-isolation.sh | 2 +-
tests/regressions/rhbz563450.sh | 2 +-
tests/relative-paths/Makefile.am | 2 +-
tools/virt-win-reg | 2 +-
v2v/Makefile.am | 2 +-
v2v/convert_linux.ml | 6 +-
v2v/input_libvirt.ml | 4 +-
v2v/lib_ovf.ml | 2 +-
v2v/output_glance.ml | 2 +-
v2v/output_rhev.ml | 6 +-
v2v/test-v2v-print-source.sh | 4 +-
v2v/v2v.ml | 6 +-
87 files changed, 524 insertions(+), 528 deletions(-)
--
1.9.3
10 years, 3 months
Why is virt-resize designed to involve two disks?
by 吴志勇
HI,
As you've known, vhd-util and qemu-img both provide the capacity for resizing the original disk, but why is virt-resize designed to involve two disks, not only original disk? Is there any concern? Is it possible that only one original disk is involved in virt-resize?
--
Regards,
Zhi Yong Wu
10 years, 3 months
[PATCH] inspect: map Hurd devices, and enable fstab introspection
by Pino Toscano
Add a mapping for the Hurd device names, so it is possible to enable the
inspection of /etc/fstab.
---
src/inspect-fs-unix.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
index 3f57cd5..b629508 100644
--- a/src/inspect-fs-unix.c
+++ b/src/inspect-fs-unix.c
@@ -78,6 +78,7 @@ static pcre *re_opensuse_version;
static pcre *re_sles_version;
static pcre *re_sles_patchlevel;
static pcre *re_minix;
+static pcre *re_hurd_dev;
static void compile_regexps (void) __attribute__((constructor));
static void free_regexps (void) __attribute__((destructor));
@@ -137,6 +138,7 @@ compile_regexps (void)
COMPILE (re_sles_version, "^VERSION = (\\d+)", 0);
COMPILE (re_sles_patchlevel, "^PATCHLEVEL = (\\d+)", 0);
COMPILE (re_minix, "^(\\d+)\\.(\\d+)(\\.(\\d+))?", 0);
+ COMPILE (re_hurd_dev, "^/dev/(h)d(\\d+)s(\\d+)$", 0);
}
static void
@@ -170,6 +172,7 @@ free_regexps (void)
pcre_free (re_sles_version);
pcre_free (re_sles_patchlevel);
pcre_free (re_minix);
+ pcre_free (re_hurd_dev);
}
static void check_architecture (guestfs_h *g, struct inspect_fs *fs);
@@ -776,7 +779,11 @@ guestfs___check_hurd_root (guestfs_h *g, struct inspect_fs *fs)
/* Determine the architecture. */
check_architecture (g, fs);
- /* XXX Check for /etc/fstab. */
+ if (guestfs_is_file (g, "/etc/fstab") > 0) {
+ const char *configfiles[] = { "/etc/fstab", NULL };
+ if (inspect_with_augeas (g, fs, configfiles, check_fstab) == -1)
+ return -1;
+ }
/* Determine hostname. */
if (check_hostname_unix (g, fs) == -1)
@@ -1635,6 +1642,22 @@ resolve_fstab_device (guestfs_h *g, const char *spec, Hash_table *md_map)
if (r == -1)
return NULL;
}
+ else if (match3 (g, spec, re_hurd_dev, &type, &disk, &part)) {
+ /* Hurd disk devices are like /dev/hdNsM, where hdN is the
+ * N-th disk and M is the M-th partition on that disk.
+ * Turn the disk number into a letter-based identifier, so
+ * we can resolve it easily.
+ */
+ int disk_i = guestfs___parse_unsigned_int (g, disk);
+ char disk_as_letter[2] = { 0 };
+ disk_as_letter[0] = disk_i + 'a';
+ r = resolve_fstab_device_xdev (g, type, disk_as_letter, part, &device);
+ free (type);
+ free (disk);
+ free (part);
+ if (r == -1)
+ return NULL;
+ }
/* Didn't match device pattern, return original spec unchanged. */
if (device == NULL)
--
1.9.3
10 years, 3 months
libguestfs fails on FreeBSD9.3, MINIX3 qcow2 images
by Assaf Gordon
Hello Richard and all,
(continuing from https://www.redhat.com/archives/libguestfs/2014-September/msg00112.html ).
I'm experimenting with libguestfs on non-linux VMs, encountered errors on FreeBSD9.3 and MINIX3 (and few others, but these ones are easy to share), with host Ubuntu 14.04.01 LTS x86-64.
Attached are logs from "virt-inspector -v -x" for each VM.
The images are here:
http://files.housegordon.org/libguestfs/minixR330.qcow2.clean_install.xz (44MB)
http://files.housegordon.org/libguestfs/freebsd93.qcow2.clean_install.xz (161MB)
To run them:
xz -dc < minix3/minixR330.qcow2.clean_install.xz > minixR330.qcow2
kvm -drive file=minixR330.qcow2,if=virtio,media=disk,index=0 \
-m 384 -curses -net user -net nic,model=virtio
xz -dc < freebsd93.qcow2.clean_install.xz > freebsd93.qcow2
kvm -drive file=freebsd93.qcow2,if=virtio,media=disk,index=0 \
-m 384 -curses -net user -net nic,model=virtio
Root password for freebsd is "12345".
Root in Minix does not require a password.
Regards,
- Assaf
==== Disk structure from within MINIX3 VM guest ====
# fdisk /dev/c0d0
Geometry of /dev/c0d0: 10402x16x63
Inconsistent size in partition 1.
Suspect head and sector parameters.
Disk appears to have mis-specified number of heads or sectors.
Try fdisk -h256 -s63 /dev/c0d0 instead of
fdisk -h16 -s63 /dev/c0d0
Do not write the table if you are not sure!.
----first---- -----last---- --------sectors-------
Num Sorted Act Type Cyl Head Sec Cyl Head Sec Base Last Size
1 1 A MINIX 0 1 1 649 255 63 63+10483199 10483137
-
2 2 None 0 0 0 0 0 0 0 0 0
3 3 None 0 0 0 0 0 0 0 0 0
4 4 None 0 0 0 0 0 0 0 0 0
# df
Filesystem 512-blocks Used Avail %Cap Mounted on
/dev/c0d0p0s0 4194304 111632 4082672 2% /
none 0 0 0 100% /proc
/dev/c0d0p0s2 3831200 805792 3025408 21% /usr
/dev/c0d0p0s1 2457600 25784 2431816 1% /home
none 0 0 0 100% /sys
# mount
/dev/c0d0p0s0 on / type mfs (rw)
none on /proc type procfs (rw)
/dev/c0d0p0s2 on /usr type mfs (rw)
/dev/c0d0p0s1 on /home type mfs (rw)
none on /sys type devman (rw)
====== Disk structure from within FreeBSD 9.3 VM guest ======
# df
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/vtbd0p2 4818524 777212 3655832 18% /
devfs 1 1 0 100% /dev
# mount
/dev/vtbd0p2 on / (ufs, local, journaled soft-updates)
devfs on /dev (devfs, local, multilabel)
# fdisk /dev/vtbd0
******* Working on device /dev/vtbd0 *******
parameters extracted from in-core disklabel are:
cylinders=10402 heads=16 sectors/track=63 (1008 blks/cyl)
Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=10402 heads=16 sectors/track=63 (1008 blks/cyl)
Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 238 (0xee),(EFI GPT)
start 1, size 10485759 (5119 Meg), flag 0
beg: cyl 0/ head 0/ sector 2;
end: cyl 1023/ head 255/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
10 years, 3 months