Strange libtool problem
by Richard W.M. Jones
I'm not sure if this is related to me updating to gcc 4.6.0 or not,
but in the gnulib/lib directory I get an error which comes down to the
following libtool command running:
$ ../../libtool --tag=CC --mode=compile gcc -std=gnu99 -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -g -O2 -MT c-ctype.lo -MD -MP -MF .deps/c-ctype.Tpo -c -o c-ctype.lo c-ctype.c
../../libtool: line 2075: c-ctype.c: command not found
libtool: compile: gcc -std=gnu99 -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -g -O2 -MT c-ctype.lo -MD -MP -MF .deps/c-ctype.Tpo -c "" -fPIC -DPIC -o .libs/c-ctype.o
gcc: error: : No such file or directory
gcc: fatal error: no input files
compilation terminated.
Note how the -c option is converted to -c "". Also the error
"c-ctype.c: command not found" which comes from a function very deep
in libtool which is called from all over the place.
I've tried recreating libtool, but to no effect.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
13 years, 5 months
Re: [Libguestfs] Guestfish errors (Running in VirtualBox)
by Richard W.M. Jones
[Please keep messages on the list]
On Thu, Apr 07, 2011 at 09:28:39AM -0700, Chris Willmore wrote:
> You were correct that I used the wrong insmod.static. I downloaded the 32bit and rebuilt.
> liguestfs-test-tool is still failing, albeit for a different reason.
>
> I'm running Ubuntu 10.10, Kernel 2.6.36
>
> Following my message is the new output.
>
> Many thanks for your help.
>
> -Chris
>
> new guestfs handle 0x83f8958
> ===== Test starts here =====
> LIBGUESTFS_DEBUG=1
> library version: 1.8.4
> guestfs_get_append: (null)
> guestfs_get_autosync: 1
> guestfs_get_memsize: 500
> guestfs_get_path: /usr/local/lib/guestfs
> guestfs_get_qemu: /usr/bin/kvm
> guestfs_get_verbose: 1
> Launching appliance, timeout set to 120 seconds.
> [00000ms] febootstrap-supermin-helper --verbose -f checksum '/usr/local/lib/guestfs/supermin.d' i686
> supermin helper [00000ms] whitelist = (not specified), host_cpu = i686, kernel = (null), initrd = (null), appliance = (null)
> supermin helper [00001ms] inputs[0] = /usr/local/lib/guestfs/supermin.d
> checking modpath /lib/modules/2.6.32-24-generic is a directory
> picked vmlinuz-2.6.32-24-generic because modpath /lib/modules/2.6.32-24-generic exists
> checking modpath /lib/modules/2.6.36-020636-generic is a directory
> picked vmlinuz-2.6.36-020636-generic because modpath /lib/modules/2.6.36-020636-generic exists
> supermin helper [00002ms] finished creating kernel
> supermin helper [00004ms] visiting /usr/local/lib/guestfs/supermin.d
> supermin helper [00005ms] visiting /usr/local/lib/guestfs/supermin.d/base.img
> supermin helper [00005ms] visiting /usr/local/lib/guestfs/supermin.d/daemon.img
> supermin helper [00005ms] visiting /usr/local/lib/guestfs/supermin.d/hostfiles
> supermin helper [00093ms] visiting /usr/local/lib/guestfs/supermin.d/init.img
> supermin helper [00312ms] finished creating appliance
> [00340ms] begin testing qemu features
> [00474ms] finished testing qemu features
> /dev/kvm: No such file or directory
> accept_from_daemon: 0x83f8958 g->state = 1
> [00486ms] /usr/bin/kvm \
> -drive file=/tmp/libguestfs-test-tool-sda-jlHPvW,cache=off,format=raw,if=virtio \
> -drive file=/tmp/libguestfs-test-tool-iso-vfywgp,snapshot=on,format=raw,if=virtio \
> -nodefconfig \
> -nodefaults \
> -nographic \
> -m 500 \
> -no-reboot \
> -no-hpet \
> -device virtio-serial \
> -serial stdio \
> -chardev socket,path=/tmp/libguestfsRmtgLt/guestfsd.sock,id=channel0 \
> -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \
> -kernel /tmp/.guestfs-1001/kernel.3907 \
> -initrd /tmp/.guestfs-1001/initrd.3907 \
> -append 'panic=1 console=ttyS0 udevtimeout=300 noapic acpi=off printk.time=1 cgroup_disable=memory selinux=0 guestfs_verbose=1 TERM=xterm ' \
> -drive file=/tmp/.guestfs-1001/root.3907,snapshot=on,if=virtio,cache=unsafe
> recv_from_daemon: 0x83f8958 g->state = 1, size_rtn = 0xbf81eabc, buf_rtn = 0xbf81eab8
> open /dev/kvm: No such file or directory
> Could not initialize KVM, will disable KVM support
> [ 0.000000] Initializing cgroup subsys cpuset
> [ 0.000000] Initializing cgroup subsys cpu
> [ 0.000000] Linux version 2.6.36-020636-generic (root@zinc) (gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)) #201010210905 SMP Thu Oct 21 10:17:53 UTC 2010
> [ 0.000000] BIOS-provided physical RAM map:
> [ 0.000000] BIOS-e820: 0000000000000000 - 000000000009f400 (usable)
> [ 0.000000] BIOS-e820: 000000000009f400 - 00000000000a0000 (reserved)
> [ 0.000000] BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
> [ 0.000000] BIOS-e820: 0000000000100000 - 000000001f3fd000 (usable)
> [ 0.000000] BIOS-e820: 000000001f3fd000 - 000000001f400000 (reserved)
> [ 0.000000] BIOS-e820: 00000000fffc0000 - 0000000100000000 (reserved)
> [ 0.000000] Notice: NX (Execute Disable) protection cannot be enabled: non-PAE kernel!
> [ 0.000000] DMI 2.4 present.
> [ 0.000000] last_pfn = 0x1f3fd max_arch_pfn = 0x100000
> [ 0.000000] x86 PAT enabled: cpu 0, old 0x0, new 0x7010600070106
> [ 0.000000] Scanning 1 areas for low memory corruption
> [ 0.000000] modified physical RAM map:
> [ 0.000000] modified: 0000000000000000 - 0000000000001000 (reserved)
> [ 0.000000] modified: 0000000000001000 - 0000000000002000 (usable)
> [ 0.000000] modified: 0000000000002000 - 0000000000010000 (reserved)
> [ 0.000000] modified: 0000000000010000 - 000000000009f400 (usable)
> [ 0.000000] modified: 000000000009f400 - 00000000000a0000 (reserved)
> [ 0.000000] modified: 00000000000f0000 - 0000000000100000 (reserved)
> [ 0.000000] modified: 0000000000100000 - 000000001f3fd000 (usable)
> [ 0.000000] modified: 000000001f3fd000 - 000000001f400000 (reserved)
> [ 0.000000] modified: 00000000fffc0000 - 0000000100000000 (reserved)
> [ 0.000000] found SMP MP-table at [c00f8990] f8990
> [ 0.000000] init_memory_mapping: 0000000000000000-000000001f3fd000
> [ 0.000000] RAMDISK: 1f27f000 - 1f3f0000
> [ 0.000000] 0MB HIGHMEM available.
> [ 0.000000] 499MB LOWMEM available.
> [ 0.000000] mapped low ram: 0 - 1f3fd000
> [ 0.000000] low ram: 0 - 1f3fd000
> [ 0.000000] Zone PFN ranges:
> [ 0.000000] DMA 0x00000001 -> 0x00001000
> [ 0.000000] Normal 0x00001000 -> 0x0001f3fd
> [ 0.000000] HighMem empty
> [ 0.000000] Movable zone start PFN for each node
> [ 0.000000] early_node_map[3] active PFN ranges
> [ 0.000000] 0: 0x00000001 -> 0x00000002
> [ 0.000000] 0: 0x00000010 -> 0x0000009f
> [ 0.000000] 0: 0x00000100 -> 0x0001f3fd
> [ 0.000000] Using APIC driver default
> [ 0.000000] SFI: Simple Firmware Interface v0.81 http://simplefirmware.org
> [ 0.000000] Intel MultiProcessor Specification v1.4
> [ 0.000000] Virtual Wire compatibility mode.
> [ 0.000000] MPTABLE: OEM ID: BOCHSCPU
> [ 0.000000] MPTABLE: Product ID: 0.1
> [ 0.000000] MPTABLE: APIC at: 0xFEE00000
> [ 0.000000] Processor #0 (Bootup-CPU)
> [ 0.000000] I/O APIC #1 Version 17 at 0xFEC00000.
> [ 0.000000] IOAPIC[0]: apic_id 1, version 17, address 0xfec00000, GSI 0-23
> [ 0.000000] Processors: 1
> [ 0.000000] SMP: Allowing 1 CPUs, 0 hotplug CPUs
> [ 0.000000] PM: Registered nosave memory: 0000000000002000 - 0000000000010000
> [ 0.000000] PM: Registered nosave memory: 000000000009f000 - 00000000000a0000
> [ 0.000000] PM: Registered nosave memory: 00000000000a0000 - 00000000000f0000
> [ 0.000000] PM: Registered nosave memory: 00000000000f0000 - 0000000000100000
> [ 0.000000] Allocating PCI resources starting at 1f400000 (gap: 1f400000:e0bc0000)
> [ 0.000000] Booting paravirtualized kernel on bare hardware
> [ 0.000000] setup_percpu: NR_CPUS:8 nr_cpumask_bits:8 nr_cpu_ids:1 nr_node_ids:1
> [ 0.000000] PERCPU: Embedded 14 pages/cpu @c1400000 s32896 r0 d24448 u4194304
> [ 0.000000] pcpu-alloc: s32896 r0 d24448 u4194304 alloc=1*4194304
> [ 0.000000] pcpu-alloc: [0] 0
> [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 126885
> [ 0.000000] Kernel command line: panic=1 console=ttyS0 udevtimeout=300 noapic acpi=off printk.time=1 cgroup_disable=memory selinux=0 guestfs_verbose=1 TERM=xterm
> [ 0.000000] Disabling memory control group subsystem
> [ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
> [ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
> [ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
> [ 0.000000] Enabling fast FPU save and restore... done.
> [ 0.000000] Enabling unmasked SIMD FPU exception support... done.
> [ 0.000000] Initializing CPU#0
> [ 0.000000] Subtract (40 early reservations)
> [ 0.000000] #1 [0000001000 - 0000002000] EX TRAMPOLINE
> [ 0.000000] #2 [0000100000 - 00009d5824] TEXT DATA BSS
> [ 0.000000] #3 [001f27f000 - 001f3f0000] RAMDISK
> [ 0.000000] #4 [00009d6000 - 00009d9049] BRK
> [ 0.000000] #5 [000009f400 - 00000f8990] BIOS reserved
> [ 0.000000] #6 [00000f8990 - 00000f89a0] MP-table mpf
> [ 0.000000] #7 [00000f8a90 - 0000100000] BIOS reserved
> [ 0.000000] #8 [00000f89a0 - 00000f8a90] MP-table mpc
> [ 0.000000] #9 [0000010000 - 0000011000] TRAMPOLINE
> [ 0.000000] #10 [0000011000 - 0000015000] ACPI WAKEUP
> [ 0.000000] #11 [0000015000 - 0000016000] PGTABLE
> [ 0.000000] #12 [0001000000 - 0001001000] BOOTMEM
> [ 0.000000] #13 [0001001000 - 00013e9000] BOOTMEM
> [ 0.000000] #14 [00013e9000 - 00013e9004] BOOTMEM
> [ 0.000000] #15 [00013e9040 - 00013e9100] BOOTMEM
> [ 0.000000] #16 [00013e9100 - 00013e9130] BOOTMEM
> [ 0.000000] #17 [00013e9140 - 00013ea940] BOOTMEM
> [ 0.000000] #18 [00013ea940 - 00013ea967] BOOTMEM
> [ 0.000000] #19 [00013ea980 - 00013eaa7c] BOOTMEM
> [ 0.000000] #20 [00013eaa80 - 00013eaac0] BOOTMEM
> [ 0.000000] #21 [00013eaac0 - 00013eab00] BOOTMEM
> [ 0.000000] #22 [00013eab00 - 00013eab40] BOOTMEM
> [ 0.000000] #23 [00013eab40 - 00013eab80] BOOTMEM
> [ 0.000000] #24 [00013eab80 - 00013eabc0] BOOTMEM
> [ 0.000000] #25 [00013eabc0 - 00013eac00] BOOTMEM
> [ 0.000000] #26 [00013eac00 - 00013eac10] BOOTMEM
> [ 0.000000] #27 [00013eac40 - 00013eac50] BOOTMEM
> [ 0.000000] #28 [00013eac80 - 00013ead02] BOOTMEM
> [ 0.000000] #29 [00013ead40 - 00013eadc2] BOOTMEM
> [ 0.000000] #30 [0001400000 - 000140e000] BOOTMEM
> [ 0.000000] #31 [00013ece00 - 00013ece04] BOOTMEM
> [ 0.000000] #32 [00013ece40 - 00013ece44] BOOTMEM
> [ 0.000000] #33 [00013ece80 - 00013ece84] BOOTMEM
> [ 0.000000] #34 [00013ecec0 - 00013ecec4] BOOTMEM
> [ 0.000000] #35 [00013ecf00 - 00013ecfb0] BOOTMEM
> [ 0.000000] #36 [00013ecfc0 - 00013ed068] BOOTMEM
> [ 0.000000] #37 [00013eae00 - 00013ece00] BOOTMEM
> [ 0.000000] #38 [000140e000 - 000144e000] BOOTMEM
> [ 0.000000] #39 [000144e000 - 000146e000] BOOTMEM
> [ 0.000000] Initializing HighMem for node 0 (00000000:00000000)
> [ 0.000000] Memory: 496508k/511988k available (5000k kernel code, 15032k reserved, 2406k data, 740k init, 0k highmem)
> [ 0.000000] virtual kernel memory layout:
> [ 0.000000] fixmap : 0xfff16000 - 0xfffff000 ( 932 kB)
> [ 0.000000] pkmap : 0xff800000 - 0xffc00000 (4096 kB)
> [ 0.000000] vmalloc : 0xdfbfd000 - 0xff7fe000 ( 508 MB)
> [ 0.000000] lowmem : 0xc0000000 - 0xdf3fd000 ( 499 MB)
> [ 0.000000] .init : 0xc083c000 - 0xc08f5000 ( 740 kB)
> [ 0.000000] .data : 0xc05e2039 - 0xc083bb28 (2406 kB)
> [ 0.000000] .text : 0xc0100000 - 0xc05e2039 (5000 kB)
> [ 0.000000] Checking if this processor honours the WP bit even in supervisor mode...Ok.
> [ 0.000000] SLUB: Genslabs=13, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
> [ 0.000000] Hierarchical RCU implementation.
> [ 0.000000] RCU dyntick-idle grace-period acceleration is enabled.
> [ 0.000000] RCU-based detection of stalled CPUs is disabled.
> [ 0.000000] Verbose stalled-CPUs detection is disabled.
> [ 0.000000] NR_IRQS:2304 nr_irqs:256
> [ 0.000000] Console: colour dummy device 80x25
> [ 0.000000] console [ttyS0] enabled
> [ 0.000000] Fast TSC calibration failed
> [ 0.000000] TSC: Unable to calibrate against PIT
> [ 0.000000] TSC: No reference (HPET/PMTIMER) available
> [ 0.000000] Marking TSC unstable due to could not calculate TSC khz
> [ 0.036000] Calibrating delay loop... 189.44 BogoMIPS (lpj=378880)
> [ 0.116000] pid_max: default: 32768 minimum: 301
> [ 0.120000] Security Framework initialized
> [ 0.128000] AppArmor: AppArmor initialized
> [ 0.136000] Mount-cache hash table entries: 512
> [ 0.152000] Initializing cgroup subsys ns
> [ 0.156000] Initializing cgroup subsys cpuacct
> [ 0.160000] Initializing cgroup subsys memory
> [ 0.164000] Initializing cgroup subsys devices
> [ 0.168000] Initializing cgroup subsys freezer
> [ 0.168000] Initializing cgroup subsys net_cls
> [ 0.172000] mce: CPU supports 10 MCE banks
> [ 0.180000] Performance Events: AMD PMU driver.
> [ 0.184000] ... version: 0
> [ 0.188000] ... bit width: 48
> [ 0.192000] ... generic registers: 4
> [ 0.192000] ... value mask: 0000ffffffffffff
> [ 0.196000] ... max period: 00007fffffffffff
> [ 0.200000] ... fixed-purpose events: 0
> [ 0.200000] ... event mask: 000000000000000f
> [ 0.220000] SMP alternatives: switching to UP code
> [ 0.376000] Freeing SMP alternatives: 20k freed
> [ 0.380000] ftrace: converting mcount calls to 0f 1f 44 00 00
> [ 0.384000] ftrace: allocating 26011 entries in 51 pages
> [ 0.420000] Enabling APIC mode: Flat. Using 1 I/O APICs
> [ 0.428000] ------------[ cut here ]------------
> [ 0.428000] WARNING: at /home/kernel-ppa/COD/linux/arch/x86/kernel/apic/apic.c:1238 setup_local_APIC+0x3a5/0x3e0()
> [ 0.432000] Hardware name: Bochs
> [ 0.432000] Modules linked in:
> [ 0.432000] Pid: 1, comm: swapper Not tainted 2.6.36-020636-generic #201010210905
> [ 0.436000] Call Trace:
> [ 0.436000] [<c05d5ab5>] ? setup_local_APIC+0x3a5/0x3e0
> [ 0.440000] [<c014e4e1>] warn_slowpath_common+0x81/0xa0
> [ 0.440000] [<c05d5ab5>] ? setup_local_APIC+0x3a5/0x3e0
> [ 0.444000] [<c014e522>] warn_slowpath_null+0x22/0x30
> [ 0.444000] [<c05d5ab5>] setup_local_APIC+0x3a5/0x3e0
> [ 0.448000] [<c084abb3>] native_smp_prepare_cpus+0x123/0x210
> [ 0.448000] [<c0141f9e>] ? set_cpus_allowed_ptr+0x8e/0x120
> [ 0.452000] [<c0102c46>] ? ret_from_fork+0x6/0x1c
> [ 0.452000] [<c083cbb3>] kernel_init+0x63/0x110
> [ 0.456000] [<c083cb50>] ? kernel_init+0x0/0x110
> [ 0.456000] [<c010327e>] kernel_thread_helper+0x6/0x10
> [ 0.460000] ---[ end trace a7919e7f17c0a725 ]---
> [ 0.464000] CPU0: AMD QEMU Virtual CPU version 0.14.0 stepping 03
> [ 0.604000] APIC timer disabled due to verification failure
> [ 0.628000] Brought up 1 CPUs
> [ 0.632000] Total of 1 processors activated (189.44 BogoMIPS).
> [ 0.648000] devtmpfs: initialized
> [ 0.676000] regulator: core version 0.5
> [ 0.676000] Time: 16:16:07 Date: 04/07/11
> [ 0.680000] NET: Registered protocol family 16
> [ 0.692000] EISA bus registered
> [ 0.708000] PCI: PCI BIOS revision 2.10 entry at 0xffe77, last bus=0
> [ 0.712000] PCI: Using configuration type 1 for base access
> [ 0.744000] bio: create slab <bio-0> at 0
> [ 0.752000] ACPI: Interpreter disabled.
> [ 0.764000] vgaarb: loaded
> [ 0.768000] SCSI subsystem initialized
> [ 0.776000] usbcore: registered new interface driver usbfs
> [ 0.780000] usbcore: registered new interface driver hub
> [ 0.784000] usbcore: registered new device driver usb
> [ 0.792000] PCI: Probing PCI hardware
> [ 0.800000] pci 0000:00:01.3: quirk: [io 0xb000-0xb03f] claimed by PIIX4 ACPI
> [ 0.804000] pci 0000:00:01.3: quirk: [io 0xb100-0xb10f] claimed by PIIX4 SMB
> [ 0.820000] pci 0000:00:01.0: PIIX/ICH IRQ router [8086:7000]
> [ 0.836000] NetLabel: Initializing
> [ 0.840000] NetLabel: domain hash size = 128
> [ 0.840000] NetLabel: protocols = UNLABELED CIPSOv4
> [ 0.844000] NetLabel: unlabeled traffic allowed by default
> [ 0.848000] Switching to clocksource pit
> [ 0.990649] AppArmor: AppArmor Filesystem Enabled
> [ 0.993292] pnp: PnP ACPI: disabled
> [ 0.993292] PnPBIOS: Scanning system for PnP BIOS support...
> [ 0.998110] PnPBIOS: Found PnP BIOS installation structure at 0xc00f7e40
> [ 1.002220] PnPBIOS: PnP BIOS version 1.0, entry 0xf0000:0xdf15, dseg 0xf0000
> [ 1.005063] PnPBIOS: dev_node_info: function not supported on this system
> [ 1.009470] PnPBIOS: Unable to get node info. Aborting.
> [ 1.036554] NET: Registered protocol family 2
> [ 1.042298] IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
> [ 1.044495] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
> [ 1.049938] TCP bind hash table entries: 16384 (order: 5, 131072 bytes)
> [ 1.054419] TCP: Hash tables configured (established 16384 bind 16384)
> [ 1.058710] TCP reno registered
> [ 1.060223] UDP hash table entries: 256 (order: 1, 8192 bytes)
> [ 1.060223] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
> [ 1.065855] NET: Registered protocol family 1
> [ 1.069301] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
> [ 1.072630] pci 0000:00:01.0: PIIX3: Enabling Passive Release
> [ 1.072630] pci 0000:00:01.0: Activating ISA DMA hang workarounds
> [ 1.079986] Trying to unpack rootfs image as initramfs...
> [ 1.116031] Freeing initrd memory: 1476k freed
> [ 1.133397] platform rtc_cmos: registered platform RTC device (no PNP device found)
> [ 1.142109] cpufreq-nforce2: No nForce2 chipset.
> [ 1.146561] Scanning for low memory corruption every 60 seconds
> [ 1.156734] audit: initializing netlink socket (disabled)
> [ 1.162547] type=2000 audit(1302192966.160:1): initialized
> [ 1.252406] HugeTLB registered 4 MB page size, pre-allocated 0 pages
> [ 1.293490] VFS: Disk quotas dquot_6.5.2
> [ 1.296587] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
> [ 1.317600] fuse init (API version 7.15)
> [ 1.321113] msgmni has been set to 972
> [ 1.336571] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
> [ 1.336571] io scheduler noop registered
> [ 1.342506] io scheduler deadline registered
> [ 1.344975] io scheduler cfq registered (default)
> [ 1.350014] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
> [ 1.353752] pciehp: PCI Express Hot Plug Controller Driver version: 0.4
> [ 1.362976] isapnp: Scanning for PnP cards...
> [ 1.667788] isapnp: No Plug & Play device found
> [ 1.681862] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
> [ 1.691968] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
> [ 1.724339] brd: module loaded
> [ 1.743754] loop: module loaded
> [ 1.761855] scsi0 : ata_piix
> [ 1.764239] scsi1 : ata_piix
> [ 1.768823] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc000 irq 14
> [ 1.772970] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc008 irq 15
> [ 1.792319] Fixed MDIO Bus: probed
> [ 1.797813] PPP generic driver version 2.4.2
> [ 1.800967] tun: Universal TUN/TAP device driver, 1.6
> [ 1.803961] tun: (C) 1999-2004 Max Krasnyansky <maxk(a)qualcomm.com>
> [ 1.808018] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
> [ 1.812043] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
> [ 1.812043] uhci_hcd: USB Universal Host Controller Interface driver
> [ 1.817674] PNP: No PS/2 controller found. Probing ports directly.
> [ 1.824656] serio: i8042 KBD port at 0x60,0x64 irq 1
> [ 1.831568] serio: i8042 AUX port at 0x60,0x64 irq 12
> [ 1.844840] mice: PS/2 mouse device common for all mice
> [ 1.855215] rtc_cmos rtc_cmos: rtc core: registered rtc_cmos as rtc0
> [ 1.856031] rtc0: alarms up to one day, 114 bytes nvram
> [ 1.860054] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input0
> [ 1.865561] device-mapper: uevent: version 1.0.3
> [ 1.875099] device-mapper: ioctl: 4.18.0-ioctl (2010-06-29) initialised: dm-devel(a)redhat.com
> [ 1.879989] device-mapper: multipath: version 1.1.1 loaded
> [ 1.879989] device-mapper: multipath round-robin: version 1.0.0 loaded
> [ 1.886656] EISA: Probing bus 0 at eisa.0
> [ 1.888147] EISA: Detected 0 cards.
> [ 1.894867] cpuidle: using governor ladder
> [ 1.899180] cpuidle: using governor menu
> [ 1.901110] TCP cubic registered
> [ 1.904569] NET: Registered protocol family 10
> [ 1.912671] lo: Disabled Privacy Extensions
> [ 1.921463] NET: Registered protocol family 17
> [ 1.921463] Registering the dns_resolver key type
> [ 1.926794] powernow-k8: Processor cpuid 623 not supported
> [ 1.931206] Using IPI No-Shortcut mode
> [ 1.933182] registered taskstats version 1
> [ 1.937290] Magic number: 7:927:286
> [ 1.941274] ppp ppp: hash matches
> [ 1.941274] rtc_cmos rtc_cmos: setting system clock to 2011-04-07 16:16:08 UTC (1302192968)
> [ 1.945936] BIOS EDD facility v0.16 2004-Jun-25, 0 devices found
> [ 1.948365] EDD information not available.
> [ 1.955560] Freeing unused kernel memory: 740k freed
> [ 1.988242] Write protecting the kernel text: 5004k
> [ 1.993050] Write protecting the kernel read-only data: 2048k
> /proc/uptime: No such file or directory
> febootstrap: ext2 mini initrd starting up
> febootstrap: mounting /sys
> febootstrap: insmod crc-ccitt.ko
> febootstrap: insmod crc-itu-t.ko
> febootstrap: insmod crc32c-intel.ko
> insmod: error inserting 'crc32c-intel.ko': -1 No such device
> insmod: wait: File exists
> febootstrap: insmod crc32c.ko
> febootstrap: insmod crc7.ko
> febootstrap: insmod libcrc32c.ko
> febootstrap: insmod scsi_transport_spi.ko
> febootstrap: insmod virtio.ko
> febootstrap: insmod virtio_ring.ko
> febootstrap: insmod sym53c8xx.ko
> febootstrap: insmod virtio_pci.ko
> [ 2.467270] virtio-pci 0000:00:02.0: found PCI INT A -> IRQ 10
> [ 2.474949] virtio-pci 0000:00:03.0: found PCI INT A -> IRQ 11
> [ 2.477428] virtio-pci 0000:00:04.0: found PCI INT A -> IRQ 11
> [ 2.480629] virtio-pci 0000:00:05.0: found PCI INT A -> IRQ 10
> febootstrap: insmod virtio-rng.ko
> febootstrap: insmod virtio_net.ko
> febootstrap: insmod virtio_blk.ko
> [ 2.766849] vda: unknown partition table
> [ 2.792232] vdb: unknown partition table
> [ 2.803233] vdc: unknown partition table
> febootstrap: insmod virtio_console.ko
> febootstrap: insmod virtio_balloon.ko
> febootstrap: picked /sys/block/vdc/dev as root device
> febootstrap: creating /dev/root as block special 251:32
> febootstrap: mounting new root on /root
> febootstrap: chroot
> /proc/uptime: No such file or directory
> execl: /init: No such file or directory
It all looks perfect up to this last line.
I've seen this error before somewhere, but for the life of me I can't
exactly remember what caused it.
Is this a standard Ubuntu kernel? Does this kernel have ext2 compiled
in directly or as a module?
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/
13 years, 5 months
Re: [Libguestfs] running libguestfs as a service?
by Richard W.M. Jones
On Sat, Apr 30, 2011 at 01:10:57AM -0400, T Johnson wrote:
> Thanks for responding. I'm by no means a python expert so I could very
> well be doing something wrong, but I've been playing a bit with what
> you've suggested and noted a few interesting things.
>
> 1) As soon as I create 'g', something seems to take over stderr and
> stdout so I can no longer print debugging output like you suggested.
This is very odd. AFAIK nothing in libguestfs should affect stdout or
stderr.
When you say "create 'g'" do you mean "g = guestfs.GuestFS()" (ie.
create the handle) or "g.launch ()" (ie. launch the subprocess)? I
guess it is possible that something in g.launch (ie. forking off a
subprocess) might affect stdout/stderr, although we use it in an awful
lot of other programs and no one has noticed anything before.
Here's my test program:
----------------------------------------------------------------------
#!/usr/bin/python
import sys
import guestfs
print >> sys.stderr, "creating the handle"
g = guestfs.GuestFS()
print >> sys.stderr, "add_drive_ro"
g.add_drive_ro ("/dev/null")
print >> sys.stderr, "launch"
g.launch ()
print >> sys.stderr, "set_verbose"
g.set_verbose (1)
print >> sys.stderr, "delete the handle"
#g.close ()
del g
print >> sys.stderr, "finished"
----------------------------------------------------------------------
BTW you can't directly call g.close() from Python because that method
is not exposed (instead, it is called implicitly when you delete g).
So your program ought to be throwing an exception when you try to call
g.close(). I'm not sure why you are not seeing that.
You're not trying to create the underlying libguestfsmod objects
directly? Don't do that.
Here is the output from my test program:
----------------------------------------------------------------------
creating the handle
add_drive_ro
launch
set_verbose
delete the handle
libguestfs: closing guestfs handle 0x25106a0 (state 2)
libguestfs: send_to_daemon: 44 bytes: 00 00 00 28 | 20 00 f5 f5 | 00 00 00 04 | 00 00 01 1a | 00 00 00 00 | ...
libguestfs: recv_from_daemon: 40 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 01 1a | 00 00 00 01 | 00 12 34 00 | ...
libguestfs: sending SIGTERM to process 13874
finished
----------------------------------------------------------------------
As you can see it's completely as expected
(python-libguestfs-1.11.3-1.fc16.x86_64).
> 2) (I assume) because of #1, g.set_verbose(1) results in no output to
> stdout/stderr either, so it hasn't been helpful so far.
>
> 3) However, I then decided to try g.set_trace(1) and that does provide
> output. In the example I provided before I get this (editing config
> settings in /etc/sysconfig/network):
Unfortunately (because of a bug) closing the handle does not result
in any trace output, except ...
> libguestfs: trace: add_drive "/mnt/images/test_server.img"
> libguestfs: trace: add_drive = 0
> libguestfs: trace: launch
> libguestfs: trace: launch = 0
> libguestfs: trace: mount "/dev/vda1" "/"
> libguestfs: trace: mount = 0
> libguestfs: trace: write "/etc/sysconfig/network" "..."
> libguestfs: trace: write = 0
>
> I can't seem to get any other ouput.. but it is very interesting that
> once I kill the process I see the remainder of the calls failing from
> trace output:
>
> libguestfs: trace: umount_all
> libguestfs: trace: umount_all = -1 (error)
> libguestfs: trace: sync
> libguestfs: trace: sync = -1 (error)
> libguestfs: trace: umount_all
> libguestfs: trace: umount_all = -1 (error)
> libguestfs: trace: sync
> libguestfs: trace: sync = -1 (error)
... when you close a handle which has autosync enabled, which is now
the default, you'll see output like this. It seems like all your
handles are getting closed at once. I have no idea why.
> So, I guess that is what's failing.. but I haven't been able to
> determine why yet.
>
> This is something I've been running into on much older versions of
> libguestfs all the way up to now which I'm trying your recent
> "1.7.17-17.el6" RPMs for rhel6.
Ah, so this could be RHEL 6.0? This could well be a RHEL 6.0 bug.
Definitely try out the RHEL 6.1 packages from:
http://people.redhat.com/~rjones/rhel6.1-libguestfs-preview/
You'll find a lot of things are better. It's much faster for one.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/
13 years, 6 months
running libguestfs as a service?
by T Johnson
Hello,
First off, many thanks for libguestfs... very useful!
I'm trying to run libguestfs as an RPC service by using a python
daemon with the python libguestfs bindings. With this service I'm
"centrally" editing VM images, and often running many GuestFS() on the
same image file in a short amount of time to edit the image's
contents.
The problem I'm running across is that each GuestFS() instance called
from within the python daemon doesn't terminate itself (until a
timeout much later?). I believe this sometimes causes my image edits
to clobber each other and corrupt the image now and then. Each image
edit usually amounts to:
g = guestfs.GuestFS()
g.add_drive(image_file)
g.launch()
g.mount("/dev/vda1", "/")
g.write(file_name, file_contents)
g.sync()
g.umount_all()
g.close()
del g
As I understand things, there is a reference count that should close
"g" once the reference count = 0. However, I can't seem to make that
happen inside of my python daemon which continues to run.
Any clues on how I might accomplish this or what I'm doing wrong?
Thanks
13 years, 6 months
[PATCH] hivex/python fix for i386 integer size issue
by Hilko Bengen
Hi,
While working on Debian packages of hivex 1.2.5, I came across a test
failure for the Python bindings with Python 2.7 on the i386
architecture. (The tests ran fine on amd64.)
,----
| $ make -C python check
| make[1]: Entering directory `/home/bengen/src/deb/hivex/hivex.git/python'
| 010-import.py
| 020-open.py
| 021-close.py
| 200-write.py
| python: hivex-py.c:52: get_handle: Assertion `obj' failed.
`----
I narrowed this down to hivex-py.c:py_hivex_node_add_child():
The call
,----
| PyArg_ParseTuple (args, (char *) "OLs:hivex_node_add_child",
| &py_h, &parent, &name)
`----
results in `py_h' set to NULL, though Python's documentation claims that
this cannot happen. I think this happens because `parent' is declared a
`long int', but "L" in the format string corresponds to a `long long'.
On amd64, they have the same size, but on i386 they don't, so the
PyObject pointer is written to the wrong address.
Please consider applying the patch below which just changes the format
string. After regenerating hivex-py.c, I have successfully tested the
1.2.5 code base on both architectures.
Cheers,
-Hilko
diff --git a/generator/generator.ml b/generator/generator.ml
index 7e706d1..9722312 100755
--- a/generator/generator.ml
+++ b/generator/generator.ml
@@ -2875,7 +2875,7 @@ put_val_type (char *val, size_t len, hive_type t)
pr "O"
| ANode n
| AValue n ->
- pr "L"
+ pr "l"
| AString n ->
pr "s"
| AStringNullable n ->
13 years, 6 months
Hivex java binding
by Michael Huang
Hi all,
Is there any Java binding patch exist for Hivex library? If not, any plan for a Java binding in near future?
Thanks,
Michael
13 years, 6 months
debian binaries using qemu
by Igor Serebryany
Hi,
I am using the libguestfs-1.11.0-1 binaries posted here:
http://libguestfs.org/download/binaries/debian-packages/
on a Sid system. When I use libguestfs, I can see that an instance
of QEMU is starting up using the binary @ /usr/bin/qemu-system-x86_64
I have KVM installed on the system at /usr/bin/kvm -- how do I
ensure that KVM gets used by libguestfs instead of qemu? I guess I
can always replace the qemu binary with a symlink to the kvm binary,
but that seems like a hack...
--Igor
13 years, 6 months
[PATCH] Don't set distro for non-Linux guests
by Matthew Booth
'distro' isn't used anywhere for Windows guests. However, if it's set, it's
required to be matched in virt-v2v.conf. Rather than have to update the config
again, just don't set it for Windows guests.
---
lib/Sys/VirtConvert/Converter.pm | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/Sys/VirtConvert/Converter.pm b/lib/Sys/VirtConvert/Converter.pm
index 28c57d5..6b9f8f9 100644
--- a/lib/Sys/VirtConvert/Converter.pm
+++ b/lib/Sys/VirtConvert/Converter.pm
@@ -102,7 +102,8 @@ sub convert
my %desc;
$desc{os} = $g->inspect_get_type($root);
- $desc{distro} = $g->inspect_get_distro($root);
+ $desc{distro} = $g->inspect_get_distro($root)
+ if $desc{os} eq 'linux';
$desc{product_name} = $g->inspect_get_product_name($root);
$desc{major_version} = $g->inspect_get_major_version($root);
$desc{minor_version} = $g->inspect_get_minor_version($root);
--
1.7.4.4
13 years, 6 months
[PATCH 1/7] Push $desc creation into Sys::VirtConvert::Converter->convert
by Matthew Booth
This change is part of an ongoing effort to remove use of $desc and inspect the
OS directly as required during conversion.
---
lib/Sys/VirtConvert/Connection/LibVirtTarget.pm | 4 +-
lib/Sys/VirtConvert/Connection/RHEVTarget.pm | 41 +++++++++---------
lib/Sys/VirtConvert/Converter.pm | 35 ++++++++++++----
lib/Sys/VirtConvert/Converter/RedHat.pm | 45 +++++++++++--------
lib/Sys/VirtConvert/Converter/Windows.pm | 10 +++-
p2v-server/virt-p2v-server.pl | 52 ++++-------------------
v2v/virt-v2v.pl | 49 ++++------------------
7 files changed, 99 insertions(+), 137 deletions(-)
diff --git a/lib/Sys/VirtConvert/Connection/LibVirtTarget.pm b/lib/Sys/VirtConvert/Connection/LibVirtTarget.pm
index a74f9df..b77ce1d 100644
--- a/lib/Sys/VirtConvert/Connection/LibVirtTarget.pm
+++ b/lib/Sys/VirtConvert/Connection/LibVirtTarget.pm
@@ -269,7 +269,7 @@ sub guest_exists
return 1;
}
-=item create_guest(desc, meta, config, guestcaps, output_name)
+=item create_guest(g, root, meta, config, guestcaps, output_name)
Create the guest in the target
@@ -278,7 +278,7 @@ Create the guest in the target
sub create_guest
{
my $self = shift;
- my ($desc, $meta, $config, $guestcaps, $output_name) = @_;
+ my (undef, undef, $meta, $config, $guestcaps, $output_name) = @_;
my $vmm = $self->{vmm};
diff --git a/lib/Sys/VirtConvert/Connection/RHEVTarget.pm b/lib/Sys/VirtConvert/Connection/RHEVTarget.pm
index 4ebdcb9..5f0fe47 100644
--- a/lib/Sys/VirtConvert/Connection/RHEVTarget.pm
+++ b/lib/Sys/VirtConvert/Connection/RHEVTarget.pm
@@ -605,7 +605,7 @@ sub guest_exists
return 0;
}
-=item create_guest(desc, meta, config, guestcaps, output_name)
+=item create_guest(g, root, meta, config, guestcaps, output_name)
Create the guest in the target
@@ -614,7 +614,7 @@ Create the guest in the target
sub create_guest
{
my $self = shift;
- my ($desc, $meta, $config, $guestcaps, $output_name) = @_;
+ my ($g, $root, $meta, $config, $guestcaps, $output_name) = @_;
# Get the number of virtual cpus
my $ncpus = $meta->{cpus};
@@ -627,7 +627,7 @@ sub create_guest
my $vmuuid = rhev_util::get_uuid();
- my $ostype = _get_os_type($desc);
+ my $ostype = _get_os_type($g, $root);
my $ovf = new XML::DOM::Parser->parse(<<EOF);
<ovf:Envelope
@@ -798,23 +798,24 @@ EOF
# one of the above values in case we're wrong.
sub _get_os_type
{
- my ($desc) = @_;
+ my ($g, $root) = @_;
+
+ my $arch = $g->inspect_get_arch($root);
my $arch_suffix = '';
- if ($desc->{arch} eq 'x86_64') {
+ if ($arch eq 'x86_64') {
$arch_suffix = 'x64';
- } elsif ($desc->{arch} ne 'i386') {
- logmsg WARN, __x('Unsupported architecture: {arch}',
- arch => $desc->{arch});
+ } elsif ($arch ne 'i386') {
+ logmsg WARN, __x('Unsupported architecture: {arch}', arch => $arch);
return undef;
}
my $type;
- $type = _get_os_type_linux($desc, $arch_suffix)
- if ($desc->{os} eq 'linux');
- $type = _get_os_type_windows($desc, $arch_suffix)
- if ($desc->{os} eq 'windows');
+ $type = _get_os_type_linux($g, $root, $arch_suffix)
+ if ($g->inspect_get_type($root) eq 'linux');
+ $type = _get_os_type_windows($g, $root, $arch_suffix)
+ if ($g->inspect_get_type($root) eq 'windows');
return 'Unassigned' if (!defined($type));
return $type;
@@ -822,11 +823,11 @@ sub _get_os_type
sub _get_os_type_windows
{
- my ($desc, $arch_suffix) = @_;
+ my ($g, $root, $arch_suffix) = @_;
- my $major = $desc->{major_version};
- my $minor = $desc->{minor_version};
- my $product = $desc->{product_name};
+ my $major = $g->inspect_get_major_version($root);
+ my $minor = $g->inspect_get_minor_version($root);
+ my $product = $g->inspect_get_product_name($root);
if ($major == 5) {
if ($minor == 1 ||
@@ -847,7 +848,7 @@ sub _get_os_type_windows
}
if ($major == 6 && $minor == 1) {
- if ($desc->{product_variant} eq 'Client') {
+ if ($g->inspect_get_product_variant($root) eq 'Client') {
return "Windows7".$arch_suffix;
}
@@ -861,10 +862,10 @@ sub _get_os_type_windows
sub _get_os_type_linux
{
- my ($desc, $arch_suffix) = @_;
+ my ($g, $root, $arch_suffix) = @_;
- my $distro = $desc->{distro};
- my $major = $desc->{major_version};
+ my $distro = $g->inspect_get_distro($root);
+ my $major = $g->inspect_get_major_version($root);
# XXX: RHEV 2.2 doesn't support a RHEL 6 target, however RHEV 2.3+ will.
# For the moment, we set RHEL 6 to be 'OtherLinux', however we will need to
diff --git a/lib/Sys/VirtConvert/Converter.pm b/lib/Sys/VirtConvert/Converter.pm
index cfee3da..28c57d5 100644
--- a/lib/Sys/VirtConvert/Converter.pm
+++ b/lib/Sys/VirtConvert/Converter.pm
@@ -40,7 +40,7 @@ Sys::VirtConvert::Converter - Convert a guest to run on KVM
use Sys::VirtConvert::Converter;
- Sys::VirtConvert::Converter->convert($g, $config, $desc, $meta);
+ Sys::VirtConvert::Converter->convert($g, $config, $root, $meta);
=head1 DESCRIPTION
@@ -51,7 +51,7 @@ guest OS, and uses it to convert the guest to run on KVM.
=over
-=item Sys::VirtConvert::Converter->convert(g, config, desc, meta)
+=item Sys::VirtConvert::Converter->convert(g, config, root, meta)
Instantiate an appropriate backend and call convert on it.
@@ -65,9 +65,9 @@ A libguestfs handle to the target.
An initialised Sys::VirtConvert::Config object.
-=item desc
+=item root
-The OS description (see virt-v2v.pl:inspect_guest).
+The root device of the os to be converted.
=item meta
@@ -81,18 +81,37 @@ sub convert
{
my $class = shift;
- my ($g, $config, $desc, $meta) = @_;
+ my ($g, $config, $root, $meta) = @_;
croak("convert called without g argument") unless defined($g);
croak("convert called without config argument") unless defined($config);
- croak("convert called without desc argument") unless defined($desc);
+ croak("convert called without root argument") unless defined($root);
croak("convert called without meta argument") unless defined($meta);
my $guestcaps;
+ # Mount up the disks.
+ my %fses = $g->inspect_get_mountpoints ($root);
+ my @fses = sort { length $a <=> length $b } keys %fses;
+ foreach (@fses) {
+ eval { $g->mount_options ("", $fses{$_}, $_) };
+ print __x("{e} (ignored)\n", e => $@) if $@;
+ }
+
+ # Construct the "$desc" hashref which contains the main features
+ # found by inspection.
+ my %desc;
+
+ $desc{os} = $g->inspect_get_type($root);
+ $desc{distro} = $g->inspect_get_distro($root);
+ $desc{product_name} = $g->inspect_get_product_name($root);
+ $desc{major_version} = $g->inspect_get_major_version($root);
+ $desc{minor_version} = $g->inspect_get_minor_version($root);
+ $desc{arch} = $g->inspect_get_arch($root);
+
# Find a module which can convert the guest and run it
foreach my $module ($class->modules()) {
- if($module->can_handle($desc)) {
- $guestcaps = $module->convert($g, $config, $desc, $meta);
+ if($module->can_handle(\%desc)) {
+ $guestcaps = $module->convert($g, $root, $config, \%desc, $meta);
last;
}
}
diff --git a/lib/Sys/VirtConvert/Converter/RedHat.pm b/lib/Sys/VirtConvert/Converter/RedHat.pm
index cd7bde1..8a6ff6b 100644
--- a/lib/Sys/VirtConvert/Converter/RedHat.pm
+++ b/lib/Sys/VirtConvert/Converter/RedHat.pm
@@ -68,7 +68,7 @@ sub can_handle
$desc->{distro} =~ /^(rhel|fedora)$/);
}
-=item Sys::VirtConvert::Converter::RedHat->convert(g, config, meta, desc)
+=item Sys::VirtConvert::Converter::RedHat->convert(g, root, config, meta, desc)
Convert a Red Hat based guest. Assume that can_handle has previously returned 1.
@@ -78,13 +78,17 @@ Convert a Red Hat based guest. Assume that can_handle has previously returned 1.
An initialised Sys::Guestfs handle
+=item root
+
+The root device of this operating system.
+
=item config
An initialised Sys::VirtConvert::Config
=item desc
-A description of the guest OS (see virt-v2v.pl:inspect_guest).
+A description of the guest OS (see Sys::VirtConvert::Converter->convert()).
=item meta
@@ -98,8 +102,9 @@ sub convert
{
my $class = shift;
- my ($g, $config, $desc, $meta) = @_;
+ my ($g, $root, $config, $desc, $meta) = @_;
croak("convert called without g argument") unless defined($g);
+ croak("convert called without root argument") unless defined($root);
croak("convert called without config argument") unless defined($config);
croak("convert called without desc argument") unless defined($desc);
croak("convert called without meta argument") unless defined($meta);
@@ -112,7 +117,7 @@ sub convert
# Un-configure HV specific attributes which don't require a direct
# replacement
- _unconfigure_hv($g, $desc);
+ _unconfigure_hv($g, $root, $desc);
# Try to install the virtio capability
my $virtio = _install_capability('virtio', $g, $config, $meta, $desc);
@@ -125,7 +130,7 @@ sub convert
_configure_display_driver($g);
_remap_block_devices($meta, $virtio, $g, $desc);
_configure_kernel_modules($g, $desc, $virtio, $modpath);
- _configure_boot($kernel, $virtio, $g, $desc);
+ _configure_boot($kernel, $virtio, $g, $root, $desc);
my %guestcaps;
@@ -850,18 +855,18 @@ sub _configure_kernel
sub _configure_boot
{
- my ($kernel, $virtio, $g, $desc) = @_;
+ my ($kernel, $virtio, $g, $root, $desc) = @_;
if($virtio) {
# The order of modules here is deliberately the same as the order
# specified in the postinstall script of kmod-virtio in RHEL3. The
# reason is that the probing order determines the major number of vdX
# block devices. If we change it, RHEL 3 KVM guests won't boot.
- _prepare_bootable($g, $desc, $kernel, "virtio", "virtio_ring",
- "virtio_blk", "virtio_net",
- "virtio_pci");
+ _prepare_bootable($g, $root, $desc, $kernel, "virtio", "virtio_ring",
+ "virtio_blk", "virtio_net",
+ "virtio_pci");
} else {
- _prepare_bootable($g, $desc, $kernel, "sym53c8xx");
+ _prepare_bootable($g, $root, $desc, $kernel, "sym53c8xx");
}
}
@@ -934,21 +939,23 @@ sub _get_application_owner
sub _unconfigure_hv
{
- my ($g, $desc) = @_;
+ my ($g, $root, $desc) = @_;
- _unconfigure_xen($g, $desc);
- _unconfigure_vmware($g, $desc);
+ my @apps = $g->inspect_list_applications($root);
+
+ _unconfigure_xen($g, $desc, \@apps);
+ _unconfigure_vmware($g, $desc, \@apps);
}
# Unconfigure Xen specific guest modifications
sub _unconfigure_xen
{
- my ($g, $desc) = @_;
+ my ($g, $desc, $apps) = @_;
my $found_kmod = 0;
# Look for kmod-xenpv-*, which can be found on RHEL 3 machines
- foreach my $app (@{$desc->{apps}}) {
+ foreach my $app (@$apps) {
my $name = $app->{app_name};
if($name =~ /^kmod-xenpv(-.*)?$/) {
@@ -1005,10 +1012,10 @@ sub _unconfigure_xen
# Unconfigure VMware specific guest modifications
sub _unconfigure_vmware
{
- my ($g, $desc) = @_;
+ my ($g, $desc, $apps) = @_;
# Uninstall VMwareTools
- foreach my $app (@{$desc->{apps}}) {
+ foreach my $app (@$apps) {
my $name = $app->{app_name};
if ($name eq "VMwareTools") {
@@ -2161,7 +2168,7 @@ sub _drivecmp
sub _prepare_bootable
{
- my ($g, $desc, $version, @modules) = @_;
+ my ($g, $root, $desc, $version, @modules) = @_;
# Find the grub entry for the given kernel
my $initrd;
@@ -2255,7 +2262,7 @@ sub _prepare_bootable
# internal variable in mkinitrd, and is therefore extremely nasty
# and applicable only to a particular version of mkinitrd.
if ($desc->{distro} eq 'rhel' && $desc->{major_version} eq '4') {
- push(@env, 'root_lvm=1') if ($g->is_lv($desc->{root_device}));
+ push(@env, 'root_lvm=1') if ($g->is_lv($root));
}
$g->sh(join(' ', @env).' /sbin/mkinitrd '.join(' ', @module_args).
diff --git a/lib/Sys/VirtConvert/Converter/Windows.pm b/lib/Sys/VirtConvert/Converter/Windows.pm
index b4eae74..321f797 100644
--- a/lib/Sys/VirtConvert/Converter/Windows.pm
+++ b/lib/Sys/VirtConvert/Converter/Windows.pm
@@ -80,7 +80,7 @@ sub can_handle
return ($desc->{os} eq 'windows');
}
-=item Sys::VirtConvert::Converter::Windows->convert(g, config, desc, meta)
+=item Sys::VirtConvert::Converter::Windows->convert(g, root, config, desc, meta)
(Pre-)convert a Windows guest. Assume that can_handle has previously
returned 1.
@@ -91,13 +91,17 @@ returned 1.
A libguestfs handle to the target.
+=item root
+
+The root device of this operating system.
+
=item config
An initialised Sys::VirtConvert::Config object.
=item desc
-A description of the guest OS (see virt-v2v.pl:inspect_guest).
+A description of the guest OS (see Sys::VirtConvert::Converter->convert).
=item meta
@@ -111,7 +115,7 @@ sub convert
{
my $class = shift;
- my ($g, $config, $desc, undef) = @_;
+ my ($g, undef, $config, $desc, undef) = @_;
croak("convert called without g argument") unless defined($g);
croak("convert called without config argument") unless defined($config);
croak("convert called without desc argument") unless defined($desc);
diff --git a/p2v-server/virt-p2v-server.pl b/p2v-server/virt-p2v-server.pl
index 5b1cb68..c193e1c 100755
--- a/p2v-server/virt-p2v-server.pl
+++ b/p2v-server/virt-p2v-server.pl
@@ -306,8 +306,6 @@ sub convert
my @localpaths = map { $_->{local_path} } @{$meta->{disks}};
my $g;
- my $desc;
- my $guestcaps;
eval {
$g = new Sys::VirtConvert::GuestfsHandle(
\@localpaths,
@@ -315,10 +313,11 @@ sub convert
$target->isa('Sys::VirtConvert::Connection::RHEVTarget')
);
- $desc = inspect_guest($g);
- $guestcaps =
- Sys::VirtConvert::Converter->convert($g, $config, $desc, $meta);
- $target->create_guest($desc, $meta, $config, $guestcaps, $meta->{name});
+ my $root = inspect_guest($g);
+ my $guestcaps =
+ Sys::VirtConvert::Converter->convert($g, $config, $root, $meta);
+ $target->create_guest($g, $root, $meta, $config, $guestcaps,
+ $meta->{name});
if($guestcaps->{block} eq 'virtio' && $guestcaps->{net} eq 'virtio') {
logmsg NOTICE, __x('{name} configured with virtio drivers.',
@@ -373,14 +372,13 @@ END {
}
# Perform guest inspection using the libguestfs core inspection API.
-# Returns a hashref ("$desc") which contains the main features from
-# inspection.
+# Returns the root device of the os to be converted.
sub inspect_guest
{
my $g = shift;
# Get list of roots, sorted
- my @roots = $g->inspect_os ();
+ my @roots = $g->inspect_os();
@roots = sort @roots;
# Only work on single-root operating systems.
@@ -390,41 +388,7 @@ sub inspect_guest
v2vdie __('Multiboot operating systems are not supported.')
if @roots > 1;
- my $root_dev = $roots[0];
-
- # Mount up the disks.
- my %fses = $g->inspect_get_mountpoints ($root_dev);
- my @fses = sort { length $a <=> length $b } keys %fses;
- foreach (@fses) {
- eval { $g->mount_options ("", $fses{$_}, $_) };
- print __x("{e} (ignored)\n", e => $@) if $@;
- }
-
- # Construct the "$desc" hashref which contains the main features
- # found by inspection.
- my %desc;
-
- $desc{root_device} = $root_dev;
-
- $desc{os} = $g->inspect_get_type ($root_dev);
- $desc{distro} = $g->inspect_get_distro ($root_dev);
- $desc{product_name} = $g->inspect_get_product_name ($root_dev);
- $desc{product_variant} = $g->inspect_get_product_variant ($root_dev);
- $desc{major_version} = $g->inspect_get_major_version ($root_dev);
- $desc{minor_version} = $g->inspect_get_minor_version ($root_dev);
- $desc{arch} = $g->inspect_get_arch ($root_dev);
-
- # Notes:
- # (1) Filesystems have to be mounted for this to work. Do not
- # move this code over the filesystem mounting code above.
- # (2) For RPM-based distros, new libguestfs inspection code
- # is only able to populate the 'app_name' field (old Perl code
- # populated a lot more). Fortunately this is the only field
- # that the code currently uses.
- my @apps = $g->inspect_list_applications ($root_dev);
- $desc{apps} = \@apps;
-
- return \%desc;
+ return $roots[0];
}
sub p2v_receive
diff --git a/v2v/virt-v2v.pl b/v2v/virt-v2v.pl
index 6e73102..3d71afe 100755
--- a/v2v/virt-v2v.pl
+++ b/v2v/virt-v2v.pl
@@ -504,14 +504,14 @@ if (defined($transferiso)) {
}
my $guestcaps;
-my $desc;
+my $root;
eval {
# Inspect the guest
- $desc = inspect_guest($g, $transferdev);
+ $root = inspect_guest($g, $transferdev);
# Modify the guest and its metadata
$guestcaps =
- Sys::VirtConvert::Converter->convert($g, $config, $desc, $meta);
+ Sys::VirtConvert::Converter->convert($g, $config, $root, $meta);
};
# If any of the above commands result in failure, we need to ensure that the
@@ -523,9 +523,9 @@ if ($@) {
die($err);
}
-$g->close();
+$target->create_guest($g, $root, $meta, $config, $guestcaps, $output_name);
-$target->create_guest($desc, $meta, $config, $guestcaps, $output_name);
+$g->close();
if($guestcaps->{block} eq 'virtio' && $guestcaps->{net} eq 'virtio') {
logmsg NOTICE, __x('{name} configured with virtio drivers.',
@@ -561,15 +561,14 @@ sub signal_exit
}
# Perform guest inspection using the libguestfs core inspection API.
-# Returns a hashref ("$desc") which contains the main features from
-# inspection.
+# Returns the root device of the os to be converted.
sub inspect_guest
{
my $g = shift;
my $transferdev = shift;
# Get list of roots, sorted.
- my @roots = $g->inspect_os ();
+ my @roots = $g->inspect_os();
# Filter out the transfer device from the results of inspect_os
# There's a libguestfs bug (fixed upstream) which meant the transfer ISO
@@ -655,39 +654,7 @@ sub inspect_guest
}
}
- # Mount up the disks.
- my %fses = $g->inspect_get_mountpoints ($root_dev);
- my @fses = sort { length $a <=> length $b } keys %fses;
- foreach (@fses) {
- eval { $g->mount_options ("", $fses{$_}, $_) };
- print __x("{e} (ignored)\n", e => $@) if $@;
- }
-
- # Construct the "$desc" hashref which contains the main features
- # found by inspection.
- my %desc;
-
- $desc{root_device} = $root_dev;
-
- $desc{os} = $g->inspect_get_type ($root_dev);
- $desc{distro} = $g->inspect_get_distro ($root_dev);
- $desc{product_name} = $g->inspect_get_product_name ($root_dev);
- $desc{product_variant} = $g->inspect_get_product_variant ($root_dev);
- $desc{major_version} = $g->inspect_get_major_version ($root_dev);
- $desc{minor_version} = $g->inspect_get_minor_version ($root_dev);
- $desc{arch} = $g->inspect_get_arch ($root_dev);
-
- # Notes:
- # (1) Filesystems have to be mounted for this to work. Do not
- # move this code over the filesystem mounting code above.
- # (2) For RPM-based distros, new libguestfs inspection code
- # is only able to populate the 'app_name' field (old Perl code
- # populated a lot more). Fortunately this is the only field
- # that the code currently uses.
- my @apps = $g->inspect_list_applications ($root_dev);
- $desc{apps} = \@apps;
-
- return \%desc;
+ return $root_dev;
}
=head1 PREPARING TO CONVERT A GUEST
--
1.7.4.4
13 years, 6 months