X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/8e69317214ad56a6255f56725fa3b966c663eda3..27daf08f38eec505c224e7776678b32d50241e13:/services/api/app/models/keep_disk.rb diff --git a/services/api/app/models/keep_disk.rb b/services/api/app/models/keep_disk.rb index 77fc6278eb..4623393d0c 100644 --- a/services/api/app/models/keep_disk.rb +++ b/services/api/app/models/keep_disk.rb @@ -1,5 +1,5 @@ class KeepDisk < ArvadosModel - include AssignUuid + include HasUuid include KindAndEtag include CommonApiTemplate before_validation :ensure_ping_secret @@ -17,6 +17,7 @@ class KeepDisk < ArvadosModel t.add :service_host t.add :service_port t.add :service_ssl_flag + t.add :keep_service_uuid end api_accessible :superuser, :extend => :user do |t| t.add :ping_secret @@ -36,17 +37,26 @@ class KeepDisk < ArvadosModel @bypass_arvados_authorization = true self.update_attributes!(o.select { |k,v| - [:service_host, - :service_port, - :service_ssl_flag, - :bytes_total, + [:bytes_total, :bytes_free, :is_readable, :is_writable, :last_read_at, :last_write_at ].collect(&:to_s).index k - }.merge(last_ping_at: Time.now)) + }.merge(last_ping_at: db_current_time)) + end + + def service_host + KeepService.find_by_uuid(self.keep_service_uuid).andand.service_host + end + + def service_port + KeepService.find_by_uuid(self.keep_service_uuid).andand.service_port + end + + def service_ssl_flag + KeepService.find_by_uuid(self.keep_service_uuid).andand.service_ssl_flag end protected