Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
g1-g2-ostack-cloud-migration
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
g1-g2-ostack-cloud-migration
Commits
185f2e43
Commit
185f2e43
authored
9 months ago
by
František Řezníček
Browse files
Options
Downloads
Patches
Plain Diff
feat: Detect and assign same MAC address as in source cloud
parent
6bf955bd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!7
feat: Detect and assign same MAC address as in source cloud
Pipeline
#451537
passed with stage
in 29 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ci/olib.py
+17
-3
17 additions, 3 deletions
ci/olib.py
ci/project-migrator.py
+2
-1
2 additions, 1 deletion
ci/project-migrator.py
with
19 additions
and
4 deletions
ci/olib.py
+
17
−
3
View file @
185f2e43
"""
OpenStack migrator - OpenStack library
"""
import
copy
import
inspect
import
math
import
os.path
...
...
@@ -508,22 +509,35 @@ def describe_server_network_connection(args, dst_ostack_conn, netaddr_dict):
# netaddr_dict{ 'dst-network': Network,
# 'src-network-addresses': {'network-name': <source-network-name>,
# 'addresses': [ ... ]} }
func_name
=
inspect
.
currentframe
().
f_code
.
co_name
msg_suffix
=
"
Carefully check whether migrated VM is accessible and can communicate with outside world.
"
fixed_port
=
None
dst_network
=
netaddr_dict
[
'
dst-network
'
]
source_server_fixed_addresses
=
[
i_addr
[
'
addr
'
]
for
i_addr
in
netaddr_dict
[
'
src-network-addresses
'
][
'
addresses
'
]
if
i_addr
.
get
(
'
OS-EXT-IPS:type
'
)
==
'
fixed
'
]
source_server_mac_addresses
=
[
i_addr
.
get
(
'
OS-EXT-IPS-MAC:mac_addr
'
,
None
)
for
i_addr
in
netaddr_dict
[
'
src-network-addresses
'
][
'
addresses
'
]
if
i_addr
.
get
(
'
OS-EXT-IPS:type
'
)
==
'
fixed
'
]
if
len
(
source_server_fixed_addresses
)
==
1
and
len
(
dst_network
.
subnet_ids
)
==
1
:
if
source_server_fixed_addresses
[
0
]
and
source_server_mac_addresses
[
0
]
is
None
:
args
.
logger
.
warning
(
f
"
{
func_name
}
() MAC address detection failed!
"
\
f
"
Migrated VM will have same internal IP address, but different MAC address.
{
msg_suffix
}
"
)
try
:
port_desc
=
"
A part of workload migration: created to get same server fixed-ips
"
port_desc
=
"
A part of workload migration: created to get same server fixed-ip
/ MAC addresse
s
"
fixed_port
=
dst_ostack_conn
.
network
.
create_port
(
name
=
get_dst_resource_name
(
args
),
description
=
port_desc
,
network_id
=
dst_network
.
id
,
mac_address
=
source_server_mac_addresses
[
0
],
fixed_ips
=
[{
"
ip_address
"
:
source_server_fixed_addresses
[
0
],
"
subnet_id
"
:
dst_network
.
subnet_ids
[
0
]}])
except
:
pass
except
Exception
as
ex
:
args
.
logger
.
error
(
f
"
{
func_name
}
() throws exception while creating an ostack port.
"
,
exc_info
=
True
)
else
:
args
.
logger
.
warning
(
f
"
{
func_name
}
() detected multiple ports which is NOT implemented yet!
"
\
f
"
Migrated VM will not have same internal IP address / MAC address.
{
msg_suffix
}
"
)
if
fixed_port
:
return
{
'
port
'
:
fixed_port
.
id
}
args
.
logger
.
warning
(
f
"
{
func_name
}
() Creation of dedicated network port failed!
"
\
f
"
Migrated VM will not have same internal IP address / MAC address.
{
msg_suffix
}
"
)
return
{
'
uuid
'
:
dst_network
.
id
}
...
...
This diff is collapsed.
Click to expand it.
ci/project-migrator.py
+
2
−
1
View file @
185f2e43
...
...
@@ -245,6 +245,7 @@ def main(args):
args
.
logger
.
info
(
f
"
F.42 Source OpenStack VM server (name:
{
i_source_server_detail
.
name
}
) became ACTIVE already.
"
)
# EXPLICIT OpenStack volume migration
# ---------------------------------------------------------------------------------------------
if
args
.
explicit_volume_names
:
for
i_source_volume_name
in
args
.
explicit_volume_names
:
i_source_volume
=
source_project_conn
.
block_storage
.
find_volume
(
i_source_volume_name
)
...
...
@@ -279,7 +280,7 @@ def main(args):
# main() call (argument parsing)
# ---------------------------------------------------------------------------
# ---------------------------------------------------------------------------
----------------------
if
__name__
==
"
__main__
"
:
AP
=
argparse
.
ArgumentParser
(
epilog
=
globals
().
get
(
'
__doc__
'
),
formatter_class
=
argparse
.
RawDescriptionHelpFormatter
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment