1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

F 1377: Change Sunstone interface for locks

This commit is contained in:
juanmont 2018-01-31 18:04:00 +01:00 committed by Ruben S. Montero
parent 17d5b31cb2
commit 37ce0d2a8f
15 changed files with 128 additions and 111 deletions

View File

@ -404,8 +404,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
elsif !options[:all].nil?
level = 4
else
STDERR.puts "Need to level of lock."
exit -1
level = 1
end
i.lock(level)
end

View File

@ -326,8 +326,7 @@ CommandParser::CmdParser.new(ARGV) do
elsif !options[:all].nil?
level = 4
else
STDERR.puts "Need to level of lock."
exit -1
level = 1
end
app.lock(level)
end

View File

@ -388,8 +388,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
elsif !options[:all].nil?
level = 4
else
STDERR.puts "Need to level of lock."
exit -1
level = 1
end
t.lock(level)
end

View File

@ -1038,8 +1038,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
elsif !options[:all].nil?
level = 4
else
STDERR.puts "Need to level of lock."
exit -1
level = 1
end
vm.lock(level)
end

View File

@ -229,8 +229,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
elsif !options[:all].nil?
level = 4
else
STDERR.puts "Need to level of lock."
exit -1
level = 1
end
vmg.lock(level)
end

View File

@ -469,8 +469,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
elsif !options[:all].nil?
level = 4
else
STDERR.puts "Need to level of lock."
exit -1
level = 1
end
vnet.lock(level)
end

View File

@ -361,8 +361,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
elsif !options[:all].nil?
level = 4
else
STDERR.puts "Need to level of lock."
exit -1
level = 1
end
vr.lock(level)
end

View File

@ -87,6 +87,31 @@ public abstract class Document extends PoolElement
super(xmlElement, client);
}
/**
* lock this Document
*
* @param client XML-RPC Client.
* @param id The Image id.
* @param level Lock level.
* @return If an error occurs the error message contains the reason.
*/
public static OneResponse lock(Client client, int id, int level)
{
return client.call(LOCK, id, level);
}
/**
* Unlock this Document
*
* @param client XML-RPC Client.
* @param id The Image id.
* @return If an error occurs the error message contains the reason.
*/
public static OneResponse unlock(Client client, int id)
{
return client.call(UNLOCK, id);
}
// =================================
// Static XML-RPC methods
// =================================
@ -244,24 +269,23 @@ public abstract class Document extends PoolElement
/**
* Locks this object
*
* @param owner String to identify the application requestiong the lock
* @param level int to identify the lock level
* @return In case of success, a boolean with true if the lock was granted,
* and false if the object is already locked.
*/
public OneResponse lock(String owner)
public OneResponse lock(int level)
{
return client.call(LOCK, id, owner);
return client.call(LOCK, id, level);
}
/**
* Unlocks this object
*
* @param owner String to identify the application requestiong the lock
* @return If an error occurs the error message contains the reason.
*/
public OneResponse unlock(String owner)
public OneResponse unlock()
{
return client.call(UNLOCK, id, owner);
return client.call(UNLOCK, id);
}
// =================================

View File

@ -85,21 +85,21 @@ define(function(require) {
"Image.edit_labels" : {
layout: "labels",
},
"Image.lockA" : {
type: "action",
text: Locale.tr("Admin"),
layout: "lock_buttons",
data: 3
},
"Image.lockM" : {
type: "action",
text: Locale.tr("Manage"),
layout: "lock_buttons",
data: 2
},
// "Image.lockA" : {
// type: "action",
// text: Locale.tr("Admin"),
// layout: "lock_buttons",
// data: 3
// },
// "Image.lockM" : {
// type: "action",
// text: Locale.tr("Manage"),
// layout: "lock_buttons",
// data: 2
// },
"Image.lockU" : {
type: "action",
text: Locale.tr("Use"),
text: Locale.tr("Lock"),
layout: "lock_buttons",
data: 1
},

View File

@ -68,21 +68,21 @@ define(function(require) {
"MarketPlaceApp.edit_labels" : {
layout: "labels",
},
"MarketPlaceApp.lockA" : {
type: "action",
text: Locale.tr("Admin"),
layout: "lock_buttons",
data: 3
},
"MarketPlaceApp.lockM" : {
type: "action",
text: Locale.tr("Manage"),
layout: "lock_buttons",
data: 2
},
// "MarketPlaceApp.lockA" : {
// type: "action",
// text: Locale.tr("Admin"),
// layout: "lock_buttons",
// data: 3
// },
// "MarketPlaceApp.lockM" : {
// type: "action",
// text: Locale.tr("Manage"),
// layout: "lock_buttons",
// data: 2
// },
"MarketPlaceApp.lockU" : {
type: "action",
text: Locale.tr("Use"),
text: Locale.tr("Lock"),
layout: "lock_buttons",
data: 1
},

View File

@ -84,21 +84,21 @@ define(function(require) {
"Template.edit_labels" : {
layout: "labels",
},
"Template.lockA" : {
type: "action",
text: Locale.tr("Admin"),
layout: "lock_buttons",
data: 3
},
"Template.lockM" : {
type: "action",
text: Locale.tr("Manage"),
layout: "lock_buttons",
data: 2
},
// "Template.lockA" : {
// type: "action",
// text: Locale.tr("Admin"),
// layout: "lock_buttons",
// data: 3
// },
// "Template.lockM" : {
// type: "action",
// text: Locale.tr("Manage"),
// layout: "lock_buttons",
// data: 2
// },
"Template.lockU" : {
type: "action",
text: Locale.tr("Use"),
text: Locale.tr("Lock"),
layout: "lock_buttons",
data: 1
},

View File

@ -53,21 +53,21 @@ define(function(require) {
text: Locale.tr("Delete"),
layout: "del"
},
"VMGroup.lockA" : {
type: "action",
text: Locale.tr("Admin"),
layout: "lock_buttons",
data: 3
},
"VMGroup.lockM" : {
type: "action",
text: Locale.tr("Manage"),
layout: "lock_buttons",
data: 2
},
// "VMGroup.lockA" : {
// type: "action",
// text: Locale.tr("Admin"),
// layout: "lock_buttons",
// data: 3
// },
// "VMGroup.lockM" : {
// type: "action",
// text: Locale.tr("Manage"),
// layout: "lock_buttons",
// data: 2
// },
"VMGroup.lockU" : {
type: "action",
text: Locale.tr("Use"),
text: Locale.tr("Lock"),
layout: "lock_buttons",
data: 1
},

View File

@ -198,21 +198,21 @@ define(function(require) {
"VM.edit_labels" : {
layout: "labels",
},
"VM.lockA" : {
type: "action",
text: Locale.tr("Admin"),
layout: "lock_buttons",
data: 3
},
"VM.lockM" : {
type: "action",
text: Locale.tr("Manage"),
layout: "lock_buttons",
data: 2
},
// "VM.lockA" : {
// type: "action",
// text: Locale.tr("Admin"),
// layout: "lock_buttons",
// data: 3
// },
// "VM.lockM" : {
// type: "action",
// text: Locale.tr("Manage"),
// layout: "lock_buttons",
// data: 2
// },
"VM.lockU" : {
type: "action",
text: Locale.tr("Use"),
text: Locale.tr("Lock"),
layout: "lock_buttons",
data: 1
},

View File

@ -75,21 +75,21 @@ define(function(require) {
"Network.edit_labels" : {
layout: "labels",
},
"Network.lockA" : {
type: "action",
text: Locale.tr("Admin"),
layout: "lock_buttons",
data: 3
},
"Network.lockM" : {
type: "action",
text: Locale.tr("Manage"),
layout: "lock_buttons",
data: 2
},
// "Network.lockA" : {
// type: "action",
// text: Locale.tr("Admin"),
// layout: "lock_buttons",
// data: 3
// },
// "Network.lockM" : {
// type: "action",
// text: Locale.tr("Manage"),
// layout: "lock_buttons",
// data: 2
// },
"Network.lockU" : {
type: "action",
text: Locale.tr("Use"),
text: Locale.tr("Lock"),
layout: "lock_buttons",
data: 1
},

View File

@ -55,21 +55,21 @@ define(function(require) {
"VirtualRouter.edit_labels" : {
layout: "labels",
},
"VirtualRouter.lockA" : {
type: "action",
text: Locale.tr("Admin"),
layout: "lock_buttons",
data: 3
},
"VirtualRouter.lockM" : {
type: "action",
text: Locale.tr("Manage"),
layout: "lock_buttons",
data: 2
},
// "VirtualRouter.lockA" : {
// type: "action",
// text: Locale.tr("Admin"),
// layout: "lock_buttons",
// data: 3
// },
// "VirtualRouter.lockM" : {
// type: "action",
// text: Locale.tr("Manage"),
// layout: "lock_buttons",
// data: 2
// },
"VirtualRouter.lockU" : {
type: "action",
text: Locale.tr("Use"),
text: Locale.tr("Lock"),
layout: "lock_buttons",
data: 1
},