2022-06-28 13:10:56 +02:00
---
2022-12-01 08:51:34 +01:00
title: "xe CLI"
2022-11-19 15:25:20 +01:00
visible: true
2022-06-28 13:10:56 +02:00
---
[toc]
2022-12-01 08:51:34 +01:00
2022-06-28 13:13:36 +02:00
## VM Operations
2022-12-01 08:51:34 +01:00
2023-02-19 16:01:08 +01:00
Show running VMs
2022-06-28 13:10:56 +02:00
2024-07-20 11:24:36 +02:00
[shroot]
```sh
xe vm-list power-state=running
```
[/shroot]
Show only the names of running VMs
[shroot]
2023-02-19 16:01:08 +01:00
```sh
2024-07-20 11:24:36 +02:00
xe vm-list power-state=running | grep "name-label"
2023-02-19 16:01:08 +01:00
```
2024-07-20 11:24:36 +02:00
[/shroot]
2023-02-19 16:01:08 +01:00
Poweroff all VMs currently running
2024-07-20 11:24:36 +02:00
[shroot]
2023-02-19 16:01:08 +01:00
```sh
xe vm-shutdown --multiple power-state=running
```
2024-07-20 11:24:36 +02:00
[/shroot]
2023-02-19 16:01:08 +01:00
Start VM
2024-07-20 11:24:36 +02:00
[shroot]
2023-02-19 16:01:08 +01:00
```sh
xe vm-start uuid={VM UUID}
```
2024-07-20 11:24:36 +02:00
[/shroot]
2023-02-19 16:01:08 +01:00
## Host reboot procedure
2022-12-01 08:51:34 +01:00
2023-07-30 11:39:26 +02:00
Disable the host so that no new VM can be started on this host and so that the rest of the pool knows that the host was disabled on purpose.
From command line:
[shroot]
2023-07-30 11:37:57 +02:00
2023-07-30 11:39:26 +02:00
```sh
2023-08-20 12:49:06 +02:00
xe host-disable host=$(hostname)
2023-07-30 11:39:26 +02:00
```
2023-07-30 11:37:57 +02:00
2023-07-30 11:39:26 +02:00
[/shroot]
2023-07-30 11:37:57 +02:00
2023-07-30 11:39:26 +02:00
Migrate the VMs running on the host to other hosts in the pool, or shut them down.
2023-07-30 11:37:57 +02:00
2023-07-30 11:39:26 +02:00
Reboot or shutdown.
Can be done from XO, or from command line
2023-08-20 12:49:06 +02:00
[shroot]
```sh
xe host-reboot host=$(hostname)
```
[/shroot]
2023-07-30 11:39:26 +02:00
(After a reboot or host startup) Move VMs back to the host if appropriate. There is no need to re-enable the host: it is done automatically when it starts.
2023-07-30 11:37:57 +02:00
2023-02-19 16:01:08 +01:00
> [XCP-ng documentation](https://docs.xcp-ng.org/guides/host-reboot/)
2022-06-28 13:13:36 +02:00
## Snapshot management
2022-12-01 08:51:34 +01:00
_TODO_
## VM Limits
2023-02-19 16:01:08 +01:00
Check current limits
```sh
xe vm-param-get uuid={VM UUID} param-name={PARAMETER}
```
2022-12-01 08:51:34 +01:00
Parameters:
```
VCPUs-max: Maximum number of CPU cores
VCPUs-at-startup: Number of CPU cores initially assigned
```
2023-02-19 16:01:08 +01:00
Set Limits
```sh
xe vm-param-set uuid={VM UUID} {PARAMETER}={VALUE}
```
2022-12-01 08:52:45 +01:00
2023-02-19 16:01:08 +01:00
[TODO Memory limits ](https://support.citrix.com/article/CTX219771/increase-ram-for-xenserver-vms-through-command-line-interface )