...

Използване на virsh командата за листване на KVM виртуални машини

Как да покажем наличните виртуалки с техните опции
преди 1 месец

Листване на KVM виртуалните машини

синтаксиса е:

virsh list
virsh list --all
virsh list [options]

Състоянието на всеки домейн може да е:

  • running – The domain is currently running on a CPU.
  • idle – The domain is idle, and not running or runnable. This can be caused because the domain is waiting on IO (a traditional wait state) or has gone to sleep because there was nothing else for it to do.
  • paused – The domain has been paused, usually occurring through the administrator running virsh suspend. When in a paused state the domain will still consume allocated resources like memory, but will not be eligible for scheduling by the hypervisor.
  • in shutdown – The domain is in the process of shutting down, i.e. the guest operating system has been notified and should be in the process of stopping its operations gracefully.
  • shut off – The domain is not running. Usually this indicates the domain has been shut down completely, or has not been started.
  • crashed – The domain has crashed, which is always a violent ending. Usually this state can only occur if the domain has been configured not to restart on crash.
  • pmsuspended – The domain has been suspended by guest power management, e.g. entered into s3 state.

    Показване на автоматично стартираните домейни:

    virsh list --autostart
    Id   Име           Състояние
    -------------------------------
    1    ubuntu18.04   работи
    2    gitbsd        работи

    Може да видите всички опции чрез virsh list --help:

    virsh list --help
    ИМЕ
    list - показване на домейните
    
    РЕЗЮМЕ
    list [--inactive] [--all] [--transient] [--persistent] [--with-snapshot] [--without-snapshot] [--with-checkpoint] [--without-checkpoint] [--state-running] [--state-paused] [--state-shutoff] [--state-other] [--autostart] [--no-autostart] [--with-managed-save] [--without-managed-save] [--uuid] [--name] [--table] [--managed-save] [--title]
    
    ОПИСАНИЕ
    Връща списък с домейните.
    
    ОПЦИИ
    --inactive       показване на неактивните домейни
    --all            списък на активни и неактивни домейни
    --transient      list transient domains
    --persistent     list persistent domains
    --with-snapshot  list domains with existing snapshot
    --without-snapshot  list domains without a snapshot
    --with-checkpoint  list domains with existing checkpoint
    --without-checkpoint  list domains without a checkpoint
    --state-running  list domains in running state
    --state-paused   list domains in paused state
    --state-shutoff  list domains in shutoff state
    --state-other    list domains in other states
    --autostart      list domains with autostart enabled
    --no-autostart   list domains with autostart disabled
    --with-managed-save  list domains with managed save state
    --without-managed-save  list domains without managed save
    --uuid           list uuid's only
    --name           list domain names only
    --table          list table (default)
    --managed-save   mark inactive domains with managed save state
    --title          show domain title

    Пълен лист с възможностите на командата може да намерите тук: https://libvirt.org/sources/virshcmdref/html-single/ или чрез man virsh