diff --git a/share/doc/states/states-complete.dot b/share/doc/states/states-complete.dot
index 9937c7a306..07d9baeb61 100644
--- a/share/doc/states/states-complete.dot
+++ b/share/doc/states/states-complete.dot
@@ -81,6 +81,9 @@ digraph OpenNebula {
unknown -> boot [label="restart"];
boot -> boot [label="restart"];
+# reboot
+ running -> running [label="reboot"];
+
# resubmit
"ANY \\ {suspended,done}" -> pending [label="resubmit"];
diff --git a/share/doc/states/states-simple.dot b/share/doc/states/states-simple.dot
index 21d37fb8b9..00b74e7d6b 100644
--- a/share/doc/states/states-simple.dot
+++ b/share/doc/states/states-simple.dot
@@ -75,6 +75,9 @@ digraph OpenNebula {
unknown -> boot [label="restart"];
boot -> boot [label="restart"];
+# reboot
+ running -> running [label="reboot"];
+
# resubmit
"ANY \\ {suspended,done}" -> pending [label="resubmit"];
diff --git a/src/authm_mad/remotes/quota/authorize b/src/authm_mad/remotes/quota/authorize
index 19e7c15909..ae5916b4c0 100755
--- a/src/authm_mad/remotes/quota/authorize
+++ b/src/authm_mad/remotes/quota/authorize
@@ -50,7 +50,13 @@ quota = Quota.new
#OpenNebula.log_debug("quotas: #{quota.get(1)}")
ARGV.each {|request|
- rc = quota.authorize(user_id, request)
+ obj, template_or_id, op, owner, acl_eval = request.split(':')
+
+ if ( obj == "TEMPLATE" && op == "USE" && ARGV.size == 1 )
+ rc = false
+ else
+ rc = quota.authorize(user_id, request)
+ end
if rc
OpenNebula.error_message rc
diff --git a/src/authm_mad/remotes/quota/quota.rb b/src/authm_mad/remotes/quota/quota.rb
index f230f16000..c86854526e 100644
--- a/src/authm_mad/remotes/quota/quota.rb
+++ b/src/authm_mad/remotes/quota/quota.rb
@@ -219,10 +219,20 @@ class Quota
# Check if this op needs to check the quota
return false unless with_quota?(obj, op)
- # If the object is a template the info should be retrived from the
- # VM pool.
- obj = "VM" if obj == "TEMPLATE"
- template = Base64::decode64(template_or_id)
+ template = ""
+
+ if ( obj == "TEMPLATE" )
+ obj = "VM"
+
+ vm_template = OpenNebula::Template.new_with_id(template_or_id, @client)
+ vm_template.info
+
+ vm_template.each("TEMPLATE") { |xml_elem|
+ template = xml_elem.to_xml
+ }
+ else
+ template = Base64::decode64(template_or_id)
+ end
check_quotas(user_id.to_i, obj, template)
end
@@ -267,7 +277,7 @@ class Quota
def with_quota?(obj, op)
return (obj == "VM" && op == "CREATE") ||
(obj == "IMAGE" && op == "CREATE") ||
- (obj == "TEMPLATE" && op == "INSTANTIATE")
+ (obj == "TEMPLATE" && op == "USE")
end
###########################################################################
diff --git a/src/cli/one_helper.rb b/src/cli/one_helper.rb
index c61828e527..3bfda3e948 100644
--- a/src/cli/one_helper.rb
+++ b/src/cli/one_helper.rb
@@ -385,6 +385,13 @@ EOT
tmp = Tempfile.new(id.to_s)
path = tmp.path
+ rc = resource.info
+
+ if OpenNebula.is_error?(rc)
+ puts rc.message
+ exit -1
+ end
+
tmp << resource.template_str
tmp.flush
diff --git a/src/cloud/occi/lib/ImageOCCI.rb b/src/cloud/occi/lib/ImageOCCI.rb
index 650883c14a..8f873aaa93 100755
--- a/src/cloud/occi/lib/ImageOCCI.rb
+++ b/src/cloud/occi/lib/ImageOCCI.rb
@@ -24,7 +24,7 @@ class ImageOCCI < Image
<%= self.id.to_s %>
<%= self.name %>
<% if self['TYPE'] != nil %>
- <%= self['TYPE'] %>
+ <%= self.type_str %>
<% end %>
<% if self['TEMPLATE/DESCRIPTION'] != nil %>
<%= self['TEMPLATE/DESCRIPTION'] %>
@@ -33,7 +33,7 @@ class ImageOCCI < Image
<% if self['FSTYPE'] != nil and !self['FSTYPE'].empty? %>
<%= self['FSTYPE'] %>
<% end %>
- <%= pub %>
+ <%= self.public? ? "YES" : "NO" %>
<%= self['PERSISTENT'] == "0" ? "NO" : "YES"%>
}
@@ -82,12 +82,6 @@ class ImageOCCI < Image
# Creates the OCCI representation of an Image
def to_occi(base_url)
- if self['PERMISSIONS/GROUP_U'] == "1" || self['PERMISSIONS/OTHER_U'] == "1"
- pub = "YES"
- else
- pub = "NO"
- end
-
begin
occi_im = ERB.new(OCCI_IMAGE)
occi_im_text = occi_im.result(binding)
diff --git a/src/cloud/occi/lib/VirtualNetworkOCCI.rb b/src/cloud/occi/lib/VirtualNetworkOCCI.rb
index f522d9e8c4..22cb93901a 100755
--- a/src/cloud/occi/lib/VirtualNetworkOCCI.rb
+++ b/src/cloud/occi/lib/VirtualNetworkOCCI.rb
@@ -34,7 +34,7 @@ class VirtualNetworkOCCI < VirtualNetwork
<%= network_size %>
<% end %>
<%= self['TOTAL_LEASES'] %>
- <%= pub %>
+ <%= self.public? ? "YES" : "NO" %>
}
diff --git a/src/cloud/occi/lib/occi-server.rb b/src/cloud/occi/lib/occi-server.rb
index 6f5ba7cec2..cfadd287a2 100755
--- a/src/cloud/occi/lib/occi-server.rb
+++ b/src/cloud/occi/lib/occi-server.rb
@@ -50,6 +50,7 @@ require 'sinatra'
require 'yaml'
require 'erb'
require 'tempfile'
+require 'fileutils'
require 'json'
require 'OCCIServer'
@@ -255,11 +256,7 @@ end
###################################################
get '/compute/:id' do
- if params[:id] == "types"
- result,rc = @occi_server.get_computes_types
- else
- result,rc = @occi_server.get_compute(request, params)
- end
+ result,rc = @occi_server.get_compute(request, params)
treat_response(result,rc)
end
@@ -353,9 +350,8 @@ end
post '/ui/upload' do
file = Tempfile.new('uploaded_image')
+ FileUtils.cp(request.env['rack.input'].path,file.path)
request.params['file'] = file.path #so we can re-use occi post_storage()
- file.write(request.env['rack.input'].read)
- #file.close # this would allow that file is garbage-collected
result,rc = @occi_server.post_storage(request)
treat_response(result,rc)
end
diff --git a/src/cloud/occi/lib/ui/public/js/plugins/compute.js b/src/cloud/occi/lib/ui/public/js/plugins/compute.js
index b321b8cbe7..fb64497c31 100644
--- a/src/cloud/occi/lib/ui/public/js/plugins/compute.js
+++ b/src/cloud/occi/lib/ui/public/js/plugins/compute.js
@@ -427,9 +427,12 @@ function vMachineInfoListener(){
$('#tbodyvmachines tr',dataTable_vMachines).live("click", function(e){
if ($(e.target).is('input') || $(e.target).is('a img')) {return true;}
- popDialogLoading();
+
var aData = dataTable_vMachines.fnGetData(this);
var id = $(aData[0]).val();
+ if (!id) return true;
+
+ popDialogLoading();
Sunstone.runAction("VM.showinfo",id);
return false;
});
diff --git a/src/cloud/occi/lib/ui/public/js/plugins/network.js b/src/cloud/occi/lib/ui/public/js/plugins/network.js
index 52c82ae58a..436b040939 100644
--- a/src/cloud/occi/lib/ui/public/js/plugins/network.js
+++ b/src/cloud/occi/lib/ui/public/js/plugins/network.js
@@ -237,10 +237,13 @@ function vNetworkElementArray(vn_json){
function vNetworkInfoListener(){
$('#tbodyvnetworks tr',dataTable_vNetworks).live("click", function(e){
- if ($(e.target).is('input')) {return true;}
- popDialogLoading();
+ if ($(e.target).is('input')) {return true;};
+
var aData = dataTable_vNetworks.fnGetData(this);
var id = $(aData[0]).val();
+ if (!id) return true;
+
+ popDialogLoading();
Sunstone.runAction("Network.showinfo",id);
return false;
});
diff --git a/src/cloud/occi/lib/ui/public/js/plugins/storage.js b/src/cloud/occi/lib/ui/public/js/plugins/storage.js
index 06d719a44f..d6fbfe10d9 100644
--- a/src/cloud/occi/lib/ui/public/js/plugins/storage.js
+++ b/src/cloud/occi/lib/ui/public/js/plugins/storage.js
@@ -308,9 +308,11 @@ function imageInfoListener(){
if (target.is('input') || target.is('select') || target.is('option'))
return true;
- popDialogLoading();
var aData = dataTable_images.fnGetData(this);
var id = $(aData[0]).val();
+ if (!id) return true;
+
+ popDialogLoading();
Sunstone.runAction("Image.showinfo",id);
return false;
});
diff --git a/src/oca/ruby/OpenNebula/Image.rb b/src/oca/ruby/OpenNebula/Image.rb
index 6b364adba6..348b4c4df1 100644
--- a/src/oca/ruby/OpenNebula/Image.rb
+++ b/src/oca/ruby/OpenNebula/Image.rb
@@ -219,6 +219,14 @@ module OpenNebula
self['GID'].to_i
end
+ def public?
+ if self['PERMISSIONS/GROUP_U'] == "1" || self['PERMISSIONS/OTHER_U'] == "1"
+ true
+ else
+ false
+ end
+ end
+
private
def set_enabled(enabled)
diff --git a/src/oca/ruby/OpenNebula/Template.rb b/src/oca/ruby/OpenNebula/Template.rb
index df9d4c454b..2ee5e90262 100644
--- a/src/oca/ruby/OpenNebula/Template.rb
+++ b/src/oca/ruby/OpenNebula/Template.rb
@@ -154,6 +154,14 @@ module OpenNebula
self['UID'].to_i
end
+ def public?
+ if self['PERMISSIONS/GROUP_U'] == "1" || self['PERMISSIONS/OTHER_U'] == "1"
+ true
+ else
+ false
+ end
+ end
+
private
def set_publish(published)
diff --git a/src/oca/ruby/OpenNebula/VirtualNetwork.rb b/src/oca/ruby/OpenNebula/VirtualNetwork.rb
index a7ee9c42c4..134e0a038c 100644
--- a/src/oca/ruby/OpenNebula/VirtualNetwork.rb
+++ b/src/oca/ruby/OpenNebula/VirtualNetwork.rb
@@ -210,6 +210,14 @@ module OpenNebula
SHORT_VN_TYPES[type_str]
end
+ def public?
+ if self['PERMISSIONS/GROUP_U'] == "1" || self['PERMISSIONS/OTHER_U'] == "1"
+ true
+ else
+ false
+ end
+ end
+
private
def set_publish(published)
group_u = published ? 1 : 0
diff --git a/src/ozones/Server/lib/OZones/VDC.rb b/src/ozones/Server/lib/OZones/VDC.rb
index 8513960818..b3b89bb905 100644
--- a/src/ozones/Server/lib/OZones/VDC.rb
+++ b/src/ozones/Server/lib/OZones/VDC.rb
@@ -233,7 +233,8 @@ module OZones
# Grant permissions to the vdc admin
rule_str << "##{@vdc.VDCADMIN_ID} USER/* CREATE"
- rule_str << "##{@vdc.VDCADMIN_ID} USER/@#{@vdc.GROUP_ID} USE+MANAGE"
+ rule_str << "##{@vdc.VDCADMIN_ID} USER/@#{@vdc.GROUP_ID} " \
+ "USE+MANAGE+ADMIN"
###############################################################
#When more rules are added the class constant HOST_ACL_FIRST_ID
diff --git a/src/ozones/Server/public/js/plugins/vdcs-tab.js b/src/ozones/Server/public/js/plugins/vdcs-tab.js
index 88685d81f7..902744f212 100644
--- a/src/ozones/Server/public/js/plugins/vdcs-tab.js
+++ b/src/ozones/Server/public/js/plugins/vdcs-tab.js
@@ -234,11 +234,14 @@ function vdcElementArray(vdc_json){
}
function vdcInfoListener() {
- $("#tbodyvdcs tr").live("click", function(e){
+ $("#tbodyvdcs tr").live("click", function(e){
if ($(e.target).is('input')) {return true;}
- popDialogLoading();
+
var aData = dataTable_vdcs.fnGetData(this);
var id = $(aData[0]).val();
+ if (!id) return true;
+
+ popDialogLoading();
Sunstone.runAction("VDC.showinfo",id);
return false;
});
diff --git a/src/ozones/Server/public/js/plugins/zones-tab.js b/src/ozones/Server/public/js/plugins/zones-tab.js
index c1c8e76213..d8ea22a55a 100644
--- a/src/ozones/Server/public/js/plugins/zones-tab.js
+++ b/src/ozones/Server/public/js/plugins/zones-tab.js
@@ -244,9 +244,12 @@ function zoneElementArray(zone_json){
function zoneInfoListener(){
$("#tbodyzones tr").live("click", function(e){
if ($(e.target).is('input')) {return true;}
- popDialogLoading();
+
var aData = dataTable_zones.fnGetData(this);
var id = $(aData[0]).val();
+ if (!id) return true;
+
+ popDialogLoading();
Sunstone.runAction("Zone.showinfo",id);
return false;
});
diff --git a/src/sunstone/public/js/plugins/acls-tab.js b/src/sunstone/public/js/plugins/acls-tab.js
index b2d43d8e14..9216424a7b 100644
--- a/src/sunstone/public/js/plugins/acls-tab.js
+++ b/src/sunstone/public/js/plugins/acls-tab.js
@@ -146,7 +146,7 @@ var acl_buttons = {
text: tr("+ New")
},
"Acl.delete" : {
- type: "action",
+ type: "confirm",
text: tr("Delete")
}
}
diff --git a/src/sunstone/public/js/plugins/groups-tab.js b/src/sunstone/public/js/plugins/groups-tab.js
index 4dd340989d..981ed8f3c7 100644
--- a/src/sunstone/public/js/plugins/groups-tab.js
+++ b/src/sunstone/public/js/plugins/groups-tab.js
@@ -134,7 +134,7 @@ var group_buttons = {
// },
"Group.delete" : {
- type: "action",
+ type: "confirm",
text: tr("Delete")
}
};
diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js
index 2dabdd259d..77db99cb93 100644
--- a/src/sunstone/public/js/plugins/hosts-tab.js
+++ b/src/sunstone/public/js/plugins/hosts-tab.js
@@ -273,7 +273,7 @@ var host_buttons = {
text: tr("Disable")
},
"Host.delete" : {
- type: "action",
+ type: "confirm",
text: tr("Delete host")
}
};
@@ -369,9 +369,12 @@ function hostInfoListener(){
$('#tbodyhosts tr',dataTable_hosts).live("click",function(e){
//do nothing if we are clicking a checkbox!
if ($(e.target).is('input')) {return true;}
- popDialogLoading();
+
var aData = dataTable_hosts.fnGetData(this);
var id = $(aData[0]).val();
+ if (!id) return true;
+
+ popDialogLoading();
Sunstone.runAction("Host.showinfo",id);
return false;
});
diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js
index 97a60cdffe..62ab9f159c 100644
--- a/src/sunstone/public/js/plugins/images-tab.js
+++ b/src/sunstone/public/js/plugins/images-tab.js
@@ -456,7 +456,7 @@ var image_buttons = {
}
},
"Image.delete" : {
- type: "action",
+ type: "confirm",
text: tr("Delete")
}
}
@@ -528,9 +528,11 @@ function imageInfoListener(){
if (target.is('input') || target.is('select') || target.is('option'))
return true;
- popDialogLoading();
var aData = dataTable_images.fnGetData(this);
var id = $(aData[0]).val();
+ if (!id) return true;
+
+ popDialogLoading();
Sunstone.runAction("Image.showinfo",id);
return false;
});
diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js
index a097134703..f838bd1495 100644
--- a/src/sunstone/public/js/plugins/templates-tab.js
+++ b/src/sunstone/public/js/plugins/templates-tab.js
@@ -815,7 +815,7 @@ var template_buttons = {
}
},
"Template.delete" : {
- type: "action",
+ type: "confirm",
text: tr("Delete")
}
}
@@ -865,9 +865,12 @@ function templateElementArray(template_json){
function templateInfoListener(){
$('#tbodytemplates tr',dataTable_templates).live("click",function(e){
if ($(e.target).is('input')) {return true;}
- popDialogLoading();
+
var aData = dataTable_templates.fnGetData(this);
var id = $(aData[0]).val();
+ if (!id) return true;
+
+ popDialogLoading();
Sunstone.runAction("Template.showinfo",id);
return false;
});
diff --git a/src/sunstone/public/js/plugins/users-tab.js b/src/sunstone/public/js/plugins/users-tab.js
index a8d6a73166..fbd1e2a8fa 100644
--- a/src/sunstone/public/js/plugins/users-tab.js
+++ b/src/sunstone/public/js/plugins/users-tab.js
@@ -282,7 +282,7 @@ var user_buttons = {
// condition: True
// },
"User.delete" : {
- type: "action",
+ type: "confirm",
text: tr("Delete")
}
}
diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js
index ccd2698a9c..43c71961be 100644
--- a/src/sunstone/public/js/plugins/vms-tab.js
+++ b/src/sunstone/public/js/plugins/vms-tab.js
@@ -651,9 +651,12 @@ function vMachineInfoListener(){
$('#tbodyvmachines tr',dataTable_vMachines).live("click", function(e){
if ($(e.target).is('input') || $(e.target).is('a img')) {return true;}
- popDialogLoading();
+
var aData = dataTable_vMachines.fnGetData(this);
var id = $(aData[0]).val();
+ if (!id) return true;
+
+ popDialogLoading();
Sunstone.runAction("VM.showinfo",id);
return false;
});
diff --git a/src/sunstone/public/js/plugins/vnets-tab.js b/src/sunstone/public/js/plugins/vnets-tab.js
index 16c692c211..66856161ce 100644
--- a/src/sunstone/public/js/plugins/vnets-tab.js
+++ b/src/sunstone/public/js/plugins/vnets-tab.js
@@ -401,7 +401,7 @@ var vnet_buttons = {
},
"Network.delete" : {
- type: "action",
+ type: "confirm",
text: tr("Delete")
}
}
@@ -457,9 +457,12 @@ function vNetworkInfoListener(){
$('#tbodyvnetworks tr',dataTable_vNetworks).live("click", function(e){
if ($(e.target).is('input')) {return true;}
- popDialogLoading();
+
var aData = dataTable_vNetworks.fnGetData(this);
var id = $(aData[0]).val();
+ if (!id) return true;
+
+ popDialogLoading();
Sunstone.runAction("Network.showinfo",id);
return false;
});
diff --git a/src/sunstone/public/js/sunstone-util.js b/src/sunstone/public/js/sunstone-util.js
index 97d0ba493e..b09f67013d 100644
--- a/src/sunstone/public/js/sunstone-util.js
+++ b/src/sunstone/public/js/sunstone-util.js
@@ -16,7 +16,7 @@
/* Some useful functions for Sunstone default plugins */
-var INTERVAL=300000; //milisecs
+var INTERVAL=60000; //milisecs
function someTime(){
return Math.floor(Math.random()*30000);
diff --git a/src/vmm_mad/remotes/vmware/vmware_driver.rb b/src/vmm_mad/remotes/vmware/vmware_driver.rb
index a0c8b539bf..570b7b0b81 100644
--- a/src/vmm_mad/remotes/vmware/vmware_driver.rb
+++ b/src/vmm_mad/remotes/vmware/vmware_driver.rb
@@ -252,14 +252,14 @@ class VMwareDriver
end
#Performs a action usgin libvirt
- def do_action(cmd)
+ def do_action(cmd, log=true)
rc = LocalCommand.run(esx_cmd(cmd))
if rc.code == 0
return [true, rc.stdout]
else
err = "Error executing: #{cmd} err: #{rc.stderr} out: #{rc.stdout}"
- OpenNebula.log_error(err)
+ OpenNebula.log_error(err) if log
return [false, rc.code]
end
end
@@ -299,7 +299,7 @@ class VMwareDriver
end
def domain_defined?(one_id)
- rc, info = do_action("virsh -c #{@uri} dominfo one-#{one_id}")
+ rc, info = do_action("virsh -c #{@uri} dominfo one-#{one_id}", false)
return rc
end