Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cci-tools
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Harbor Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cloud-infrastructure
cci-tools
Merge requests
!421
Update assign_resource_class_ironic.py
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Update assign_resource_class_ironic.py
OS-17717_add_rack
into
master
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Maryna Savchenko
requested to merge
OS-17717_add_rack
into
master
7 months ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
Closes
OS-17717
0
0
Merge request reports
Viewing commit
26a17def
Show latest version
1 file
+
9
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
26a17def
Update assign_resource_class_ironic.py
· 26a17def
Maryna Savchenko
authored
7 months ago
ccitools/cmd/assign_resource_class_ironic.py
+
9
−
2
Options
@@ -22,6 +22,9 @@ class AssignResourceClassIronic(BaseCloudCMD):
self
.
parser
.
add_argument
(
"
--flavor_prefix
"
,
default
=
"
p1
"
,
help
=
"
Flavor prefix, p1 for physical, s1 for the storage.
"
)
self
.
parser
.
add_argument
(
"
--add_rack
"
,
default
=
False
,
action
=
'
store_true
'
,
help
=
"
If set to True, rack location will be added in the RC.
"
)
def
main
(
self
,
args
=
None
):
"""
Parse node
'
s name and generate resource class.
"""
@@ -40,11 +43,15 @@ class AssignResourceClassIronic(BaseCloudCMD):
node_ip
=
socket
.
gethostbyname
(
node
)
device
=
self
.
landb
.
device_info
(
self
.
landb
.
device_search
(
ip_addr
=
node_ip
)[
0
])
rack_location
=
''
if
args
.
add_rack
:
rack_location
=
device
.
Zone
+
'
_
'
for
interface
in
device
.
Interfaces
:
if
interface
.
Name
==
device
.
DeviceName
+
'
.CERN.CH
'
:
svc_name
=
interface
.
ServiceName
.
replace
(
'
-
'
,
'
_
'
)
resource_class
=
'
BAREMETAL_{}_{}_{}
'
.
format
(
args
.
flavor_prefix
.
upper
(),
delivery
.
upper
(),
svc_name
)
resource_class
=
'
BAREMETAL_{}_{}_{}{}
'
.
format
(
args
.
flavor_prefix
.
upper
(),
delivery
.
upper
(),
rack_location
,
svc_name
)
ironic_command
=
"
openstack baremetal node set {}
"
\
"
--resource-class {}
"
print
(
ironic_command
.
format
(
node
,
resource_class
))
Loading