mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-25 15:02:13 +00:00
acrn_manager: create acrnctl configuration folder when starting
The creation of the acrn_manager ('acrnctl') configuration folder is currently done when adding a new VM to the system. This leads to an error (non-fatal) thrown on the terminal is calling, say 'list' first without having added a VM yet. This patch moves the creation of such folder as part of main() thereby ensuring it is created as soon as the program starts. Tracked-On: #4898 Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
This commit is contained in:
parent
ffd13a2fe1
commit
ac091bacba
@ -346,14 +346,6 @@ static int acrnctl_do_add(int argc, char *argv[])
|
|||||||
goto get_vmname;
|
goto get_vmname;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (snprintf(cmd, sizeof(cmd), "mkdir -p %s", ACRN_CONF_PATH_ADD)
|
|
||||||
>= sizeof(cmd)) {
|
|
||||||
printf("ERROR: cmd is truncated\n");
|
|
||||||
ret = -1;
|
|
||||||
goto get_vmname;
|
|
||||||
}
|
|
||||||
system(cmd);
|
|
||||||
|
|
||||||
s = vmmngr_find(vmname);
|
s = vmmngr_find(vmname);
|
||||||
if (s) {
|
if (s) {
|
||||||
printf("%s(%s) already exist, can't add %s%s\n",
|
printf("%s(%s) already exist, can't add %s%s\n",
|
||||||
@ -765,6 +757,7 @@ static void usage(void)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, err;
|
int i, err;
|
||||||
|
char cmd[PATH_LEN];
|
||||||
|
|
||||||
if (argc == 1 || !strcmp(argv[1], "help")) {
|
if (argc == 1 || !strcmp(argv[1], "help")) {
|
||||||
usage();
|
usage();
|
||||||
@ -778,6 +771,14 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
acrnctl_bin_path = argv[0];
|
acrnctl_bin_path = argv[0];
|
||||||
|
|
||||||
|
/* Create the acrnctl conf folder if it does not exist yet */
|
||||||
|
if (snprintf(cmd, sizeof(cmd), "mkdir -p %s", ACRN_CONF_PATH_ADD)
|
||||||
|
>= sizeof(cmd)) {
|
||||||
|
printf("ERROR: cmd is truncated\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
system(cmd);
|
||||||
|
|
||||||
/* first check acrnctl reserved operations */
|
/* first check acrnctl reserved operations */
|
||||||
if (!strcmp(argv[1], "gentmpfile")) {
|
if (!strcmp(argv[1], "gentmpfile")) {
|
||||||
printf("\nacrnctl: %s\n", argv[argc - 1]);
|
printf("\nacrnctl: %s\n", argv[argc - 1]);
|
||||||
|
Loading…
Reference in New Issue
Block a user