def create_instance(credentials, image_id, opts={})
client = new_client(credentials)
params = {}
name = opts[:name]
if not name
name = Time.now.to_i.to_s
end
if name.length > USER_NAME_MAX
raise "Parameter name must be #{USER_NAME_MAX} characters or less"
end
safely do
params[:name] = name
params[:realm_id] = opts[:realm_id] if opts[:realm_id]
params[:hwp_id] = opts[:hwp_id] if opts[:hwp_id]
params[:hwp_memory] = opts[:hwp_memory] if opts[:hwp_memory]
params[:hwp_cpu] = opts[:hwp_cpu] if opts[:hwp_cpu]
convert_instance(client, client.create_vm(image_id, params))
end
end