[upgrade sonic] reduce number of installed sonic image before installing#605
[upgrade sonic] reduce number of installed sonic image before installing#605yxieca wants to merge 1 commit intosonic-net:masterfrom
Conversation
Before installing a new sonic image, reduce number of installed sonic images to make space on the harddrive. Signed-off-by: Ying Xie <ying.xie@microsoft.com>
| elif line != "Available:" and len(line) > 0: | ||
| images.add(line) | ||
|
|
||
| return keep, images |
There was a problem hiding this comment.
Just another thought is to return (images - keep) since the only check below is to skip images in keep.
There was a problem hiding this comment.
The reason I kept that was that we need to count len(keep) to decide how many images to delete.
There was a problem hiding this comment.
You are not using len(keep) but len(images)
| - name: define retain_copies if not defined | ||
| set_fact: | ||
| retain_copies: 2 | ||
| when: retain_copies is not defined |
There was a problem hiding this comment.
I feel the word "copies" is a bit confusing. Something along the lines of max_images_to_retain (but maybe less verbose) is a more accurate name.
|
|
||
| discard = set() | ||
| for img in images: | ||
| if (len(images) - len(discard)) <= retain_copies: |
There was a problem hiding this comment.
What happens if len(keep) > retain_copies? We will retain more than we were instructed. Should we at least output a message in case this is not expected?
|
Will create a new PR after refactoring. |
…-net#3345) * [201811] advance sairedis, swss and utilities sub module heads Submodule src/sonic-utilities f28b720..0a3455b: > [neighbor_advertise]: Use the existing MIRROR ACL table (sonic-net#605) > [neighbor_advertiser] Use full vlan name for vxlan tunnel map programming (sonic-net#604) Submodule src/sonic-swss f44029d..950e9db: > [orchagent] Add support for Innovium platform (sonic-net#1026) > [policerorch]: Add the capability to update policer rate/size (sonic-net#1017) Submodule src/sonic-sairedis 992cdc0..4ee82cb: > [syncd] Add support for Innovium platform (sonic-net#496) Signed-off-by: Ying Xie <ying.xie@microsoft.com> * [201811][utilities] advance sub module head Submodule src/sonic-utilities 0a3455b..7460f5c: > [fast/warm reboot] kill radv docker before stopping BGP (sonic-net#608) Signed-off-by: Ying Xie <ying.xie@microsoft.com>
Signed-off-by: Ying Xie ying.xie@microsoft.com
Type of change
Approach
How did you do it?
Before installing a new sonic image, reduce number of installed sonic
images to make space on the harddrive.
How did you verify/test it?
Tested on Arista 7260 platform