SHA256
1
0
forked from pool/libguestfs

Accepting request 406383 from Virtualization

- Fix guestfs-tools dependencies. bsc#986866

- Fix virt-filesystem -l for btrfs. bsc#980092
- Add p2v support (fate#316274)

OBS-URL: https://build.opensuse.org/request/show/406383
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libguestfs?expand=0&rev=38
This commit is contained in:
Dominique Leuenberger 2016-07-05 07:52:47 +00:00 committed by Git OBS Bridge
commit 93d0e82b12
3 changed files with 919 additions and 20 deletions

View File

@ -933,15 +933,16 @@ Index: libguestfs-1.32.4/v2v/convert_windows.ml
(* Get the Windows %systemroot%. *)
let systemroot = g#inspect_get_windows_systemroot inspect.i_root in
@@ -158,19 +165,19 @@ let convert ~keep_serial_console (g : G.
@@ -158,19 +165,20 @@ let convert ~keep_serial_console (g : G.
(* Perform the conversion of the Windows guest. *)
let rec configure_firstboot () =
- configure_rhev_apt ();
+ match installer with
+ (match installer with
+ | None -> ()
+ | Some (`RhevApt, tool_path) -> configure_rhev_apt tool_path
+ | Some (`VmdpExe, tool_path) -> configure_vmdp tool_path;
+ | Some (`VmdpExe, tool_path) -> configure_vmdp tool_path
+ );
unconfigure_xenpv ()
- and configure_rhev_apt () =
@ -960,7 +961,7 @@ Index: libguestfs-1.32.4/v2v/convert_windows.ml
@echo off
echo installing rhev-apt
@@ -179,8 +186,38 @@ echo installing rhev-apt
@@ -179,8 +187,38 @@ echo installing rhev-apt
echo starting rhev-apt
net start rhev-apt
" in
@ -1274,3 +1275,868 @@ Index: libguestfs-1.32.4/v2v/test-v2v-i-ova-subfolders.sh
+diff -u test-v2v-i-ova-subfolders.expected $d/source
+
+rm -rf $d
Index: libguestfs-1.32.4/cat/filesystems.c
===================================================================
--- libguestfs-1.32.4.orig/cat/filesystems.c
+++ libguestfs-1.32.4/cat/filesystems.c
@@ -477,9 +477,28 @@ do_output_filesystems (void)
}
}
if ((columns & COLUMN_SIZE)) {
- size = guestfs_blockdev_getsize64 (g, fses[i]);
- if (size == -1)
+ CLEANUP_FREE char *device = guestfs_mountable_device (g, fses[i]);
+ CLEANUP_FREE char *subvolume = NULL;
+
+ guestfs_push_error_handler (g, NULL, NULL);
+
+ subvolume = guestfs_mountable_subvolume (g, fses[i]);
+ if (subvolume == NULL && guestfs_last_errno (g) != EINVAL) {
+ fprintf (stderr,
+ _("%s: cannot determine the subvolume for %s: %s: %s\n"),
+ guestfs_int_program_name, fses[i],
+ guestfs_last_error (g),
+ strerror (guestfs_last_errno (g)));
exit (EXIT_FAILURE);
+ }
+
+ guestfs_pop_error_handler (g);
+
+ if (!device || !subvolume) {
+ size = guestfs_blockdev_getsize64 (g, fses[i]);
+ if (size == -1)
+ exit (EXIT_FAILURE);
+ }
}
if (is_md (fses[i]))
Index: libguestfs-1.32.4/.gitignore
===================================================================
--- libguestfs-1.32.4.orig/.gitignore
+++ libguestfs-1.32.4/.gitignore
@@ -321,6 +321,7 @@ Makefile.in
/p2v/stamp-virt-p2v.pod
/p2v/stamp-virt-p2v-make-disk.pod
/p2v/stamp-virt-p2v-make-kickstart.pod
+/p2v/stamp-virt-p2v-make-kiwi.pod
/p2v/test-virt-p2v-pxe.id_rsa
/p2v/test-virt-p2v-pxe.id_rsa.pub
/p2v/test-virt-p2v-pxe.img
@@ -335,6 +336,8 @@ Makefile.in
/p2v/virt-p2v-make-disk.1
/p2v/virt-p2v-make-kickstart
/p2v/virt-p2v-make-kickstart.1
+/p2v/virt-p2v-make-kiwi
+/p2v/virt-p2v-make-kiwi.1
/perl/_build
/perl/bindtests.pl
/perl/blib
Index: libguestfs-1.32.4/configure.ac
===================================================================
--- libguestfs-1.32.4.orig/configure.ac
+++ libguestfs-1.32.4/configure.ac
@@ -159,6 +159,8 @@ AC_CONFIG_FILES([p2v/virt-p2v-make-disk]
[chmod +x,-w p2v/virt-p2v-make-disk])
AC_CONFIG_FILES([p2v/virt-p2v-make-kickstart],
[chmod +x,-w p2v/virt-p2v-make-kickstart])
+AC_CONFIG_FILES([p2v/virt-p2v-make-kiwi],
+ [chmod +x,-w p2v/virt-p2v-make-kiwi])
AC_CONFIG_FILES([php/extension/php-for-tests.sh],
[chmod +x,-w php/extension/php-for-tests.sh])
AC_CONFIG_FILES([pick-guests.pl],
Index: libguestfs-1.32.4/p2v/Makefile.am
===================================================================
--- libguestfs-1.32.4.orig/p2v/Makefile.am
+++ libguestfs-1.32.4/p2v/Makefile.am
@@ -21,6 +21,8 @@ EXTRA_DIST = \
HACKING \
dependencies.m4 \
issue \
+ kiwi-config.sh \
+ kiwi-config.xml.in \
launch-virt-p2v.in \
p2v.ks.in \
p2v.service \
@@ -28,15 +30,19 @@ EXTRA_DIST = \
virt-p2v-make-disk.in \
virt-p2v-make-disk.pod \
virt-p2v-make-kickstart.in \
- virt-p2v-make-kickstart.pod
+ virt-p2v-make-kickstart.pod \
+ virt-p2v-make-kiwi.in \
+ virt-p2v-make-kiwi.pod
CLEANFILES = \
stamp-virt-p2v.pod \
stamp-virt-p2v-make-disk.pod \
stamp-virt-p2v-make-kickstart.pod \
+ stamp-virt-p2v-make-kiwi.pod \
virt-p2v.1 \
virt-p2v-make-disk.1 \
- virt-p2v-make-kickstart.1
+ virt-p2v-make-kickstart.1 \
+ virt-p2v-make-kiwi.1
# Although virt-p2v is a regular binary, it is not usually installed
# in /usr/bin since it only functions when contained in an ISO or PXE
@@ -83,7 +89,7 @@ virt_p2v_LDADD = \
../gnulib/lib/libgnu.la
# Scripts to build the disk image, USB key, or kickstart.
-bin_SCRIPTS = virt-p2v-make-disk virt-p2v-make-kickstart
+bin_SCRIPTS = virt-p2v-make-disk virt-p2v-make-kickstart virt-p2v-make-kiwi
dependencies_files = \
dependencies.archlinux \
@@ -103,6 +109,8 @@ virtp2vdatadir = $(datadir)/virt-p2v
virtp2vdata_DATA = \
$(dependencies_files) \
issue \
+ kiwi-config.sh \
+ kiwi-config.xml.in \
launch-virt-p2v \
p2v.ks.in \
p2v.service
@@ -118,12 +126,14 @@ launch-virt-p2v: launch-virt-p2v.in
man_MANS = \
virt-p2v.1 \
virt-p2v-make-disk.1 \
- virt-p2v-make-kickstart.1
+ virt-p2v-make-kickstart.1 \
+ virt-p2v-make-kiwi.1
noinst_DATA = \
$(top_builddir)/website/virt-p2v.1.html \
$(top_builddir)/website/virt-p2v-make-disk.1.html \
- $(top_builddir)/website/virt-p2v-make-kickstart.1.html
+ $(top_builddir)/website/virt-p2v-make-kickstart.1.html \
+ $(top_builddir)/website/virt-p2v-make-kiwi.1.html
virt-p2v.1 $(top_builddir)/website/virt-p2v.1.html: stamp-virt-p2v.pod
@@ -156,6 +166,17 @@ stamp-virt-p2v-make-kickstart.pod: virt-
--license GPLv2+ \
--warning safe \
$<
+ touch $@
+
+virt-p2v-make-kiwi.1 $(top_builddir)/website/virt-p2v-make-kiwi.1.html: stamp-virt-p2v-make-kiwi.pod
+
+stamp-virt-p2v-make-kiwi.pod: virt-p2v-make-kiwi.pod
+ $(PODWRAPPER) \
+ --man virt-p2v-make-kiwi.1 \
+ --html $(top_builddir)/website/virt-p2v-make-kiwi.1.html \
+ --license GPLv2+ \
+ --warning safe \
+ $<
touch $@
# Tests.
Index: libguestfs-1.32.4/p2v/dependencies.m4
===================================================================
--- libguestfs-1.32.4.orig/p2v/dependencies.m4
+++ libguestfs-1.32.4/p2v/dependencies.m4
@@ -90,16 +90,18 @@ ifelse(SUSE,1,
pcre
libxml2
gtk2
- /usr/bin/ssh
- /usr/bin/qemu-nbd
+ qemu-tools
+ openssh
curl
hwdata
- /usr/bin/xinit
- /usr/bin/Xorg
+ xinit
+ xorg-x11-server
xf86-video-*
- metacity
NetworkManager
- nm-connection-editor
- network-manager-applet
- dbus-x11
+ xf86-input-*
+ icewm-lite
+ dbus-1-x11
+ yast2-network
+ libyui-qt
+ SuSEfirewall2
)
Index: libguestfs-1.32.4/p2v/gui.c
===================================================================
--- libguestfs-1.32.4.orig/p2v/gui.c
+++ libguestfs-1.32.4/p2v/gui.c
@@ -381,7 +381,10 @@ test_connection_thread (void *data)
static void
configure_network_button_clicked (GtkWidget *w, gpointer data)
{
- ignore_value (system ("nm-connection-editor &"));
+ if (access ("/sbin/yast2", X_OK) >= 0)
+ ignore_value (system ("yast2 lan &"));
+ else
+ ignore_value (system ("nm-connection-editor &"));
}
static void
Index: libguestfs-1.32.4/p2v/kiwi-config.sh
===================================================================
--- /dev/null
+++ libguestfs-1.32.4/p2v/kiwi-config.sh
@@ -0,0 +1,73 @@
+#!/bin/bash
+#================
+# FILE : config.sh
+#----------------
+# PROJECT : OpenSuSE KIWI Image System
+# COPYRIGHT : (c) 2006 SUSE LINUX Products GmbH. All rights reserved
+# :
+# AUTHOR : Marcus Schaefer <ms@suse.de>
+#======================================
+# Functions...
+#--------------------------------------
+test -f /.kconfig && . /.kconfig
+test -f /.profile && . /.profile
+
+#======================================
+# Greeting...
+#--------------------------------------
+echo "Configure image: [$kiwi_iname]..."
+
+#======================================
+# Mount system filesystems
+#--------------------------------------
+baseMount
+
+#======================================
+# Setup baseproduct link
+#--------------------------------------
+suseSetupProduct
+
+#======================================
+# Add missing gpg keys to rpm
+#--------------------------------------
+suseImportBuildKey
+
+#======================================
+# Activate services
+#--------------------------------------
+suseInsertService p2v
+
+#======================================
+# Setup default target, multi-user
+#--------------------------------------
+baseSetRunlevel 3
+
+#==========================================
+# remove package docs
+#------------------------------------------
+rm -rf /usr/share/doc/packages/*
+rm -rf /usr/share/doc/manual/*
+rm -rf /opt/kde*
+
+# Update the default getty target to login automatically as root without
+# prompting for a password
+sed -i 's/^ExecStart=\(.*\)/ExecStart=\1 -a root/' \
+ /usr/lib/systemd/system/getty@.service
+
+# Reserve tty1 as a getty so we can document it clearly
+echo ReserveVT=1 >> /etc/systemd/logind.conf
+
+sed -i 's/^ROOT_USES_LANG=.*$/ROOT_USES_LANG="yes"/' \
+ /etc/sysconfig/language
+
+#======================================
+# SuSEconfig
+#--------------------------------------
+suseConfig
+
+#======================================
+# Umount kernel filesystems
+#--------------------------------------
+baseCleanMount
+
+exit 0
Index: libguestfs-1.32.4/p2v/kiwi-config.xml.in
===================================================================
--- /dev/null
+++ libguestfs-1.32.4/p2v/kiwi-config.xml.in
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="utf-8"?>
+<image schemaversion="6.2" name="p2v-__KIWI_BOOT__" displayname="p2v___PACKAGE_VERSION_____KIWI_BOOT__">
+ <description type="system">
+ <author>Marcus Schäfer</author>
+ <contact>ms@suse.com</contact>
+ <specification>P2V __PACKAGE_VERSION__</specification>
+ </description>
+ <profiles>
+ <profile name="vmxFlavour" description="VMX with default kernel" import="true"/>
+ <profile name="netboot" description="compressed rootfs image for pxe"/>
+ </profiles>
+ <preferences>
+ <type image="iso" primary="true" boot="isoboot/suse-__KIWI_BOOT__" flags="overlay" hybrid="true" firmware="uefi" kernelcmdline="splash"/>
+ <version>__PACKAGE_VERSION__</version>
+ <packagemanager>zypper</packagemanager>
+ <locale>en_US</locale>
+ <keytable>us.map.gz</keytable>
+ <hwclock>utc</hwclock>
+ <bootloader-theme>__BRANDING__</bootloader-theme>
+ <bootsplash-theme>__BRANDING__</bootsplash-theme>
+ <rpm-excludedocs>true</rpm-excludedocs>
+ <rpm-check-signatures>false</rpm-check-signatures>
+ </preferences>
+ <preferences profiles="netboot">
+ <type image="pxe" filesystem="overlayfs" boot="netboot/suse-__KIWI_BOOT__">
+ <pxedeploy server="192.168.100.2" blocksize="4096">
+ <partitions device="/dev/sda">
+ <partition type="swap" number="1" size="5"/>
+ <partition type="L" number="2" size="image" mountpoint="/" target="true"/>
+ <partition type="L" number="3" target="false"/>
+ </partitions>
+ <union ro="/dev/sda2" rw="/dev/sda3" type="overlayfs"/>
+ </pxedeploy>
+ </type>
+ </preferences>
+ <preferences profiles="vmxFlavour">
+ <type image="vmx" filesystem="ext3" boot="vmxboot/suse-__KIWI_BOOT__" format="vmdk" bootloader="grub2" firmware="uefi" kernelcmdline="splash" bootpartition="false">
+ <systemdisk name="systemVG"/>
+ <machine memory="512" guestOS="suse" HWversion="4">
+ <vmdisk id="0" controller="ide"/>
+ <vmnic driver="e1000" interface="0" mode="bridged"/>
+ </machine>
+ </type>
+ </preferences>
+ <users group="root">
+ <user password="p2v" pwdformat="plain" home="/root" name="root"/>
+ </users>
+ <!--__REPOS__-->
+ <packages type="image" patternType="onlyRequired">
+ <package name="__BASE_PATTERN__"/>
+ <package name="plymouth-branding-__BRANDING__" bootinclude="true"/>
+ <package name="grub2-branding-__BRANDING__" bootinclude="true"/>
+ <package name="iputils"/>
+ <package name="grub2"/>
+ <package name="grub2-x86_64-efi"/>
+ <package name="syslinux"/>
+ <package name="lvm2"/>
+ <package name="plymouth"/>
+ <package name="fontconfig"/>
+ <package name="fonts-config"/>
+ <package name="tar"/>
+ <package name="systemd"/>
+ <package name="systemd-sysvinit"/>
+ <package name="dracut"/>
+ <package name="wicked"/>
+ <package name="iproute2"/>
+ <package name="sudo"/>
+ <package name="dhcp-client"/>
+ <package name="which"/>
+ <!-- virt-p2v dependencies from dependencies.suse -->
+<!--__DEPENDENCIES__-->
+ </packages>
+ <packages type="iso">
+ <package name="gfxboot-branding-__BRANDING__" bootinclude="true" bootdelete="true"/>
+ </packages>
+ <packages type="image" profiles="vmxFlavour">
+ <package name="kernel-default" replaces="kernel-xen"/>
+ <package name="kernel-default" replaces="xen-kmp-default"/>
+ <package name="kernel-default" replaces="xen-libs"/>
+ <package name="kernel-default" replaces="xen-tools"/>
+ <package name="kernel-default" replaces="xen"/>
+ <package name="gfxboot-branding-__BRANDING__" bootinclude="true" bootdelete="true"/>
+ </packages>
+ <packages type="bootstrap">
+ <package name="udev"/>
+ <package name="filesystem"/>
+ <package name="glibc-locale"/>
+ <package name="cracklib-dict-full"/>
+ <package name="ca-certificates"/>
+ <package name="__RELEASE_PKG__"/>
+ </packages>
+</image>
Index: libguestfs-1.32.4/p2v/launch-virt-p2v.in
===================================================================
--- libguestfs-1.32.4.orig/p2v/launch-virt-p2v.in
+++ libguestfs-1.32.4/p2v/launch-virt-p2v.in
@@ -22,8 +22,20 @@
# and virt-p2v.
if [ "$1" = "run" ]; then
cd /
- metacity &
- nm-applet &
+ ID=
+ if test -f /etc/os-release; then
+ . /etc/os-release
+ fi
+
+ case "$ID" in
+ sles|opensuse)
+ # not all versions of SLE / openSUSE ship metacity and nm-applet
+ icewm &
+ ;;
+ *)
+ metacity &
+ nm-applet &
+ esac
exec @libexecdir@/virt-p2v
else
xinit "$0" run
Index: libguestfs-1.32.4/p2v/utils.c
===================================================================
--- libguestfs-1.32.4.orig/p2v/utils.c
+++ libguestfs-1.32.4/p2v/utils.c
@@ -143,7 +143,7 @@ get_if_vendor (const char *if_name, int
*/
/* XXX We could make this configurable. */
-#define NETWORK_ONLINE_COMMAND "nm-online -t 30"
+#define NETWORK_ONLINE_COMMAND "nm-online -t 30 -x"
void
wait_network_online (const struct config *config)
Index: libguestfs-1.32.4/p2v/virt-p2v-make-disk.pod
===================================================================
--- libguestfs-1.32.4.orig/p2v/virt-p2v-make-disk.pod
+++ libguestfs-1.32.4/p2v/virt-p2v-make-disk.pod
@@ -148,6 +148,7 @@ L</FILES> above). If not set, a compile
L<virt-p2v(1)>,
L<virt-p2v-make-kickstart(1)>,
+L<virt-p2v-make-kiwi(1)>,
L<virt-v2v(1)>,
L<http://libguestfs.org/>.
Index: libguestfs-1.32.4/p2v/virt-p2v-make-kiwi.in
===================================================================
--- /dev/null
+++ libguestfs-1.32.4/p2v/virt-p2v-make-kiwi.in
@@ -0,0 +1,228 @@
+#!/bin/bash -
+# @configure_input@
+# virt-p2v-make-kiwi
+# Copyright (C) 2016 SUSE.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+unset CDPATH
+
+program="virt-p2v-make-kiwi"
+version="@PACKAGE_VERSION@"
+
+TEMP=`getopt \
+ -o o:V \
+ --long help,inject-ssh-identity:,output:,version \
+ -n $program -- "$@"`
+if [ $? != 0 ]; then
+ echo "$program: problem parsing the command line arguments"
+ exit 1
+fi
+eval set -- "$TEMP"
+
+usage ()
+{
+ echo "Usage:"
+ echo " $program [--options] [-o kiwi-folder]"
+ echo
+ echo "Read $program(1) man page for more information."
+ exit $1
+}
+
+output=p2v.kiwi
+ssh_identity=
+
+while true; do
+ case "$1" in
+ --inject-ssh-identity)
+ ssh_identity="$2"
+ shift 2;;
+ -o|--output)
+ output="$2"
+ shift 2;;
+ -V|--version)
+ echo "$program $version"
+ exit 0;;
+ --help)
+ usage 0;;
+ --)
+ shift
+ break;;
+ *)
+ echo "internal error ($1)"
+ exit 1;;
+ esac
+done
+
+set -e
+
+# Deal with stupid autotools libexecdir-not-expandable crap.
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+libexecdir="@libexecdir@"
+
+if [ -n "$VIRT_P2V_DATA_DIR" ]; then
+ datadir="$VIRT_P2V_DATA_DIR"
+ host_libexecdir="$VIRT_P2V_DATA_DIR"
+else
+ datadir="@datadir@/virt-p2v"
+ host_libexecdir="@libexecdir@"
+fi
+
+# Dependencies. Since kiwi is SUSE-specific, only include
+# dependencies.suse here.
+depsfile="$datadir/dependencies.suse"
+if [ ! -f "$depsfile" ]; then
+ echo "$0: cannot find dependencies file ($depsfile)"
+ exit 1
+fi
+dependencies=
+while read line; do
+ if [ -n "$line" ]; then
+ depname=$(echo $line | awk '{gsub(/ /, "", $0); print}')
+ pkg=" <package name=\"$depname\"/>"
+ if [ -z "$dependencies" ]; then
+ dependencies="$pkg"
+ else
+ dependencies="$dependencies
+$pkg"
+ fi
+ fi
+done < $depsfile
+
+# Compute the distro-dependent pieces for kiwi
+branding=
+release_pkg=
+base_pattern=
+kiwi_boot=
+repos=
+. /etc/os-release
+case "$NAME" in
+ SLES)
+ branding="SLE"
+ release_pkg="sles-release"
+ base_pattern="patterns-sles-Minimal"
+ case "$VERSION_ID" in
+ 12)
+ kiwi_boot="SLES12"
+ repos="http://download.suse.de/ibs/SUSE:/SLE-12:/Update/standard
+ http://download.suse.de/ibs/SUSE:/SLE-12:/GA/standard"
+ ;;
+ 12.1)
+ kiwi_boot="SLES12"
+ repos="http://download.suse.de/ibs/SUSE:/SLE-12-SP1:/Update/standard
+ http://download.suse.de/ibs/SUSE:/SLE-12-SP1:/GA/standard
+ http://download.suse.de/ibs/SUSE:/SLE-12:/Update/standard
+ http://download.suse.de/ibs/SUSE:/SLE-12:/GA/standard"
+ ;;
+ *)
+ echo "Unsupported distribution $NAME $VERSION_ID"
+ exit 1;;
+ esac;;
+ openSUSE*)
+ branding="openSUSE"
+ release_pkg="openSUSE-release"
+ base_pattern="patterns-openSUSE-base"
+ case "$VERSION" in
+ 13.1\ *)
+ kiwi_boot="13.1"
+ repos="obs://13.1/repo/oss"
+ ;;
+ 13.2\ *)
+ kiwi_boot="13.2"
+ repos="obs://13.2/repo/oss"
+ ;;
+ 42.1)
+ kiwi_boot="leap42.1"
+ repos="obs://leap/42.1/repo/oss"
+ ;;
+ *\ \(Tumbleweed\))
+ kiwi_boot="leap42.1"
+ repos="obs://openSUSE:Factory/standard"
+ ;;
+ *)
+ echo "Unsupported distribution $NAME $VERSION_ID"
+ exit 1;;
+ esac;;
+ *)
+ echo "Unsupported distribution $NAME $VERSION"
+ exit 1;;
+esac
+
+# Compute the repos
+repos_xml=
+for repo in $repos; do
+ repos_xml=" <repository type=\"rpm-md\">\n <source path=\"$repo\"/>\n </repository>\n$repos_xml"
+done
+
+mkdir $output
+cp $datadir/kiwi-config.sh $output/config.sh
+
+mkdir -p $output/root/etc/sysconfig/network
+cat >$output/root/etc/sysconfig/network/ifcfg-eth0 << EOF
+BOOTPROTO='dhcp'
+MTU=''
+REMOTE_IPADDR=''
+STARTMODE='onboot'
+EOF
+
+mkdir -p $output/root/etc/systemd/system
+cp $datadir/p2v.service $output/root/etc/systemd/system
+
+mkdir -p $output/root/etc/udev/rules.d
+cat >$output/root/etc/udev/rules.d/70-persistent-net.rules <<EOF
+SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="?*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="?*", NAME="eth0"
+EOF
+
+cp $datadir/issue $output/root/etc/issue
+
+mkdir -p $output/root/usr/bin
+cp $datadir/launch-virt-p2v $output/root/usr/bin
+
+mkdir -p $output/root/$libexecdir
+cp $host_libexecdir/virt-p2v $output/root/$libexecdir
+
+if test "z$ssh_identity" != "z"; then
+ mkdir -p $output/root/var/tmp
+ cp $ssh_identity $output/root/var/tmp/id_rsa
+ chmod 0600 $output/root/var/tmp/id_rsa
+fi
+
+# Now generate the final kiwi config, substituting as necessary.
+@AWK@ \
+ -v "dependencies=$dependencies" \
+ -v "md5sum_virt_p2v=$md5sum_virt_p2v" \
+ -v "libexecdir=$libexecdir" \
+ -v "branding=$branding" \
+ -v "release_pkg=$release_pkg" \
+ -v "base_pattern=$base_pattern" \
+ -v "kiwi_boot=$kiwi_boot" \
+ -v "repos=$repos_xml" \
+ '{
+ gsub (/__PACKAGE_NAME__/, "@PACKAGE_NAME@");
+ gsub (/__PACKAGE_VERSION__/, "@PACKAGE_VERSION@");
+ gsub (/__PACKAGE_VERSION_FULL__/, "@PACKAGE_VERSION_FULL@");
+ gsub (/<!--__DEPENDENCIES__-->/, dependencies);
+ gsub (/__LIBEXECDIR__/, libexecdir);
+ gsub (/__BRANDING__/, branding);
+ gsub (/__RELEASE_PKG__/, release_pkg);
+ gsub (/__BASE_PATTERN__/, base_pattern);
+ gsub (/__KIWI_BOOT__/, kiwi_boot);
+ gsub (/<!--__REPOS__-->/, repos);
+ print;
+ }' \
+ $datadir/kiwi-config.xml.in > $output/config.xml
+
+echo "kiwi config folder written to $output"
Index: libguestfs-1.32.4/p2v/virt-p2v-make-kiwi.pod
===================================================================
--- /dev/null
+++ libguestfs-1.32.4/p2v/virt-p2v-make-kiwi.pod
@@ -0,0 +1,184 @@
+=head1 NAME
+
+virt-p2v-make-kiwi - Build the virt-p2v kiwi configuration
+
+=head1 SYNOPSIS
+
+ virt-p2v-make-kiwi [--inject-ssh-identity path] [-o kiwi-folder]
+
+=head1 DESCRIPTION
+
+L<virt-p2v(1)> converts a physical machine to run virtualized on KVM,
+managed by libvirt, OpenStack, oVirt, Red Hat Enterprise
+Virtualisation (RHEV), or one of the other targets supported by
+L<virt-v2v(1)>.
+
+Kiwi is a tool used mainly by SUSE Linux Enterprise and openSUSE to
+build live CDs, make appliances and so on. It is driven by a few files
+including an xml description of the machine.
+
+virt-p2v-make-kiwi builds a folder containing all the pieces needed for
+kiwi to build a bootable P2V live CD ISO, USB key, or PXE image. This tool
+only builds the kiwi configuration, but this manual page describes some of
+the ways you can use the kickstart file.
+
+=head1 BUILDING THE KIWI CONFIGURATION
+
+Using virt-p2v-make-kiwi is very simple:
+
+ virt-p2v-make-kiwi
+
+will build a kiwi configuration based on the current machine's distribution.
+
+To control the name of the output folder, use the I<-o> parameter.
+
+=head1 BUILDING A LIVE CD / ISO
+
+Once you have the kiwi configuration folder, you can use L<kiwi(1)> to make a
+live CD:
+
+ sudo kiwi --build p2v.kiwi -d build --type iso
+
+Before running this, you may have to tweak the C<config.xml> file
+to change the locale and keyboard mapping to the one you need.
+
+If running on a SUSE Linux Entreprise Server, add the path to your packages repositories
+using the C<--ignore-repos> and C<--add-repo> kiwi parameters.
+
+The generated ISO image will be placed in the C<build> folder.
+
+=head1 BUILDING A BOOTABLE USB KEY
+
+Use the L<dd(1)> program to write the ISO created above to a USB key:
+
+ sudo dd if=path/to/p2v.iso of=/dev/sdX
+
+=head1 BUILDING A PXE BOOT IMAGE
+
+To create a PXE boot image, run kiwi in such a way:
+
+ sudo kiwi --build $PWD/p2v.kiwi -d build --add-profile netboot --type pxe
+
+For more details on how to use the generated image, report to the kiwi documentation
+on PXE images: L<https://doc.opensuse.org/projects/kiwi/doc/#chap.pxe>
+
+=head1 ADDING AN SSH IDENTITY
+
+You can inject an SSH identity (private key) file to the kiwi config and
+hence into the ISO using the I<--inject-ssh-identity> option. Note
+that you I<cannot> inject a key once the ISO has been built.
+
+First create a key pair. It must have an empty passphrase:
+
+ ssh-keygen -t rsa -N '' -f id_rsa
+
+This creates a private key (C<id_rsa>) and a public key
+(C<id_rsa.pub>) pair. The public key should be appended to the
+C<authorized_keys> file on the virt-v2v conversion server (usually to
+C</root/.ssh/authorized_keys>).
+
+The private key should be added to the kiwi config and then
+discarded:
+
+ virt-p2v-make-kiwi [...] --inject-ssh-identity id_rsa
+ rm id_rsa
+
+The ISO can then be built from the kickstart in the usual way (see
+above), and it will contain the embedded SSH identity
+(F</var/tmp/id_rsa>).
+
+When booting virt-p2v, specify the URL of the injected file like this:
+
+ │ User name: [root_____________________________] │
+ │ │
+ │ Password: [ <leave this field blank> ] │
+ │ │
+ │ SSH Identity URL: [file:///var/tmp/id_rsa___________] │
+
+or if using the kernel command line, add:
+
+ p2v.identity=file:///var/tmp/id_rsa
+
+For more information, see L<virt-p2v(1)/SSH IDENTITIES>.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--help>
+
+Display help.
+
+=item B<--inject-ssh-identity> id_rsa
+
+Add an SSH identity (private key) file into the kickstart.
+See L</ADDING AN SSH IDENTITY> above.
+
+=item B<-o> OUTPUT
+
+=item B<--output> OUTPUT
+
+Write kiwi configuration to the C<OUTPUT> folder. If not specified, the default is
+F<p2v.kiwi> in the current directory.
+
+=item B<-V>
+
+=item B<--version>
+
+Display version number and exit.
+
+=back
+
+=head1 FILES
+
+=over 4
+
+=item F<$libexecdir/virt-p2v>
+
+The L<virt-p2v(1)> binary which is copied into the kiwi configuration.
+
+The location of the binary can be changed by setting the
+C<VIRT_P2V_DATA_DIR> environment variable.
+
+=item F<$datadir/virt-p2v/issue>
+
+=item F<$datadir/virt-p2v/launch-virt-p2v.in>
+
+=item F<$datadir/virt-p2v/kiwi>
+
+=item F<$datadir/virt-p2v/p2v.service>
+
+Various data files that are used to make the kiwi appliance.
+
+The location of these files can be changed by setting the
+C<VIRT_P2V_DATA_DIR> environment variable.
+
+=back
+
+=head1 ENVIRONMENT VARIABLES
+
+=over 4
+
+=item C<VIRT_P2V_DATA_DIR>
+
+The directory where virt-p2v-make-kiwi looks for data files and
+the virt-p2v binary (see L</FILES> above). If not set, a compiled-in
+location is used.
+
+=back
+
+=head1 SEE ALSO
+
+L<virt-p2v(1)>,
+L<virt-p2v-make-disk(1)>,
+L<virt-v2v(1)>,
+L<kiwi(1)>,
+L<http://libguestfs.org/>.
+
+=head1 AUTHORS
+
+Cédric Bosdonnat
+
+=head1 COPYRIGHT
+
+Copyright (C) 2016 SUSE Ltd.
Index: libguestfs-1.32.4/p2v/virt-p2v.pod
===================================================================
--- libguestfs-1.32.4.orig/p2v/virt-p2v.pod
+++ libguestfs-1.32.4/p2v/virt-p2v.pod
@@ -725,6 +725,7 @@ control connection to be displayed in th
L<virt-p2v-make-disk(1)>,
L<virt-p2v-make-kickstart(1)>,
+L<virt-p2v-make-kiwi(1)>,
L<virt-v2v(1)>,
L<qemu-nbd(1)>,
L<ssh(1)>,

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Mon Jul 4 10:11:11 UTC 2016 - cbosdonnat@suse.com
- Fix guestfs-tools dependencies. bsc#986866
-------------------------------------------------------------------
Wed Jun 8 13:02:30 UTC 2016 - cbosdonnat@suse.com
- Fix virt-filesystem -l for btrfs. bsc#980092
- Add p2v support (fate#316274)
-------------------------------------------------------------------
Mon Mar 14 08:41:08 UTC 2016 - cbosdonnat@suse.com

View File

@ -48,7 +48,6 @@ Release: 0
%bcond_without zerofree
%bcond_with ext4_writeable
%endif
%define with_p2v 0
%bcond_without fuse
@ -58,6 +57,8 @@ Release: 0
%bcond_with ruby_bindings
%endif
%bcond_without p2v
%if %suse_version >= 1230
%bcond_without bash_completion
%else
@ -188,7 +189,7 @@ BuildRequires: hivex
BuildRequires: hivex-devel
%endif
#
%if %{with_p2v}
%if %{with p2v}
BuildRequires: gtk2-devel
%endif
#
@ -235,6 +236,7 @@ License: GPL-2.0
Group: System/Filesystems
Provides: %{name} = %{version}
Obsoletes: %{name} < %{version}
Requires: libguestfs0 = %{version}
Requires: python-evtx
%if %{with bash_completion}
Recommends: bash-completion >= 2.0
@ -537,8 +539,20 @@ Requires: qemu-block-ssh
%description -n virt-v2v
virt-v2v is a tool for converting and importing virtual machines to
libvirt-managed KVM, or Red Hat Enterprise Virtualization. It can import a
variety of guest operating systems from libvirt-managed hosts and VMware ESX.
libvirt-managed KVM. It can import a variety of guest operating systems
from libvirt-managed hosts.
%if %{with p2v}
%package -n virt-p2v
Summary: Convert a virtual machine to run on KVM
License: GPL-2.0
Group: System/Management
Requires: virt-v2v = %{version}
%description -n virt-p2v
virt-p2v is a tool for converting physical machines into libvirt-managed KVM machines.
It can import a variety of guest operating systems from libvirt-managed hosts.
%endif
%prep
: _ignore_exclusive_arch '%{?_ignore_exclusive_arch}'
@ -570,15 +584,8 @@ else
CFLAGS="$CFLAGS -DGUESTFS_QEMU_NO_VIRTIO_BLK"
CXXFLAGS="$CXXFLAGS -DGUESTFS_QEMU_NO_VIRTIO_BLK"
fi
am_version="`automake --version | awk '/^automake \(GNU automake\) / { print $4 }'`"
if test -n "${am_version}"
then
case "${am_version}" in
1.10) ;;
1.10.*) ;;
*) autoreconf -fi ;;
esac
fi
autoreconf -fi
#
%configure \
--help || :
@ -674,6 +681,11 @@ rm -rf $RPM_BUILD_ROOT/tmp
%endif
%endif
%if %{with p2v}
# Remove the kickstart files from p2v package
rm $RPM_BUILD_ROOT/%{_datadir}/virt-p2v/p2v.ks.in
%endif
%clean
rm -rf $RPM_BUILD_ROOT
@ -765,6 +777,7 @@ rm -rf $RPM_BUILD_ROOT
%{_sbindir}/libguestfs-make-fixed-appliance
%{_bindir}/*
%exclude %{_bindir}/virt-v2v
%exclude %{_bindir}/virt-p2v-*
%config(noreplace) /etc/libguestfs-tools.conf
/etc/virt-builder
%dir /etc/xdg/virt-builder
@ -776,6 +789,7 @@ rm -rf $RPM_BUILD_ROOT
%endif
%{_mandir}/man1/*
%exclude %{_mandir}/man1/virt-v2v.*
%exclude %{_mandir}/man1/virt-p2v*
%{_mandir}/man5/*
%files -n virt-v2v
@ -783,9 +797,17 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/virt-v2v
%{_datadir}/bash-completion/*/virt-v2v
%{_mandir}/man1/virt-v2v.*
%if %{with_p2v}
%if %{with p2v}
%files -n virt-p2v
%defattr(-,root,root)
%{_prefix}/lib/virt-p2v
%{_datadir}/virt-p2v
%attr(0555,-,-) %{_datadir}/virt-p2v/launch-virt-p2v
%{_bindir}/virt-p2v-make-kiwi
%{_bindir}/virt-p2v-make-disk
%{_mandir}/man1/virt-p2v-make-kiwi*
%{_mandir}/man1/virt-p2v-make-disk*
%endif
%changelog