lop-devops / LOPOsinstall

GNU General Public License v2.0
2 stars 5 forks source link

installvm.py script not working for RHEL10 Distro #12

Open vpuliyal opened 4 months ago

vpuliyal commented 4 months ago

While installing RHEL10 distro on my target lpar I could see below errors.

2024-06-12 03:28:59,639 [DEBUG]  [    6.941093] dracut-initqueue[1655]: Warning: can't find installer main image path in .treeinfo
2024-06-12 03:28:59,639 [DEBUG]  [    6.946104] dracut-initqueue[1854]:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
2024-06-12 03:28:59,639 [DEBUG]  [    6.946280] dracut-initqueue[1854]:                                  Dload  Upload   Total   Spent    Left  Speed
2024-06-12 03:29:05,405 [DEBUG]  [   12.706667] dracut-initqueue[1854]: ^M  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0^M  0  633M    0 4927k    0     0  88.7M      0  0:00:07 --:--:--  0:00:07 87.4M^M 18  633M   18  114M    0     0   108M      0  0:00:05  0:00:01  0:00:04  108M^M 35  633M   35  224M    0     0   109M      0  0:00:05  0:00:02  0:00:03  109M^M 52  633M   52  334M    0     0   109M      0  0:00:05  0:00:03  0:00:02  109M^M 70  633M   70  445M    0     0   109M      0  0:00:05  0:00:04  0:00:01  109M^M 87  633M   87  555M    0     0   109M      0  0:00:05  0:00:05 --:--:--  110M^M100  633M  100  633M    0     0   109M      0  0:00:05  0:00:05 --:--:--  110M
2024-06-12 03:29:05,451 [DEBUG]  [   12.753277] dracut-initqueue[1936]: Unknown device "/dev//tmp/curl_fetch_url1/install.img": No such device
2024-06-12 03:29:05,451 [DEBUG]  [   12.755716] dracut-initqueue[1937]: Unknown device "/sys/": No such device
2024-06-12 03:29:05,509 [DEBUG]  [   12.813456] loop: module loaded
2024-06-12 03:29:05,509 [DEBUG]  [   12.814786] loop0: detected capacity change from 0 to 1297728
2024-06-12 03:29:05,510 [DEBUG]  ^[[0;21;39mloop: module loaded^[[0m
2024-06-12 03:29:05,510 [DEBUG]  ^[[0;21;39mloop0: detected capacity change from 0 to 1297728^[[0m

I was able to identify the problematic area of RHEL10 installation. installvm.py script is hard-coded for RHEL8 and RHEL9 Distros. It is not taking care of RHEL10 installation. I made changes in the script and the problem was fixed. Hard-coded for RHEL8 and RHEL9 :

Original code :

 if version.startswith('8') or version.startswith('9'):
      lstr = "%end"
      urlstring = "--url=http://"+vmParser.confparser('repo', 'RepoIP') + ':' + vmParser.confparser('repo', 'RepoPort') + \
        self.repoDir + "/BaseOS"

 if version.startswith('9'):
      sshd_file="\n%post \nsed -i 's/#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;service sshd restart"+mpath_file+"\n%end"

So I've added below code and it is working fine for RHEL10 installation also.

 if version.startswith('8') or  version.startswith('9') or  version.startswith('10'):
            lstr = "%end"
            urlstring = "--url=http://"+vmParser.confparser('repo', 'RepoIP') + ':' + vmParser.confparser('repo', 'RepoPort') + \
                self.repoDir + "/BaseOS"
        else:
            lstr = "telnet\njava\n%end"
            urlstring = "--url=http://"+vmParser.confparser('repo', 'RepoIP') + ':' + vmParser.confparser('repo', 'RepoPort') + \
                self.repoDir
 if version.startswith('9'):
            sshd_file="\n%post \nsed -i 's/#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;service sshd restart"+mpath_file+"\n%end"
        if version.startswith('10'):
            sshd_file="\n%post \nsed -i 's/#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;service sshd restart"+mpath_file+"\n%end"
PraveenPenguin commented 3 months ago

@vpuliyal can you please send patch as it looks good