This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
cloud:libvirt [2017/08/08 12:51] frank |
cloud:libvirt [2017/08/08 12:54] (current) frank |
||
|---|---|---|---|
| Line 6: | Line 6: | ||
| - | === Virsh === | + | ==== Virsh === |
| + | === Storage pool and volume === | ||
| create a file system directory storage pool | create a file system directory storage pool | ||
| <code bash> | <code bash> | ||
| Line 31: | Line 32: | ||
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ||
| ovs143-v672_0.img /u01/vm_pool/ovs143-v672_0.img | ovs143-v672_0.img /u01/vm_pool/ovs143-v672_0.img | ||
| + | </code> | ||
| + | |||
| + | === Network === | ||
| + | Create libvirt network | ||
| + | <code bash> | ||
| + | # cat mynetwork.xml | ||
| + | <network> | ||
| + | <name>mynetwork</name> | ||
| + | <uuid>9252d9d4-f3ce-4814-8de3-adf8368671f7</uuid> | ||
| + | <forward mode='nat'> | ||
| + | <nat> | ||
| + | <port start='1024' end='65535'/> | ||
| + | </nat> | ||
| + | </forward> | ||
| + | <bridge name='mybr0' stp='on' delay='0'/> | ||
| + | <mac address='52:54:00:f1:3e:cb'/> | ||
| + | <ip address='192.168.0.1' netmask='255.255.255.0'> | ||
| + | <dhcp> | ||
| + | <range start='192.168.0.2' end='192.168.0.254'/> | ||
| + | </dhcp> | ||
| + | </ip> | ||
| + | </network> | ||
| + | |||
| + | virsh # net-define mynetwork.xml | ||
| + | Network mynetwork defined from mynetwork.xml | ||
| + | |||
| + | virsh # net-list --all | ||
| + | Name State Autostart Persistent | ||
| + | ---------------------------------------------------------- | ||
| + | default active yes yes | ||
| + | mynetwork inactive no yes | ||
| + | |||
| + | virsh # net-start mynetwork | ||
| + | Network mynetwork started | ||
| + | |||
| + | virsh # net-autostart mynetwork | ||
| + | Network mynetwork marked as autostarted | ||
| + | |||
| + | virsh # net-list | ||
| + | Name State Autostart Persistent | ||
| + | ---------------------------------------------------------- | ||
| + | default active yes yes | ||
| + | mynetwork active yes yes | ||
| + | |||
| + | # brctl show | ||
| + | bridge name bridge id STP enabled interfaces | ||
| + | mybr0 8000.525400f13ecb yes mybr0-nic | ||
| + | virbr0 8000.525400f13eca yes virbr0-nic | ||
| + | </code> | ||
| + | |||
| + | Bridge | ||
| + | <code bash> | ||
| + | virsh # iface-list | ||
| + | Name State MAC Address | ||
| + | --------------------------------------------------- | ||
| + | eno1 active 00:10:e0:b3:b1:68 | ||
| + | eno2 active 00:10:e0:b3:b1:69 | ||
| + | lo active 00:00:00:00:00:00 | ||
| + | |||
| + | virsh # iface-bridge --no-stp eno2 br1 | ||
| + | Created bridge br1 with attached device eno2 | ||
| + | Bridge interface br1 started | ||
| + | virsh # iface-list | ||
| + | Name State MAC Address | ||
| + | --------------------------------------------------- | ||
| + | br1 active 00:10:e0:b3:b1:69 | ||
| + | eno1 active 00:10:e0:b3:b1:68 | ||
| + | lo active 00:00:00:00:00:00 | ||
| + | |||
| + | # brctl show | ||
| + | bridge name bridge id STP enabled interfaces | ||
| + | br1 8000.0010e0b3b169 no eno2 | ||
| + | virbr0 8000.5254004707ec yes virbr0-nic | ||
| + | </code> | ||
| + | |||
| + | Virtual machine | ||
| + | <code bash> | ||
| + | $ virsh define --fine /path/to/vm_pool/myvm.xml | ||
| </code> | </code> | ||