build openeuler maas image and deploy as VM of KVM pod

Bug #1975922 reported by Zhanglei Mao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Invalid
Undecided
Unassigned
curtin
New
Undecided
Unassigned

Bug Description

Reproduce like:

1. Using packer to build a OpenEuler MAAS image with pattern of centos7

2. Upload into maas as:
$ maas root boot-resources create name=openeuler20.03 title="openeuler 20.03 LTS" base_image=ubuntu/focal architecture=amd64/generic content@=openeuler2003.tar.gz

3. Deploy this image, it will report below error just after finished download image.

Running curtin builtin curthooks
finish: cmd-install/stage-curthooks/builtin/cmd-curthooks: FAIL: curtin command curthooks
Traceback (most recent call last):
  File "/curtin/curtin/distro.py", line 120, in get_distroinfo
    variant = name_to_distro(variant_name)
  File "/curtin/curtin/distro.py", line 57, in name_to_distro
    return DISTROS[DISTROS.index(distname)]
ValueError: tuple.index(x): x not in tuple

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

I guess MAAS expect specific distname, but I didn't find a way to trace or debug as it will shutdown machine immediately. Try to inject comand to the preseeds/curtin_userdata_custom file, but get snapfuse readonly.

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

The MAAS version is 3.1.0 (installed by sanp)

Revision history for this message
Alberto Donato (ack) wrote :

Can you please check (and possibly attach) the machine log for errors. It's under /var/snap/maas/common/log/rsyslog/$machine_name/$date/messages

Changed in maas:
status: New → Incomplete
Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

@Alberto Thanks for help. Below is log file.

Alberto Donato (ack)
no longer affects: curtin (Ubuntu)
Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

@Alberto, Do you mean I can upgrade to lates MAAS like 3.2 and then it will work.

Revision history for this message
Alberto Donato (ack) wrote :

I'm not sure what the issue is. It would be good if someone from the Curtin team could advise

Changed in maas:
status: Incomplete → New
status: New → Incomplete
summary: - custom image deploy get failed in cmd-curthooks of
- DISTROS[DISTROS.index(distname)]
+ build openeuler maas image and deploy as VM of KVM pod
Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

It can be deploy as rhel customer images with below adjustments:
curtin/curtin$ sudo vi distro.py
DISTRO_NAMES = ['arch', 'centos', 'debian', 'fedora', 'freebsd', 'gentoo',
                'opensuse', 'redhat', 'rhel', 'sles', 'suse', 'ubuntu', 'openEuler']
...

OS_FAMILIES = {
    DISTROS.debian: [DISTROS.debian, DISTROS.ubuntu],
    DISTROS.redhat: [DISTROS.centos, DISTROS.fedora, DISTROS.redhat,
                     DISTROS.rhel, DISTROS.openEuler],

Let euler of to be detected as rhel8 (rpm -E "%rhel")
[root@vm1-openeuler ~]# echo "%rhel 8" >> /etc/rpm/macros.dist
[root@vm1-openeuler ~]# rpm -E "%rhel"
8
[root@vm1-openeuler ~]#

$ maas root boot-resources create name=rhel/8 title="OpenEuler 2003" architecture=amd64/generic content@=openeuler.tar.gz #base ubuntu is still ubuntu; but curtin configure are difference;

Deploy as "Redhat Enterprise Linux" -> "OpenEuler 2003"

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote (last edit ):

After deploy, it cloud-init would fail like:

2022-06-21 02:30:15,216 - stages.py[ERROR]: Unable to render networking. Network config is likely broken: No available network renderers found. Searched through list: ['eni', 'sysconfig', 'netplan']

2022-06-21 02:30:15,192 - util.py[DEBUG]: Running command ['ip', '-6', 'addr', 'show', 'permanent', 'scope', 'global'] with allowed return codes [0] (shell=False, capture=True)
2022-06-21 02:30:15,206 - util.py[DEBUG]: Running command ['ip', '-4', 'addr', 'show'] with allowed return codes [0] (shell=False, capture=True)
2022-06-21 02:30:15,210 - __init__.py[DEBUG]: no work necessary for renaming of [['52:54:00:9b:71:20', 'ens4', 'virtio_net', '0x0001']]
2022-06-21 02:30:15,210 - stages.py[INFO]: Applying network configuration from system_cfg bringup=False: {'config': [{'id': 'ens4', 'mac_address': '52:54:00:9b:71:20', 'mtu': 1500, 'name': 'ens4', 'subnets': [{'address': '192.168.122.90/24', 'dns_nameservers': ['192.168.122.12'], 'dns_search': ['maas'], 'gateway': '192.168.122.1', 'type': 'static'}], 'type': 'physical'}, {'address': ['192.168.122.12'], 'search': ['maas'], 'type': 'nameserver'}], 'version': 1}
2022-06-21 02:30:15,215 - util.py[DEBUG]: Reading from /etc/os-release (quiet=False)
2022-06-21 02:30:15,215 - util.py[DEBUG]: Read 136 bytes from /etc/os-release
2022-06-21 02:30:15,216 - stages.py[ERROR]: Unable to render networking. Network config is likely broken: No available network renderers found. Searched through list: ['eni', 'sysconfig', 'netplan']

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

openEuler use same method for network as redhat, below adjust can make it workable.

[root@vm-k8s-m1 ~]# grep ID /etc/os-release
ID="openEuler"
VERSION_ID="20.03"
[root@vm-k8s-m1 ~]# cloud-init clean
[root@vm-k8s-m1 ~]# cloud-init init --local
Cloud-init v. 19.4 running 'init-local' at Wed, 22 Jun 2022 06:45:52 +0000. Up 5776.60 seconds.
2022-06-22 06:45:52,487 - stages.py[ERROR]: Unable to render networking. Network config is likely broken: No available network renderers found. Searched through list: ['eni', 'sysconfig', 'netplan']
[root@vm-k8s-m1 ~]# vi /usr/lib/python3.7/site-packages/cloudinit/net/sysconfig.py
[root@vm-k8s-m1 ~]# grep openeuler /usr/lib/python3.7/site-packages/cloudinit/net/sysconfig.py
KNOWN_DISTROS = ['centos', 'fedora', 'rhel', 'suse', 'openeuler']
[root@vm-k8s-m1 ~]# grep openEuler /usr/lib/python3.7/site-packages/cloudinit/util.py
/usr/lib/python3.7/site-packages/cloudinit/util.py: 'arch', 'centos', 'debian', 'fedora', 'rhel', 'suse', 'openEuler'):
[root@vm-k8s-m1 ~]# vi /usr/lib/python3.7/site-packages/cloudinit/util.py
root@vm-k8s-m1 ~]# grep openeuler /usr/lib/python3.7/site-packages/cloudinit/util.py
                'arch', 'centos', 'debian', 'fedora', 'rhel', 'suse', 'openeuler'):
[root@vm-k8s-m1 ~]# cloud-init clean
[root@vm-k8s-m1 ~]# cloud-init init --local
Cloud-init v. 19.4 running 'init-local' at Wed, 22 Jun 2022 06:54:23 +0000. Up 6287.66 seconds.
-------------------------------------------------------------------------------------------

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

A workaround to deploy pack build image is to pretend openEuler images as a rhel8. It can pass in my test without any modification for cloud-init and curtin, below two change can be apply in packer build kickstart configure file too:

echo "%rhel 8" >> /etc/rpm/macros.dist
sed -i s/\^ID=.*\$/ID=\"rhel\"/ /etc/os-release

The upload command are below:
maas root boot-resources create name=rhel/8 title="OpenEuler 2003" architecture=amd64/generic content@=openeuler.tar.gz

Revision history for this message
Alexsander de Souza (alexsander-souza) wrote (last edit ):

Until Curtin has proper openeuler support MAAS cannot officially support it also. I'm moving this to a feature request. I suggest you move this discussion to https://discourse.maas.io/ where the community can assist you.

Changed in maas:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.