hwameistor / drbd-adapter

A DRBD kernel loader that auto-adapts OS distros
Apache License 2.0
4 stars 6 forks source link

redhat7.9 run drbd-adapter pod Error #80

Closed Bpmm9012 closed 1 month ago

Bpmm9012 commented 1 month ago

I try deploy drbd-adapter In redhat 7.9 system environment and Kubernetes v1.28.2 ,but error occurs when starting the job Err log

+ which lbdisttool.py
/pkgs/entrypoint.adapter.sh: line 6: which: command not found
++ lbdisttool.py -l
++ awk -F. '{print $1}'
Traceback (most recent call last):
  File "/usr/bin/lbdisttool.py", line 5, in <module>
    pkg_resources.run_script('lbdist==0.8.1', 'lbdisttool.py')
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 540, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1462, in run_script
    exec_(script_code, namespace, namespace)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 41, in exec_
    exec("""exec code in globs, locs""")
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/lbdist-0.8.1-py2.7.egg/EGG-INFO/scripts/lbdisttool.py", line 34, in <module>

  File "build/bdist.linux-x86_64/egg/lbdist/distribution.py", line 163, in __init__
  File "build/bdist.linux-x86_64/egg/lbdist/distribution.py", line 31, in __init__
  File "build/bdist.linux-x86_64/egg/lbdist/distribution.py", line 96, in _update_version
Exception: Could not determine version information for your Centos
+ image_dist=
++ lbdisttool.py -l --os-release /etc/host-release
++ awk -F. '{print $1}'
+ host_dist=rhel7
+ '[' -z ']'
+ grep -i 'kylin .* v10' /etc/os-release
+ '[' -z rhel7 ']'
+ [[ rhel7 != '' ]]
+ echo 'Image type does not match OS type, skip !'
+ [[ no == \y\e\s ]]
+ exit 1
Image type does not match OS type, skip !

One job start a pod with two container,the one name is shipper,copy file to emptydir pkgs,the other container‘s name is rhel7 with command /pkgs/entrypoint.adapter.sh 3.10.0-1160.el7.x86_64. abow error log is printed by container rhel7

I check the /pkgs/entrypoint.adapter.sh content

image_dist="$(lbdisttool.py -l | awk -F'.' '{print $1}' )"
host_dist="$(lbdisttool.py -l --os-release /etc/host-release | awk -F'.' '{print $1}' )"
...
if [[ $host_dist != $image_dist ]]; then 
   echo "Image type does not match OS type, skip !" 
   [[ $LB_SKIP == 'yes' ]] && exit 0 || exit 1
fi

The container rhel7 using images hwameistor/drbd9-rhel7:v9.0.32-1 which base on centos7 when i use

 lbdisttool.py -l

in container(start by same job),return the error

Exception: Could not determine version information for your Centos

because the os info it get is centos,while command

 lbdisttool.py -l --os-release /etc/host-release  

return "rhel7.9"

Bpmm9012 commented 1 month ago

create new images with overwrite /files/entrypoint.adapter.sh

#if [[ $host_dist != $image_dist ]]; then 
#   echo "Image type does not match OS type, skip !" 
#   [[ $LB_SKIP == 'yes' ]] && exit 0 || exit 1
#fi

It appears that the issue can be resolved,But only applicable to RHEL 7