2018-05-30 06:54:57 +08:00
|
|
|
.. _acrnctl:
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2021-02-13 08:27:24 +08:00
|
|
|
Acrnctl and Acrnd
|
2018-07-19 02:21:07 +08:00
|
|
|
#################
|
DM:tools: add acrnctl tool
The acrnctl can help user to create, delete, launch and stop UOSs,
To see what it can do, just run:
# acrnctl
or
# acrnctl help
you may see:
support:
list
start
stop
del
add
Use acrnctl [cmd] help for details
There are examples:
(1) add a VM
Each time you can just add one VM. Suppose you have an UOS
launch script, such as launch_UOS.sh
you can run:
# acrnctl add launch_UOS.sh -U 1
vm1-14:59:30 added
Note that, launch script shoud be able to launch ONE UOS. If
it fail, it is better to print some error logs, to tell user
the reason, so that he knows how to solve it.
The vmname is important, the acrnctl searchs VMs by their
names. so duplicated VM names are not allowed. Beside, if the
launch script changes VM name at launch time, acrnctl will
not recgonize it.
(2) delete VMs
# acrnctl del vm1-14:59:30
(3) show VMs
# acrnctl list
vm1-14:59:30 untracked
vm-yocto stop
vm-android stop
(4) start VM
you can start a vm with 'stop' status, each time can start
one VM.
# acrnctl start vm-yocto
(5) stop VM
you can stop VMs, if their status is not 'stop'
# acrnctl stop vm-yocto vm1-14:59:30 vm-android
Acked-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Zhao, Yakui <yakui.zhao@intel.com>
Signed-off-by: Tao, Yuhong <yuhong.tao@intel.com>
2018-04-03 21:43:00 +08:00
|
|
|
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
Description
|
|
|
|
***********
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
The ``acrnctl`` tool helps users create, delete, launch, and stop a User
|
2020-09-10 16:09:22 +08:00
|
|
|
VM (aka UOS). The tool runs under the Service VM, and User VMs should be based
|
2018-07-19 02:21:07 +08:00
|
|
|
on ``acrn-dm``. The daemon for acrn-manager is `acrnd`_.
|
DM:tools: add acrnctl tool
The acrnctl can help user to create, delete, launch and stop UOSs,
To see what it can do, just run:
# acrnctl
or
# acrnctl help
you may see:
support:
list
start
stop
del
add
Use acrnctl [cmd] help for details
There are examples:
(1) add a VM
Each time you can just add one VM. Suppose you have an UOS
launch script, such as launch_UOS.sh
you can run:
# acrnctl add launch_UOS.sh -U 1
vm1-14:59:30 added
Note that, launch script shoud be able to launch ONE UOS. If
it fail, it is better to print some error logs, to tell user
the reason, so that he knows how to solve it.
The vmname is important, the acrnctl searchs VMs by their
names. so duplicated VM names are not allowed. Beside, if the
launch script changes VM name at launch time, acrnctl will
not recgonize it.
(2) delete VMs
# acrnctl del vm1-14:59:30
(3) show VMs
# acrnctl list
vm1-14:59:30 untracked
vm-yocto stop
vm-android stop
(4) start VM
you can start a vm with 'stop' status, each time can start
one VM.
# acrnctl start vm-yocto
(5) stop VM
you can stop VMs, if their status is not 'stop'
# acrnctl stop vm-yocto vm1-14:59:30 vm-android
Acked-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Zhao, Yakui <yakui.zhao@intel.com>
Signed-off-by: Tao, Yuhong <yuhong.tao@intel.com>
2018-04-03 21:43:00 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
Usage
|
2019-06-22 01:27:40 +08:00
|
|
|
=====
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
You can see the available ``acrnctl`` commands by running:
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
.. code-block:: none
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
# acrnctl help
|
|
|
|
support:
|
|
|
|
list
|
|
|
|
start
|
2019-08-22 16:57:34 +08:00
|
|
|
stop [--force/-f]
|
2018-05-30 06:54:57 +08:00
|
|
|
del
|
|
|
|
add
|
2018-05-31 10:50:54 +08:00
|
|
|
reset
|
2019-05-03 02:47:37 +08:00
|
|
|
blkrescan
|
2018-05-30 06:54:57 +08:00
|
|
|
Use acrnctl [cmd] help for details
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2019-06-24 19:43:59 +08:00
|
|
|
.. note::
|
2022-09-20 00:37:24 +08:00
|
|
|
You must run ``acrnctl`` with root privileges, and make sure the ``acrnd``
|
2021-12-22 08:10:51 +08:00
|
|
|
service has been started before running ``acrnctl``.
|
2019-06-24 19:43:59 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
Here are some usage examples:
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
Add a VM
|
|
|
|
========
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
The ``add`` command lets you add a VM by specifying a
|
2020-09-10 16:09:22 +08:00
|
|
|
script that will launch a User VM, for example ``launch_uos.sh``:
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
.. code-block:: none
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2019-06-26 12:09:31 +08:00
|
|
|
# acrnctl add launch_uos.sh -U 1
|
2018-05-30 06:54:57 +08:00
|
|
|
vm1-14:59:30 added
|
DM:tools: add acrnctl tool
The acrnctl can help user to create, delete, launch and stop UOSs,
To see what it can do, just run:
# acrnctl
or
# acrnctl help
you may see:
support:
list
start
stop
del
add
Use acrnctl [cmd] help for details
There are examples:
(1) add a VM
Each time you can just add one VM. Suppose you have an UOS
launch script, such as launch_UOS.sh
you can run:
# acrnctl add launch_UOS.sh -U 1
vm1-14:59:30 added
Note that, launch script shoud be able to launch ONE UOS. If
it fail, it is better to print some error logs, to tell user
the reason, so that he knows how to solve it.
The vmname is important, the acrnctl searchs VMs by their
names. so duplicated VM names are not allowed. Beside, if the
launch script changes VM name at launch time, acrnctl will
not recgonize it.
(2) delete VMs
# acrnctl del vm1-14:59:30
(3) show VMs
# acrnctl list
vm1-14:59:30 untracked
vm-yocto stop
vm-android stop
(4) start VM
you can start a vm with 'stop' status, each time can start
one VM.
# acrnctl start vm-yocto
(5) stop VM
you can stop VMs, if their status is not 'stop'
# acrnctl stop vm-yocto vm1-14:59:30 vm-android
Acked-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Zhao, Yakui <yakui.zhao@intel.com>
Signed-off-by: Tao, Yuhong <yuhong.tao@intel.com>
2018-04-03 21:43:00 +08:00
|
|
|
|
2019-06-22 01:27:40 +08:00
|
|
|
If a ``-C`` option is also specified, the VM is launched in a runC
|
|
|
|
container::
|
|
|
|
|
2019-06-26 12:09:31 +08:00
|
|
|
# acrnctl add launch_uos.sh -C
|
|
|
|
|
2020-11-05 06:13:47 +08:00
|
|
|
.. note:: You can download an :acrn_raw:`example launch_uos.sh script
|
2022-09-20 00:37:24 +08:00
|
|
|
<misc/config_tools/data/sample_launch_scripts/nuc/launch_uos.sh>`
|
2021-02-13 08:27:24 +08:00
|
|
|
that supports the ``-C`` (``run_container`` function) option.
|
2019-06-22 01:27:40 +08:00
|
|
|
|
2020-09-10 16:09:22 +08:00
|
|
|
Note that the launch script must only launch one User VM instance.
|
2018-05-30 06:54:57 +08:00
|
|
|
The VM name is important. ``acrnctl`` searches VMs by their
|
|
|
|
names so duplicate VM names are not allowed. If the
|
|
|
|
launch script changes the VM name at launch time, ``acrnctl``
|
|
|
|
will not recognize it.
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
Delete VMs
|
|
|
|
==========
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
Use the ``delete`` command with a VM name to delete that VM:
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
.. code-block:: none
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
# acrnctl del vm1-14:59:30
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
List VMs
|
|
|
|
========
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
Use the ``list`` command to display VMs and their state:
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
.. code-block:: none
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
# acrnctl list
|
|
|
|
vm1-14:59:30 untracked
|
2020-06-09 09:34:16 +08:00
|
|
|
vm-ubuntu stopped
|
2018-05-30 06:54:57 +08:00
|
|
|
vm-android stopped
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
Start VM
|
|
|
|
========
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2022-09-20 00:37:24 +08:00
|
|
|
If a VM is in a stopped state, you can start it with the ``start`` command. The
|
|
|
|
``acrnd`` service automatically loads the launch script under
|
|
|
|
``/usr/share/acrn/conf/add/`` to boot the VM.
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
.. code-block:: none
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2020-06-09 09:34:16 +08:00
|
|
|
# acrnctl start vm-ubuntu
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
Stop VM
|
|
|
|
=======
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2022-09-20 00:37:24 +08:00
|
|
|
Use the ``stop`` command to stop one or more running VMs:
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
.. code-block:: none
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2020-06-09 09:34:16 +08:00
|
|
|
# acrnctl stop vm-ubuntu vm1-14:59:30 vm-android
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2019-08-22 16:57:34 +08:00
|
|
|
Use the optional ``-f`` or ``--force`` argument to force the stop operation.
|
|
|
|
This will trigger an immediate shutdown of the User VM by the ACRN Device Model
|
|
|
|
and can be useful when the User VM is in a bad state and not shutting down
|
|
|
|
gracefully by itself.
|
|
|
|
|
|
|
|
.. code-block:: none
|
|
|
|
|
2020-06-09 09:34:16 +08:00
|
|
|
# acrnctl stop -f vm-ubuntu
|
2019-08-22 16:57:34 +08:00
|
|
|
|
2020-09-10 16:09:22 +08:00
|
|
|
Rescan Block Device
|
2019-05-03 02:47:37 +08:00
|
|
|
===================
|
|
|
|
|
|
|
|
Use the ``blkrescan`` command to trigger a rescan of
|
|
|
|
virtio-blk device by guest VM, in order to revalidate and
|
|
|
|
update the backend file.
|
|
|
|
|
|
|
|
.. code-block:: none
|
|
|
|
|
|
|
|
# acrnctl blkrescan vmname slot,newfilepath
|
|
|
|
vmname: Name of VM with dummy backend file attached to virtio-blk device.
|
|
|
|
slot: Slot number of the virtio-blk device.
|
|
|
|
newfilepath: File path for the backend of virtio-blk device.
|
|
|
|
|
|
|
|
acrnctl blkrescan vm1 6,actual_file.img
|
|
|
|
|
|
|
|
.. note:: blkrescan is only supported when VM is launched with
|
|
|
|
empty backend file (using **nodisk**) for virtio-blk device.
|
|
|
|
Replacing a valid backend file is not supported and will
|
|
|
|
result in error.
|
|
|
|
|
2018-06-28 19:28:23 +08:00
|
|
|
.. _acrnd:
|
|
|
|
|
2021-02-13 08:27:24 +08:00
|
|
|
Acrnd
|
2018-07-19 02:21:07 +08:00
|
|
|
*****
|
2018-06-28 19:28:23 +08:00
|
|
|
|
2020-09-10 16:09:22 +08:00
|
|
|
The ``acrnd`` daemon process provides a way for launching or resuming a User VM
|
|
|
|
should the User VM shut down, either in a planned manner or unexpectedly. A User
|
|
|
|
VM can ask ``acrnd`` to set up a timer to make sure the User VM is running, even
|
|
|
|
if the Service VM is suspended or stopped.
|
2019-06-22 01:27:40 +08:00
|
|
|
|
|
|
|
Usage
|
|
|
|
=====
|
|
|
|
|
|
|
|
You can see the available ``acrnd`` commands by running:
|
|
|
|
|
|
|
|
.. code-block:: none
|
|
|
|
|
|
|
|
$ acrnd -h
|
2019-06-24 16:27:07 +08:00
|
|
|
acrnd - Daemon for ACRN VM Management
|
2019-06-22 01:27:40 +08:00
|
|
|
[Usage] acrnd [-t] [-d delay] [-h]
|
|
|
|
-t: print messages to stdout
|
2019-06-24 16:27:07 +08:00
|
|
|
-d: delay the autostarting of VMs, <0-60> in second (not available in the
|
|
|
|
``RELEASE=1`` build)
|
|
|
|
-h: print this message
|
2019-06-22 01:27:40 +08:00
|
|
|
|
2021-12-22 08:10:51 +08:00
|
|
|
.. note::
|
|
|
|
You must run ``acrnd`` with root privileges.
|
|
|
|
|
2019-06-22 01:27:40 +08:00
|
|
|
Normally, ``acrnd`` runs silently (messages are directed to
|
2019-06-24 16:27:07 +08:00
|
|
|
``/dev/null``). Use the ``-t`` option to direct messages to ``stdout``,
|
2019-06-22 01:27:40 +08:00
|
|
|
useful for debugging.
|
|
|
|
|
2020-09-10 16:09:22 +08:00
|
|
|
The ``acrnd`` daemon stores pending User VM work to ``/usr/share/acrn/conf/timer_list``
|
|
|
|
and sets an RTC timer to wake up the Service VM or bring the Service VM back up again.
|
2018-06-28 19:28:23 +08:00
|
|
|
When ``acrnd`` daemon is restarted, it restores the previously saved timer
|
2020-09-10 16:09:22 +08:00
|
|
|
list and launches the User VMs at the right time.
|
2018-06-28 19:28:23 +08:00
|
|
|
|
2021-12-22 08:10:51 +08:00
|
|
|
A ``systemd`` service file (``acrnd.service``) is installed by default.
|
|
|
|
You can enable, restart or stop acrnd service using ``systemctl``.
|
2018-06-28 19:28:23 +08:00
|
|
|
|
2021-12-22 08:10:51 +08:00
|
|
|
.. code-block:: none
|
|
|
|
|
|
|
|
systemctl enable --now acrnd.service
|
2019-06-24 19:43:59 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
Build and Install
|
|
|
|
*****************
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2020-09-10 16:09:22 +08:00
|
|
|
Source code for both ``acrnctl`` and ``acrnd`` is in the ``misc/acrn-manager`` folder.
|
2018-05-30 06:54:57 +08:00
|
|
|
Change to that folder and run:
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
.. code-block:: none
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2020-09-10 16:09:22 +08:00
|
|
|
$ make
|
|
|
|
$ sudo make install
|