mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-05-08 00:17:01 +00:00
tools: acrn-manager: change path of vm conf files
The path of vm conf files changed from "/opt/acrn/conf" to "/usr/share/acrn/conf", since "/opt" is not generally used on clearlinux. Tracked-On: #2040 Signed-off-by: Yan, Like <like.yan@intel.com> Acked-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
parent
2f30dcdb37
commit
04fef4f363
@ -102,7 +102,7 @@ The ``acrnd`` daemon process provides a way for launching or resuming a UOS
|
||||
should the UOS shut down, either planned or unexpected. A UOS can ask ``acrnd``
|
||||
to set up a timer to make sure the UOS is running, even if the SOS is
|
||||
suspended or stopped.
|
||||
The ``acrnd`` daemon stores pending UOS work to ``/opt/acrn/conf/timer_list``
|
||||
The ``acrnd`` daemon stores pending UOS work to ``/usr/share/acrn/conf/timer_list``
|
||||
and sets an RTC timer to wake up the SOS or bring the SOS back up again.
|
||||
When ``acrnd`` daemon is restarted, it restores the previously saved timer
|
||||
list and launches the UOSs at the right time.
|
||||
|
@ -128,13 +128,13 @@ static void _scan_alive_vm(void)
|
||||
int pid;
|
||||
int ret;
|
||||
|
||||
ret = check_dir(ACRN_DM_SOCK_ROOT);
|
||||
ret = check_dir(ACRN_DM_SOCK_PATH);
|
||||
if (ret) {
|
||||
pdebug();
|
||||
return;
|
||||
}
|
||||
|
||||
dir = opendir(ACRN_DM_SOCK_ROOT);
|
||||
dir = opendir(ACRN_DM_SOCK_PATH);
|
||||
if (!dir) {
|
||||
pdebug();
|
||||
return;
|
||||
@ -223,22 +223,19 @@ static void _scan_added_vm(void)
|
||||
char suffix[128];
|
||||
int ret;
|
||||
|
||||
if (check_dir("/opt") || check_dir("/opt/acrn"))
|
||||
return;
|
||||
|
||||
ret = check_dir(ACRNCTL_OPT_ROOT);
|
||||
ret = check_dir(ACRN_CONF_PATH);
|
||||
if (ret) {
|
||||
pdebug();
|
||||
return;
|
||||
}
|
||||
|
||||
ret = check_dir("/opt/acrn/conf/add");
|
||||
ret = check_dir(ACRN_CONF_PATH_ADD);
|
||||
if (ret) {
|
||||
pdebug();
|
||||
return;
|
||||
}
|
||||
|
||||
dir = opendir("/opt/acrn/conf/add");
|
||||
dir = opendir(ACRN_CONF_PATH_ADD);
|
||||
if (!dir) {
|
||||
pdebug();
|
||||
return;
|
||||
@ -374,8 +371,8 @@ int start_vm(const char *vmname)
|
||||
{
|
||||
char cmd[128];
|
||||
|
||||
if (snprintf(cmd, sizeof(cmd), "bash %s/add/%s.sh $(cat %s/add/%s.args)",
|
||||
ACRNCTL_OPT_ROOT, vmname, ACRNCTL_OPT_ROOT, vmname) >= sizeof(cmd)) {
|
||||
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)) {
|
||||
printf("ERROR: command is truncated\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -23,8 +23,6 @@
|
||||
#include "acrnctl.h"
|
||||
#include "ioc.h"
|
||||
|
||||
#define ACRNCTL_OPT_ROOT "/opt/acrn/conf"
|
||||
|
||||
#define ACMD(CMD,FUNC,DESC, VALID_ARGS) \
|
||||
{.cmd = CMD, .func = FUNC, .desc = DESC, .valid_args = VALID_ARGS}
|
||||
|
||||
@ -330,7 +328,7 @@ static int acrnctl_do_add(int argc, char *argv[])
|
||||
goto get_vmname;
|
||||
}
|
||||
|
||||
if (snprintf(cmd, sizeof(cmd), "mkdir -p %s/add", ACRNCTL_OPT_ROOT)
|
||||
if (snprintf(cmd, sizeof(cmd), "mkdir -p %s", ACRN_CONF_PATH_ADD)
|
||||
>= sizeof(cmd)) {
|
||||
printf("ERROR: cmd is truncated\n");
|
||||
ret = -1;
|
||||
@ -346,16 +344,16 @@ static int acrnctl_do_add(int argc, char *argv[])
|
||||
goto vm_exist;
|
||||
}
|
||||
|
||||
if (snprintf(cmd, sizeof(cmd), "cp %s.back %s/add/%s.sh", argv[1],
|
||||
ACRNCTL_OPT_ROOT, vmname) >= sizeof(cmd)) {
|
||||
if (snprintf(cmd, sizeof(cmd), "cp %s.back %s/%s.sh", argv[1],
|
||||
ACRN_CONF_PATH_ADD, vmname) >= sizeof(cmd)) {
|
||||
printf("ERROR: cmd is truncated\n");
|
||||
ret = -1;
|
||||
goto vm_exist;
|
||||
}
|
||||
system(cmd);
|
||||
|
||||
if (snprintf(cmd, sizeof(cmd), "echo %s >%s/add/%s.args", args,
|
||||
ACRNCTL_OPT_ROOT, vmname) >= sizeof(cmd)) {
|
||||
if (snprintf(cmd, sizeof(cmd), "echo %s >%s/%s.args", args,
|
||||
ACRN_CONF_PATH_ADD, vmname) >= sizeof(cmd)) {
|
||||
printf("ERROR: cmd is truncated\n");
|
||||
ret = -1;
|
||||
goto vm_exist;
|
||||
@ -438,14 +436,14 @@ static int acrnctl_do_del(int argc, char *argv[])
|
||||
state_str[s->state]);
|
||||
continue;
|
||||
}
|
||||
if (snprintf(cmd, sizeof(cmd), "rm -f %s/add/%s.sh",
|
||||
ACRNCTL_OPT_ROOT, argv[i]) >= sizeof(cmd)) {
|
||||
if (snprintf(cmd, sizeof(cmd), "rm -f %s/%s.sh",
|
||||
ACRN_CONF_PATH_ADD, argv[i]) >= sizeof(cmd)) {
|
||||
printf("WARN: cmd is truncated\n");
|
||||
return -1;
|
||||
}
|
||||
system(cmd);
|
||||
if (snprintf(cmd, sizeof(cmd), "rm -f %s/add/%s.args",
|
||||
ACRNCTL_OPT_ROOT, argv[i]) >= sizeof(cmd)) {
|
||||
if (snprintf(cmd, sizeof(cmd), "rm -f %s/%s.args",
|
||||
ACRN_CONF_PATH_ADD, argv[i]) >= sizeof(cmd)) {
|
||||
printf("WARN: cmd is truncated\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -8,8 +8,11 @@
|
||||
|
||||
#include <sys/queue.h>
|
||||
|
||||
#define ACRNCTL_OPT_ROOT "/opt/acrn/conf"
|
||||
#define ACRN_DM_SOCK_ROOT "/run/acrn/mngr"
|
||||
#define ACRN_CONF_PATH "/usr/share/acrn/conf"
|
||||
#define ACRN_CONF_PATH_ADD ACRN_CONF_PATH "/add"
|
||||
#define ACRN_CONF_TIMER_LIST ACRN_CONF_PATH "/timer_list"
|
||||
|
||||
#define ACRN_DM_SOCK_PATH "/run/acrn/mngr"
|
||||
|
||||
#define MAX_NAME_LEN (32)
|
||||
|
||||
|
@ -143,7 +143,6 @@ void acrnd_vm_timer_func(struct work_arg *arg)
|
||||
}
|
||||
}
|
||||
|
||||
#define TIMER_LIST_FILE "/opt/acrn/conf/timer_list"
|
||||
static pthread_mutex_t timer_file_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/* load/store_timer_list to file to keep timers if SOS poweroff */
|
||||
@ -157,7 +156,7 @@ static int load_timer_list(void)
|
||||
|
||||
pthread_mutex_lock(&timer_file_mutex);
|
||||
|
||||
fp = fopen(TIMER_LIST_FILE, "r");
|
||||
fp = fopen(ACRN_CONF_TIMER_LIST, "r");
|
||||
if (!fp) {
|
||||
perror("Open timer list file");
|
||||
ret = -1;
|
||||
@ -402,7 +401,7 @@ static int store_timer_list(void)
|
||||
int ret = 0;
|
||||
|
||||
pthread_mutex_lock(&timer_file_mutex);
|
||||
fp = fopen(TIMER_LIST_FILE, "w+");
|
||||
fp = fopen(ACRN_CONF_TIMER_LIST, "w+");
|
||||
if (!fp) {
|
||||
perror("Open timer list file");
|
||||
ret = -1;
|
||||
@ -429,7 +428,7 @@ static int store_timer_list(void)
|
||||
if (sys_wakeup) {
|
||||
set_sos_timer(sys_wakeup);
|
||||
} else {
|
||||
unlink(TIMER_LIST_FILE);
|
||||
unlink(ACRN_CONF_TIMER_LIST);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
@ -584,7 +583,7 @@ void handle_acrnd_resume(struct mngr_msg *msg, int client_fd, void *param)
|
||||
|
||||
if (wakeup_reason & CBC_WK_RSN_RTC) {
|
||||
/* wakeup by RTC timer */
|
||||
if (!stat(TIMER_LIST_FILE, &st)
|
||||
if (!stat(ACRN_CONF_TIMER_LIST, &st)
|
||||
&& S_ISREG(st.st_mode)) {
|
||||
ack.data.err = load_timer_list();
|
||||
if (ack.data.err == 0) {
|
||||
@ -602,7 +601,7 @@ void handle_acrnd_resume(struct mngr_msg *msg, int client_fd, void *param)
|
||||
}
|
||||
|
||||
reply_ack:
|
||||
unlink(TIMER_LIST_FILE);
|
||||
unlink(ACRN_CONF_TIMER_LIST);
|
||||
|
||||
if (client_fd > 0)
|
||||
mngr_send_msg(client_fd, &ack, NULL, 0);
|
||||
@ -677,7 +676,7 @@ int main(int argc, char *argv[])
|
||||
return -1;
|
||||
}
|
||||
|
||||
unlink(TIMER_LIST_FILE);
|
||||
unlink(ACRN_CONF_TIMER_LIST);
|
||||
|
||||
atexit(handle_on_exit);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user