mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Bug #528: Fix SunstoneServer image creation, copy the local file to the Image Repository
This commit is contained in:
parent
42b61bdd76
commit
178a042ef8
@ -20,13 +20,13 @@ module OpenNebulaJSON
|
||||
class ClusterJSON < OpenNebula::Cluster
|
||||
include JSONUtils
|
||||
|
||||
def allocate(template_json)
|
||||
def create(template_json)
|
||||
cluster_hash = parse_json(template_json,'cluster')
|
||||
if OpenNebula.is_error?(cluster_hash)
|
||||
return cluster_hash
|
||||
end
|
||||
|
||||
super(cluster_hash['name'])
|
||||
self.allocate(cluster_hash['name'])
|
||||
end
|
||||
|
||||
def perform_action(template_json)
|
||||
|
@ -20,14 +20,16 @@ module OpenNebulaJSON
|
||||
class HostJSON < OpenNebula::Host
|
||||
include JSONUtils
|
||||
|
||||
def allocate(template_json)
|
||||
def create(template_json)
|
||||
host_hash = parse_json(template_json, 'host')
|
||||
if OpenNebula.is_error?(host_hash)
|
||||
return host_hash
|
||||
end
|
||||
|
||||
super(host_hash['name'], host_hash['im_mad'], host_hash['vm_mad'],
|
||||
host_hash['tm_mad'])
|
||||
self.allocate(host_hash['name'],
|
||||
host_hash['im_mad'],
|
||||
host_hash['vm_mad'],
|
||||
host_hash['tm_mad'])
|
||||
end
|
||||
|
||||
def delete
|
||||
|
@ -20,18 +20,19 @@ module OpenNebulaJSON
|
||||
class ImageJSON < OpenNebula::Image
|
||||
include JSONUtils
|
||||
|
||||
def allocate(template_json)
|
||||
def create(template_json)
|
||||
image_hash = parse_json(template_json, 'image')
|
||||
if OpenNebula.is_error?(image_hash)
|
||||
return image_hash
|
||||
end
|
||||
|
||||
if image_hash['image_raw']
|
||||
super(image_hash['image_raw'])
|
||||
template = image_hash['image_raw']
|
||||
else
|
||||
template = template_to_str(image_hash)
|
||||
super(template)
|
||||
end
|
||||
|
||||
OpenNebula::ImageRepository.new.create(self, template)
|
||||
end
|
||||
|
||||
def perform_action(template_json)
|
||||
|
@ -20,14 +20,14 @@ module OpenNebulaJSON
|
||||
class UserJSON < OpenNebula::User
|
||||
include JSONUtils
|
||||
|
||||
def allocate(template_json)
|
||||
def create(template_json)
|
||||
user_hash = parse_json(template_json, 'user')
|
||||
if OpenNebula.is_error?(user_hash)
|
||||
return user_hash
|
||||
end
|
||||
|
||||
password = Digest::SHA1.hexdigest(user_hash['password'])
|
||||
super(user_hash['name'], password)
|
||||
self.allocate(user_hash['name'], password)
|
||||
end
|
||||
|
||||
def perform_action(template_json)
|
||||
|
@ -20,18 +20,19 @@ module OpenNebulaJSON
|
||||
class VirtualMachineJSON < OpenNebula::VirtualMachine
|
||||
include JSONUtils
|
||||
|
||||
def allocate(template_json)
|
||||
def create(template_json)
|
||||
vm_hash = parse_json(template_json, 'vm')
|
||||
if OpenNebula.is_error?(vm_hash)
|
||||
return vm_hash
|
||||
end
|
||||
|
||||
if vm_hash['vm_raw']
|
||||
super(vm_hash['vm_raw'])
|
||||
template = vm_hash['vm_raw']
|
||||
else
|
||||
template = template_to_str(vm_hash)
|
||||
super(template)
|
||||
end
|
||||
|
||||
self.allocate(template)
|
||||
end
|
||||
|
||||
def perform_action(template_json)
|
||||
|
@ -20,18 +20,19 @@ module OpenNebulaJSON
|
||||
class VirtualNetworkJSON < OpenNebula::VirtualNetwork
|
||||
include JSONUtils
|
||||
|
||||
def allocate(template_json)
|
||||
def create(template_json)
|
||||
vnet_hash = parse_json(template_json, 'vnet')
|
||||
if OpenNebula.is_error?(vnet_hash)
|
||||
return vnet_hash
|
||||
end
|
||||
|
||||
if vnet_hash['vnet_raw']
|
||||
super(vnet_hash['vnet_raw'])
|
||||
template = vnet_hash['vnet_raw']
|
||||
else
|
||||
template = template_to_str(vnet_hash)
|
||||
super(template)
|
||||
end
|
||||
|
||||
self.allocate(template)
|
||||
end
|
||||
|
||||
def perform_action(template_json)
|
||||
|
@ -115,7 +115,7 @@ class SunstoneServer
|
||||
return [404, error.to_json]
|
||||
end
|
||||
|
||||
rc = resource.allocate(template)
|
||||
rc = resource.create(template)
|
||||
if OpenNebula.is_error?(rc)
|
||||
return [500, rc.to_json]
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user