Skip to content

Commit

Permalink
xen-shell-cmd: add optional paramenters for pausing domain on creation
Browse files Browse the repository at this point in the history
Previously f_paused flag was introduced to domain configuration struct.
Add optional parameter for "xu create" command to left created domain
paused after creation.

Signed-off-by: Dmytro Firsov <[email protected]>
  • Loading branch information
firscity committed May 14, 2024
1 parent f41f2a0 commit 36de39d
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions xen-shell-cmd/src/xen_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ uint32_t parse_domid(size_t argc, char **argv)
return 0;
}

void parse_and_fill_flags(size_t argc, char **argv, struct xen_domain_cfg *cfg)
{
int i;

for (i = 0; i < argc; i++) {
/* check if domain should remain paused after creation */
if (argv[i][0] == '-' && argv[i][1] == 'p') {
cfg->f_paused = 1;
}
}
}

static int domu_create(const struct shell *shell, int argc, char **argv)
{
int ret;
Expand All @@ -57,6 +69,8 @@ static int domu_create(const struct shell *shell, int argc, char **argv)
return -EINVAL;
}

parse_and_fill_flags(argc, argv, cfg);

ret = domain_create(cfg, domid);
if (ret < 0) {
return ret; /* domain_create should care about error logs */
Expand Down Expand Up @@ -165,8 +179,8 @@ SHELL_STATIC_SUBCMD_SET_CREATE(
subcmd_xu,
SHELL_CMD_ARG(create, NULL,
" Create Xen domain\n"
" Usage: create cfg_name [-d <domid>]\n",
domu_create, 2, 2),
" Usage: create cfg_name [-d <domid>] [-p]\n",
domu_create, 2, 3),
SHELL_CMD_ARG(destroy, NULL,
" Destroy Xen domain\n"
" Usage: destroy <domid>\n",
Expand Down

0 comments on commit 36de39d

Please sign in to comment.