Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance logging around snapshot create/delete #56

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions lib/VolumeManager/VolMgrPlatformSupportLinux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,27 @@ def preMount
desc = @ost.snapshotDescription ? @ost.snapshotDescription : "EVM Snapshot"
st = Time.now
@snMor = @vimVm.createEvmSnapshot(desc, "false", true, @ost.snapshot_create_free_space)
$log.info "VolMgrPlatformSupportLinux.preMount: VM snapshot created in [#{Time.now - st}] seconds"
$log.info "VolMgrPlatformSupportLinux.preMount: VM snapshot [#{@snMor}] created in [#{Time.now - st}] seconds"
$log.debug "VolMgrPlatformSupportLinux.preMount: snMor = \"#{@snMor}\""
end

def postMount
$log.debug "VolMgrPlatformSupportLinux.postMount Enter: force = #{@ost.force}, @vimVm.nil? = #{@vimVm.nil?}"
log_prefix = "VolMgrPlatformSupportLinux.postMount"
$log.debug "#{log_prefix} Enter: force = #{@ost.force}, @vimVm.nil? = #{@vimVm.nil?}"
return unless @ost.force
return unless @vimVm

if @ost.force
if !@snMor
$log.warn "VolMgrPlatformSupportLinux.postMount: VM not snapped: #{@cfgFile}"
$log.warn "#{log_prefix}: VM not snapped: #{@cfgFile}"
else
$log.debug "VolMgrPlatformSupportLinux.postMount: removing snapshot snMor = \"#{@snMor}\""
$log.debug "#{log_prefix}: removing snapshot snMor = \"#{@snMor}\""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this at least info to coincide with the call in preMount.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking the pre/post symmetry was that they both logged to info the result after the operation:
$log.info "VolMgrPlatformSupportLinux.preMount: VM snapshot [#{@snMor}] created in [#{Time.now - st}] seconds"
and
$log.info "#{log_prefix}: VM snapshot [#{@snMor}] removed"
But I can just make this info.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we can add a INFO -- Creating snapshot to preMount, thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you're right @agrare I didn't see the second line.

begin
@vimVm.removeSnapshot(@snMor, "false", true, @ost.snapshot_remove_free_space)
$log.info "#{log_prefix}: VM snapshot [#{@snMor}] removed"
rescue => err
$log.warn "VolMgrPlatformSupportLinux.postMount: failed to remove snapshot for VM: #{@cfgFile}"
$log.warn "VolMgrPlatformSupportLinux.postMount: #{err}"
$log.warn "#{log_prefix}: failed to remove snapshot for VM: #{@cfgFile}"
$log.warn "#{log_prefix}: #{err}"
end
end
end
Expand Down