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
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
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
1f366f9d
Commit
1f366f9d
authored
11 months ago
by
František Řezníček
Browse files
Options
Downloads
Patches
Plain Diff
feat/refactor: source and destination entity names now match except security...
parent
fc188f11
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!14
feat/refactor: source and destination entity names now match except security...
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.md
+4
-0
4 additions, 0 deletions
CHANGELOG.md
ci/lib.py
+4
-0
4 additions, 0 deletions
ci/lib.py
ci/olib.py
+5
-5
5 additions, 5 deletions
ci/olib.py
ci/project-migrator.py
+4
-2
4 additions, 2 deletions
ci/project-migrator.py
with
17 additions
and
7 deletions
CHANGELOG.md
+
4
−
0
View file @
1f366f9d
...
...
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [1.2.0] - 2024-06-11
### Changed
-
source and destination entity names now match except security groups where prefix migrated- is kept
## [1.1.3] - 2024-05-31
### Fixed
-
assert disabled projects
...
...
This diff is collapsed.
Click to expand it.
ci/lib.py
+
4
−
0
View file @
1f366f9d
...
...
@@ -88,6 +88,10 @@ def normalize_table_data(data):
int_list
.
append
(
normalize_table_data_field
(
i_data_field
[
'
field
'
]))
return
int_list
def
get_dst_secgroup_name
(
args
,
name
=
""
):
"""
translate original secgroup name to destination one
"""
return
f
"
{
args
.
destination_secgroup_name_prefix
}{
name
}
"
def
get_dst_resource_name
(
args
,
name
=
""
):
"""
translate original name to destination one
"""
return
f
"
{
args
.
destination_entity_name_prefix
}{
name
}
"
...
...
This diff is collapsed.
Click to expand it.
ci/olib.py
+
5
−
5
View file @
1f366f9d
...
...
@@ -10,7 +10,7 @@ import xmltodict
import
openstack
import
clib
from
lib
import
log_or_assert
,
get_dst_resource_name
,
get_dst_resource_desc
,
remote_cmd_exec
,
normalize_table_data
,
trim_dict
,
wait_for_ostack_volume_status
from
lib
import
log_or_assert
,
get_dst_resource_name
,
get_dst_secgroup_name
,
get_dst_resource_desc
,
remote_cmd_exec
,
normalize_table_data
,
trim_dict
,
wait_for_ostack_volume_status
def
get_destination_network
(
source_network
):
"""
LUT for networks
"""
...
...
@@ -367,7 +367,7 @@ def get_or_create_dst_server_keypair(args, source_keypairs, src_server, dst_osta
def
create_security_groups
(
args
,
src_ostack_conn
,
dst_ostack_conn
,
src_security_group
,
dst_project
,
recursion_stack
=
None
):
"""
create openstack security group[s]
"""
int_recursion_stack
=
{}
if
recursion_stack
is
None
else
recursion_stack
int_sg
=
dst_ostack_conn
.
network
.
create_security_group
(
name
=
get_dst_
resource
_name
(
args
,
src_security_group
.
name
),
int_sg
=
dst_ostack_conn
.
network
.
create_security_group
(
name
=
get_dst_
secgroup
_name
(
args
,
src_security_group
.
name
),
description
=
get_dst_resource_desc
(
args
,
src_security_group
.
description
,
src_security_group
.
id
),
...
...
@@ -386,7 +386,7 @@ def create_security_groups(args, src_ostack_conn, dst_ostack_conn, src_security_
i_mod_rule
[
'
remote_group_id
'
]
=
int_recursion_stack
[
i_mod_rule
[
'
remote_group_id
'
]]
# get linked source SG
elif
_src_sg
:
=
src_ostack_conn
.
network
.
find_security_group
(
i_mod_rule
[
'
remote_group_id
'
]):
if
_dst_sg
:
=
dst_ostack_conn
.
network
.
find_security_group
(
get_dst_
resource
_name
(
args
,
_src_sg
.
name
),
if
_dst_sg
:
=
dst_ostack_conn
.
network
.
find_security_group
(
get_dst_
secgroup
_name
(
args
,
_src_sg
.
name
),
project_id
=
dst_project
.
id
):
i_mod_rule
[
'
remote_group_id
'
]
=
_dst_sg
.
id
else
:
...
...
@@ -409,7 +409,7 @@ def duplicate_ostack_project_security_groups(args, src_ostack_conn, dst_ostack_c
for
i_src_security_group
in
src_project_security_groups
:
j_dst_security_group_found
=
False
for
j_dst_security_group
in
tuple
(
dst_ostack_conn
.
network
.
security_groups
(
project_id
=
dst_project
.
id
)):
if
get_dst_
resource
_name
(
args
,
i_src_security_group
.
name
)
==
j_dst_security_group
.
name
and
\
if
get_dst_
secgroup
_name
(
args
,
i_src_security_group
.
name
)
==
j_dst_security_group
.
name
and
\
i_src_security_group
.
id
in
j_dst_security_group
.
description
:
j_dst_security_group_found
=
True
if
not
j_dst_security_group_found
:
...
...
@@ -425,7 +425,7 @@ def get_or_create_dst_server_security_groups(args, src_ostack_conn, dst_ostack_c
i_src_server_security_group
=
src_ostack_conn
.
network
.
find_security_group
(
i_src_server_security_group_name
,
project_id
=
src_project
.
id
)
i_dst_server_security_group
=
None
if
i_dst_server_security_group
:
=
dst_ostack_conn
.
network
.
find_security_group
(
get_dst_
resource
_name
(
args
,
if
i_dst_server_security_group
:
=
dst_ostack_conn
.
network
.
find_security_group
(
get_dst_
secgroup
_name
(
args
,
i_src_server_security_group
.
name
),
project_id
=
dst_project
.
id
):
log_or_assert
(
args
,
...
...
This diff is collapsed.
Click to expand it.
ci/project-migrator.py
+
4
−
2
View file @
1f366f9d
...
...
@@ -336,8 +336,10 @@ if __name__ == "__main__":
help
=
'
Destination cloud bootable volumes are made on top of public image. Name of destination cloud image.
'
)
AP
.
add_argument
(
'
--destination-ipv4-external-network
'
,
default
=
'
external-ipv4-general-public
'
,
help
=
'
Destination cloud IPV4 external network.
'
)
AP
.
add_argument
(
'
--destination-entity-name-prefix
'
,
default
=
'
migrated-
'
,
help
=
'
Destination cloud entity name prefix.
'
)
AP
.
add_argument
(
'
--destination-secgroup-entity-name-prefix
'
,
default
=
'
migrated-
'
,
help
=
'
Destination cloud security_groups entity name prefix.
'
)
AP
.
add_argument
(
'
--destination-entity-name-prefix
'
,
default
=
''
,
help
=
'
Destination cloud entity name prefix (all except secgroups).
'
)
AP
.
add_argument
(
'
--destination-entity-description-suffix
'
,
default
=
'
, migrated(id:{})
'
,
help
=
'
Destination cloud entity description suffix.
'
)
...
...
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