Today, we will try again, add a piece of data disk, and an intranet network card.
This test command is still done through profile.
We need to add some data to _grains's virt_disk_nic.py.
As follows:
Def disk_nic ():
Grains = {}
grains[' virt ']={' disk ': {}, ' Nic ': {}}
grains[' virt ' [' Disk '] [' System ']={}
grains[' Virt ' [' Nic '] [' NICs ']=[{' eth0 ': {' bridge ': ' Br0 '}},{' eth1 ': {' bridge ': ' Br0 '}]
grains[' virt ' [' Disk '] [' System ']=[{' system ': {' format ': ' Raw ', ' pool ': '/var/lib/libvirt/images '}},{' data ': {' Format ': ' Raw ', ' pool ': '/var/lib/libvirt/images '}]
return grains
Test
[Email protected]:/srv/salt/_grains# Salt ' kvm.tiancity.com ' config.get virt:nic:nics--output=json
{
"Kvm.tiancity.com": [
{
"Eth0": {
"Bridge": "Br0"
}
},
{
"Eth1": {
"Bridge": "Br0"
}
}
]
}
[Email protected]:/srv/salt/_grains# Salt ' kvm.tiancity.com ' config.get virt:disk:system--output=json
{
"Kvm.tiancity.com": [
{
"System": {
"Pool": "/var/lib/libvirt/images",
"Format": "Raw"
}
},
{
"Data": {
"Pool": "/var/lib/libvirt/images",
"Format": "Raw"
}
}
]
}
Execution Result:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/56/D6/wKioL1SOktDDNZG2AABVX4m4BWM272.jpg "title=" 001. PNG "alt=" wkiol1soktddnzg2aabvx4m4bwm272.jpg "/>650) this.width=650; src=" http://s3.51cto.com/wyfs02/M02/56/D9 /wkiom1sokksaun7vaahrzf_1_ve586.jpg "title=" 002.png "alt=" Wkiom1sokksaun7vaahrzf_1_ve586.jpg "/>
After the experiment, I'll need to experiment with how to add IP.
This needs to be a good thought.
This article is from the "Bad Boy" blog, make sure to keep this source http://5ydycm.blog.51cto.com/115934/1590121
Saltstack virt Module Create virtual machine analysis three