我正在尝试使用 xenserver 上的打包程序构建“vdi_vhd”映像,但出现以下错误,请问有人能帮我解决这个问题吗,提前谢谢了。
[root@localhost bin]# packer build /usr/local/test-scripts/main.json
xenserver-iso output will be in this color.
==> xenserver-iso: XAPI client session established
==> xenserver-iso: Downloading or copying ISO
xenserver-iso: Downloading or copying: http://www.mirrorservice.org/sites/mirror.centos.org/7.6.1810/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso
xenserver-iso: Error downloading: open : no such file or directory
==> xenserver-iso: ISO download failed. Build 'xenserver-iso' errored: ISO download failed.
==> Some builds didn't complete successfully and had errors:
--> xenserver-iso: ISO download failed.
==> Builds finished but no artifacts were created.
这些是我安装打包程序的步骤
mkdir -p /usr/local/packer/
cd /usr/local/packer/
wget https://releases.hashicorp.com/packer/1.4.1/packer_1.4.1_linux_amd64.zip
unzip packer_1.4.1_linux_amd64.zip
vim ~/.bashrc
##added the below
export PATH=/usr/local/packer/:$PATH
##save and exit
sudo ln -s /usr/local/packer/packer /usr/bin/packer
source ~/.bashrc
这些是我安装 xenserver-iso 插件的步骤
RELEASE="go1.12.6.linux-amd64.tar.gz";
cd /tmp && curl -L -O "https://dl.google.com/go/${RELEASE}";
tar -zxvf "${RELEASE}";
mv -v go $HOME/go-1.12.6;
rm -f "/tmp/${RELEASE}";
vim ~/.bashrc
##added the below
export GOROOT=$HOME/go-1.12.6;
export GOPATH=$HOME/go-workspace;
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin;
##save and exit
source ~/.bashrc
mkdir -p $GOPATH/src/github.com/hashicorp/packer;
cd $GOPATH/src/github.com/hashicorp/packer;
go get github.com/mitchellh/gox;
go get github.com/mitchellh/go-vnc;
cd $GOPATH;
PROV="src/github.com/xenserver";
mkdir -p $PROV && cd $PROV;
git clone https://github.com/xenserver/packer-builder-xenserver.git;
cd packer-builder-xenserver;
./build.sh;
验证插件
[root@localhost bin]# ll
total 34732
-rwxr-xr-x. 1 root root 17813736 Jul 2 12:04 packer-builder-xenserver-iso
-rwxr-xr-x. 1 root root 17747856 Jul 2 12:04 packer-builder-xenserver-xva
[root@localhost bin]# pwd
/root/go-workspace/src/github.com/xenserver/packer-builder-xenserver/bin
[root@localhost bin]#
注意:我已经在 Virtual-box 本地服务器上安装了打包程序和 xenserver 插件
{
"builders": [
{
"iso_checksum": "38d5d51d9d100fd73df031ffd6bd8b1297ce24660dc8c13a3b8b4534a4bd291c",
"iso_checksum_type": "sha256",
"iso_url": "{{user `mirror`}}/7.6.1810/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso",
"output_directory": "CentOS-7-x86_64-xenserver-minimal",
"format": "vdi_vhd",
"remote_host": "192.1XX.XX.XX",
"remote_password": "XXXXX",
"remote_username": "root",
"shutdown_command": "/sbin/halt",
"ssh_password": "XXXXX",
"ssh_username": "root",
"ssh_wait_timeout": "10000s",
"type": "xenserver-iso",
"vm_name": "packer-centos-7.6-x86_64"
}
],
"variables": {
"mirror": "http://www.mirrorservice.org/sites/mirror.centos.org"
}
}
我期望输出类似下面的内容,
==> Builds finished. The artifacts of successful builds are
答案1
您的 ISO 链接不正确。请找到另一个链接,先手动测试,然后再次运行打包程序。 在此处输入图片描述