36
36
- VIF: virtual interface, the eth on VM
37
37
- SR: storage repository, the storage pool on server
38
38
39
- # Create KVM VMS
40
- 1 . Auto schedual the target vm to a available server, this is only available on dev env
39
+ # Create KVM VMs Auto Schedule
41
40
42
- > lain3_node.py --role=rolename --cluster=<test|xyz|kvm>
41
+ Note: ` schedule_node.py ` can auto schedule the wanted vm to a available server
42
+ you can list the supported role with ` --list-roles ` , if there is no role you want, you can define a new one
43
+ in ` etc/Nodeconfig.json ` , each role is a dict defined the cpu, memory, etc. You can define ` k8s-master ` ,
44
+ ` k8s-node ` , ` etcd ` template as you want.
45
+
46
+ for example:
47
+
48
+ ```
49
+ "jenkins": {
50
+ "cpu": 8,
51
+ "memory": 32,
52
+ "template": "template",
53
+ "disk_size": 100,
54
+ "add_disk_num": 2
55
+ }
56
+ ```
57
+
58
+ ## 1. Auto schedual the target vm to a available server
59
+
60
+ > schedule_node.py --role=rolename --cluster=<dev|test|prod>
61
+
62
+ > Note: user can define the vm-name rule at function ` generate_vmname_key(role, cluster) ` in file ` lib/Utils/schedule.py `
43
63
44
- 2 . manually given the target vm-name, host and vm-ip. Product env should use this command
64
+ ## 2. manually given the target vm-name, host and vm-ip.
45
65
46
- > lain3_node.py --role=rolename --name=new_vm_name --host=hostip --ip=vm_ip
66
+ > schedule_node.py --role=rolename --name=new_vm_name --host=hostip --ip=vm_ip
67
+
47
68
# Create multiple VMs from xml config
48
69
- ` setup_vms.py --validate xmlFile ` Validate the given xml file
49
70
- ` setup_vms.py --create xmlFile ` Do the create up according to the xml file
@@ -102,13 +123,13 @@ Create VMs with xml just need to write a xml config following the xml-example. B
102
123
- ` --list-network ` List the bridge/switch network in the host
103
124
- ` --list-SR ` List the storage repository infor in the host
104
125
105
- ##### 1). <b >** Create a new VM with a template:** <b >
126
+ ##### 2. 1). <b >** Create a new VM with a template:** <b >
106
127
- ` -c VM_NAME, --create=VM_NAME ` Create a new VM with a template.
107
128
- ` -t TEMPLATE, --templ=TEMPLATE ` Template used to create a new VM.
108
129
109
- > create_vm.py -c "test_vm" -t "CentOS 7.2 for Lain "
130
+ > create_vm.py -c "test_vm" -t "CentOS 7.2 Template "
110
131
111
- ##### 2). <b >** Create a new VM with a given IP: if a IP specified** <b >
132
+ ##### 2.2 ). <b >** Create a new VM with a given IP: if a IP specified** <b >
112
133
- ` --vif=VIF_INDEX ` The index of virtual interface on which configure will be
113
134
- ` --device=DEVICE ` The target physic NIC name with an associated network VIF attach(ed) to
114
135
- ` --network=NETWORK ` The target bridge/switch network which VIF connect(ed) to
@@ -122,15 +143,15 @@ Create VMs with xml just need to write a xml config following the xml-example. B
122
143
** neither * --device* nor * --network* , the default manage network will be used**
123
144
> create_vm.py -c "test2" -t "CentOS 7.2 template" --ip=192.168.1.100 --vif=0
124
145
125
- ##### 3). <b >** Create a new VM with given max cpu cores and current cpu cores:** <b >
146
+ ##### 2. 3). <b >** Create a new VM with given max cpu cores and current cpu cores:** <b >
126
147
- ` --cpu-max=MAX_CORES ` Config the max VCPU cores.
127
148
- ` --cpu-cores=CPU_CORES ` Config the number of startup VCPUs for the new created VM
128
149
129
150
> create_vm.py -c "test2" -t "CentOS 7.2 template" --cpu-core=2 --cpu-max=4
130
151
131
152
The max cpu cores can be configured when VM is power off only, and it affect the upper limit when set the cpu cores lively
132
153
133
- ##### 4). <b >** Create a new VM with memory size:** <b >
154
+ ##### 2. 4). <b >** Create a new VM with memory size:** <b >
134
155
- ` --memory=MEMORY_SIZE ` Config the target memory size in GB.
135
156
- ` --min-mem=MIN_MEMORY ` Config the min static memory size in GB.
136
157
- ` --max-mem=MAX_MEMORY ` Config the max static memory size in GB.
@@ -144,7 +165,7 @@ Create VMs with xml just need to write a xml config following the xml-example. B
144
165
- ` --max-mem will set the max static memory `
145
166
> create_vm.py -c "test2" -t "CentOS 7.2 template" --memory=2 --max-mem=4
146
167
147
- ##### 5).Add new disk to VM, the storage_name is choosed from * --list-SR*
168
+ ##### 2. 5).Add new disk to VM, the storage_name is choosed from * --list-SR*
148
169
- ` --add-disk=DISK_SIZE ` The disk size(GB) add to the VM
149
170
- ` --storage=STORAGE_NAME ` The storage location where the virtual disk put
150
171
> create_vm.py "test1"--add-disk=2 --storage=data2
@@ -165,7 +186,7 @@ Create VMs with xml just need to write a xml config following the xml-example. B
165
186
- ` --list-network ` List the bridge/switch network in the host
166
187
- ` --list-SR ` List the storage repository information in the host
167
188
168
- ##### 1). <b >** Config a VM's interface, add a VIF, delete a VIF, config a VIF(will delete old one if exist, otherwise create it newly), and the * --ip* , * --device* , * --network* is same as that when create vm** <b >
189
+ ##### 4. 1). <b >** Config a VM's interface, add a VIF, delete a VIF, config a VIF(will delete old one if exist, otherwise create it newly), and the * --ip* , * --device* , * --network* is same as that when create vm** <b >
169
190
- ` --add-vif=ADD_INDEX ` Add a virtual interface device to guest VM
170
191
- ` --del-vif=DEL_INDEX ` Delete a virtual interface device from guest VM
171
192
- ` --vif=VIF_INDEX ` Configure on a virtual interface device
@@ -174,17 +195,17 @@ Create VMs with xml just need to write a xml config following the xml-example. B
174
195
175
196
> config_vm.py "test1" --add-vif=1 --device=eth1 --ip=192.168.1.200 --netmask=255.255.255.0
176
197
177
- ##### 2). <b >** config a VM' cpu when it is running** <b >
198
+ ##### 4. 2). <b >** config a VM' cpu when it is running** <b >
178
199
- ` --cpu-cores=CPU_CORES ` Config the VCPU cores lively for a running VM or the number of startup VCPUs for a halted VM
179
200
180
201
> config_vm.py "test1" --cpu-core=4
181
202
182
- ##### 3). <b >** config a VM' memory when it is running** <b >
203
+ ##### 4. 3). <b >** config a VM' memory when it is running** <b >
183
204
- ` --memory=MEMORY_SIZE ` Config the target memory size in GB.
184
205
185
206
> config_vm.py "test1" --memory=1
186
207
187
- ##### 4).Add new disk to VM, the storage_name is choosed from * --list-SR*
208
+ ##### 4.4 ).Add new disk to VM, the storage_name is choosed from * --list-SR*
188
209
- ` --add-disk=DISK_SIZE ` The disk size(GB) add to the VM
189
210
- ` --storage=STORAGE_NAME ` The storage location where the virtual disk put
190
211
> config_vm.py "test1"--add-disk=2 --storage=data2
0 commit comments