Merge lp:~liuyq0307/lava-master-image-scripts/use-kpartx into lp:lava-master-image-scripts

Proposed by Yongqin Liu
Status: Merged
Merged at revision: 61
Proposed branch: lp:~liuyq0307/lava-master-image-scripts/use-kpartx
Merge into: lp:lava-master-image-scripts
Diff against target: 56 lines (+15/-4)
1 file modified
lava-create-master (+15/-4)
To merge this branch: bzr merge lp:~liuyq0307/lava-master-image-scripts/use-kpartx
Reviewer Review Type Date Requested Status
Spring Zhang (community) Approve
Review via email: mp+111133@code.launchpad.net

Description of the change

change to use kpartx instead of partx to map the partitions of image file to kernel

To post a comment you must log in.
Revision history for this message
Spring Zhang (qzhang) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lava-create-master'
--- lava-create-master 2012-05-16 13:05:26 +0000
+++ lava-create-master 2012-06-20 02:02:19 +0000
@@ -48,6 +48,9 @@
48 precise)48 precise)
49 export LAVA_SUPPORTED=149 export LAVA_SUPPORTED=1
50 ;;50 ;;
51 natty)
52 export LAVA_SUPPORTED=1
53 ;;
51 esac54 esac
52 ;;55 ;;
53 esac56 esac
@@ -253,7 +256,7 @@
253 if [ -n "$LOOP_DEV" ]; then256 if [ -n "$LOOP_DEV" ]; then
254 # Remove loopback partitions257 # Remove loopback partitions
255 verbose " * Removing loopback device partitions..."258 verbose " * Removing loopback device partitions..."
256 partx --delete $LOOP_DEV259 kpartx -d $LOOP_DEV
257 # Detach loopback device 260 # Detach loopback device
258 verbose " * Detaching loopback device..."261 verbose " * Detaching loopback device..."
259 losetup --detach $LOOP_DEV262 losetup --detach $LOOP_DEV
@@ -276,6 +279,13 @@
276279
277280
278make_master() {281make_master() {
282 if [ -z "$(which kpartx)" ]; then
283 sudo apt-get -y install kpartx
284 if [ $? -ne 0 ]; then
285 echo "Failed to install kpartx" >&2
286 exit 1
287 fi
288 fi
279 # Cleanup on exit 289 # Cleanup on exit
280 trap cleanup EXIT290 trap cleanup EXIT
281291
@@ -371,15 +381,16 @@
371381
372 # Add partition devices382 # Add partition devices
373 verbose " * Adding partitions to the loopback device..."383 verbose " * Adding partitions to the loopback device..."
374 partx --add $LOOP_DEV384 kpartx -av $LOOP_DEV
375385
376 # Get a mount point for master image386 # Get a mount point for master image
377 verbose " * Creating temporary mount point for rootfs..."387 verbose " * Creating temporary mount point for rootfs..."
378 MASTER_MNT=$(mktemp --directory --suffix .lava.$dev.master)388 MASTER_MNT=$(mktemp --directory --suffix .lava.$dev.master)
379389
380 # Mount the root filesystem390 # Mount the root filesystem
381 verbose " * Mounting rootfs..."391 verbose " * Mounting rootfs..."
382 mount ${LOOP_DEV}p${ROOTFS_PARTITION} $MASTER_MNT392 LOOP_NAME=`basename ${LOOP_DEV}`
393 mount /dev/mapper/${LOOP_NAME}p${ROOTFS_PARTITION} $MASTER_MNT
383 394
384 # Update hostname to 'master'395 # Update hostname to 'master'
385 verbose " * Changing hostname to 'master'..."396 verbose " * Changing hostname to 'master'..."

Subscribers

People subscribed via source and target branches