Skip to content
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

[sonic_installer] don't print errors when installing an image not sup… #1719

Conversation

stepanblyschak
Copy link
Contributor

@stepanblyschak stepanblyschak commented Jul 20, 2021

…porting app ext

Signed-off-by: Stepan Blyschak stepanb@nvidia.com

FIXES: sonic-net/sonic-buildimage#8149

What I did

Don't print errors if installing app.ext incompatible image.

How I did it

Check for docker.sh existance and take an assumption that if it exists then it is app.ext compatible.

How to verify it

From master image install 202012 image and verify no errors in logs.

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)

Installing image SONiC-OS-202012.129-90c0dcf9e_Internal and setting it as default...
Command: bash ./sonic-mellanox.bin
Verifying image checksum ... OK.
Preparing image archive ... OK.
Installing SONiC in SONiC
ONIE Installer: platform: x86_64-mellanox-r0
onie_platform: x86_64-mlnx_msn3700-r0
Installing SONiC to /host/image-202012.129-90c0dcf9e_Internal
Archive:  fs.zip
   creating: /host/image-202012.129-90c0dcf9e_Internal/boot/
  inflating: /host/image-202012.129-90c0dcf9e_Internal/boot/config-4.19.0-12-2-amd64  
  inflating: /host/image-202012.129-90c0dcf9e_Internal/boot/initrd.img-4.19.0-12-2-amd64  
  inflating: /host/image-202012.129-90c0dcf9e_Internal/boot/System.map-4.19.0-12-2-amd64  
  inflating: /host/image-202012.129-90c0dcf9e_Internal/boot/vmlinuz-4.19.0-12-2-amd64  
   creating: /host/image-202012.129-90c0dcf9e_Internal/platform/
 extracting: /host/image-202012.129-90c0dcf9e_Internal/platform/firsttime  
   creating: /host/image-202012.129-90c0dcf9e_Internal/platform/x86_64-grub/
  inflating: /host/image-202012.129-90c0dcf9e_Internal/platform/x86_64-grub/grub-pc-bin_2.02+dfsg1-20+deb10u4_amd64.deb  
 extracting: /host/image-202012.129-90c0dcf9e_Internal/fs.squashfs  
Switch CPU vendor is: GenuineIntel
Switch CPU cstates are: disabled
Installed SONiC base image SONiC-OS successfully

Command: grub-set-default --boot-directory=/host 0

Command: config-setup backup
Taking backup of current configuration

Command: mkdir -p /tmp/image-202012.129-90c0dcf9e_Internal-fs
Command: mount -t squashfs /host/image-202012.129-90c0dcf9e_Internal/fs.squashfs /tmp/image-202012.129-90c0dcf9e_Internal-fs
Command: sonic-cfggen -d -y /tmp/image-202012.129-90c0dcf9e_Internal-fs/etc/sonic/sonic_version.yml -t /tmp/image-202012.129-90c0dcf9e_Internal-fs/usr/share/sonic/templates/sonic-environment.j2
Command: umount -r -f /tmp/image-202012.129-90c0dcf9e_Internal-fs
Command: rm -rf /tmp/image-202012.129-90c0dcf9e_Internal-fs
Command: mkdir -p /tmp/image-202012.129-90c0dcf9e_Internal-fs
Command: mount -t squashfs /host/image-202012.129-90c0dcf9e_Internal/fs.squashfs /tmp/image-202012.129-90c0dcf9e_Internal-fs
Command: mkdir -p /host/image-202012.129-90c0dcf9e_Internal/rw
Command: mkdir -p /host/image-202012.129-90c0dcf9e_Internal/work
Command: mkdir -p /tmp/image-202012.129-90c0dcf9e_Internal-fs
Command: mount overlay -t overlay -o rw,relatime,lowerdir=/tmp/image-202012.129-90c0dcf9e_Internal-fs,upperdir=/host/image-202012.129-90c0dcf9e_Internal/rw,workdir=/host/image-202012.129-90c0dcf9e_Internal/work /tmp/image-202012.129-90c0dcf9e_Internal-fs
Command: mkdir -p /tmp/image-202012.129-90c0dcf9e_Internal-fs/var/lib/docker
Command: mount --bind /host/image-202012.129-90c0dcf9e_Internal/docker /tmp/image-202012.129-90c0dcf9e_Internal-fs/var/lib/docker
Command: chroot /tmp/image-202012.129-90c0dcf9e_Internal-fs mount proc /proc -t proc
Command: chroot /tmp/image-202012.129-90c0dcf9e_Internal-fs mount sysfs /sys -t sysfs
Warning: SONiC Application Extension is not supported in this image
Command: umount -f -R /tmp/image-202012.129-90c0dcf9e_Internal-fs
Command: umount -r -f /tmp/image-202012.129-90c0dcf9e_Internal-fs
Command: rm -rf /tmp/image-202012.129-90c0dcf9e_Internal-fs
Command: sync;sync;sync

Command: sleep 3

Done

…porting app ext

Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
@stepanblyschak
Copy link
Contributor Author

/azpw run

1 similar comment
@stepanblyschak
Copy link
Contributor Author

/azpw run

run_command_or_raise(["chroot", new_image_mount, SONIC_PACKAGE_MANAGER, "migrate",
os.path.join("/", tmp_dir, packages_file),
"--dockerd-socket", os.path.join("/", tmp_dir, DOCKERD_SOCK),
"-y"])
finally:
run_command_or_raise(["chroot", new_image_mount, DOCKER_CTL_SCRIPT, "stop"], raise_exception=False)
if docker_started:
Copy link
Contributor

@qiluo-msft qiluo-msft Jul 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker_started

Why you need this check? If the DOCKER_CTL_SCRIPT could not be stop more than once, it's a bug. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qiluo-msft This check prevents doing "stop" in case we haven't done "start" at line 351

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know your intention. My point here is that a service script in general should allow stop a stopped service and return 0. So I think this is a bug inside /usr/lib/docker/docker.sh

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not like it cannot stop it if it is stopped already. Here we added a check - if DOCKER_CTL_SCRIPT exists or not. If it exists then we continue the flow and start docker, if not we return from the function but a cleanup is still required. In case DOCKER_CTL_SCRIPT is missing this line will fail and print error. So a check is added "if docker_started", if it was started DOCKER_CTL_SCRIPT exists and we can execute this line, if not - not even needed to execute stop.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not like it cannot stop it if it is stopped already.

I checked files/docker/docker, and it is using start-stop-daemon --stop --pidfile "$DOCKER_SSD_PIDFILE" --retry 10 in the stop branch. I think the option --oknodo will treat noop as success.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qiluo-msft It is not what I fix in this PR. The intention is to not call DOCKER_CTL_SCRIPT stop in case DOCKER_CTL_SCRIPT is missing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification!

@qiluo-msft qiluo-msft merged commit 0d53b7a into sonic-net:master Aug 3, 2021
judyjoseph pushed a commit that referenced this pull request Aug 7, 2021
…porting app ext (#1719)

FIXES: sonic-net/sonic-buildimage#8149

#### What I did
Don't print errors if installing app.ext incompatible image.

#### How I did it
Check for docker.sh existance and take an assumption that if it exists then it is app.ext compatible.

#### How to verify it
From master image install 202012 image and verify no errors in logs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants