Re: [Libguestfs] Test fails in arch linux
by Nikos Skalkotos
Hello Vaggelis,
The PKGBUILD you provided does not make a difference. The --disable-java is
not a valid config option, and after I replace it with this
--with-java-home=/usr/lib/jvm/
java-7-openjdk I get the same error in libguestfs-test-tool:
IBGUESTFS_DEBUG=1
TMPDIR=(not set)
libguestfs: new guestfs handle 0x22f43d0supermin helper [00066ms] visiting
/usr/lib/guestfs/supermin.d/init.img
supermin helper [00066ms] adding kernel modules
supermin helper [00243ms] finished creating appliance
libguestfs: [00249ms] begin building supermin appliance
libguestfs: [00249ms] run febootstrap-supermin-helper
libguestfs: [00249ms] febootstrap-supermin-helper --verbose -f ext2
/usr/lib/guestfs/supermin.d x86_64 /var/tmp/guestfs.DP8yqi/kernel
/var/tmp/guestfs.DP8yqi/initrd /var/tmp/guestfs.DP8yqi/root
supermin helper [00000ms] whitelist = (not specified), host_cpu = x86_64,
kernel = /var/tmp/guestfs.DP8yqi/kernel, initrd =
/var/tmp/guestfs.DP8yqi/initrd, appliance = /var/tmp/guestfs.DP8yqi/root
supermin helper [00000ms] inputs[0] = /usr/lib/guestfs/supermin.d
checking modpath /lib/modules/3.2.6-2-ARCH is a directory
picked vmlinuz-linux because modpath /lib/modules/3.2.6-2-ARCH exists
supermin helper [00000ms] finished creating kernel
supermin helper [00701ms] finished mke2fs
supermin helper [00702ms] visiting /usr/lib/guestfs/supermin.d
supermin helper [00702ms] visiting /usr/lib/guestfs/supermin.d/base.img
supermin helper [00853ms] visiting /usr/lib/guestfs/supermin.d/daemon.img
supermin helper [00855ms] visiting /usr/lib/guestfs/supermin.d/hostfiles
supermin helper [26364ms] visiting /usr/lib/guestfs/supermin.d/init.img
supermin helper [26367ms] adding kernel modules
supermin helper [37877ms] closing ext2 filesystem
supermin helper [37877ms] finished creating appliance
libguestfs: [38128ms] finished building supermin appliance
libguestfs: [38212ms] begin testing qemu features
libguestfs: [38320ms] finished testing qemu features
libguestfs: accept_from_daemon: 0x22f43d0 g->state = 1
[38321ms] /usr/bin/qemu-kvm \
-global virtio-blk-pci.scsi=off \
-drive file=/tmp/libguestfs-test-tool-sda-Jejxf7,format=raw,if=virtio \
-nodefconfig \
-machine accel=kvm:tcg \
-nodefaults \
-nographic \
-m 500 \
-no-reboot \
-no-hpet \
-device virtio-serial \
-serial stdio \
-chardev socket,path=/tmp/libguestfsevt4oc/guestfsd.sock,id=channel0 \
-device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \
-kernel /var/tmp/.guestfs-0/kernel.25211 \
-initrd /var/tmp/.guestfs-0/initrd.25211 \
-append 'panic=1 console=ttyS0 udevtimeout=300 no_timer_check acpi=off
printk.time=1 cgroup_disable=memory selinux=0 guestfs_verbose=1 TERM=xterm
' \
-drive
file=/var/tmp/.guestfs-0/root.25211,snapshot=on,if=virtio,cache=unsafefebootstrap:
mounting /proc c--------- 1 root root 10, 235 Feb 23 20:16 autofs
c--------- 1 root root 10, 234 Feb 23 20:16 btrfs-control
drwxr-xr-x 2 root root 60 Feb 23 20:16 char
crw------- 1 root root 5, 1 Feb 23 20:16 console
lrwxrwxrwx 1 root root 11 Feb 23 20:16 core -> /proc/kcore
drwxr-xr-x 2 root root 60 Feb 23 20:16 cpu
crw------- 1 root root 10, 62 Feb 23 20:16 cpu_dma_latency
lrwxrwxrwx 1 root root 13 Feb 23 20:16 fd -> /proc/self/fd
crw-rw-rw- 1 root root 1, 7 Feb 23 20:16 full
crw-rw-rw- 1 root root 10, 229 Feb 23 20:16 fuse
drwxr-xr-x 2 root root 60 Feb 23 20:16 input
crw------- 1 root root 1, 11 Feb 23 20:16 kmsg
c--------- 1 root root 10, 237 Feb 23 20:16 loop-control
brw-r--r-- 1 root disk 7, 0 Feb 23 20:16 loop0
drwxr-xr-x 2 root root 60 Feb 23 20:16 mapper
crw------- 1 root root 10, 227 Feb 23 20:16 mcelog
crw------- 1 root root 1, 1 Feb 23 20:16 mem
drwxr-xr-x 2 root root 60 Feb 23 20:16 net
crw------- 1 root root 10, 61 Feb 23 20:16 network_latency
crw------- 1 root root 10, 60 Feb 23 20:16 network_throughput
crw-rw-rw- 1 root root 1, 3 Feb 23 20:16 null
crw------- 1 root root 1, 4 Feb 23 20:16 port
c--------- 1 root root 108, 0 Feb 23 20:16 ppp
crw------- 1 root root 10, 1 Feb 23 20:16 psaux
crw-rw-rw- 1 root root 5, 2 Feb 23 20:16 ptmx
crw-rw-rw- 1 root root 1, 8 Feb 23 20:16 random
crw------- 1 root root 10, 59 Feb 23 20:16 rfkill
crw------- 1 root root 254, 0 Feb 23 20:16 rtc0
crw------- 1 root root 10, 231 Feb 23 20:16 snapshot
drwxr-xr-x 2 root root 80 Feb 23 20:16 snd
lrwxrwxrwx 1 root root 15 Feb 23 20:16 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Feb 23 20:16 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Feb 23 20:16 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root root 5, 0 Feb 23 20:16 tty
crw------- 1 root root 4, 0 Feb 23 20:16 tty0
crw------- 1 root root 4, 1 Feb 23 20:16 tty1
crw------- 1 root root 4, 10 Feb 23 20:16 tty10
crw------- 1 root root 4, 11 Feb 23 20:16 tty11
crw------- 1 root root 4, 12 Feb 23 20:16 tty12
crw------- 1 root root 4, 13 Feb 23 20:16 tty13
crw------- 1 root root 4, 14 Feb 23 20:16 tty14
crw------- 1 root root 4, 15 Feb 23 20:16 tty15
crw------- 1 root root 4, 16 Feb 23 20:16 tty16
crw------- 1 root root 4, 17 Feb 23 20:16 tty17
crw------- 1 root root 4, 18 Feb 23 20:16 tty18
crw------- 1 root root 4, 19 Feb 23 20:16 tty19
crw------- 1 root root 4, 2 Feb 23 20:16 tty2
crw------- 1 root root 4, 20 Feb 23 20:16 tty20
crw------- 1 root root 4, 21 Feb 23 20:16 tty21
crw------- 1 root root 4, 22 Feb 23 20:16 tty22
crw------- 1 root root 4, 23 Feb 23 20:16 tty23
crw------- 1 root root 4, 24 Feb 23 20:16 tty24
crw------- 1 root root 4, 25 Feb 23 20:16 tty25
crw------- 1 root root 4, 26 Feb 23 20:16 tty26
crw------- 1 root root 4, 27 Feb 23 20:16 tty27
crw------- 1 root root 4, 28 Feb 23 20:16 tty28
crw------- 1 root root 4, 29 Feb 23 20:16 tty29
crw------- 1 root root 4, 3 Feb 23 20:16 tty3
crw------- 1 root root 4, 30 Feb 23 20:16 tty30
crw------- 1 root root 4, 31 Feb 23 20:16 tty31
crw------- 1 root root 4, 32 Feb 23 20:16 tty32
crw------- 1 root root 4, 33 Feb 23 20:16 tty33
crw------- 1 root root 4, 34 Feb 23 20:16 tty34
crw------- 1 root root 4, 35 Feb 23 20:16 tty35
crw------- 1 root root 4, 36 Feb 23 20:16 tty36
crw------- 1 root root 4, 37 Feb 23 20:16 tty37
crw------- 1 root root 4, 38 Feb 23 20:16 tty38
crw------- 1 root root 4, 39 Feb 23 20:16 tty39
crw------- 1 root root 4, 4 Feb 23 20:16 tty4
crw------- 1 root root 4, 40 Feb 23 20:16 tty40
crw------- 1 root root 4, 41 Feb 23 20:16 tty41
crw------- 1 root root 4, 42 Feb 23 20:16 tty42
crw------- 1 root root 4, 43 Feb 23 20:16 tty43
crw------- 1 root root 4, 44 Feb 23 20:16 tty44
crw------- 1 root root 4, 45 Feb 23 20:16 tty45
crw------- 1 root root 4, 46 Feb 23 20:16 tty46
crw------- 1 root root 4, 47 Feb 23 20:16 tty47
crw------- 1 root root 4, 48 Feb 23 20:16 tty48
crw------- 1 root root 4, 49 Feb 23 20:16 tty49
crw------- 1 root root 4, 5 Feb 23 20:16 tty5
crw------- 1 root root 4, 50 Feb 23 20:16 tty50
crw------- 1 root root 4, 51 Feb 23 20:16 tty51
crw------- 1 root root 4, 52 Feb 23 20:16 tty52
crw------- 1 root root 4, 53 Feb 23 20:16 tty53
crw------- 1 root root 4, 54 Feb 23 20:16 tty54
crw------- 1 root root 4, 55 Feb 23 20:16 tty55
crw------- 1 root root 4, 56 Feb 23 20:16 tty56
crw------- 1 root root 4, 57 Feb 23 20:16 tty57
crw------- 1 root root 4, 58 Feb 23 20:16 tty58
crw------- 1 root root 4, 59 Feb 23 20:16 tty59
crw------- 1 root root 4, 6 Feb 23 20:16 tty6
crw------- 1 root root 4, 60 Feb 23 20:16 tty60
crw------- 1 root root 4, 61 Feb 23 20:16 tty61
crw------- 1 root root 4, 62 Feb 23 20:16 tty62
crw------- 1 root root 4, 63 Feb 23 20:16 tty63
crw------- 1 root root 4, 7 Feb 23 20:16 tty7
crw------- 1 root root 4, 8 Feb 23 20:16 tty8
crw------- 1 root root 4, 9 Feb 23 20:16 tty9
crw------- 1 root root 4, 64 Feb 23 20:16 ttyS0
crw------- 1 root root 4, 65 Feb 23 20:16 ttyS1
crw------- 1 root root 4, 66 Feb 23 20:16 ttyS2
crw------- 1 root root 4, 67 Feb 23 20:16 ttyS3
c--------- 1 root root 10, 223 Feb 23 20:16 uinput
crw-rw-rw- 1 root root 1, 9 Feb 23 20:16 urandom
crw------- 1 root root 7, 0 Feb 23 20:16 vcs
crw------- 1 root root 7, 1 Feb 23 20:16 vcs1
crw------- 1 root root 7, 128 Feb 23 20:16 vcsa
crw------- 1 root root 7, 129 Feb 23 20:16 vcsa1
brw------- 1 root root 254, 0 Feb 23 20:16 vda
brw------- 1 root root 254, 16 Feb 23 20:16 vdb
crw------- 1 root root 10, 63 Feb 23 20:16 vga_arbiter
crw------- 1 root root 252, 1 Feb 23 20:16 vport0p1
crw-rw-rw- 1 root root 1, 5 Feb 23 20:16 zero
/dev/char:
total 0
lrwxrwxrwx 1 root root 17 Feb 23 20:16 10:236 -> ../mapper/control
/dev/cpu:
total 0
c--------- 1 root root 10, 184 Feb 23 20:16 microcode
/dev/input:
total 0
crw------- 1 root root 13, 63 Feb 23 20:16 mice
/dev/mapper:
total 0
crw------- 1 root root 10, 236 Feb 23 20:16 control
/dev/net:
total 0
crw-rw-rw- 1 root root 10, 200 Feb 23 20:16 tun
/dev/snd:
total 0
crw-rw---- 1 root audio 116, 1 Feb 23 20:16 seq
crw-rw---- 1 root audio 116, 33 Feb 23 20:16 timer Thu Feb 23 20:16:13 UTC
2012
uptime: 2.38 1.20
verbose daemon enabled
linux commmand line: panic=1 console=ttyS0 udevtimeout=300 no_timer_check
acpi=off printk.time=1 cgroup_disable=memory selinux=0 guestfs_verbose=1
TERM=xterm
Failed to connect to virtio-serial channel.
This is a fatal error and the appliance will now exit.
Usually this error is caused by either QEMU or the appliance
kernel not supporting the vmchannel method that the
libguestfs library chose to use. Please run
'libguestfs-test-tool' and provide the complete, unedited
output to the libguestfs developers, either in a bug report
or on the libguestfs redhat com mailing list.
/dev/virtio-ports/org.libguestfs.channel.0: No such file or directory
/init: line 146: /sbin/reboot: No such file or directory
[ 2.436729] Kernel panic - not syncing: Attempted to kill init!
[ 2.437588] Pid: 1, comm: init Not tainted 3.2.6-2-ARCH #1
[ 2.438386] Call Trace:
[ 2.439192] [<ffffffff81452925>] panic+0xa0/0x1b6
[ 2.439884] [<ffffffff8106a740>] do_exit+0x880/0x8e0
[ 2.440877] [<ffffffff811672a1>] ? rw_verify_area+0x61/0xf0
[ 2.441948] [<ffffffff8106aaf4>] do_group_exit+0x44/0xa0
[ 2.442992] [<ffffffff8106ab67>] sys_exit_group+0x17/0x20
[ 2.443791] [<ffffffff8145d382>] system_call_fastpath+0x16/0x1b
[ 2.445128] Rebooting in 1 seconds..libguestfs: error: unexpected end of
file when reading from daemon.
See earlier debug messages.
Or you can run 'libguestfs-test-tool' and post the complete output into
a bug report or message to the libguestfs mailing list.
libguestfs: child_cleanup: 0x22f43d0: child process died
libguestfs-test-tool: failed to launch appliance
libguestfs: closing guestfs handle 0x22f43d0 (state 0)
Nikos
On 23 February 2012 21:39, Nikos Skalkotos <skalkoto(a)gmail.com> wrote:
> Sorry, I misread your e-mail. I'll try this, thank you.
>
> On 23 February 2012 21:06, Evaggelos Balaskas <ebalaskas(a)ebalaskas.gr>wrote:
>
>> Can you plz try the attached PKGBUILD file
>>
>> Evaggelos Balaskas - Unix System Engineer
>> http://gr.linkedin.com/in/evaggelosbalaskas
>>
>
>
12 years, 10 months
[PATCH v2] Add a flag to make some functions called only at CONFIG state(RHBZ796520)
by Wanlong Gao
Add a flag "ConfigOnly" to make sure that some non-daemon-functions
should be called only at CONFIG state(RHBZ796520).
Signed-off-by: Wanlong Gao <gaowanlong(a)cn.fujitsu.com>
---
generator/generator_actions.ml | 44 ++++++++++++++++++++--------------------
generator/generator_c.ml | 8 ++++++-
generator/generator_checks.ml | 1 +
generator/generator_types.ml | 2 +
4 files changed, 32 insertions(+), 23 deletions(-)
diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml
index d9bd356..53a9607 100644
--- a/generator/generator_actions.ml
+++ b/generator/generator_actions.ml
@@ -112,7 +112,7 @@ You probably don't want to call this function.")]
*)
let non_daemon_functions = test_functions @ [
- ("launch", (RErr, [], []), -1, [FishAlias "run"; Progress],
+ ("launch", (RErr, [], []), -1, [FishAlias "run"; Progress; ConfigOnly],
[],
"launch the qemu subprocess",
"\
@@ -122,7 +122,7 @@ using L<qemu(1)>.
You should call this after configuring the handle
(eg. adding drives) but before performing any actions.");
- ("wait_ready", (RErr, [], []), -1, [NotInFish; DeprecatedBy "launch"],
+ ("wait_ready", (RErr, [], []), -1, [NotInFish; DeprecatedBy "launch"; ConfigOnly],
[],
"wait until the qemu subprocess launches (no op)",
"\
@@ -143,7 +143,7 @@ versions of the API.");
"\
This kills the qemu subprocess. You should never need to call this.");
- ("add_drive", (RErr, [String "filename"], []), -1, [],
+ ("add_drive", (RErr, [String "filename"], []), -1, [ConfigOnly],
[],
"add an image to examine or modify",
"\
@@ -158,7 +158,7 @@ this security hole. Therefore you should think about replacing
calls to this function with calls to C<guestfs_add_drive_opts>,
and specifying the format.");
- ("add_cdrom", (RErr, [String "filename"], []), -1, [DeprecatedBy "add_drive_opts"],
+ ("add_cdrom", (RErr, [String "filename"], []), -1, [DeprecatedBy "add_drive_opts"; ConfigOnly],
[],
"add a CD-ROM disk image to examine",
"\
@@ -185,7 +185,7 @@ should probably use C<guestfs_add_drive_ro> instead.
=back");
- ("add_drive_ro", (RErr, [String "filename"], []), -1, [FishAlias "add-ro"],
+ ("add_drive_ro", (RErr, [String "filename"], []), -1, [FishAlias "add-ro"; ConfigOnly],
[],
"add a drive in snapshot mode (read-only)",
"\
@@ -194,7 +194,7 @@ with the optional parameter C<GUESTFS_ADD_DRIVE_OPTS_READONLY> set to 1,
so the disk is added read-only, with the format being detected
automatically.");
- ("config", (RErr, [String "qemuparam"; OptString "qemuvalue"], []), -1, [],
+ ("config", (RErr, [String "qemuparam"; OptString "qemuvalue"], []), -1, [ConfigOnly],
[],
"add qemu parameters",
"\
@@ -207,7 +207,7 @@ The first character of C<param> string must be a C<-> (dash).
C<value> can be NULL.");
- ("set_qemu", (RErr, [OptString "qemu"], []), -1, [FishAlias "qemu"],
+ ("set_qemu", (RErr, [OptString "qemu"], []), -1, [FishAlias "qemu"; ConfigOnly],
[],
"set the qemu binary",
"\
@@ -239,7 +239,7 @@ Return the current qemu binary.
This is always non-NULL. If it wasn't set already, then this will
return the default qemu binary name.");
- ("set_path", (RErr, [OptString "searchpath"], []), -1, [FishAlias "path"],
+ ("set_path", (RErr, [OptString "searchpath"], []), -1, [FishAlias "path"; ConfigOnly],
[],
"set the search path",
"\
@@ -260,7 +260,7 @@ Return the current search path.
This is always non-NULL. If it wasn't set already, then this will
return the default path.");
- ("set_append", (RErr, [OptString "append"], []), -1, [FishAlias "append"],
+ ("set_append", (RErr, [OptString "append"], []), -1, [FishAlias "append"; ConfigOnly],
[],
"add options to kernel command line",
"\
@@ -286,7 +286,7 @@ guest kernel command line.
If C<NULL> then no options are added.");
- ("set_autosync", (RErr, [Bool "autosync"], []), -1, [FishAlias "autosync"],
+ ("set_autosync", (RErr, [Bool "autosync"], []), -1, [FishAlias "autosync"; ConfigOnly],
[],
"set autosync mode",
"\
@@ -373,7 +373,7 @@ only useful for printing debug and internal error messages.
For more information on states, see L<guestfs(3)>.");
- ("set_memsize", (RErr, [Int "memsize"], []), -1, [FishAlias "memsize"],
+ ("set_memsize", (RErr, [Int "memsize"], []), -1, [FishAlias "memsize"; ConfigOnly],
[InitNone, Always, TestOutputInt (
[["set_memsize"; "500"];
["get_memsize"]], 500)],
@@ -451,7 +451,7 @@ features from later versions into earlier versions,
making this an unreliable way to test for features.
Use C<guestfs_available> instead.");
- ("set_selinux", (RErr, [Bool "selinux"], []), -1, [FishAlias "selinux"],
+ ("set_selinux", (RErr, [Bool "selinux"], []), -1, [FishAlias "selinux"; ConfigOnly],
[InitNone, Always, TestOutputTrue (
[["set_selinux"; "true"];
["get_selinux"]])],
@@ -502,7 +502,7 @@ C<guestfs_set_event_callback>).");
"\
Return the command trace flag.");
- ("set_direct", (RErr, [Bool "direct"], []), -1, [FishAlias "direct"],
+ ("set_direct", (RErr, [Bool "direct"], []), -1, [FishAlias "direct"; ConfigOnly],
[InitNone, Always, TestOutputFalse (
[["set_direct"; "false"];
["get_direct"]])],
@@ -527,7 +527,7 @@ The default is disabled.");
"\
Return the direct appliance mode flag.");
- ("set_recovery_proc", (RErr, [Bool "recoveryproc"], []), -1, [FishAlias "recovery-proc"],
+ ("set_recovery_proc", (RErr, [Bool "recoveryproc"], []), -1, [FishAlias "recovery-proc"; ConfigOnly],
[InitNone, Always, TestOutputTrue (
[["set_recovery_proc"; "true"];
["get_recovery_proc"]])],
@@ -553,14 +553,14 @@ qemu, which is not very helpful.");
"\
Return the recovery process enabled flag.");
- ("add_drive_with_if", (RErr, [String "filename"; String "iface"], []), -1, [DeprecatedBy "add_drive_opts"],
+ ("add_drive_with_if", (RErr, [String "filename"; String "iface"], []), -1, [DeprecatedBy "add_drive_opts"; ConfigOnly],
[],
"add a drive specifying the QEMU block emulation to use",
"\
This is the same as C<guestfs_add_drive> but it allows you
to specify the QEMU interface emulation to use at run time.");
- ("add_drive_ro_with_if", (RErr, [String "filename"; String "iface"], []), -1, [DeprecatedBy "add_drive_opts"],
+ ("add_drive_ro_with_if", (RErr, [String "filename"; String "iface"], []), -1, [DeprecatedBy "add_drive_opts"; ConfigOnly],
[],
"add a drive read-only specifying the QEMU block emulation to use",
"\
@@ -968,7 +968,7 @@ for a filesystem to be shared between operating systems.
Please read L<guestfs(3)/INSPECTION> for more details.
See also C<guestfs_inspect_get_mountpoints>.");
- ("set_network", (RErr, [Bool "network"], []), -1, [FishAlias "network"],
+ ("set_network", (RErr, [Bool "network"], []), -1, [FishAlias "network"; ConfigOnly],
[],
"set enable network flag",
"\
@@ -1020,7 +1020,7 @@ be mountable but require special options. Filesystems may
not all belong to a single logical operating system
(use C<guestfs_inspect_os> to look for OSes).");
- ("add_drive_opts", (RErr, [String "filename"], [OBool "readonly"; OString "format"; OString "iface"; OString "name"]), -1, [FishAlias "add"],
+ ("add_drive_opts", (RErr, [String "filename"], [OBool "readonly"; OString "format"; OString "iface"; OString "name"]), -1, [FishAlias "add"; ConfigOnly],
[],
"add an image to examine or modify",
"\
@@ -1110,7 +1110,7 @@ not part of the formal API and can be removed or changed at any time.");
This returns the internal list of drives. 'debug' commands are
not part of the formal API and can be removed or changed at any time.");
- ("add_domain", (RInt "nrdisks", [String "dom"], [OString "libvirturi"; OBool "readonly"; OString "iface"; OBool "live"; OBool "allowuuid"; OString "readonlydisk"]), -1, [FishAlias "domain"],
+ ("add_domain", (RInt "nrdisks", [String "dom"], [OString "libvirturi"; OBool "readonly"; OString "iface"; OBool "live"; OBool "allowuuid"; OString "readonlydisk"]), -1, [FishAlias "domain"; ConfigOnly],
[],
"add the disk(s) from a named libvirt domain",
"\
@@ -1450,7 +1450,7 @@ part of a set.
Please read L<guestfs(3)/INSPECTION> for more details.");
- ("set_attach_method", (RErr, [String "attachmethod"], []), -1, [FishAlias "attach-method"],
+ ("set_attach_method", (RErr, [String "attachmethod"], []), -1, [FishAlias "attach-method"; ConfigOnly],
[],
"set the attach method",
"\
@@ -1618,7 +1618,7 @@ advice before using trademarks in applications.
=back");
- ("set_pgroup", (RErr, [Bool "pgroup"], []), -1, [FishAlias "pgroup"],
+ ("set_pgroup", (RErr, [Bool "pgroup"], []), -1, [FishAlias "pgroup"; ConfigOnly],
[],
"set process group flag",
"\
@@ -1637,7 +1637,7 @@ C<^C> to kill the subprocess.");
"\
This returns the process group flag.");
- ("set_smp", (RErr, [Int "smp"], []), -1, [FishAlias "smp"],
+ ("set_smp", (RErr, [Int "smp"], []), -1, [FishAlias "smp"; ConfigOnly],
[],
"set number of virtual CPUs in appliance",
"\
diff --git a/generator/generator_c.ml b/generator/generator_c.ml
index 7b73197..a312a43 100644
--- a/generator/generator_c.ml
+++ b/generator/generator_c.ml
@@ -1012,7 +1012,7 @@ trace_send_line (guestfs_h *g)
(* For non-daemon functions, generate a wrapper around each function. *)
List.iter (
- fun (shortname, (ret, _, optargs as style), _, _, _, _, _) ->
+ fun (shortname, (ret, _, optargs as style), _, flags, _, _, _) ->
if optargs = [] then
generate_prototype ~extern:false ~semicolon:false ~newline:true
~handle:"g" ~prefix:"guestfs_"
@@ -1046,6 +1046,12 @@ trace_send_line (guestfs_h *g)
pr " struct guestfs_%s_list *r;\n" typ
);
pr "\n";
+ if List.mem ConfigOnly flags then (
+ pr " if (g->state != CONFIG) {\n";
+ pr " error (g, \"This ConfigOnly function can only be called at config state.\");\n";
+ pr " return -1;\n";
+ pr " }\n";
+ );
enter_event shortname;
check_null_strings shortname style;
reject_unknown_optargs shortname style;
diff --git a/generator/generator_checks.ml b/generator/generator_checks.ml
index 464b9cd..df038d0 100644
--- a/generator/generator_checks.ml
+++ b/generator/generator_checks.ml
@@ -189,6 +189,7 @@ let () =
| FishOutput _
| NotInFish
| NotInDocs
+ | ConfigOnly
| Progress -> ()
| FishAlias n ->
if contains_uppercase n then
diff --git a/generator/generator_types.ml b/generator/generator_types.ml
index dffe7c5..7555970 100644
--- a/generator/generator_types.ml
+++ b/generator/generator_types.ml
@@ -228,6 +228,8 @@ type flags =
This flag is currently only used by the GObject
bindings. *)
| Cancellable (* The user can cancel this long-running function *)
+ | ConfigOnly (* The non-daemon-function which only used at CONFIG
+ state. *)
and fish_output_t =
| FishOutputOctal (* for int return, print in octal *)
--
1.7.9
12 years, 10 months
[PATCH] set-smp: only set smp value at config time
by Wanlong Gao
We only set smp number at config time, other than
it has no effect.
Also limit the number value below 255, since qemu
can't support that.
Below is the reproduce from https://bugzilla.redhat.com/show_bug.cgi?id=795322
> # guestfish -a /dev/null
> [...]
> ><fs> run
> ><fs> get-smp
> 1
> ><fs> set-smp 4
> ><fs> get-smp
> 4
> ><fs>
>
> Actually, we're expecting to get 1 rather than 4, because there is only one
> vcpu assigned to the appliance, and it's impossible for the appliance to get 4
> virtual vcpus now.
Signed-off-by: Wanlong Gao <gaowanlong(a)cn.fujitsu.com>
---
src/guestfs.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/guestfs.c b/src/guestfs.c
index 3607eaa..3dcdf27 100644
--- a/src/guestfs.c
+++ b/src/guestfs.c
@@ -794,7 +794,12 @@ guestfs__get_pgroup (guestfs_h *g)
int
guestfs__set_smp (guestfs_h *g, int v)
{
- if (v >= 1) {
+ if (g->state != CONFIG)
+ return 0;
+ if (v > 255) {
+ error (g, "Unsupported number of smp cpus: %d", v);
+ return -1;
+ } else if (v >= 1) {
g->smp = v;
return 0;
} else {
--
1.7.9
12 years, 10 months
[PATCH] mkfs: wipefs before we mkfs
by Wanlong Gao
we wipe the filesystem signatures from device before do mkfs,
since we can't trust mkfs can remove the filesystem signature absolutely.
Signed-off-by: Wanlong Gao <gaowanlong(a)cn.fujitsu.com>
---
daemon/mkfs.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/daemon/mkfs.c b/daemon/mkfs.c
index 5475582..19224ec 100644
--- a/daemon/mkfs.c
+++ b/daemon/mkfs.c
@@ -181,6 +181,15 @@ do_mkfs_opts (const char *fstype, const char *device, int blocksize,
ADD_ARG (argv, i, device);
ADD_ARG (argv, i, NULL);
+ /* we wipe the filesystem signatures from device before do mkfs,
+ * since we can't trust mkfs can remove the filesystem signature absolutely.
+ */
+ if (do_wipefs (device)) {
+ reply_with_error ("%s: %s: %s", fstype, device, err);
+ free (err);
+ return -1;
+ }
+
r = commandv (NULL, &err, argv);
if (r == -1) {
reply_with_error ("%s: %s: %s", fstype, device, err);
--
1.7.9
12 years, 10 months
[PATCH] sysprep: Try unmounting the filesystem a few times when busy.
by Richard W.M. Jones
From: "Richard W.M. Jones" <rjones(a)redhat.com>
tracker-miner-fs jumps into newly mounted filesystems. This prevents
the filesystem from being unmounted, so retry a few times.
---
clone/virt-sysprep.in | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/clone/virt-sysprep.in b/clone/virt-sysprep.in
index 9e8f212..833a31d 100644
--- a/clone/virt-sysprep.in
+++ b/clone/virt-sysprep.in
@@ -390,7 +390,17 @@ esac
sync
-fusermount -u $tmpdir/mnt
+# Unfortunately various unwanted processes jump into mountpoints.
+# tracker-miner-fs is the latest, previously it was something called
+# gvfs-gdu-volume-monitor. Therefore if the mountpoint is busy, try
+# to unmount it a few times. XXX
+count=10
+while ! fusermount -u $tmpdir/mnt && [ $count -gt 0 ]; do
+ sleep 1
+ ((count--))
+done
+if [ $count -eq 0 ]; then exit 1; fi
+
rm -rf $tmpdir
trap - EXIT ERR
--
1.7.9
12 years, 10 months
[PATCH] test-user-cancel: Add \n to fprintf error messages.
by Richard W.M. Jones
From: "Richard W.M. Jones" <rjones(a)redhat.com>
---
tests/c-api/test-user-cancel.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tests/c-api/test-user-cancel.c b/tests/c-api/test-user-cancel.c
index 0cc049a..4908f95 100644
--- a/tests/c-api/test-user-cancel.c
+++ b/tests/c-api/test-user-cancel.c
@@ -143,7 +143,7 @@ main (int argc, char *argv[])
/* Create the test thread. */
r = pthread_create (&test_thread, NULL, start_test_thread, &data);
if (r != 0) {
- fprintf (stderr, "pthread_create: %s", strerror (r));
+ fprintf (stderr, "pthread_create: %s\n", strerror (r));
exit (EXIT_FAILURE);
}
@@ -154,12 +154,12 @@ main (int argc, char *argv[])
/* Kill the test thread and clean up. */
r = pthread_cancel (test_thread);
if (r != 0) {
- fprintf (stderr, "pthread_cancel: %s", strerror (r));
+ fprintf (stderr, "pthread_cancel: %s\n", strerror (r));
exit (EXIT_FAILURE);
}
r = pthread_join (test_thread, NULL);
if (r != 0) {
- fprintf (stderr, "pthread_join: %s", strerror (r));
+ fprintf (stderr, "pthread_join: %s\n", strerror (r));
exit (EXIT_FAILURE);
}
@@ -204,7 +204,7 @@ main (int argc, char *argv[])
/* Create the test thread. */
r = pthread_create (&test_thread, NULL, start_test_thread, &data);
if (r != 0) {
- fprintf (stderr, "pthread_create: %s", strerror (r));
+ fprintf (stderr, "pthread_create: %s\n", strerror (r));
exit (EXIT_FAILURE);
}
@@ -215,12 +215,12 @@ main (int argc, char *argv[])
/* Kill the test thread and clean up. */
r = pthread_cancel (test_thread);
if (r != 0) {
- fprintf (stderr, "pthread_cancel: %s", strerror (r));
+ fprintf (stderr, "pthread_cancel: %s\n", strerror (r));
exit (EXIT_FAILURE);
}
r = pthread_join (test_thread, NULL);
if (r != 0) {
- fprintf (stderr, "pthread_join: %s", strerror (r));
+ fprintf (stderr, "pthread_join: %s\n", strerror (r));
exit (EXIT_FAILURE);
}
--
1.7.9
12 years, 10 months
[PATCH] daemon: Don't xdr_free uninitialized args struct on error paths.
by Richard W.M. Jones
From: "Richard W.M. Jones" <rjones(a)redhat.com>
For stubs of functions that had arguments, code did this:
static void
mount_stub (XDR *xdr_in)
{
int r;
struct guestfs_mount_args args;
if (optargs_bitmask != 0) {
//...
goto done;
}
// possibly other tests here
memset (&args, 0, sizeof args);
[...]
done:
xdr_free ((xdrproc_t) xdr_guestfs_mount_args, (char *) &args);
return;
}
This caused xdr_free to be called on uninitialized 'args' struct,
causing a segfault.
The fix is to add another label, so the code looks like:
static void
mount_stub (XDR *xdr_in)
{
int r;
struct guestfs_mount_args args;
if (optargs_bitmask != 0) {
//...
goto done_no_free;
}
// possibly other tests here
memset (&args, 0, sizeof args);
[...]
done:
xdr_free ((xdrproc_t) xdr_guestfs_mount_args, (char *) &args);
done_no_free:
return;
}
This fixes commit 330fbea5b2d6bd7db84f7ea7afe87cf1bcd438e0
and commit 0344248af55802bbbd816b349ec1ba9305996f6e.
---
generator/generator_daemon.ml | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/generator/generator_daemon.ml b/generator/generator_daemon.ml
index 0eb2446..8c96061 100644
--- a/generator/generator_daemon.ml
+++ b/generator/generator_daemon.ml
@@ -136,7 +136,7 @@ and generate_daemon_actions () =
pr " \"build of libguestfs. Read 'AVAILABILITY' in the guestfs(3) man page for\\n\"\n";
pr " \"how to check for the availability of features.\",\n";
pr " \"%s\");\n" group;
- pr " goto done;\n";
+ pr " goto done_no_free;\n";
pr " }\n";
pr "\n"
| _ -> ()
@@ -154,14 +154,14 @@ and generate_daemon_actions () =
if is_filein then
pr " cancel_receive ();\n";
pr " reply_with_error (\"unknown option in optional arguments bitmask (this can happen if a program is compiled against a newer version of libguestfs, then run against an older version of the daemon)\");\n";
- pr " goto done;\n";
+ pr " goto done_no_free;\n";
pr " }\n";
) else (
pr " if (optargs_bitmask != 0) {\n";
if is_filein then
pr " cancel_receive ();\n";
pr " reply_with_error (\"header optargs_bitmask field must be passed as 0 for calls that don't take optional arguments\");\n";
- pr " goto done;\n";
+ pr " goto done_no_free;\n";
pr " }\n";
);
pr "\n";
@@ -339,6 +339,7 @@ and generate_daemon_actions () =
pr " xdr_free ((xdrproc_t) xdr_guestfs_%s_args, (char *) &args);\n"
name
);
+ pr "done_no_free:\n";
pr " return;\n";
pr "}\n\n";
) daemon_functions;
--
1.7.9
12 years, 10 months
[PATCH] Eliminate duplicate entries from package list
by Hilko Bengen
"apt-cache depends --recurse -i ..." on Ubuntu 12.04 (apt
0.8.16~exp12ubuntu3) outputs duplicate entries which broke the code
that checks whether all package files have been successfully
downloaded. I am not sure if this is a bug in apt.
---
src/febootstrap_debian.ml | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/febootstrap_debian.ml b/src/febootstrap_debian.ml
index 8d0f75f..d1ee8ab 100644
--- a/src/febootstrap_debian.ml
+++ b/src/febootstrap_debian.ml
@@ -53,7 +53,7 @@ let rec debian_resolve_dependencies_and_download names =
if Config.apt_cache_depends_recurse_broken then
workaround_broken_apt_cache_depends_recurse (sort_uniq pkgs)
else
- pkgs in
+ sort_uniq pkgs in
(* Exclude packages matching [--exclude] regexps on the command line. *)
let pkgs =
--
1.7.9
12 years, 10 months
[PATCH] Do not run test-virt-format.sh if appliance has not been built
by Hilko Bengen
---
format/Makefile.am | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/format/Makefile.am b/format/Makefile.am
index 0d1b28e..1dc8f14 100644
--- a/format/Makefile.am
+++ b/format/Makefile.am
@@ -74,4 +74,6 @@ TESTS_ENVIRONMENT = \
MALLOC_PERTURB_=$(random_val) \
$(top_builddir)/run
+if ENABLE_APPLIANCE
TESTS = test-virt-format.sh
+endif ENABLE_APPLIANCE
--
1.7.9
12 years, 10 months