x86上安装diskimage-builder

 

安裝下列套件:
git
qemu-system-x86 qemu-img
kpartx

 

 

 yum install python3
 yum -y install qemu-img  kpartx
 yum -y install python3-pip

 

 

git clone https://git.openstack.org/openstack/diskimage-builder

 

 
 cd diskimage-builder



python3 setup.py install
或者 pip3 install . -i https://pypi.tuna.tsinghua.edu.cn/simple/  

 

pip3 install diskimage-builder   -i https://mirrors.aliyun.com/pypi/simple/

 

env DIB_DEBUG_TRACE=3 DIB_RELEASE=7  disk-image-create ironic-agent centos  -o ironic-deploy -a x86_64 --logfile ./centos7-os_v6.log

 

 

 手动下载get-pip.py

elements/cache-url/bin/cache-url

if [ "$url" == "https://bootstrap.pypa.io/get-pip.py" ] ; then
    cp /root/get-pip.py   $tmp 
    rcode=200
else
   rcode=$(curl -v -L -o $tmp -w '%{http_code}' --connect-timeout 10 "${curl_opts[@]}" $url $time_cond)
fi
#rcode=$(curl -v -L -o $tmp -w '%{http_code}' --connect-timeout 10 "${curl_opts[@]}" $url $time_cond)

 

chmod +x cache-url

 

 

/tmp/in_target.d/install.d/60-ironic-agent-install: line 13: /usr/share/ironic-python-agent/imagebuild/common/generate_upper_constraints.sh: No such file or directory
 

pip3 install ironic-python-agent-builder


 ironic-python-agent-ramdisk

env DIB_DEBUG_TRACE=3 DIB_RELEASE=eoan disk-image-create ironic-python-agent-ramdisk  ubuntu  -o ironic-deploy -a arm64
 

 

 

 

[root@host-10-10-18-131 ~]# pip3 install ironic-python-agent-builder   -i https://mirrors.aliyun.com/pypi/simple/
 
[root@host-10-10-18-131 ~]# ls  /usr/local/lib/python3.6/site-packages/ironic_python_agent_builder
__init__.py  __pycache__
[root@host-10-10-18-131 ~]# ls   /usr/local/share/ironic-python-agent-builder/dib/
ironic-python-agent-ramdisk
[root@host-10-10-18-131 ~]# 
[root@host-10-10-18-131 ~]# pip3 show ironic-python-agent-builder
Name: ironic-python-agent-builder
Version: 2.0.0
Summary: Tools and scripts to build Ironic Python Agent
Home-page: https://docs.openstack.org/ironic-python-agent-builder/latest/
Author: OpenStack
Author-email: openstack-discuss@lists.openstack.org
License: UNKNOWN
Location: /usr/local/lib/python3.6/site-packages
Requires: diskimage-builder
[root@host-10-10-18-131 ~]# ls /usr/local/lib/python3.6/site-packages/ironic_python_agent_builder
ironic_python_agent_builder/                 ironic_python_agent_builder-2.0.0.dist-info/
[root@host-10-10-18-131 ~]# ls /usr/local/lib/python3.6/site-packages/ironic_python_agent_builder
__init__.py  __pycache__
[root@host-10-10-18-131 ~]# ls /usr/local/lib/python3.6/site-packages/ironic_python_agent_builder-2.0.0.dist-info/
AUTHORS  entry_points.txt  INSTALLER  LICENSE  METADATA  pbr.json  RECORD  top_level.txt  WHEEL
[root@host-10-10-18-131 ~]# ls /usr/local/lib/python3.6/site-packages/ironic_python_agent_builder -al
total 8
drwxr-xr-x.  3 root root   44 Jun 24 06:22 .
drwxr-xr-x. 23 root root 4096 Jun 24 06:22 ..
-rw-r--r--.  1 root root 3601 Jun 24 06:22 __init__.py
drwxr-xr-x.  2 root root   37 Jun 24 06:22 __pycache__
[root@host-10-10-18-131 ~]# ls /usr/local/share/ironic-python-agent-builder/dib/
ironic-python-agent-ramdisk
[root@host-10-10-18-131 ~]# 
[root@host-10-10-18-131 ~]# export ELEMENTS_PATH=/usr/local/share/ironic-python-agent-builder/dib/
[root@host-10-10-18-131 ~]# env DIB_DEBUG_TRACE=3 DIB_RELEASE=7  disk-image-create ironic-python-agent-ramdisk  centos  -o ironic-deploy -a x86_64

2020-06-24 06:29:21.724 | + git clone -q https://opendev.org/openstack/ironic-python-agent /root/.cache/image-create/source-repositories/ironic_python_agent_e50a8037ee39f9c90c6bf36bda2f594b0cf55085.tmp
2020-06-24 06:35:25.707 | error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 104
2020-06-24 06:35:25.709 | fatal: The remote end hung up unexpectedly
2020-06-24 06:35:25.709 | fatal: early EOF
2020-06-24 06:35:25.713 | fatal: index-pack failed

 

git访问超时,重试几次


python版本问题

2020-06-24 06:56:57.040 | ERROR: Package 'ironic-python-agent' requires a different Python: 2.7.5 not in '>=3.6'
2020-06-24 06:56:57.176 | ++ diskimage_builder/lib/img-functions:run_in_target:60 : check_break after-error run_in_target bash]

[root@bogon dib-env]# grep 'requires a different ' -rn *
lib/python2.7/site-packages/pip/_internal/index/package_finder.py:90: 'Link requires a different Python (%s not in: %r): %s',
Binary file lib/python2.7/site-packages/pip/_internal/index/package_finder.pyc matches
lib/python2.7/site-packages/pip/_internal/legacy_resolve.py:100: 'Package {!r} requires a different Python: {} not in {!r}'.format(
Binary file lib/python2.7/site-packages/pip/_internal/legacy_resolve.pyc matches
lib64/python2.7/site-packages/pip/_internal/index/package_finder.py:90: 'Link requires a different Python (%s not in: %r): %s',
Binary file lib64/python2.7/site-packages/pip/_internal/index/package_finder.pyc matches
lib64/python2.7/site-packages/pip/_internal/legacy_resolve.py:100: 'Package {!r} requires a different Python: {} not in {!r}'.format(
Binary file lib64/python2.7/site-packages/pip/_internal/legacy_resolve.pyc matches
[root@bogon dib-env]#

 

yum -y install python

ln -s /usr/bin/python2.7 /usr/bin/python
pip命令可以成功执行

 

Install

sudo apt install -y curl python-pip qemu-utils
pip install diskimage-builder
 
# packages
dib/elements/my_pkg/package-installs.yaml
...
vlan:
wget:
linux-image-generic:
  uninstall: True
 
# change TMPDIR
export TMPDIR=/mnt
disk-image-create -o output.qcow --no-tmpfs vm block-device-gpt ubuntu-minimal
Build IPA image

export DIB_QUIET=0
export ELEMENTS_PATH=/opt/ironic-python-agent-builder/dib:/opt/diskimage-builder/dib/elements
export IMAGE_NAME=ironic-python-agent
export DIB_ELEMENTS=ironic-python-agent-ramdisk
export DIB_RELEASE=focal
 
disk-image-create ${DIB_ELEMENTS} -o ${IMAGE_NAME} --logfile ${IMAGE_NAME}.log
Build Ubuntu image

export DIB_QUIET=0
export ELEMENTS_PATH=/opt/diskimage-builder/dib/elements
export IMAGE_NAME=img-${DIB_RELEASE}-minimal
export DIB_ELEMENTS=foo
export DIB_RELEASE=focal
 
disk-image-create ${DIB_ELEMENTS} -o ${IMAGE_NAME} -t tgz --logfile ${IMAGE_NAME}.log --checksum

 

posted on 2020-06-24 12:08  tycoon3  阅读(781)  评论(0编辑  收藏  举报

导航