Long-Term Supported Versions

    Innovation Versions

      Managing the VM Lifecycle



      This section describes how to use StratoVirt to manage the lifecycle of a VM, namely starting, pausing, resuming, and exiting a VM.

      Creating and Starting a VM

      As described in the section "Configuring a VM", users can specify the VM configuration by using command line parameters or the JSON file, and run the stratovirt command on the host to create and start a VM.

      • Run the following command to create and start a VM:
      $/path/to/stratovirt - [Parameter 1] [Parameter Option] - [Parameter 2] [Parameter Option]...
      • Use the JSON file to provide the VM configuration. The command for creating and starting a VM is as follows:
      $ /path/to/stratovirt \
          -config /path/to/json \
          -api-channel unix:/path/to/socket

      Where, /path/to/json indicates the path of the JSON configuration file. /path/to/socket is the socket file specified by the user (for example, /tmp/stratovirt.socket). After the command is executed, the socket file is automatically created. Ensure that the socket file does not exist before executing the command, so that the VM can be started properly.

      After the VM is started, there are two NICs: eth0 and eth1. The two NICs are reserved for hot plugging: eth0 first, and then eth1. Currently, only two virtio-net NICs can be hot-plugged.

      Connecting a VM

      StratoVirt uses QMP to manage VMs. To pause, resume, and exit a VM, connect it to StratoVirt through QMP first.

      Open a new CLI (CLI B) on the host and run the following command to perform the api-channel connection:

      $ ncat -U /path/to/socket

      After the connection is set up, a greeting message will be received from StratoVirt, as shown in the following figure.


      Now, manage the VM by entering QMP commands in CLI B.

      QMP provides stop, cont, quit, and query-status to manage and query the VM status.

      All QMP commands for managing VMs are entered in CLI B. <- indicates the command input, and -> indicates the QMP returned result.

      Pausing a VM

      QMP provides the stop command for pausing a VM, that is, pausing all vCPUs of the VM. Command format:



      Run the stop command to pause the VM. The command output is as follows:

      <- {"execute":"stop"}
      -> {"event":"STOP","data":{},"timestamp":{"seconds":1583908726,"microseconds":162739}}
      -> {"return":{}}

      Resuming a VM

      QMP provides the cont command to resume a VM, that is, to resume all vCPUs of the VM. Command format:



      Run the cont command to resume the VM. The command output is as follows:

      <- {"execute":"cont"}
      -> {"event":"RESUME","data":{},"timestamp":{"seconds":1583908853,"microseconds":411394}}
      -> {"return":{}}

      Exiting a VM

      QMP provides the quit command to exit a VM, that is, to exit the StratoVirt process. Command format:



      <- {"execute":"quit"}
      -> {"return":{}}
      -> {"event":"SHUTDOWN","data":{"guest":false,"reason":"host-qmp-quit"},"timestamp":{"ds":1590563776,"microseconds":519808}}

      Bug Catching

      Buggy Content

      Bug Description

      Submit As Issue

      It's a little complicated....

      I'd like to ask someone.


      Just a small problem.

      I can fix it online!

      Bug Type
      Specifications and Common Mistakes

      ● Misspellings or punctuation mistakes;

      ● Incorrect links, empty cells, or wrong formats;

      ● Chinese characters in English context;

      ● Minor inconsistencies between the UI and descriptions;

      ● Low writing fluency that does not affect understanding;

      ● Incorrect version numbers, including software package names and version numbers on the UI.


      ● Incorrect or missing key steps;

      ● Missing prerequisites or precautions;

      ● Ambiguous figures, tables, or texts;

      ● Unclear logic, such as missing classifications, items, and steps.


      ● Technical principles, function descriptions, or specifications inconsistent with those of the software;

      ● Incorrect schematic or architecture diagrams;

      ● Incorrect commands or command parameters;

      ● Incorrect code;

      ● Commands inconsistent with the functions;

      ● Wrong screenshots.

      Risk Warnings

      ● Lack of risk warnings for operations that may damage the system or important data.

      Content Compliance

      ● Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions;

      ● Copyright infringement.

      How satisfied are you with this document

      Not satisfied at all
      Very satisfied
      Click to create an issue. An issue template will be automatically generated based on your feedback.
      Bug Catching
      编组 3备份