Project

General

Profile

« Previous | Next » 

Revision 5dec3a52

Added by karimb almost 8 years ago

Fixes #8289 - handle user data in ovirt

View differences:

app/models/compute_resources/foreman/model/ovirt.rb
ComputeResource.model_name
end
def user_data_supported?
true
end
def host_compute_attrs(host)
super.tap do |attrs|
attrs[:os] = { :type => determine_os_type(host) } if supports_operating_systems?
......
end
def start_vm(uuid)
find_vm_by_uuid(uuid).start(:blocking => true)
vm = find_vm_by_uuid(uuid)
if vm.comment.include? "cloud-config"
vm.start_with_cloudinit(:blocking => true, :user_data => vm.comment)
vm.comment = ''
vm.save
else
vm.start(:blocking => true)
end
end
def start_with_cloudinit(uuid, user_data = nil)
find_vm_by_uuid(uuid).start_with_cloudinit(:blocking => true, :user_data => user_data)
end
def create_vm(args = {})
args[:comment] = args[:user_data] if args[:user_data]
if (image_id = args[:image_id])
args.merge!({:template => image_id})
end

Also available in: Unified diff