-
Notifications
You must be signed in to change notification settings - Fork 2
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
Make it possible to list all hosts of an aggregate #1116
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,12 @@ def get_parser(self, prog_name): | |
type=str, | ||
help="Filter by domain ID", | ||
) | ||
parser.add_argument( | ||
"--aggregate", | ||
default=None, | ||
type=str, | ||
help="Filter by aggregate", | ||
) | ||
parser.add_argument( | ||
"host", | ||
nargs="?", | ||
|
@@ -110,6 +116,7 @@ def take_action(self, parsed_args): | |
conn = get_cloud_connection() | ||
domain = parsed_args.domain | ||
project = parsed_args.project | ||
aggregate = parsed_args.aggregate | ||
|
||
result = [] | ||
if host: | ||
Comment on lines
116
to
122
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The method Recommendation:
Comment on lines
116
to
122
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Recommendation:
Comment on lines
116
to
122
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current implementation in lines [116-122] does not handle potential exceptions that might arise from network issues or API errors when interacting with the cloud services. This could lead to unhandled exceptions and application crashes. Recommendation:
Comment on lines
116
to
122
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The filtering logic in lines [116-122] does not account for the possibility that both Recommendation:
Comment on lines
116
to
122
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Recommendation:
|
||
|
@@ -132,6 +139,10 @@ def take_action(self, parsed_args): | |
) | ||
|
||
else: | ||
hypervisors = conn.compute.hypervisors() | ||
for hypervisor in conn.compute.hypervisors(details=True): | ||
print(hypervisor) | ||
|
||
for service in conn.compute.services(**{"binary": "nova-compute"}): | ||
result.append( | ||
[ | ||
Comment on lines
139
to
148
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In lines [139-148], the method prints details of hypervisors and compute services. However, the loop in lines [143-145] that prints each hypervisor detail is inefficient as it makes a redundant API call to Recommendation:
|
||
|
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.
The method
get_parser
in theComputeList
class defines several command-line arguments for filtering compute resources. While the implementation is straightforward, it lacks explicit validation or sanitization of the input parameters such asproject
,domain
,aggregate
, andhost
. This could potentially lead to issues if malformed or unexpected inputs are provided.Recommendation: