sdc-imgadm import <uuid> -S <sources-url>
sdc-imgadm import -m <manifest> -f <file>
echo '{"add_nics":[{"nic_tag":"external","ip":"10.9.8.2","netmask":"255.255.255.0"}]}' | vmadm update <uuid>
创建一个自定义的Zone镜像的过程如下:
- Create and customize a zone as you wish
- Purge the logs, etc. and run the sm-prepare-image to make the machine image-ready (remember to read the warning message!).
- Halt the zone: vmadm stop
- Snapshot the Zone dataset: zfs snapshot zones/@image
- Dump & Compress the dataset: zfs send zones/@image | gzip > image_name.zfs.gz
- Create the manifest as described above
创建一个自定义的KVM镜像的过程如下:
- Create and customize a KVM instance as you wish
- Purge and ready the instance
- Halt the VM: vmadm stop
- Snapshot the disk0 ZVol: zfs snapshot zones/-disk0@image
- Dump & Compress the dataset: zfs send zones/-disk0@image | gzip > image_name.zvol.gz
imgadm create <vm-uuid> -f manifest
- manifest文件:cnapi.manifest
{
"v": 2,
"owner": "00000000-0000-0000-0000-000000000000",
"name": "cnapi",
"version": "release-20170302-20170302T175529Z-g29b8eb5",
"state": "active",
"disabled": false,
"public": false,
"published_at": "2017-03-02T18:06:05.627Z",
"type": "zone-dataset",
"description": "SDDC",
"requirements": {
"min_platform": {
"7.0": "20141030T081701Z"
},
"networks": [
{
"name": "net0",
"description": "admin"
}
]
},
"tags": {
"smartdc_service": true
}
}
- 从sdc-smartos 1.6.3创建好的虚机 最简单的创建方式是使用adminui创建,选择镜像的时候选sdc-smartos 1.6.3即可。也可以使用vmadm进行创建,指定manifest文件即可。
- 编译好的cnapi模块,以及其他模块。具体模块参照原cnapi新建虚拟机/opt下:
- /opt/amon-agent
- /opt/smartdc/boot
/opt/smartdc/cnapi
- /opt/smartdc/config-agent
- /opt/smartdc/registrar
scp -r <源> <目标>
vmadm stop <uuid>
imgadm create <uuid> -c gzip -m cnapi.manifest
此操作将生成两个文件
将上一个操作生成的两个文件,修改文件名后,替换掉原来的文件