-
Notifications
You must be signed in to change notification settings - Fork 352
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
svc 3par vnx controller add cpu count #940
Conversation
vnx block add cpu count
hpe 3par and vnx block add cpu count
svc add controller cpu count
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #940 +/- ##
==========================================
- Coverage 71.36% 71.33% -0.03%
==========================================
Files 187 187
Lines 23067 23079 +12
Branches 3508 3510 +2
==========================================
+ Hits 16462 16464 +2
- Misses 5490 5495 +5
- Partials 1115 1120 +5
|
@@ -306,18 +306,20 @@ def list_controllers(self, storage_id): | |||
memory_size = int(controller.get('memory_size_for_the_sp', | |||
'0')) * units.Mi | |||
cpu_info = '' | |||
cpu_count = None | |||
if cpus: | |||
cpu_info = cpus.get( | |||
controller.get('serial_number_for_the_sp', ''), '') |
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.
When cpus.get()
returns an empty string, cpu_info is an empty string, so cpu_count should be None.
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.
modified
if 'Cores' in titles: | ||
node_id = str_info[0] | ||
cpu_info = ' '.join(str_info[5:]) | ||
if obj_map.get(node_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.
It's recommended to use dict.setdefault()
instead of if ... else ...
.
cpu_map = obj_map.setdefault(node_id, {})
cpu_map[cpu_info] = int(str_info[2])
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.
modified
else: | ||
cpu_info_map = {} | ||
cpu_info_map[cpu_info] = 1 | ||
obj_map[node_id] = cpu_info_map |
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's recommended to type like obj_map[node_id] = {cpu_info: 1}
.
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.
modified
add fujitsu cpu_count
@@ -306,18 +306,21 @@ def list_controllers(self, storage_id): | |||
memory_size = int(controller.get('memory_size_for_the_sp', | |||
'0')) * units.Mi | |||
cpu_info = '' | |||
cpu_count = 1 |
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.
When if cpus
in the next line returns False, cpu_count
should be None.
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.
modified
obj_map[node_id] = cpu_info_map | ||
node_id = str_info[0] | ||
cpu_info = str_info[4] | ||
if obj_map.get(node_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.
We should always try to avoid using if ... esle ...
, it's recommended to develop like:
cpu_map = obj_map.get(node_id, {})
cpu_map[cpu_info] = cpu_map.get(cpu_info, 0) + 1
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.
modified
update MSA CPU number to default value
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.
LGTM
Another PR with same commits #960 is merged. |
What this PR does / why we need it:
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
Release note: