Skip to content

Commit 9ca2013

Browse files
authored
Merge pull request globocom#211 from globocom/faas_resize
Faas resize
2 parents 0fc9aec + 51c24db commit 9ca2013

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

dbaas/notification/tasks.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@ def upgrade_mongodb_24_to_30(self, database, user, task_history=None):
796796

797797
@app.task(bind=True)
798798
def database_disk_resize(self, database, disk_offering, task_history, user):
799+
from dbaas_nfsaas.models import HostAttr
799800
from workflow.steps.util.nfsaas_utils import resize_disk
800801

801802
AuditRequest.new_request("database_disk_resize", user, "localhost")
@@ -816,7 +817,10 @@ def database_disk_resize(self, database, disk_offering, task_history, user):
816817
details='\nLoading Disk offering'
817818
)
818819

819-
for instance in databaseinfra.instances.all():
820+
for instance in databaseinfra.get_driver().get_database_instances():
821+
if not HostAttr.objects.filter(host_id=instance.hostname_id).exists():
822+
continue
823+
820824
task_history.update_details(
821825
persist=True,
822826
details='\nChanging instance {} to '

dbaas/workflow/steps/util/nfsaas_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,7 @@ def clean_unused_data(export_id):
118118

119119
def resize_disk(environment, host, disk_offering):
120120
provider = get_faas_provider(environment=environment)
121-
disk = HostAttr.objects.get(host=host)
122-
return provider.resize(disk.nfsaas_path_host, disk_offering.size_kb)
121+
for disk in HostAttr.objects.filter(host=host):
122+
if not provider.resize(disk.nfsaas_path_host, disk_offering.size_kb):
123+
return False
124+
return True

0 commit comments

Comments
 (0)