Skip to content

Commit 3ea97fa

Browse files
authored
Merge pull request #693 from globocom/fix-merge-ssddisk-migratedccc-fixbugs
Fix merge ssddisk migratedccc fixbugs
2 parents f1d2ec3 + 0f6c37b commit 3ea97fa

File tree

12 files changed

+81
-18
lines changed

12 files changed

+81
-18
lines changed

dbaas/drivers/replication_topologies/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,10 @@ def get_database_migrate_steps_stage_1(self):
426426
'Configuring database': (
427427
'workflow.steps.util.volume_provider.AttachDataVolume',
428428
'workflow.steps.util.volume_provider.MountDataVolume',
429+
'workflow.steps.util.plan.Configure',
429430
'workflow.steps.util.plan.Initialization',
430-
'workflow.steps.util.plan.ConfigureLog',
431431
'workflow.steps.util.metric_collector.ConfigureTelegraf',
432+
'workflow.steps.util.plan.Configure',
432433
)}, {
433434
'Backup and restore': (
434435
'workflow.steps.util.volume_provider.TakeSnapshotMigrate',

dbaas/drivers/replication_topologies/mongodb.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,8 +1156,10 @@ def get_database_migrate_steps_stage_3(self):
11561156
'workflow.steps.util.infra.DisableSourceInstances',
11571157
'workflow.steps.util.database.StopSourceDatabaseMigrate',
11581158
)}, {
1159-
'Cleaning up': (
1159+
'Removing Disks': (
11601160
'workflow.steps.util.volume_provider.DestroyOldEnvironment',
1161+
)}, {
1162+
'Cleaning up': (
11611163
'workflow.steps.util.host_provider.DestroyVirtualMachineMigrate',
11621164
'workflow.steps.util.host_provider.DestroyIPMigrate',
11631165
'workflow.steps.util.host_provider.DestroyServiceAccountMigrate',

dbaas/drivers/replication_topologies/mysql.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,8 +1538,10 @@ def get_database_migrate_steps_stage_3(self):
15381538
'workflow.steps.util.vip_provider.DestroySourceIPMigrateMigrate',
15391539
'workflow.steps.util.vip_provider.DestroySourceVipDatabaseMigrate',
15401540
)}, {
1541-
'Cleaning up': (
1541+
'Removing Disks': (
15421542
'workflow.steps.util.volume_provider.DestroyOldEnvironment',
1543+
)}, {
1544+
'Cleaning up': (
15431545
'workflow.steps.util.host_provider.DestroyVirtualMachineMigrate',
15441546
'workflow.steps.util.host_provider.DestroyIPMigrate',
15451547
'workflow.steps.util.host_provider.DestroyServiceAccountMigrate',

dbaas/drivers/replication_topologies/redis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,9 +1040,9 @@ def get_database_migrate_steps_stage_3(self):
10401040
'workflow.steps.redis.cluster.CheckClusterStatus',
10411041
'workflow.steps.util.infra.DisableSourceInstances',
10421042
'workflow.steps.util.database.StopSourceDatabaseMigrate',
1043+
'workflow.steps.util.volume_provider.DestroyOldEnvironment',
10431044
)}, {
10441045
'Cleaning up 2': (
1045-
'workflow.steps.util.volume_provider.DestroyOldEnvironment',
10461046
'workflow.steps.util.host_provider.DestroyVirtualMachineMigrate',
10471047
'workflow.steps.util.host_provider.DestroyIPMigrate',
10481048
'workflow.steps.util.host_provider.DestroyServiceAccountMigrate',

dbaas/maintenance/tasks_database_migrate.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ def database_environment_migrate(
142142
):
143143

144144
infra = database.infra
145-
database.infra.disk_offering_type = database.infra.disk_offering_type.get_type_to(new_environment)
146-
database.save()
145+
#database.infra.disk_offering_type = database.infra.disk_offering_type.get_type_to(new_environment)
146+
#database.save()
147147
if step_manager:
148148
migration_stage = step_manager.migration_stage
149149
if not can_migrate(database, task, migration_stage, False):
@@ -193,6 +193,7 @@ def database_environment_migrate(
193193
infra.plan = infra.plan.get_equivalent_plan_for_env(
194194
database_migrate.environment
195195
)
196+
infra.disk_offering_type = infra.disk_offering_type.get_type_to(new_environment)
196197
infra.migration_stage = infra.NOT_STARTED
197198
infra.save()
198199
database_migrate.set_success()

dbaas/physical/admin/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from .ip import IpAdmin
1919
from .vip import VipAdmin
2020
from .vip_instance_group import VipInstanceGroupAdmin
21+
from .disk_offering_type import DiskOfferingTypeAdmin
2122
from .script import ScriptAdmin
2223

2324
admin.site.register(models.DatabaseInfra, DatabaseInfraAdmin)
@@ -38,5 +39,6 @@
3839
admin.site.register(models.Ip, IpAdmin)
3940
admin.site.register(models.Vip, VipAdmin)
4041
admin.site.register(models.VipInstanceGroup, VipInstanceGroupAdmin)
41-
admin.site.register(models.DiskOfferingType)
42+
admin.site.register(models.DiskOfferingType, DiskOfferingTypeAdmin)
4243
admin.site.register(models.Volume)
44+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# -*- coding: utf-8 -*-
2+
#from django.contrib import admin
3+
from django_services import admin as services_admin
4+
from ..service.diskofferingtype import DiskOfferingTypeService
5+
6+
7+
#class DiskOfferingTypeAdmin(admin.ModelAdmin):
8+
class DiskOfferingTypeAdmin(services_admin.DjangoServicesAdmin):
9+
service_class = DiskOfferingTypeService
10+
search_fields = ('name', 'type', 'identifier')
11+
list_display = ('name', 'type', 'identifier', 'is_default', 'selected_environments')
12+
list_filter = ('name', 'type', 'identifier', 'is_default', 'environments')
13+
14+
def selected_environments(self, obj):
15+
return ",".join(obj.environments.values_list('name', flat=True))
16+
17+
save_on_top = True
18+
filter_horizontal = ("environments",)
19+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django_services import service
2+
from ..models import DiskOfferingType
3+
4+
5+
class DiskOfferingTypeService(service.CRUDService):
6+
model_class = DiskOfferingType

dbaas/tsuru/views/serviceAppBind.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from rest_framework import status
88

99

10-
class AclFromHellMissingCredentialException(Exception):
10+
class AclFromHellNotAllowerForEnvException(Exception):
1111
pass
1212

1313

@@ -21,12 +21,13 @@ def add_acl_for_hosts(self, database, app_name):
2121
hosts = infra.hosts
2222

2323
acl_from_hell_client = ACLFromHellClient(database.environment)
24-
if not acl_from_hell_client.credential:
25-
raise AclFromHellMissingCredentialException(
24+
if not acl_from_hell_client.aclfromhell_allowed:
25+
raise AclFromHellNotAllowerForEnvException(
2626
"ACL from hell credential not found for env {}".format(
2727
database.environment
2828
)
2929
)
30+
3031
for host in hosts:
3132
acl_from_hell_client.add_acl(database, app_name, host.hostname)
3233
acl_from_hell_client.add_acl_for_vip_if_needed(database, app_name)

dbaas/workflow/steps/util/acl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def __unicode__(self):
101101

102102
@property
103103
def is_valid(self):
104-
return self.acl_from_hell_client.credential is not None
104+
return self.acl_from_hell_client.aclfromhell_allowed
105105

106106
@property
107107
def acl_from_hell_client(self):

0 commit comments

Comments
 (0)