Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
b4d9511a
Commit
b4d9511a
authored
Sep 23, 2024
by
Hejing Li
Browse files
minore fixes
parent
d9756de5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
experiments/simbricks/orchestration/system/host/app.py
experiments/simbricks/orchestration/system/host/app.py
+1
-1
experiments/simbricks/orchestration/system/host/base.py
experiments/simbricks/orchestration/system/host/base.py
+5
-6
No files found.
experiments/simbricks/orchestration/system/host/app.py
View file @
b4d9511a
...
@@ -45,7 +45,7 @@ class BaseLinuxApplication(abc.ABC):
...
@@ -45,7 +45,7 @@ class BaseLinuxApplication(abc.ABC):
@
abc
.
abstractmethod
@
abc
.
abstractmethod
def
run_cmds
(
self
,
env
:
expenv
.
ExpEnv
)
->
list
[
str
]:
def
run_cmds
(
self
,
env
:
expenv
.
ExpEnv
)
->
list
[
str
]:
"""Commands to run on node."""
"""Commands to run on node."""
pass
return
[]
def
cleanup_cmds
(
self
,
env
:
expenv
.
ExpEnv
)
->
list
[
str
]:
def
cleanup_cmds
(
self
,
env
:
expenv
.
ExpEnv
)
->
list
[
str
]:
"""Commands to run to cleanup node."""
"""Commands to run to cleanup node."""
...
...
experiments/simbricks/orchestration/system/host/base.py
View file @
b4d9511a
...
@@ -25,6 +25,7 @@ import io
...
@@ -25,6 +25,7 @@ import io
from
os
import
path
from
os
import
path
import
simbricks.orchestration.instantiation.base
as
instantiation
import
simbricks.orchestration.instantiation.base
as
instantiation
from
simbricks.orchestration.system
import
base
as
base
from
simbricks.orchestration.system
import
base
as
base
from
simbricks.orchestration.system
import
eth
as
eth
from
simbricks.orchestration.system.host
import
app
from
simbricks.orchestration.system.host
import
app
if
tp
.
TYPE_CHECKING
:
if
tp
.
TYPE_CHECKING
:
from
simbricks.orchestration.system
import
(
eth
,
mem
,
pcie
)
from
simbricks.orchestration.system
import
(
eth
,
mem
,
pcie
)
...
@@ -38,7 +39,7 @@ class Host(base.Component):
...
@@ -38,7 +39,7 @@ class Host(base.Component):
self
.
applications
:
list
[
app
.
Application
]
self
.
applications
:
list
[
app
.
Application
]
def
interfaces
(
self
)
->
list
[
base
.
Interface
]:
def
interfaces
(
self
)
->
list
[
base
.
Interface
]:
return
self
.
pcie_ifs
+
self
.
eth_ifs
+
self
.
mem_
ifs
return
self
.
ifs
def
add_if
(
self
,
interface
:
base
.
Interface
)
->
None
:
def
add_if
(
self
,
interface
:
base
.
Interface
)
->
None
:
self
.
ifs
.
append
(
interface
)
self
.
ifs
.
append
(
interface
)
...
@@ -124,7 +125,7 @@ class BaseLinuxHost(FullSystemHost):
...
@@ -124,7 +125,7 @@ class BaseLinuxHost(FullSystemHost):
es
=
self
.
prepare_pre_cp
(
inst
)
+
self
.
applications
[
0
].
prepare_pre_cp
(
inst
)
+
\
es
=
self
.
prepare_pre_cp
(
inst
)
+
self
.
applications
[
0
].
prepare_pre_cp
(
inst
)
+
\
cp_cmd
+
\
cp_cmd
+
\
self
.
prepare_post_cp
(
inst
)
+
self
.
applications
[
0
].
prepare_post_cp
(
inst
)
+
\
self
.
prepare_post_cp
(
inst
)
+
self
.
applications
[
0
].
prepare_post_cp
(
inst
)
+
\
self
.
run_cmds
()
+
self
.
cleanup_cmds
()
self
.
run_cmds
(
inst
)
+
self
.
cleanup_cmds
(
inst
)
return
'
\n
'
.
join
(
es
)
return
'
\n
'
.
join
(
es
)
def
strfile
(
self
,
s
:
str
)
->
io
.
BytesIO
:
def
strfile
(
self
,
s
:
str
)
->
io
.
BytesIO
:
...
@@ -166,9 +167,7 @@ class LinuxHost(BaseLinuxHost):
...
@@ -166,9 +167,7 @@ class LinuxHost(BaseLinuxHost):
eth_i
=
0
eth_i
=
0
for
i
in
self
.
interfaces
():
for
i
in
self
.
interfaces
():
# Get ifname parameter if set, otherwise default to ethX
# Get ifname parameter if set, otherwise default to ethX
if
'ifname'
in
i
.
parameters
:
if
isinstance
(
i
,
eth
.
EthSimpleNIC
):
ifn
=
i
.
parameters
[
'ifname'
]
elif
isinstance
(
i
,
eth
.
EthSimpleNIC
):
ifn
=
f
'eth
{
eth_i
}
'
ifn
=
f
'eth
{
eth_i
}
'
eth_i
+=
1
eth_i
+=
1
else
:
else
:
...
@@ -187,7 +186,7 @@ class LinuxHost(BaseLinuxHost):
...
@@ -187,7 +186,7 @@ class LinuxHost(BaseLinuxHost):
if
'ipv4_addrs'
in
i
.
parameters
:
if
'ipv4_addrs'
in
i
.
parameters
:
for
a
in
i
.
parameters
[
'ipv4_addrs'
]:
for
a
in
i
.
parameters
[
'ipv4_addrs'
]:
l
.
append
(
f
'ip addr add
{
a
}
dev
{
ifn
}
'
)
l
.
append
(
f
'ip addr add
{
a
}
dev
{
ifn
}
'
)
return
super
().
prepare_post_cp
()
+
l
return
super
().
prepare_post_cp
(
inst
)
+
l
class
I40ELinuxHost
(
LinuxHost
):
class
I40ELinuxHost
(
LinuxHost
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment