You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/product/integration_references/system_interfaces/api.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,6 +122,9 @@ Commands with marked with \* are asynchronous. The success response for these co
122
122
| pci-attach | one.vm.attachpci | VM:MANAGE|
123
123
| pci-detach | one.vm.detachpci | VM:MANAGE|
124
124
| restore | one.vm.restore | VM:MANAGE|
125
+
| exec | one.vm.exec | VM:MANAGE|
126
+
| exec-retry | one.vm.retryexec | VM:MANAGE|
127
+
| exec-cancel | one.vm.cancelexec | VM:MANAGE|
125
128
126
129
{{< alert title="Note" color="success" >}}
127
130
The **deploy** action requires the user issuing the command to have VM:ADMIN rights. This user will usually be the scheduler with the oneadmin credentials.
@@ -1384,6 +1387,43 @@ For example:
1384
1387
| OUT | Int/String | The VM ID / The error string. |
1385
1388
| OUT | Int | Error code. |
1386
1389
1390
+
### one.vm.exec
1391
+
1392
+
-**Description**: Executes a command inside a Virtual Machine. The VM needs to be in RUNNING state.
Copy file name to clipboardExpand all lines: content/product/virtual_machines_operation/virtual_machines/vm_instances.md
+77-1Lines changed: 77 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -757,6 +757,82 @@ In this example, the first argument would be the disk and the second the snapsho
757
757
{{< alert title="Note" color="success" >}}
758
758
The arguments are mandatory. If you use the CLI or Sunstone they are generated automatically for the actions.{{< /alert >}}
759
759
760
+
## Command Execution Inside the Virtual Machine
761
+
Prerequisites:
762
+
* Running commands within a VM rely on the QEMU Guest Agent, which must be installed and running on the VM.
763
+
* The VM must be in the `RUNNING` state.
764
+
765
+
With OpenNebula, run commands inside a Virtual Machine. Commands are sent to the VM through the QEMU Guest Agent, and results are stored in the VM template under `QEMU_GA_EXEC`. The following diagram depicts how commands are executed within a VM:
766
+
767
+

768
+
769
+
The `VM_EXEC` monitor probe collects the results and updates the `QEMU_GA_EXEC` block. To find more details on configuring the monitor probe, refer to [Monitoring System](../../../product/cloud_system_administration/resource_monitoring/monitoring_system.md).
770
+
771
+
{{< alert title="Warning" color="warning" >}}
772
+
Run only one command at a time for every Virtual Machine. If a current command is still in `EXECUTING` status, even if finished but not yet updated by the monitor probe, new commands will not be executed until the current one is fully completed.{{< /alert >}}
773
+
774
+
### Options
775
+
The `QEMU_GA_EXEC` section in the VM template contains the following fields:
|`COMMAND`| The command to be executed in the VM. |
780
+
|`STDIN`| Stdin data to pass to the command executed on the VM |
781
+
|`PID`| (Hypervisor-side) PID handling the exec request. |
782
+
|`RETURN_CODE`| Numeric exit code produced by the command (e.g. `0` = success). |
783
+
|`STATUS`| Execution state: `EXECUTING`, `CANCELLED`, `DONE` or `ERROR`. |
784
+
|`STDOUT`| Command standard output (base64-encoded). |
785
+
|`STDERR`| Command standard error (base64-encoded). |
786
+
787
+
788
+
### Executing a command from the CLI
789
+
790
+
To execute a command inside a VM, use the `onevm exec` command. For example, to list files in the home directory of VM 0:
791
+
```bash
792
+
$ onevm exec 0 'ls -l'
793
+
```
794
+
795
+
Check the status of the command with:
796
+
```bash
797
+
$ onevm show 0
798
+
```
799
+
800
+
When still executing:
801
+
802
+
```bash
803
+
VIRTUAL MACHINE TEMPLATE
804
+
...
805
+
QEMU_GA_EXEC=[
806
+
COMMAND="ls -l",
807
+
STDIN="",
808
+
STATUS="EXECUTING" ]
809
+
```
810
+
811
+
After the execution is complete, details are updated:
812
+
813
+
```bash
814
+
VIRTUAL MACHINE TEMPLATE
815
+
...
816
+
QEMU_GA_EXEC=[
817
+
COMMAND="ls -l",
818
+
STDIN="",
819
+
PID="3864",
820
+
RETURN_CODE="0",
821
+
STATUS="DONE",
822
+
STDERR="",
823
+
STDOUT="dG90Y..." ]
824
+
```
825
+
826
+
To retry the execution of the last command executed, use `onevm exec-retry`:
827
+
```bash
828
+
$ onevm exec-retry 0
829
+
```
830
+
831
+
To cancel the command being executed, use `onevm exec-cancel`:
832
+
```bash
833
+
$ onevm exec-cancel 0
834
+
```
835
+
760
836
<aid="vm-life-cycle-and-states"></a>
761
837
762
838
## Virtual Machine States
@@ -775,7 +851,7 @@ Note that this is a simplified version. If you are a developer you may want to t
775
851
|`boot`|`Boot`| OpenNebula is waiting for the hypervisor to create the VM. |
776
852
|`runn`|`Running`| The VM is running (note that this stage includes the internal virtualized machine booting and shutting down phases). In this state, the virtualization driver will periodically monitor it. |
777
853
|`migr`|`Migrate`| The VM is migrating from one resource to another. This can be a life migration or cold migration (the VM is saved, powered off or powered off hard and VM files are transferred to the new resource). |
778
-
|`hotp`|`Hotplug`| A disk attach/detach, nic attach/detach, save asor resize operation is in process. |
854
+
|`hotp`|`Hotplug`| A disk attach/detach, nic attach/detach, save as, resize or exec operation is in process. |
779
855
|`snap`|`Snapshot`| A system snapshot is being taken. |
780
856
|`save`|`Save`| The system is saving the VM files after a migration, stop, or suspend operation. |
781
857
|`epil`|`Epilog`| In this phase the system cleans up the Host used to virtualize the VM, and additionally disk images to be saved are copied back to the system datastore. |
Copy file name to clipboardExpand all lines: content/software/release_information/release_notes_72/whats_new.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,7 @@ We encourage you to review the [Known Issues]({{% relref "known_issues" %}}) and
32
32
## Monitoring
33
33
<!--keeping some examples-->
34
34
-[Resource Usage Forecast](../../../product/cloud_system_administration/resource_monitoring/forecast/): Introduces predictive analytics for Host and VM resource consumption, enabling proactive infrastructure management. By analyzing trends in CPU, memory, disk, and network usage, OpenNebula 7.0 supports improved capacity planning, optimized workload scheduling, and early detection of performance bottlenecks.
35
+
-[New monitor message `EXEC_VM`to retrieve the result of commands executed inside a Virtual Machine](../../../product/cloud_system_administration/resource_monitoring/monitoring_system.md)
35
36
36
37
## Scheduler
37
38
<!--keeping some examples-->
@@ -59,6 +60,7 @@ We encourage you to review the [Known Issues]({{% relref "known_issues" %}}) and
59
60
## API and CLI
60
61
<!--keeping some examples-->
61
62
-[The `onedb purge-history` command now removes history records only within the specified `–start`, `–end` range for the `–id`, instead of deleting all records](https://github.com/OpenNebula/one/issues/6699).
63
+
-[New API calls (`one.vm.exec`, `one.vm.retryexec` and `one.vm.cancelexec`) to execute commands on a Virtual Machine](../../../product/virtual_machines_operation/virtual_machines/vm_instances.md#execute-commands-inside-the-virtual-machine)
62
64
- The output of `onemarketapp list` list now contains 2 extra columns displaying **HYPERVISOR** and **ARCHITECTURE**.
63
65
-[Add automatic VM index for multiple persistent VM instantiation](../../../product/virtual_machines_operation/virtual_machines/vm_instances.md#instantiate-to-persistent)
64
66
@@ -68,10 +70,8 @@ We encourage you to review the [Known Issues]({{% relref "known_issues" %}}) and
68
70
-[Virtual Machine memory encryption](../../../product/virtual_machines_operation/virtual_machines/vm_templates#memory-encryption) allows VM workloads whose memory cannot be read by the hypervisor.
69
71
70
72
## LXC
71
-
72
73
- NIC Hotplugging, recontextualization and NIC PCI passthrough are now available [driver features](../../../product/operation_references/hypervisor_configuration/lxc_driver.md).
73
74
74
-
75
75
## OpenNebula Flow
76
76
<!--keeping some examples-->
77
77
-[Oneflow clients include content-type header to make them work with Sinatra 4.0.0](https://github.com/OpenNebula/one/issues/6508).
0 commit comments