From f1399f4e0243fffaba8c90534252f986d680b304 Mon Sep 17 00:00:00 2001 From: Masahiro Fujiwara Date: Wed, 1 Apr 2015 17:31:15 +0900 Subject: [PATCH] /volumes/vol-xxxx/backup should only be performed for halted instance. when it is attached to instance. --- dcmgr/lib/dcmgr/endpoints/12.03/volumes.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dcmgr/lib/dcmgr/endpoints/12.03/volumes.rb b/dcmgr/lib/dcmgr/endpoints/12.03/volumes.rb index 31c98290b..f3f5bf57d 100644 --- a/dcmgr/lib/dcmgr/endpoints/12.03/volumes.rb +++ b/dcmgr/lib/dcmgr/endpoints/12.03/volumes.rb @@ -258,8 +258,12 @@ raise E::UnknownVolume, params[:id] if @volume.nil? raise E::InvalidVolumeState, params[:id] unless @volume.ready_to_take_snapshot? - if @volume.instance && !['running', 'halted'].member?(@volume.instance.state.to_s) - raise E::InvalidInstanceState, @volume.instance.canonical_uuid + if @volume.instance + # TODO: look into host node capability if the node supports + # snapshot backup. + if ![C::Instance::STATE_HALTED].member?(@volume.instance.state.to_s) + raise E::InvalidInstanceState, @volume.instance.canonical_uuid + end end bkst = find_target_backup_storage(@volume.service_type)