Skip to main content

Kvm virsh usefull command


Basic  Operation
virsh list [--all|--inactive]
inactive show defined but not active domains.
virsh start <domid|name|uuid>
virsh shutdown <domid|name|uuid>
virsh suspend <domid|name|uuid>
virsh resume <domid|name|uuid>
virsh reboot <domid|name|uuid>
virsh destroy <domid|name|uuid>
cold reset the node, does not delete/destroy anything.
virsh console <domid|name|uuid>
serial console, exit with ctrl+5 or ctrl+]

Definition
VM are created by describing the virtual machine in a libvirt XML file, and importing that XML file into virsh.
virsh dumpxml <domid|name|uuid>
virsh define <filename.xml>
http://libvirt.org/format.html
virsh undefine <domid|name|uuid>
delete the VM. First you must terminate (destroy) the domain. This command does not delete volumes, use vol-delete.

Modification

virsh autostart [--disable] <domid|name|uuid>
autostart on boot
virsh edit <domid|name|uuid>
reboot guest for changes to take effect
virsh console <domid|name|uuid>
serial console, exit with ctrl+5 or ctrl+]

Cloning
these are note virsh sub-commands
virsh-sysprep –enable=<read_doc_for_params> <dom_id>
virt-clone --original <domid> --name <dest_id> -f <dest_vol>

Info
virsh vcpuinfo <domid|name|uuid>
info about guest's vcpu
virsh vcpupin <domid|name|uuid>
info about vcpu affinity
virsh dommemstat <domid|name|uuid>
info about guest's memory status
virsh domid <domid|name|uuid>
conversion between identifiers
virsh dominfo <domid|name|uuid>
display guest information
virsh domifaddr <domid|name|uuid>
show guest interfaces
ivirsh domif-getlink <domid|name|uuid> <iface>
show guest interface status
virsh nodeinfo
display host information


Volume Operation
virsh pool-list
list all volume pools
virsh pool-info <pool_id>
virsh vol-list <pool_id> [--details]
virsh vol-delete <vol_id> [--pool <id>]
virsh vol-create-as <pool_id> <volname> [--format <raw|qcow2] <size M|G|T> [--allocation <sz M|G|T>]
this command accepts a lot of parameters, see man for more info
virsh vol-clone <src_vol> <dst_vol> <--pool pool_id>
virsh vol-resize <vol_id> <size M|G|T> <--pool pool_id>
you will have to manage the new free space inside the guest
virsh vol-wipe <vol_id> <--pool pool_id>


Snapshots
virsh snapshot-create-as <domid|name|uuid> [--name <str>] [--description <str>] [--quiesce]
virsh snapshot-current <domid|name|uuid> [--snapshotname <str>]
get or set the current snapshot
virsh snapshot-delete <domid|name|uuid> [--current | --snapshotname <str>] [--children]
delete current or particular snapshot, and if specified their children. See help for more parameters
virsh snapshot-edit <domid|name|uuid> [--snapshotname <str>]
virsh snapshot-info  <domid|name|uuid> [--current | --snapshotname <str>]
virsh snapshot-list <domid|name|uuid>
virsh snapshot-revert <domid|name|uuid> [--current | --snapshotname <str>]


Documentation
/var/lib/libvirt/
this is the default directory where images, domains, etc. reside
virsh help
http://libvirt.org/



Networking
virsh net-list
virsh net-define
virsh net-event
virsh net-dhcp-leases
virsh nwfilter-list
virsh iface-list
virsh net-info
virsh net-create
virsh net-update
virsh net-autostart
virsh net-destroy
virsh iface-edit

Comments

Popular posts from this blog

Cisco SG300 CLI Commands

Cisco SG300 CLI Commands Other parts were obtained using the CLI PDF provided by Cisco Remove a Trunk and switch to access config t int gi44 switchport trunk allowed vlan remove 2 switchport mode access switchport access vlan 2 or config t int gi44 switchport mode general switchport general allowed vlan remove 2 switchport mode access switchport access vlan 2 Change CDP Device ID Format to Hostname opposed to default MAC address s-sg300#sh cdp Global CDP information:         CDP is globally enabled         CDP log duplex mismatch is globally enabled         CDP log voice VLAN mismatch is globally enabled         CDP log native VLAN mismatch is globally enabled         Mandatory TLVs validation is disabled         Sending CDPv2 advertisements is enabled         Sending Appliance TLV is enabled       ...

Policy Based Routing on a Cisco ASA

Cisco ASA 9.4 (and later) is now supporting Policy Based Routing. Yeah. Great news, since many customers are requesting something like “HTTP traffic to the left – VoIP traffic to the right”. Coming with a new Cisco ASA 5506-X I was happy to try the policy based routing feature. The configuration steps through the ASDM GUI are not easy and full of errors so I am trying to give some hints within this blog post. The main document from Cisco for policy based routing on a ASA is here . It describes the use-cases for PBR and gives examples. Configuration I am doing all of my configurations through the GUI ASDM. (I know, some people really love the CLI even for configurations, but I don’t. I am using it only for troubleshooting issues.) For this lab I am using a Cisco ASA 5506-X with ASA version 9.5(1), while ASDM is version 7.5(1) . In my lab, I have a default route to ISP 1 (gi1/1) and a different connection to ISP 2 (gi1/2). There is no route to ISP 2 in the ro...

developer resource

  Developer Resources Your journey to success as a confident developer requires hard work, time – and if you're wise, lots of help and guidance from people who have been in your shoes (something we’re proud to be able to offer here at ZTM). It also doesn't hurt to stand on the shoulders of others and leverage the wealth of incredible free resources out there. Andrei and  our instructors  have put together this collection of their top free developer resources to help you at any stage of your programming journey. Be first to get new ZTM updates, content and resources SUBSCRIBE No spam, ever. Unsubscribe anytime. Cheat Sheets Python Cheat Sheet  Cheat Sheets Official ZTM Python Cheat Sheet to help Python programmers of all levels learn and remember common Python syntax. zerotomastery.io JavaScript Cheat Sheet  Cheat Sheets Official ZTM JavaScript Cheat Sheet to help all web developers learn and remember JavaScript concept ... zerotomastery.io Nmap Cheat Sheet ...