Skip to content
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

Merged
merged 2 commits into from
May 3, 2024
Merged

Streamline command line interface #74

merged 2 commits into from
May 3, 2024

Conversation

Deedone
Copy link
Contributor

@Deedone Deedone commented Apr 24, 2024

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.

@Deedone
Copy link
Contributor Author

Deedone commented Apr 24, 2024

Depends on xen-troops/zephyr#95

Copy link

@GrygiriiS GrygiriiS left a 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);

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?

Copy link
Contributor Author

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

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>]

Copy link
Contributor Author

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.

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.

LOG_ERR("Invalid domid passed to create cmd");
return -EINVAL;
if (argc > 2) {
shell_print(shell, "%s %d\n", __func__, __LINE__);

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",

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.

Copy link
Collaborator

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

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);
Copy link
Collaborator

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.

Copy link
Contributor Author

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",
Copy link
Collaborator

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

@Deedone
Copy link
Contributor Author

Deedone commented Apr 25, 2024

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.

@lorc Maybe we should create a separate issue or milestone regarding documentation and do it all at once?

@firscity
Copy link
Collaborator

@Deedone @GrygiriiS
Regarding documentation - such issue is already created for zephyr-xenlib #70.

@GrygiriiS
Copy link

@Deedone @GrygiriiS Regarding documentation - such issue is already created for zephyr-xenlib #70.

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.
It just few dozen lines of text, so in my opinion reasonable.

So as usual NACK without docs.

Copy link
Collaborator

@firscity firscity left a 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]>

Deedone added 2 commits April 30, 2024 12:53
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]>
@lorc
Copy link
Collaborator

lorc commented May 1, 2024

@GrygiriiS, would #76 satisfy your requirement?

@GrygiriiS
Copy link

@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.

@firscity firscity merged commit 8d48b7b into xen-troops:main May 3, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rework command line interface
4 participants