-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streamline command line interface #74
Conversation
Depends on xen-troops/zephyr#95 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Over all code looks good, but there is no README >:(
Please add README with at least one section describing domain control cmd_line interface and how it can be enabled.
return -EINVAL; | ||
if (argc > 2) { | ||
shell_print(shell, "%s %d\n", __func__, __LINE__); | ||
domid = parse_domid(argc, argv); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it really required to keep backward compatibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left the function to make the code more readable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You changed all other cmd to be strict "xu <domain_id>", the diff for create
cmd is that domain_id
is optional. but why you left here "-d"? I think you can drop "-d", so "create" command will look the same as all other:
xu create [<domain_id>]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flags are commonly used for passing optional arguments in most terminal programs. They also help to remove confusion when there is more than one optional argument and I am almost sure that we will have more args in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. with possibility to have more options agree.
xen-shell-cmd/src/xen_cmds.c
Outdated
LOG_ERR("Invalid domid passed to create cmd"); | ||
return -EINVAL; | ||
if (argc > 2) { | ||
shell_print(shell, "%s %d\n", __func__, __LINE__); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strange print
return domain_unpause(domid); | ||
} | ||
|
||
SHELL_STATIC_SUBCMD_SET_CREATE( | ||
subcmd_xu, | ||
SHELL_CMD_ARG(create, NULL, | ||
" Create Xen domain\n" | ||
" Usage: create -d <domid>\n", | ||
domu_create, 3, 0), | ||
" Usage: create [-d <domid>]\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why "-d" is kept here? it has been removed for all other commands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe, it is because this is an optional parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
closed
@@ -632,7 +632,7 @@ int domain_create(struct xen_domain_cfg *domcfg, uint32_t domid) | |||
memset(&config, 0, sizeof(config)); | |||
prepare_domain_cfg(domcfg, &config); | |||
config.grant_opts = XEN_DOMCTL_GRANT_version(1); | |||
rc = xen_domctl_createdomain(domid, &config); | |||
rc = xen_domctl_createdomain(&domid, &config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Erm, should you make corresponding change to xen_domctl_createdomain
definition? I can't it in this commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is in the PR to a zephyr repo linked above
return domain_unpause(domid); | ||
} | ||
|
||
SHELL_STATIC_SUBCMD_SET_CREATE( | ||
subcmd_xu, | ||
SHELL_CMD_ARG(create, NULL, | ||
" Create Xen domain\n" | ||
" Usage: create -d <domid>\n", | ||
domu_create, 3, 0), | ||
" Usage: create [-d <domid>]\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe, it is because this is an optional parameter
@lorc Maybe we should create a separate issue or milestone regarding documentation and do it all at once? |
@Deedone @GrygiriiS |
My doc request here is not related to API, but to user level documentation (README), where I request to have two section related to this PR: 1 is how to enable domain ctrl shell interface and 2 is domain ctrl commands description. So as usual NACK without docs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acked-by: Dmytro Firsov <[email protected]>
If we pass domid 0 to the create_domain domctl, it will be replaced with the next available domain id by Xen. We need to get this id back to further manipulate the domain. Signed-off-by: Mykyta Poturai <[email protected]> Acked-by: Dmytro Firsov <[email protected]>
Bring command line interface of xu util to a more common form. Make mandatory arguments positional and allow optional arguments. Implement automatic domid selection for new domains if not provided. Simplify console command name. Signed-off-by: Mykyta Poturai <[email protected]> Acked-by: Dmytro Firsov <[email protected]>
@GrygiriiS, would #76 satisfy your requirement? |
Actually no, as SHELL CMD interface is not documented in readme, Hence, documentation is moved forward, thanks to @Deedone. I have no objection to this PR any more. |
Fixes #69
Bring command line interface of xu util to a more common form.
Make mandatory arguments positional and allow optional arguments.
Implement automatic domid selection for new domains if not provided.
Simplify console command name.