登陆zstack
zstack-cli LogInByAccount accountName=admin password=password
Zone的参数
创建Zone
zstack-cli CreateZone name='ZONE1' resourceUuid=59c46bb0b5ab479dad54962e1088447f #resourceUuid是指定UUID
创建Cluster
zstack-cli CreateCluster name=cluster1 hypervisorType=KVM zoneUuid=59c46bb0b5ab479dad54962e1088447f resourceUuid=d58bf304ba0f4a308be6c83952de46db
Host
创建Host
zstack-cli AddKVMHost clusterUuid=d58bf304ba0f4a308be6c83952de46db managementIp=192.168.0.199 name=HOST1 username=root password=123.com resourceUuid=dbffbc8cf4174529b68cc6795a3e0901
创建主存储
zstack-cli AddNfsPrimaryStorage name=PrimaryStoryage type=NFS zoneUuid=59c46bb0b5ab479dad54962e1088447f url=192.168.0.199:/usr/local/zstack/nfs_root resourceUuid=2333ecf558ae44f698b34aaf60e0c0d7
主存储添加到Cluster
zstack-cli AttachPrimaryStorageToCluster clusterUuid=d58bf304ba0f4a308be6c83952de46db primaryStorageUuid=2333ecf558ae44f698b34aaf60e0c0d7
创建L2网络
zstack-cli CreateL2NoVlanNetwork name=L2 physicalInterface=eth0 zoneUuid=59c46bb0b5ab479dad54962e1088447f resourceUuid=0485266591b4406891213a69b420695d
L2网络添加到Cluster
zstack-cli AttachL2NetworkToCluster clusterUuid=d58bf304ba0f4a308be6c83952de46db l2NetworkUuid=0485266591b4406891213a69b420695d
L3
创建L3网络
zstack-cli CreateL3Network l2NetworkUuid=0485266591b4406891213a69b420695d name=L3 resourceUuid=c82f2b465ce7438aac5414180506cbc1
创建L3网络起始IP段
zstack-cli AddIpRange name=ipr1 startIp=192.168.0.201 endIp=192.168.0.203 netmask=255.255.255.0 gateway=192.168.0.1 l3NetworkUuid=c82f2b465ce7438aac5414180506cbc1
创建L3网络DNS
zstack-cli AddDnsToL3Network l3NetworkUuid=c82f2b465ce7438aac5414180506cbc1 dns=114.114.114.144
创建备份存储
zstack-cli AddSftpBackupStorage name=BackupStoryage url=/backupStorage hostname=192.168.0.199 username=root password=123.com resourceUuid=d9505934698e4a9b916c4a487f4eba3f
备份存储添加到Zone
zstack-cli AttachBackupStorageToZone backupStorageUuid=d9505934698e4a9b916c4a487f4eba3f zoneUuid=59c46bb0b5ab479dad54962e1088447f
创建rancheros镜像
zstack-cli AddImage name=rancher format=qcow2 mediaType=RootVolumeTemplate platform=Linux url=http://192.168.0.199/image/rancher.qcow2 backupStorageUuids=d9505934698e4a9b916c4a487f4eba3f resourceUuid=ca0c707893124041ab75844c309d9316
创建ttylinux镜像 #测试用的最小化linux
zstack-cli AddImage name=ttylinux format=qcow2 backupStorageUuids=b7f92ec5c7894c3caebdd408864986f4 url=http://7xi3lj.com1.z0.glb.clouddn.com/templates/ttylinux.qcow2 resourceUuid=6c897a8802084f3ab7211a9c4d1d0a42 platform=Linux
创建Virtual Route 镜像 #下面创建virtual route offering 需要
zstack-cli AddImage name=virtualroute format=qcow2 system=true backupStorageUuids=d9505934698e4a9b916c4a487f4eba3f url=http://7xi3lj.com1.z0.glb.clouddn.com/releases/0.9/0.9.0/zstack-virtualrouter-0.9.0.qcow2 platform=Linux resourceUuid=a92b6b97ec2f4e11ae764bde2da127f7
创建Virtual Route Offering
zstack-cli CreateVirtualRouterOffering name=VR-OFFERING cpuNum=1 cpuSpeed=512 memorySize=4294967296 imageUuid=a92b6b97ec2f4e11ae764bde2da127f7 managementNetworkUuid=c82f2b465ce7438aac5414180506cbc1 publicNetworkUuid=c82f2b465ce7438aac5414180506cbc1 isDefault=True zoneUuid=59c46bb0b5ab479dad54962e1088447f
#memorySize=4294967296单位是b
#mamagementNetworkUuid是L3网络UUid
#publicNetworkUuid是L3网络UUid
创建instance offering
zstack-cli CreateInstanceOffering name=4G cpuNum=1 cpuSpeed=1000 memorySize=2147483648 resourceUuid=1858c666e7ba4b21ba3405d467f1e43b
创建vm
zstack-cli CreateVmInstance name=rancheros imageUuid=ca0c707893124041ab75844c309d9316 instanceOfferingUuid=1858c666e7ba4b21ba3405d467f1e43b l3NetworkUuids=c82f2b465ce7438aac5414180506cbc1 defaultL3NetworkUuid=c82f2b465ce7438aac5414180506cbc1