Skip to content

Commit ccecd55

Browse files
jsun26intelacrnsi
authored andcommitted
HV: show VM UUID in shell
Enhance "vm_list" command in shell to Show VM UUID; Tracked-On: #2291 Signed-off-by: Victor Sun <victor.sun@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 445999a commit ccecd55

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

doc/user-guides/acrn-shell.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The ACRN hypervisor shell supports the following commands:
1414
* - help
1515
- Display information about supported hypervisor shell commands
1616
* - vm_list
17-
- List all VMs, displaying the VM name, ID, and state ("Started"=running)
17+
- List all VMs, displaying the VM UUID, ID, name, and state ("Started"=running)
1818
* - vcpu_list
1919
- List all vCPUs in all VMs
2020
* - vcpu_dumpreg <vm_id> <vcpu_id>

hypervisor/debug/shell.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,8 @@ static int32_t shell_list_vm(__unused int32_t argc, __unused char **argv)
561561
uint16_t vm_id;
562562
char state[32];
563563

564-
shell_puts("\r\nVM NAME\t\t\t\tVM ID\t\tVM STATE"
565-
"\r\n=======\t\t\t\t=====\t\t========\r\n");
564+
shell_puts("\r\nVM_UUID VM_ID VM_NAME VM_STATE"
565+
"\r\n================================ ===== ================================ ========\r\n");
566566

567567
for (vm_id = 0U; vm_id < CONFIG_MAX_VM_NUM; vm_id++) {
568568
vm = get_vm_from_vmid(vm_id);
@@ -581,8 +581,14 @@ static int32_t shell_list_vm(__unused int32_t argc, __unused char **argv)
581581
break;
582582
}
583583
vm_config = get_vm_config(vm_id);
584-
if (vm_config->type != UNDEFINED_VM) {
585-
snprintf(temp_str, MAX_STR_SIZE, "%-34s%-14d%-8s\r\n", vm_config->name, vm_id, state);
584+
if (is_valid_vm(vm)) {
585+
int8_t i;
586+
587+
for (i = 0; i < 16; i++) {
588+
snprintf(temp_str + 2 * i, 3U, "%02x", vm->uuid[i]);
589+
}
590+
snprintf(temp_str + 32, MAX_STR_SIZE - 32U, " %-3d %-32s %-8s\r\n",
591+
vm_id, vm_config->name, state);
586592

587593
/* Output information for this task */
588594
shell_puts(temp_str);

hypervisor/debug/shell_priv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct shell {
4040

4141
#define SHELL_CMD_VM_LIST "vm_list"
4242
#define SHELL_CMD_VM_LIST_PARAM NULL
43-
#define SHELL_CMD_VM_LIST_HELP "List all VMs, displaying the VM name, ID, and state"
43+
#define SHELL_CMD_VM_LIST_HELP "List all VMs, displaying the VM UUID, ID, name and state"
4444

4545
#define SHELL_CMD_VCPU_LIST "vcpu_list"
4646
#define SHELL_CMD_VCPU_LIST_PARAM NULL

0 commit comments

Comments
 (0)