Skip to content

Commit

Permalink
Merge pull request #211 from globocom/faas_resize
Browse files Browse the repository at this point in the history
Faas resize
  • Loading branch information
otherpirate authored Aug 25, 2016
2 parents 0fc9aec + 51c24db commit 9ca2013
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion dbaas/notification/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ def upgrade_mongodb_24_to_30(self, database, user, task_history=None):

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

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

for instance in databaseinfra.instances.all():
for instance in databaseinfra.get_driver().get_database_instances():
if not HostAttr.objects.filter(host_id=instance.hostname_id).exists():
continue

task_history.update_details(
persist=True,
details='\nChanging instance {} to '
Expand Down
6 changes: 4 additions & 2 deletions dbaas/workflow/steps/util/nfsaas_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,7 @@ def clean_unused_data(export_id):

def resize_disk(environment, host, disk_offering):
provider = get_faas_provider(environment=environment)
disk = HostAttr.objects.get(host=host)
return provider.resize(disk.nfsaas_path_host, disk_offering.size_kb)
for disk in HostAttr.objects.filter(host=host):
if not provider.resize(disk.nfsaas_path_host, disk_offering.size_kb):
return False
return True

0 comments on commit 9ca2013

Please sign in to comment.