-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a build mode to the installer to facilitate partition dump #846
Add a build mode to the installer to facilitate partition dump #846
Conversation
…on in build environment
@padmanarayana, It will cover your contributions to all Microsoft-managed open source projects. |
build_image.sh
Outdated
|
||
## Generate a compressed 8GB partition dump that can be used to 'dd' in-lieu of using the onie-nos-installer | ||
## The 'build' install mode of the installer is used to generate this dump. | ||
if [[ "$TARGET_MACHINE" == "broadcom" ]] && [[ -n "$DELL_Z9100_PLATFORM_MODULE_VERSION" || -n "$DELL_S6100_PLATFORM_MODULE_VERSION" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only for this machine?
Can we make it more generic to support any type of machine?
Removed the platform check as requested. Currently, the installer is platform agnostic - so it cannot determine the dump partition size : which is set to 8GB. I presume this would suffice for most platforms. |
@padmanarayana, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request. |
|
||
[ -b "$blk_dev" ] || { | ||
if [ "$install_env" != "build" ] && [ ! -b "$blk_dev" ]; then | ||
echo "Error: Unable to determine block device of ONIE install" | ||
exit 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this into previous block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
I like the user command to be make target/sonic-broadcom.raw, and it will generate the dd image you have created. If user only specify target/sonic-broadcom.bin, then you do not need to build the raw image. By default, the raw image will be gzipped. Also, you can specify the raw image disk size, default is 8G. you can add two variables in onie-image.conf
|
if [ ! -e /host/machine.conf ]; then | ||
onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//') | ||
mkdir -p /mnt/onie-boot | ||
mount $onie_dev /mnt/onie-boot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mount $onie_dev /mnt/onie-boot [](start = 8, length = 30)
please umount /mnt/onie-boot after done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
can you help to understand why we still have 6.6 space give the /var/log is a 4G file under /host/disk-img/var-log.ext4
|
@@ -559,7 +600,13 @@ $onie_menuentry | |||
EOF | |||
fi | |||
|
|||
cp $grub_cfg $onie_initrd_tmp/$demo_mnt/grub/grub.cfg | |||
if [ "$install_env" = "build" ]; then | |||
cp $grub_cfg $demo_mnt/$image_dir/platform/grub.cfg.migration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is your plan for this grub.cfg.migration? I do not see it is used anywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed all changes pertaining to grub.cfg.migration since /host/machine.conf can be used instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The migration flag was meant to be used to install the grub for SONiC post migration. Since machine.conf can be used, it is now removed.
@@ -35,6 +35,18 @@ if [ "$IMAGE_TYPE" = "onie" ]; then | |||
./onie-mk-demo.sh $TARGET_PLATFORM $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \ | |||
installer platform/$TARGET_MACHINE/platform.conf $OUTPUT_ONIE_IMAGE OS $IMAGE_VERSION $ONIE_IMAGE_PART_SIZE \ | |||
$ONIE_INSTALLER_PAYLOAD | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in line 17, $IMAGE_TYPE = "onie" or $IMAGE_TYPE = "raw"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introduced IMAGE_TYPE "raw".
@@ -35,6 +35,18 @@ if [ "$IMAGE_TYPE" = "onie" ]; then | |||
./onie-mk-demo.sh $TARGET_PLATFORM $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \ | |||
installer platform/$TARGET_MACHINE/platform.conf $OUTPUT_ONIE_IMAGE OS $IMAGE_VERSION $ONIE_IMAGE_PART_SIZE \ | |||
$ONIE_INSTALLER_PAYLOAD | |||
|
|||
## Generate a compressed 8GB partition dump that can be used to 'dd' in-lieu of using the onie-nos-installer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if IMAGE_TYPE == "raw", then after we build the onie image, we need to install it in a raw device. Here, in the build_image.sh, we should use fallocate to create the disk file and in onie installer, we only do installation in the disk file, after that, we should do gzip here in the build_image.sh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Note that the build of sonic-broadcom.raw will build the sonic-broadcom.bin and then use it to build the sonic-broadcom.raw.
cp $grub_cfg $onie_initrd_tmp/$demo_mnt/grub/grub.cfg | ||
if [ "$install_env" = "build" ]; then | ||
cp $grub_cfg $demo_mnt/$image_dir/platform/grub.cfg.migration | ||
gzip /tmp/sonic-${TARGET_MACHINE}_8GB_dd.img |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do the gzip in the build_image.sh
# to facilitate migration from a 3rd party OS into SONiC | ||
if [ "$install_env" = "build" ]; then | ||
touch $demo_mnt/$image_dir/platform/migration | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer not to introduce this migration flag. In the rc.local, if it is the first time, check if there is /host/machine.conf or not first, if there is no /host/machine.conf, then mount onie and copy the file. We do not really need the migration flag here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed migration flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as comments
This seems to be the expected behaviour as shown in the test on my build server: root@ubuntu-16:/work# Note that once a child ext4 partition (4G.fs) is carved out of the parent, the parent does not immediately account for the child's partition size as used. However, once the child partition usage increases, it gets accounted both in the child as well as the parent appropriately. |
Please refer to #901 |
* d0f8091 2020-03-22 | Revert "add support for MCLAG (sonic-net#453)" (sonic-net#849) (HEAD -> master, origin/master, origin/HEAD) [lguohan] * 6f54e8c 2020-03-22 | Revert "return list for _get_optional_services() (sonic-net#822)" (sonic-net#848) [lguohan] * f1c79d5 2020-03-22 | return list for _get_optional_services() (sonic-net#822) (HEAD -> master, origin/master, origin/HEAD) [shine4chen] * 28ea21a 2020-03-21 | Fix kernel panic for irq after fast-reboot (sonic-net#823) [byu343] * 727b499 2020-03-22 | [decode-syseeprom] fix getattribute check for sime platforms (sonic-net#835) [Mykola F] * db78cb6 2020-03-21 | Update Command Reference with sFlow section (sonic-net#841) [padmanarayana] * 780673c 2020-03-21 | explicitly specify command with underscores (sonic-net#846) [lguohan] * 07dc201 2020-03-21 | [db_migrator]Do DB migration for buffer pool size change on Mellanox platform (sonic-net#833) [Kebo Liu] * 9a94955 2020-03-20 | [sonic_installer] Enable ARM64 arch (sonic-net#811) [arheneus@marvell.com] * 92b30c2 2020-03-18 | [config]: add syslog messages to config load_minigraph/reload (sonic-net#843) [lguohan] * 4389ffe 2020-03-17 | [intfutil] set speed to 0 when interface speed is not available (sonic-net#839) [Ying Xie] * 45c6c68 2020-03-17 | [Mellanox] add document for thermal control related cli (sonic-net#832) [Junchao-Mellanox] * 7105400 2020-03-12 | Add kdump support for Aboot platforms (sonic-net#824) [byu343] * c5c5ffc 2020-03-01 | [fwutil]: Set default socket timeout for FW download to 30 sec. (sonic-net#821) [Nazarii Hnydyn] * 81c5930 2020-03-01 | Update config/show to include PFC Watchdog commands (sonic-net#736) [Andriy Moroz] * 66e9dfb 2020-02-28 | [MultiDB] sonic-utilities - replace redis-cli/redis-dump with sonic-db-cli/sonic-db-dump (sonic-net#810) [Dong Zhang] * 8aea564 2020-02-24 | add support for MCLAG (sonic-net#453) [shine4chen] * 118620f 2020-02-23 | [reboot] make sure the reboot happens even if platform reboot failed (sonic-net#819) [Ying Xie] * 40eff82 2020-02-22 | Multi-Db changes for NAT feature. (sonic-net#818) [Akhilesh Samineni] * a4cb4dd 2020-02-21 | [Command-Reference.md] Unify Usage statments and Examples (including sample prompts) (sonic-net#816) [Joe LeVeque] Signed-off-by: Guohan Lu <lguohan@gmail.com>
Signed-off-by: Shu0T1an ChenG <shuche@microsoft.com>
* [submodule]: update sonic-utilities * d0f8091 2020-03-22 | Revert "add support for MCLAG (#453)" (#849) (HEAD -> master, origin/master, origin/HEAD) [lguohan] * 6f54e8c 2020-03-22 | Revert "return list for _get_optional_services() (#822)" (#848) [lguohan] * f1c79d5 2020-03-22 | return list for _get_optional_services() (#822) (HEAD -> master, origin/master, origin/HEAD) [shine4chen] * 28ea21a 2020-03-21 | Fix kernel panic for irq after fast-reboot (#823) [byu343] * 727b499 2020-03-22 | [decode-syseeprom] fix getattribute check for sime platforms (#835) [Mykola F] * db78cb6 2020-03-21 | Update Command Reference with sFlow section (#841) [padmanarayana] * 780673c 2020-03-21 | explicitly specify command with underscores (#846) [lguohan] * 07dc201 2020-03-21 | [db_migrator]Do DB migration for buffer pool size change on Mellanox platform (#833) [Kebo Liu] * 9a94955 2020-03-20 | [sonic_installer] Enable ARM64 arch (#811) [arheneus@marvell.com] * 92b30c2 2020-03-18 | [config]: add syslog messages to config load_minigraph/reload (#843) [lguohan] * 4389ffe 2020-03-17 | [intfutil] set speed to 0 when interface speed is not available (#839) [Ying Xie] * 45c6c68 2020-03-17 | [Mellanox] add document for thermal control related cli (#832) [Junchao-Mellanox] * 7105400 2020-03-12 | Add kdump support for Aboot platforms (#824) [byu343] * c5c5ffc 2020-03-01 | [fwutil]: Set default socket timeout for FW download to 30 sec. (#821) [Nazarii Hnydyn] * 81c5930 2020-03-01 | Update config/show to include PFC Watchdog commands (#736) [Andriy Moroz] * 66e9dfb 2020-02-28 | [MultiDB] sonic-utilities - replace redis-cli/redis-dump with sonic-db-cli/sonic-db-dump (#810) [Dong Zhang] * 8aea564 2020-02-24 | add support for MCLAG (#453) [shine4chen] * 118620f 2020-02-23 | [reboot] make sure the reboot happens even if platform reboot failed (#819) [Ying Xie] * 40eff82 2020-02-22 | Multi-Db changes for NAT feature. (#818) [Akhilesh Samineni] * a4cb4dd 2020-02-21 | [Command-Reference.md] Unify Usage statments and Examples (including sample prompts) (#816) [Joe LeVeque] Signed-off-by: Guohan Lu <lguohan@gmail.com>
[fwutil]: Use overlay driver when mounting next image filesystem (#825) Fix for adding L3 interface to Vlan group (#826)Fix for adding L3 interface to Vlan group (#826) [db_migrator]Do DB migration for buffer pool size change on Mellanox platform (#833) explicitly specify command with underscores (#846) [intfutil] set speed to 0 when interface speed is not available (#839)
[fwutil]: Use overlay driver when mounting next image filesystem (sonic-net#825) Fix for adding L3 interface to Vlan group (sonic-net#826)Fix for adding L3 interface to Vlan group (sonic-net#826) [db_migrator]Do DB migration for buffer pool size change on Mellanox platform (sonic-net#833) explicitly specify command with underscores (sonic-net#846) [intfutil] set speed to 0 when interface speed is not available (sonic-net#839)
Starting click 7.0. The default behavior of a command with under scores will be replace with dashes. this is to address the above default behavior change, so that the command remains the same. more details can be found: pallets/click#1123
6cfb3ecb0248768da0a91e5f7fb4477c5da7eb4e (HEAD -> 201911, origin/201911) [build]: allow to use extra inc/lib location to build the package (#595) 40d34872d3b7f354adac67f084eebf6ee467f779 Merge pull request #846 from xumia/azp-201911 76ac50f147a7d820b19d8d7628a67f2fe4f5159b Disable the build test 6c9cf655b8b5b152cab1d578e05eddf8238b81b0 Fix branch reference error ca8d81d37a9b0294098f161b036d330d9ff461e0 [ci]: download artifacts from master branch (#768) 0cbf4d55c67a9f8f52715f95536f3588acf06c4a [ci]: use sonicbld pool (#766) b6f1265ee9bd86f8a5e909a6f1e9b2384497c906 [ci]: add build for arm64 and armhf (#757) 9ec0a7da64d479b124815edc5b505fb88b2532a0 CI: add azure pipeline CI/CD (#754) 1436dbe02cd3c56f796c6b3398d4075cd05d97e0 Fix RIF issue (#835) Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
Note: The installer currently checks the /etc/lsb-release to determine if it's a onie environment. The assumption is that DISTRIB_ID=onie will be present in all the ONIE builds across platforms.