Editing VMs with virsh: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Added two commands: brctl show and virsh domiflist) |
||
Line 6: | Line 6: | ||
virsh setmem chi 2G --config | virsh setmem chi 2G --config | ||
virsh start chi | virsh start chi | ||
'''View current virtual NICs of VM:''' | |||
virsh domiflist <domain> | |||
'''-sh-4.1$ sudo virsh domiflist ldap-test-serv''' | |||
Interface Type Source Model MAC | |||
------------------------------------------------------- | |||
vnet0 bridge br0 virtio 52:54:00:cd:3f:15 | |||
Use brctl show to view bridges you can connect your VM NIC to. | |||
Example: | |||
'''-sh-4.1$ sudo brctl show''' | |||
bridge name bridge id STP enabled interfaces | |||
br0 8000.001e0bc689d6 no eth0 | |||
vnet0 | |||
vnet1 | |||
br1 8000.001e0bc689d7 no eth1 | |||
virbr0 8000.5254001021b8 yes virbr0-nic | |||
Add a virtual NIC to a VM: | Add a virtual NIC to a VM: | ||
virsh attach-interface --domain <domain_name> --type bridge_id --source <source_device> --model virtio --mac <random_mac_address> --config --live | virsh attach-interface --domain <domain_name> --type bridge_id --source <source_device> --model virtio --mac <random_mac_address> --config --live | ||
ex: [root@vav networks]# virsh attach-interface --domain chronos --type bridge --source br1 --model virtio --mac 52:54:00:ab:cc:09 --config --live | ex: '''[root@vav networks]# virsh attach-interface --domain chronos --type bridge --source br1 --model virtio --mac 52:54:00:ab:cc:09 --config --live''' | ||
--config affects next startup of domain | --config affects next startup of domain | ||
--live affects a running domain | --live affects a running domain |
Latest revision as of 23:46, 13 October 2017
To increase the memory size of a vm:
Power off the vm then (say to increase the memory on chi to 2GB):
virsh setmaxmem chi 2G --config virsh setmem chi 2G --config virsh start chi
View current virtual NICs of VM:
virsh domiflist <domain> -sh-4.1$ sudo virsh domiflist ldap-test-serv Interface Type Source Model MAC ------------------------------------------------------- vnet0 bridge br0 virtio 52:54:00:cd:3f:15
Use brctl show to view bridges you can connect your VM NIC to. Example:
-sh-4.1$ sudo brctl show bridge name bridge id STP enabled interfaces br0 8000.001e0bc689d6 no eth0 vnet0 vnet1 br1 8000.001e0bc689d7 no eth1 virbr0 8000.5254001021b8 yes virbr0-nic
Add a virtual NIC to a VM:
virsh attach-interface --domain <domain_name> --type bridge_id --source <source_device> --model virtio --mac <random_mac_address> --config --live ex: [root@vav networks]# virsh attach-interface --domain chronos --type bridge --source br1 --model virtio --mac 52:54:00:ab:cc:09 --config --live --config affects next startup of domain --live affects a running domain