[PATCH] cimtest: fix guest images generation

Parted-3.1 remove mkpartfs capability. When generating guest images, it should use external tools (like mke2fs) to create filesystem. Signed-off-by: Jincheng Miao <jmiao@redhat.com> --- suites/libvirt-cim/images/xmt-makefv.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/suites/libvirt-cim/images/xmt-makefv.sh b/suites/libvirt-cim/images/xmt-makefv.sh index 1cf6a0f..85a340c 100755 --- a/suites/libvirt-cim/images/xmt-makefv.sh +++ b/suites/libvirt-cim/images/xmt-makefv.sh @@ -51,7 +51,7 @@ partition() { local file=$1 $PARTED $file mklabel msdos - $PARTED $file mkpartfs primary ext2 0 $(($SIZE - 1)) + $PARTED $file mkpart primary ext2 0 $(($SIZE - 1)) } mount_partition() { @@ -62,7 +62,10 @@ mount_partition() { losetup /dev/$loopdev $file || die "Failed to losetup $file" kpartx -a /dev/$loopdev || die "Failed to kpartx $loopdev" + sleep 2 + mke2fs -t ext2 /dev/mapper/${loopdev}p1 >/dev/null 2>&1 || die "Failed to mkfs ${loopdev}p1" tune2fs -j /dev/mapper/${loopdev}p1 >/dev/null 2>&1|| die "Failed to add journal" + sleep 2 mount /dev/mapper/${loopdev}p1 $TMPMOUNT || die "Failed to mount ${loopdev}p1" echo $loopdev -- 1.8.3.1

On 08/03/2013 12:14 PM, Jincheng Miao wrote:
Parted-3.1 remove mkpartfs capability. When generating guest images, it should use external tools (like mke2fs) to create filesystem.
Signed-off-by: Jincheng Miao <jmiao@redhat.com>
I'm not the expert here - how would I know whether this works? I read the README, ran make but it didn't succeed: # make chmod +x xmt-convert.sh (cd xm-test && sh ../xmt-convert.sh `basename xm-test/initrd-1.1-i386.img`) 1856 blocks if uname -r | grep -q xen; then \ cp /boot/vmlinuz-`uname -r` /var/lib/libvirt/images/default-xen-kernel; \ fi chmod +x xmt-makefv.sh ./xmt-makefv.sh xm-test/xm-test.gz xm-test/xmt_disk.img Warning: The resulting partition is not properly aligned for best performance. FAILED: No kver 0-rescue-9481a187403f46b38d535cf9ffa1cc20 make: *** [xm-test/xmt_disk.img] Error 1 John
--- suites/libvirt-cim/images/xmt-makefv.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/suites/libvirt-cim/images/xmt-makefv.sh b/suites/libvirt-cim/images/xmt-makefv.sh index 1cf6a0f..85a340c 100755 --- a/suites/libvirt-cim/images/xmt-makefv.sh +++ b/suites/libvirt-cim/images/xmt-makefv.sh @@ -51,7 +51,7 @@ partition() { local file=$1
$PARTED $file mklabel msdos - $PARTED $file mkpartfs primary ext2 0 $(($SIZE - 1)) + $PARTED $file mkpart primary ext2 0 $(($SIZE - 1)) }
mount_partition() { @@ -62,7 +62,10 @@ mount_partition() {
losetup /dev/$loopdev $file || die "Failed to losetup $file" kpartx -a /dev/$loopdev || die "Failed to kpartx $loopdev" + sleep 2 + mke2fs -t ext2 /dev/mapper/${loopdev}p1 >/dev/null 2>&1 || die "Failed to mkfs ${loopdev}p1" tune2fs -j /dev/mapper/${loopdev}p1 >/dev/null 2>&1|| die "Failed to add journal" + sleep 2 mount /dev/mapper/${loopdev}p1 $TMPMOUNT || die "Failed to mount ${loopdev}p1"
echo $loopdev

----- Original Message -----
I'm not the expert here - how would I know whether this works?
I read the README, ran make but it didn't succeed:
# make chmod +x xmt-convert.sh (cd xm-test && sh ../xmt-convert.sh `basename xm-test/initrd-1.1-i386.img`) 1856 blocks if uname -r | grep -q xen; then \ cp /boot/vmlinuz-`uname -r` /var/lib/libvirt/images/default-xen-kernel; \ fi chmod +x xmt-makefv.sh ./xmt-makefv.sh xm-test/xm-test.gz xm-test/xmt_disk.img Warning: The resulting partition is not properly aligned for best performance. FAILED: No kver 0-rescue-9481a187403f46b38d535cf9ffa1cc20 make: *** [xm-test/xmt_disk.img] Error 1
Do you apply this patch, and it returns this error? According to the error "FAILED: No kver 0-rescue-9481a187403f46b38d535cf9ffa1cc20", I think it is failed at copy_in_kernel() in xmt-makefv.sh, that is not what I modified. In another word, it will be failed without this patch. Jincheng Miao

----- Original Message -----
I'm not the expert here - how would I know whether this works?
I read the README, ran make but it didn't succeed:
# make chmod +x xmt-convert.sh (cd xm-test && sh ../xmt-convert.sh `basename xm-test/initrd-1.1-i386.img`) 1856 blocks if uname -r | grep -q xen; then \ cp /boot/vmlinuz-`uname -r` /var/lib/libvirt/images/default-xen-kernel; \ fi chmod +x xmt-makefv.sh ./xmt-makefv.sh xm-test/xm-test.gz xm-test/xmt_disk.img Warning: The resulting partition is not properly aligned for best performance. FAILED: No kver 0-rescue-9481a187403f46b38d535cf9ffa1cc20 make: *** [xm-test/xmt_disk.img] Error 1
hmm, for this error, xmt-makefv.sh fails to find the kernel image in your os. In kernel_path() of xmt-makefv, it uses "find /boot | grep vmlinuz | egrep -v 'xen|hmac'| tail -n1" to get image path. The error you met maybe that your kernel image lacks hmac (a signature).

On 08/09/2013 02:02 AM, Jincheng Miao wrote:
----- Original Message -----
I'm not the expert here - how would I know whether this works?
I read the README, ran make but it didn't succeed:
# make chmod +x xmt-convert.sh (cd xm-test && sh ../xmt-convert.sh `basename xm-test/initrd-1.1-i386.img`) 1856 blocks if uname -r | grep -q xen; then \ cp /boot/vmlinuz-`uname -r` /var/lib/libvirt/images/default-xen-kernel; \ fi chmod +x xmt-makefv.sh ./xmt-makefv.sh xm-test/xm-test.gz xm-test/xmt_disk.img Warning: The resulting partition is not properly aligned for best performance. FAILED: No kver 0-rescue-9481a187403f46b38d535cf9ffa1cc20 make: *** [xm-test/xmt_disk.img] Error 1
hmm, for this error, xmt-makefv.sh fails to find the kernel image in your os.
In kernel_path() of xmt-makefv, it uses "find /boot | grep vmlinuz | egrep -v 'xen|hmac'| tail -n1" to get image path.
The error you met maybe that your kernel image lacks hmac (a signature).
I understand the error I saw wasn't in the area you changed. I don't believe my run got to the code you changed and as much as it seems like an ACK would be in order, I couldn't test your portion of the change on my host. John FWIW: I have a f19 host # find /boot | grep vmlinuz /boot/.vmlinuz-3.9.11-200.fc18.x86_64.hmac /boot/vmlinuz-3.9.6-200.fc18.x86_64 /boot/.vmlinuz-3.9.6-200.fc18.x86_64.hmac /boot/vmlinuz-3.9.11-200.fc18.x86_64 /boot/vmlinuz-3.9.5-201.fc18.x86_64 /boot/vmlinuz-3.10.4-300.fc19.x86_64 /boot/.vmlinuz-3.9.5-201.fc18.x86_64.hmac /boot/.vmlinuz-3.10.4-300.fc19.x86_64.hmac /boot/vmlinuz-0-rescue-9481a187403f46b38d535cf9ffa1cc20 # find /boot | grep vmlinuz | egrep -v 'xen|hmac' /boot/vmlinuz-3.9.6-200.fc18.x86_64 /boot/vmlinuz-3.9.11-200.fc18.x86_64 /boot/vmlinuz-3.9.5-201.fc18.x86_64 /boot/vmlinuz-3.10.4-300.fc19.x86_64 /boot/vmlinuz-0-rescue-9481a187403f46b38d535cf9ffa1cc20

----- Original Message -----
I understand the error I saw wasn't in the area you changed. I don't believe my run got to the code you changed and as much as it seems like an ACK would be in order, I couldn't test your portion of the change on my host.
John
FWIW:
I have a f19 host
# find /boot | grep vmlinuz /boot/.vmlinuz-3.9.11-200.fc18.x86_64.hmac /boot/vmlinuz-3.9.6-200.fc18.x86_64 /boot/.vmlinuz-3.9.6-200.fc18.x86_64.hmac /boot/vmlinuz-3.9.11-200.fc18.x86_64 /boot/vmlinuz-3.9.5-201.fc18.x86_64 /boot/vmlinuz-3.10.4-300.fc19.x86_64 /boot/.vmlinuz-3.9.5-201.fc18.x86_64.hmac /boot/.vmlinuz-3.10.4-300.fc19.x86_64.hmac /boot/vmlinuz-0-rescue-9481a187403f46b38d535cf9ffa1cc20
# find /boot | grep vmlinuz | egrep -v 'xen|hmac' /boot/vmlinuz-3.9.6-200.fc18.x86_64 /boot/vmlinuz-3.9.11-200.fc18.x86_64 /boot/vmlinuz-3.9.5-201.fc18.x86_64 /boot/vmlinuz-3.10.4-300.fc19.x86_64 /boot/vmlinuz-0-rescue-9481a187403f46b38d535cf9ffa1cc20
well, I think the xmt-makefv.sh do not care about rescue images. The command should be " find /boot | grep vmlinuz | egrep -v 'xen|hmac|rescue' ". And I think I can give this patch some modification: Signed-off-by: Jincheng Miao <jmiao@redhat.com> --- suites/libvirt-cim/images/xmt-makefv.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/suites/libvirt-cim/images/xmt-makefv.sh b/suites/libvirt-cim/images/xmt-makefv.sh index 1cf6a0f..85a340c 100755 --- a/suites/libvirt-cim/images/xmt-makefv.sh +++ b/suites/libvirt-cim/images/xmt-makefv.sh @@ -51,7 +51,7 @@ partition() { local file=$1 $PARTED $file mklabel msdos - $PARTED $file mkpartfs primary ext2 0 $(($SIZE - 1)) + $PARTED $file mkpart primary ext2 0 $(($SIZE - 1)) } mount_partition() { @@ -62,7 +62,10 @@ mount_partition() { losetup /dev/$loopdev $file || die "Failed to losetup $file" kpartx -a /dev/$loopdev || die "Failed to kpartx $loopdev" + sleep 2 + mke2fs -t ext2 /dev/mapper/${loopdev}p1 >/dev/null 2>&1 || die "Failed to mkfs ${loopdev}p1" tune2fs -j /dev/mapper/${loopdev}p1 >/dev/null 2>&1|| die "Failed to add journal" + sleep 2 mount /dev/mapper/${loopdev}p1 $TMPMOUNT || die "Failed to mount ${loopdev}p1" echo $loopdev @@ -86,7 +88,7 @@ copy_in_ramdisk() { kernel_path() { local prefix=$1 - local image=`find /boot | grep vmlinuz | egrep -v 'xen|hmac' | tail -n1` + local image=`find /boot | grep vmlinuz | egrep -v 'xen|hmac|rescue' | tail if [ -z $image ]; then touch /boot/vmlinuz-$DUMMY_PATH -- 1.8.3.1

Sorry, there is a error when I paste patch. The correct patch is : Signed-off-by: Jincheng Miao <jmiao@redhat.com> --- suites/libvirt-cim/images/xmt-makefv.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/suites/libvirt-cim/images/xmt-makefv.sh b/suites/libvirt-cim/images/xmt-makefv.sh index 1cf6a0f..85a340c 100755 --- a/suites/libvirt-cim/images/xmt-makefv.sh +++ b/suites/libvirt-cim/images/xmt-makefv.sh @@ -51,7 +51,7 @@ partition() { local file=$1 $PARTED $file mklabel msdos - $PARTED $file mkpartfs primary ext2 0 $(($SIZE - 1)) + $PARTED $file mkpart primary ext2 0 $(($SIZE - 1)) } mount_partition() { @@ -62,7 +62,10 @@ mount_partition() { losetup /dev/$loopdev $file || die "Failed to losetup $file" kpartx -a /dev/$loopdev || die "Failed to kpartx $loopdev" + sleep 2 + mke2fs -t ext2 /dev/mapper/${loopdev}p1 >/dev/null 2>&1 || die "Failed to mkfs ${loopdev}p1" tune2fs -j /dev/mapper/${loopdev}p1 >/dev/null 2>&1|| die "Failed to add journal" + sleep 2 mount /dev/mapper/${loopdev}p1 $TMPMOUNT || die "Failed to mount ${loopdev}p1" echo $loopdev @@ -86,7 +88,7 @@ copy_in_ramdisk() { kernel_path() { local prefix=$1 - local image=`find /boot | grep vmlinuz | egrep -v 'xen|hmac' | tail -n1` + local image=`find /boot | grep vmlinuz | egrep -v 'xen|hmac|rescue' | tail -n1` if [ -z $image ]; then touch /boot/vmlinuz-$DUMMY_PATH -- 1.8.3.1 ----- Original Message -----
well, I think the xmt-makefv.sh do not care about rescue images. The command should be " find /boot | grep vmlinuz | egrep -v 'xen|hmac|rescue' ".
And I think I can give this patch some modification:
Signed-off-by: Jincheng Miao <jmiao@redhat.com> --- suites/libvirt-cim/images/xmt-makefv.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/suites/libvirt-cim/images/xmt-makefv.sh b/suites/libvirt-cim/images/xmt-makefv.sh index 1cf6a0f..85a340c 100755 --- a/suites/libvirt-cim/images/xmt-makefv.sh +++ b/suites/libvirt-cim/images/xmt-makefv.sh @@ -51,7 +51,7 @@ partition() { local file=$1
$PARTED $file mklabel msdos - $PARTED $file mkpartfs primary ext2 0 $(($SIZE - 1)) + $PARTED $file mkpart primary ext2 0 $(($SIZE - 1)) }
mount_partition() { @@ -62,7 +62,10 @@ mount_partition() {
losetup /dev/$loopdev $file || die "Failed to losetup $file" kpartx -a /dev/$loopdev || die "Failed to kpartx $loopdev" + sleep 2 + mke2fs -t ext2 /dev/mapper/${loopdev}p1 >/dev/null 2>&1 || die "Failed to mkfs ${loopdev}p1" tune2fs -j /dev/mapper/${loopdev}p1 >/dev/null 2>&1|| die "Failed to add journal" + sleep 2 mount /dev/mapper/${loopdev}p1 $TMPMOUNT || die "Failed to mount ${loopdev}p1"
echo $loopdev @@ -86,7 +88,7 @@ copy_in_ramdisk() { kernel_path() { local prefix=$1
- local image=`find /boot | grep vmlinuz | egrep -v 'xen|hmac' | tail -n1` + local image=`find /boot | grep vmlinuz | egrep -v 'xen|hmac|rescue' | tail
if [ -z $image ]; then touch /boot/vmlinuz-$DUMMY_PATH -- 1.8.3.1

On 08/09/2013 07:27 AM, Jincheng Miao wrote:
----- Original Message -----
I understand the error I saw wasn't in the area you changed. I don't believe my run got to the code you changed and as much as it seems like an ACK would be in order, I couldn't test your portion of the change on my host.
John
FWIW:
I have a f19 host
# find /boot | grep vmlinuz /boot/.vmlinuz-3.9.11-200.fc18.x86_64.hmac /boot/vmlinuz-3.9.6-200.fc18.x86_64 /boot/.vmlinuz-3.9.6-200.fc18.x86_64.hmac /boot/vmlinuz-3.9.11-200.fc18.x86_64 /boot/vmlinuz-3.9.5-201.fc18.x86_64 /boot/vmlinuz-3.10.4-300.fc19.x86_64 /boot/.vmlinuz-3.9.5-201.fc18.x86_64.hmac /boot/.vmlinuz-3.10.4-300.fc19.x86_64.hmac /boot/vmlinuz-0-rescue-9481a187403f46b38d535cf9ffa1cc20
# find /boot | grep vmlinuz | egrep -v 'xen|hmac' /boot/vmlinuz-3.9.6-200.fc18.x86_64 /boot/vmlinuz-3.9.11-200.fc18.x86_64 /boot/vmlinuz-3.9.5-201.fc18.x86_64 /boot/vmlinuz-3.10.4-300.fc19.x86_64 /boot/vmlinuz-0-rescue-9481a187403f46b38d535cf9ffa1cc20
well, I think the xmt-makefv.sh do not care about rescue images. The command should be " find /boot | grep vmlinuz | egrep -v 'xen|hmac|rescue' ".
And I think I can give this patch some modification:
Signed-off-by: Jincheng Miao <jmiao@redhat.com> --- suites/libvirt-cim/images/xmt-makefv.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/suites/libvirt-cim/images/xmt-makefv.sh b/suites/libvirt-cim/images/xmt-makefv.sh index 1cf6a0f..85a340c 100755 --- a/suites/libvirt-cim/images/xmt-makefv.sh +++ b/suites/libvirt-cim/images/xmt-makefv.sh @@ -51,7 +51,7 @@ partition() { local file=$1
$PARTED $file mklabel msdos - $PARTED $file mkpartfs primary ext2 0 $(($SIZE - 1)) + $PARTED $file mkpart primary ext2 0 $(($SIZE - 1)) }
mount_partition() { @@ -62,7 +62,10 @@ mount_partition() {
losetup /dev/$loopdev $file || die "Failed to losetup $file" kpartx -a /dev/$loopdev || die "Failed to kpartx $loopdev" + sleep 2 + mke2fs -t ext2 /dev/mapper/${loopdev}p1 >/dev/null 2>&1 || die "Failed to mkfs ${loopdev}p1" tune2fs -j /dev/mapper/${loopdev}p1 >/dev/null 2>&1|| die "Failed to add journal" + sleep 2 mount /dev/mapper/${loopdev}p1 $TMPMOUNT || die "Failed to mount ${loopdev}p1"
echo $loopdev @@ -86,7 +88,7 @@ copy_in_ramdisk() { kernel_path() { local prefix=$1
- local image=`find /boot | grep vmlinuz | egrep -v 'xen|hmac' | tail -n1` + local image=`find /boot | grep vmlinuz | egrep -v 'xen|hmac|rescue' | tail
if [ -z $image ]; then touch /boot/vmlinuz-$DUMMY_PATH
Yep - that works. I suppose you need me to push right? John
participants (2)
-
Jincheng Miao
-
John Ferlan