第二篇Zstack之命令行建立虛擬機

登錄zstacklinux

zstack-cli LogInByAccount accountName=admin password=password


Zone的參數網絡

wKiom1ZS1w2wXjSBAABrPko2u2g218.png

建立Zoneide

zstack-cli CreateZone name='ZONE1' resourceUuid=59c46bb0b5ab479dad54962e1088447f  #resourceUuid是指定UUID


建立Cluster測試

zstack-cli CreateCluster name=cluster1 hypervisorType=KVM zoneUuid=59c46bb0b5ab479dad54962e1088447f resourceUuid=d58bf304ba0f4a308be6c83952de46db


Hostui

wKioL1ZS1-LSTySVAAC4FXLWN9M557.png

建立Hosturl

zstack-cli AddKVMHost clusterUuid=d58bf304ba0f4a308be6c83952de46db managementIp=192.168.0.199 name=HOST1 username=root password=123.com  resourceUuid=dbffbc8cf4174529b68cc6795a3e0901


建立主存儲orm

zstack-cli AddNfsPrimaryStorage name=PrimaryStoryage type=NFS  zoneUuid=59c46bb0b5ab479dad54962e1088447f url=192.168.0.199:/usr/local/zstack/nfs_root resourceUuid=2333ecf558ae44f698b34aaf60e0c0d7

主存儲添加到Clusterrouter

zstack-cli AttachPrimaryStorageToCluster clusterUuid=d58bf304ba0f4a308be6c83952de46db primaryStorageUuid=2333ecf558ae44f698b34aaf60e0c0d7


建立L2網絡blog

zstack-cli  CreateL2NoVlanNetwork name=L2  physicalInterface=eth0 zoneUuid=59c46bb0b5ab479dad54962e1088447f   resourceUuid=0485266591b4406891213a69b420695d

L2網絡添加到Clusterdns

zstack-cli AttachL2NetworkToCluster clusterUuid=d58bf304ba0f4a308be6c83952de46db l2NetworkUuid=0485266591b4406891213a69b420695d


L3

wKiom1ZS2TzBVEuYAACNFAqff64006.png

建立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/p_w_picpath/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  p_w_picpathUuid=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  p_w_picpathUuid=ca0c707893124041ab75844c309d9316   instanceOfferingUuid=1858c666e7ba4b21ba3405d467f1e43b  l3NetworkUuids=c82f2b465ce7438aac5414180506cbc1 defaultL3NetworkUuid=c82f2b465ce7438aac5414180506cbc1
相關文章
相關標籤/搜索