-
Notifications
You must be signed in to change notification settings - Fork 669
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
Remove partially installer image when image install failed. #3712
base: master
Are you sure you want to change the base?
Remove partially installer image when image install failed. #3712
Conversation
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
sonic_installer/main.py
Outdated
echo_and_log('Delete partial installed image: {}'.format(binary_image_version)) | ||
new_image_dir = bootloader.get_image_path(binary_image_version) | ||
run_command(["rm", "-rf", new_image_dir]) | ||
raise e |
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.
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.
Fixed
echo_and_log('Image install failed with exception: {}'.format(e)) | ||
echo_and_log('Delete partial installed image: {}'.format(binary_image_version)) | ||
new_image_dir = bootloader.get_image_path(binary_image_version) | ||
run_command(["rm", "-rf", new_image_dir]) |
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.
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.
Should we use bootloader.remove_image
?
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.
We can't because remove_image need check bootloader info, but install failed at here doesn't update bootloader.
The bootloader will be update by line 612:
update_sonic_environment(bootloader, binary_image_version)
A partial installed image failed here only extract files to /host/image-version folder, so we only need to delete that folder.
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.
how about shutil.rmtree
?
sonic_installer/main.py
Outdated
bootloader.install_image(image_path) | ||
try: | ||
bootloader.install_image(image_path) | ||
except BaseException as e: |
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.
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.
Fixed, install image failed with throw SystemExit exception.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Remove partially installer image when image install failed.
What I did
When install image failed, partially installed image not removed, which may cause disk full issue on small disk device.
How I did it
Handle install image SystemExit exception and uninstall image.
How to verify it
Manually verify.
Pass all test case
Work item tracking
Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)