Skip to content

checking disk and memory space before installing image#11151

Merged
wangxin merged 2 commits intosonic-net:masterfrom
lipxu:20231228_public_upgrade
Dec 29, 2023
Merged

checking disk and memory space before installing image#11151
wangxin merged 2 commits intosonic-net:masterfrom
lipxu:20231228_public_upgrade

Conversation

@lipxu
Copy link
Contributor

@lipxu lipxu commented Dec 28, 2023

Description of PR

Summary:
Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 201911
  • 202012
  • 202205
  • 202305

Approach

What is the motivation for this PR?

Update images failed sometimes on low-memory devices.

How did you do it?

Check memory and disk space before installing image.
If no enough space of memory or disk, abort.

How did you verify/test it?

Upgrade the images on low memory and small disk devices several times. no issue.

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

@mssonicbld
Copy link
Collaborator

The pre-commit check detected issues in the files touched by this pull request.
The pre-commit check is a mandatory check, please fix detected issues.

Detailed pre-commit check results:
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

ansible/library/reduce_and_add_sonic_images.py:147:121: E501 line too long (133 > 120 characters)
ansible/library/reduce_and_add_sonic_images.py:160:121: E501 line too long (142 > 120 characters)
ansible/library/reduce_and_add_sonic_images.py:168:121: E501 line too long (131 > 120 characters)
ansible/library/reduce_and_add_sonic_images.py:171:121: E501 line too long (162 > 120 characters)

flake8...............................................(no files to check)Skipped
check conditional mark sort..........................(no files to check)Skipped

To run the pre-commit checks locally, you can follow below steps:

  1. Ensure that default python is python3. In sonic-mgmt docker container, default python is python2. You can run
    the check by activating the python3 virtual environment in sonic-mgmt docker container or outside of sonic-mgmt
    docker container.
  2. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

wangxin
wangxin previously approved these changes Dec 29, 2023
@wangxin
Copy link
Collaborator

wangxin commented Dec 29, 2023

@lipxu Can you fix the pre-commit alerts?

@lipxu
Copy link
Contributor Author

lipxu commented Dec 29, 2023

@lipxu Can you fix the pre-commit alerts?

Thanks for reminder, had pushed the fix.

@wangxin wangxin merged commit 128567c into sonic-net:master Dec 29, 2023
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Jan 2, 2024
What is the motivation for this PR?
Update images failed sometimes on low-memory devices.

How did you do it?
Check memory and disk space before installing image.
If no enough space of memory or disk, abort.

How did you verify/test it?
Upgrade the images on low memory and small disk devices several times. no issue.

Signed-off-by: xuliping <[email protected]>
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202305: #11164

mssonicbld pushed a commit that referenced this pull request Jan 2, 2024
What is the motivation for this PR?
Update images failed sometimes on low-memory devices.

How did you do it?
Check memory and disk space before installing image.
If no enough space of memory or disk, abort.

How did you verify/test it?
Upgrade the images on low memory and small disk devices several times. no issue.

Signed-off-by: xuliping <[email protected]>
wangxin pushed a commit that referenced this pull request Jan 4, 2024
What is the motivation for this PR?
Below PR enhanced the upgrade sonic image, and would check memory and disk usage before installing the image.
But not calculate SWAP memory into the total available memory space.
#11151

How did you do it?
Add swap free memory into total available memory.

Signed-off-by: xuliping <[email protected]>
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Jan 4, 2024
What is the motivation for this PR?
Below PR enhanced the upgrade sonic image, and would check memory and disk usage before installing the image.
But not calculate SWAP memory into the total available memory space.
sonic-net#11151

How did you do it?
Add swap free memory into total available memory.

Signed-off-by: xuliping <[email protected]>
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Jan 4, 2024
What is the motivation for this PR?
Below PR enhanced the upgrade sonic image, and would check memory and disk usage before installing the image.
But not calculate SWAP memory into the total available memory space.
sonic-net#11151

How did you do it?
Add swap free memory into total available memory.

Signed-off-by: xuliping <[email protected]>
mssonicbld pushed a commit that referenced this pull request Jan 4, 2024
What is the motivation for this PR?
Below PR enhanced the upgrade sonic image, and would check memory and disk usage before installing the image.
But not calculate SWAP memory into the total available memory space.
#11151

How did you do it?
Add swap free memory into total available memory.

Signed-off-by: xuliping <[email protected]>
@mssonicbld
Copy link
Collaborator

@lipxu PR conflicts with 202311 branch

mssonicbld pushed a commit that referenced this pull request Jan 22, 2024
What is the motivation for this PR?
Below PR enhanced the upgrade sonic image, and would check memory and disk usage before installing the image.
But not calculate SWAP memory into the total available memory space.
#11151

How did you do it?
Add swap free memory into total available memory.

Signed-off-by: xuliping <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants