module Chef::Knife::Cloud::OvirtHelpers

Public Instance Methods

create_service_instance() click to toggle source
# File lib/chef/knife/ovirt_helpers.rb, line 13
def create_service_instance
  OvirtService.new
end
humanize(bytes) click to toggle source
# File lib/chef/knife/ovirt_helpers.rb, line 21
def humanize(bytes)
  b = bytes.to_i
  suf = %w(B KiB MiB GiB TiB EiB)
  c = suf[0]
  6.times do |count|
    if b < 1024
      c = suf[count]
      break
    end
    b /= 1024.0
  end
  format('%.2f ', b) + c
end
validate!() click to toggle source
Calls superclass method
# File lib/chef/knife/ovirt_helpers.rb, line 17
def validate!
  super(:ovirt_username, :ovirt_password, :ovirt_url)
end
volume_ready(vm_id, vol_id) click to toggle source
# File lib/chef/knife/ovirt_helpers.rb, line 35
def volume_ready(vm_id, vol_id)
  # find the volume and chaeck its status
  service.connection.list_vm_volumes(vm_id).select do |vol|
    vol[:id] == vol_id
  end[0][:status] == 'ok'
end