流程是下面的模板安装脚本,将对应的hypervisor模板下载下来并另存为临时文件,并解压缩,并将其移动到二级存储相应目录下,仅完成此工作。
[root@manage nfs]# /usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt -m /nfs/secondary/ -u http://192.168.1.98/4/systemvm64template-4.4.1-xen.vhd.bz2 -h xenserver -F
--2016-03-29 16:39:08-- http://192.168.1.98/4/systemvm64template-4.4.1-xen.vhd.bz2
Connecting to 192.168.1.98:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 253567236 (242M) [application/x-bzip2]
Saving to: “/usr/share/cloudstack-common/scripts/storage/secondary/47ee0613-9682-450e-8357-6f80cec3d43c.vhd”
100%[===================================================================================================================================================================================================>] 253,567,236 11.0M/s in 22s
2016-03-29 16:39:30 (11.1 MB/s) - “/usr/share/cloudstack-common/scripts/storage/secondary/47ee0613-9682-450e-8357-6f80cec3d43c.vhd” saved [253567236/253567236]
Uncompressing to /usr/share/cloudstack-common/scripts/storage/secondary/47ee0613-9682-450e-8357-6f80cec3d43c.vhd.tmp (type bz2)...could take a long time
Moving to /nfs/secondary/template/tmpl/1/1///47ee0613-9682-450e-8357-6f80cec3d43c.vhd...could take a while
Successfully installed system VM template to /nfs/secondary/template/tmpl/1/1/
[root@manage nfs]# cat secondary/template/tmpl/1/1/template.properties
filename=47ee0613-9682-450e-8357-6f80cec3d43c.vhd
description=SystemVM Template
checksum=
hvm=false
size=2626564608
vhd=true
id=1
public=true
vhd.filename=47ee0613-9682-450e-8357-6f80cec3d43c.vhd
uniquename=routing-1
vhd.virtualsize=2626564608
virtualsize=2626564608
vhd.size=2626564608
[root@manage nfs]# pwd
/nfs
[root@manage nfs]# ls -R
.:
primary secondary
./primary:
704eb654-a620-42e9-9807-407c5406142e.vhd hb-8ec935b2-8f0f-4740-be78-3546cbfa2115 hb-9385fe4b-00eb-4617-ab11-8239ee3ffcc8
./secondary:
template
./secondary/template:
tmpl
./secondary/template/tmpl:
1
./secondary/template/tmpl/1:
1
./secondary/template/tmpl/1/1:
47ee0613-9682-450e-8357-6f80cec3d43c.vhd template.properties
这个时候需要等待cpvm与ssvm启动正常,再做下面的上传镜像操作
没上传iso镜像时,是下面的目录层次结构
一个vhd是之前上传的xen(d43c.vhd)模板,另外两个是默认的模板
CentOS 5.6(64-bit) no GUI (XenServer)和
SystemVM Template (XenServer)
./secondary/template/tmpl:
1
./secondary/template/tmpl/1:
1 5
./secondary/template/tmpl/1/1:
47ee0613-9682-450e-8357-6f80cec3d43c.vhd template.properties
./secondary/template/tmpl/1/5:
dnld1575080711759885651tmp_ dnld8583106633401848920tmp_ template.properties
上传镜像之后,多了一个2目录,这个目录放的是上传的centos7.iso镜像,这个过程比较慢,先要上传有进度条的(dnld***命名的临时文件),再要安装完成(就变成iso文件了)
./secondary/template/tmpl:
1 2
./secondary/template/tmpl/1:
1 5
./secondary/template/tmpl/1/1:
47ee0613-9682-450e-8357-6f80cec3d43c.vhd template.properties
./secondary/template/tmpl/1/5:
dnld1575080711759885651tmp_ dnld8583106633401848920tmp_ template.properties
./secondary/template/tmpl/2:
202
./secondary/template/tmpl/2/202:
dnld5726001885473025948tmp_ template.properties
这是完成安装centos7.iso安装后的结构,可以看到上面的tmp_结尾的文件已经变成了.iso文件了,
不过还不清楚CentOS 5.6(64-bit) no GUI (XenServer)这个模板为什么一直不能正常完成
./secondary/template/tmpl/1/1:
47ee0613-9682-450e-8357-6f80cec3d43c.vhd template.properties
./secondary/template/tmpl/1/5:
dnld1575080711759885651tmp_ template.properties
./secondary/template/tmpl/2:
202
./secondary/template/tmpl/2/202:
202-2-5a60b882-5ce5-38ed-914c-1be63f751b68.iso template.properties
主存储的变化
按照下面的文件filelog.txt猜测的。从142e.vhd(完成之后会消失)生成b720.vhd,再从b720.vhd克隆两个虚拟磁盘分别是0b8b.vhd与1064.vhd
下面的196c是主存储上的142e.vhd
[root@xs1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 4.0G 2.0G 1.9G 52% /
none 1021M 44K 1021M 1% /dev/shm
/opt/xensource/packages/iso/XenCenter.iso
52M 52M 0 100% /var/xen/xc-install
192.168.1.250:/nfs/primary
493G 14G 454G 3% /var/run/sr-mount/29c8e045-2676-a09c-b81e-7e3be3e3196c
192.168.1.250:/nfs/secondary/template/tmpl/2/202
493G 14G 454G 3% /var/run/sr-mount/018eb7df-a2a6-14f6-1a83-6a583d44c0b3
[root@manage primary]# cat filelog.txt
2016-03-29 17:01:58.517882 log: /var/run/sr-mount/29c8e045-2676-a09c-b81e-7e3be3e3196c /var/run/sr-mount/29c8e045-2676-a09c-b81e-7e3be3e3196c/704eb654-a620-42e9-9807-407c5406142e.vhd vdi_clone 29c8e045-2676-a09c-b81e-7e3be3e3196c 704eb654-a620-42e9-9807-407c5406142e 737ec7e9-6a53-4b31-8b22-9ceb64dbb720
2016-03-29 17:01:58.770606 end: /var/run/sr-mount/29c8e045-2676-a09c-b81e-7e3be3e3196c /var/run/sr-mount/29c8e045-2676-a09c-b81e-7e3be3e3196c/704eb654-a620-42e9-9807-407c5406142e.vhd done
2016-03-29 17:02:04.854345 log: /var/run/sr-mount/29c8e045-2676-a09c-b81e-7e3be3e3196c /var/run/sr-mount/29c8e045-2676-a09c-b81e-7e3be3e3196c/737ec7e9-6a53-4b31-8b22-9ceb64dbb720.vhd vdi_clone 29c8e045-2676-a09c-b81e-7e3be3e3196c 737ec7e9-6a53-4b31-8b22-9ceb64dbb720 264f287d-a34b-47b6-8ae6-02beaa6a0b8b
2016-03-29 17:02:05.082699 end: /var/run/sr-mount/29c8e045-2676-a09c-b81e-7e3be3e3196c /var/run/sr-mount/29c8e045-2676-a09c-b81e-7e3be3e3196c/737ec7e9-6a53-4b31-8b22-9ceb64dbb720.vhd done
2016-03-29 17:02:09.239944 log: /var/run/sr-mount/29c8e045-2676-a09c-b81e-7e3be3e3196c /var/run/sr-mount/29c8e045-2676-a09c-b81e-7e3be3e3196c/737ec7e9-6a53-4b31-8b22-9ceb64dbb720.vhd vdi_clone 29c8e045-2676-a09c-b81e-7e3be3e3196c 737ec7e9-6a53-4b31-8b22-9ceb64dbb720 d6b7bc32-8c66-4a72-aa5b-d36592f61064
2016-03-29 17:02:10.449772 end: /var/run/sr-mount/29c8e045-2676-a09c-b81e-7e3be3e3196c /var/run/sr-mount/29c8e045-2676-a09c-b81e-7e3be3e3196c/737ec7e9-6a53-4b31-8b22-9ceb64dbb720.vhd done
[root@manage primary]# pwd
/nfs/primary
[root@manage primary]# ll
total 2776864
-rw-r--r-- 1 root root 240188416 Mar 29 17:54 264f287d-a34b-47b6-8ae6-02beaa6a0b8b.vhd
-rw-r--r-- 1 root root 9728 Mar 29 17:02 737ec7e9-6a53-4b31-8b22-9ceb64dbb720.vhd
-rw-r--r-- 1 root root 2626564608 Mar 29 17:01 89ebfb26-03d4-4f0b-9c0d-628aa2ad6bb4.vhd
-rw-r--r-- 1 root root 246937600 Mar 29 17:54 d6b7bc32-8c66-4a72-aa5b-d36592f61064.vhd
-rw-r--r-- 1 root root 1476 Mar 29 17:02 filelog.txt
-rw-r--r-- 1 root root 11 Mar 29 17:53 hb-8ec935b2-8f0f-4740-be78-3546cbfa2115
-rw-r--r-- 1 root root 11 Mar 29 17:53 hb-9385fe4b-00eb-4617-ab11-8239ee3ffcc8