DM/HV: Increase VM name len

VM Name length is restricted to 32 characters. kata creates
a VM name with GUID added as a part of VM name making it around
80 characters. So increasing this size to 128.

v1->v2:
It turns out that MAX_VM_OS_NAME_LEN usage in DM and HV are for
different use cases. So removing the macro from acrn_common.h.
Definied macro MAX_VMNAME_LEN for DM purposes in dm.h. Retaining
original macron name MAX_VM_OS_NAME_LEN for HV purposes but defined
in vm_config.h.

Tracked-On: #3138
Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Vijay Dhanraj 2019-05-17 18:04:18 -07:00 committed by ACRN System Integration
parent f010f99d67
commit 517707dee4
10 changed files with 24 additions and 14 deletions

View File

@ -952,8 +952,8 @@ dm_run(int argc, char *argv[])
}
vmname = argv[0];
if (strnlen(vmname, MAX_VM_OS_NAME_LEN) >= MAX_VM_OS_NAME_LEN) {
pr_err("vmname size exceed %u\n", MAX_VM_OS_NAME_LEN);
if (strnlen(vmname, MAX_VMNAME_LEN) >= MAX_VMNAME_LEN) {
pr_err("vmname size exceed %u\n", MAX_VMNAME_LEN);
exit(1);
}

View File

@ -65,6 +65,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include "dm.h"
#include "ioc.h"
#include "vmmapi.h"
#include "monitor.h"
@ -100,7 +101,7 @@ typedef void* (*ioc_work)(void *arg);
* IOC mediator and virtual UART communication channel path,
* comes from DM command line parameters.
*/
static char virtual_uart_path[32 + MAX_VM_OS_NAME_LEN];
static char virtual_uart_path[32 + MAX_VMNAME_LEN];
/*
* To activate CBC signal channel(/dev/cbc-signals).

View File

@ -34,6 +34,8 @@
#include "vmm.h"
#include "dm_string.h"
#define MAX_VMNAME_LEN 128U
struct vmctx;
extern int guest_ncpus;
extern char *guest_uuid_str;

View File

@ -16,6 +16,7 @@
#define PLUG_CPU(n) (1U << (n))
#define MAX_VUART_NUM_PER_VM 2U
#define MAX_VM_OS_NAME_LEN 32U
/*
* PRE_LAUNCHED_VM is launched by ACRN hypervisor, with LAPIC_PT;

View File

@ -366,7 +366,6 @@ struct acrn_create_vm {
uint8_t reserved2[16];
} __aligned(8);
#define MAX_VM_OS_NAME_LEN 32U
/**
* @brief Info to create a VCPU

View File

@ -3,11 +3,19 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
/*
*****************************************************
NOTE: Any changes to this file may require rebuilding
IOC daemon (cbc_lifecycle) as they share this common
header file.
*****************************************************
*/
#ifndef ACRN_MANAGER_H
#define ACRN_MANAGER_H
#include <stdlib.h>
#include <acrn_common.h>
#include "dm.h"
#define MNGR_MSG_MAGIC 0x67736d206d6d76 /* that is char[8] "mngr msg", on X86 */
#define PATH_LEN 128
@ -43,7 +51,7 @@ struct mngr_msg {
/* req of ACRND_TIMER */
struct req_acrnd_timer {
char name[MAX_VM_OS_NAME_LEN];
char name[MAX_VMNAME_LEN];
time_t t;
} acrnd_timer;
@ -67,7 +75,7 @@ struct mngr_msg {
/* req of RTC_TIMER */
struct req_rtc_timer {
char vmname[MAX_VM_OS_NAME_LEN];
char vmname[MAX_VMNAME_LEN];
time_t t;
} rtc_timer;

View File

@ -355,7 +355,7 @@ int list_vm()
int start_vm(const char *vmname)
{
char cmd[PATH_LEN + sizeof(ACRN_CONF_PATH_ADD) * 2 + MAX_VM_OS_NAME_LEN * 2];
char cmd[PATH_LEN + sizeof(ACRN_CONF_PATH_ADD) * 2 + MAX_VMNAME_LEN * 2];
if (snprintf(cmd, sizeof(cmd), "bash %s/%s.sh $(cat %s/%s.args)",
ACRN_CONF_PATH_ADD, vmname, ACRN_CONF_PATH_ADD, vmname) >= sizeof(cmd)) {

View File

@ -89,8 +89,8 @@ static int check_name(const char *name)
if (!strcmp(name, "nothing"))
return -1;
if (strnlen(name, MAX_VM_OS_NAME_LEN) >= MAX_VM_OS_NAME_LEN) {
printf("(%s) size exceed MAX_VM_OS_NAME_LEN:%u\n", name, MAX_VM_OS_NAME_LEN);
if (strnlen(name, MAX_VMNAME_LEN) >= MAX_VMNAME_LEN) {
printf("(%s) size exceed MAX_VMNAME_LEN:%u\n", name, MAX_VMNAME_LEN);
return -1;
}

View File

@ -7,7 +7,6 @@
#define _ACRNCTL_H_
#include <sys/queue.h>
#include <acrn_common.h>
#include "acrn_mngr.h"
enum vm_state {
@ -30,7 +29,7 @@ struct vmmngr_struct *vmmngr_find(const char *vmname);
/* Per-vm vm managerment struct */
struct vmmngr_struct {
char name[MAX_VM_OS_NAME_LEN];
char name[MAX_VMNAME_LEN];
unsigned long state;
unsigned long state_tmp;
unsigned long update; /* update count, remove a vm if no update for it */

View File

@ -30,7 +30,7 @@
/* acrnd worker timer */
struct work_arg {
char name[MAX_VM_OS_NAME_LEN];
char name[MAX_VMNAME_LEN];
};
struct acrnd_work {
@ -360,7 +360,7 @@ static void handle_timer_req(struct mngr_msg *msg, int client_fd, void *param)
}
strncpy(arg.name, msg->data.acrnd_timer.name, sizeof(arg.name) - 1);
if (sizeof(arg.name) - 1 < strnlen(msg->data.acrnd_timer.name, MAX_VM_OS_NAME_LEN)) {
if (sizeof(arg.name) - 1 < strnlen(msg->data.acrnd_timer.name, MAX_VMNAME_LEN)) {
perror("timer name was truncated\n");
goto reply_ack;
}