mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-09 05:27:20 +09:00
feautre #4217: Moved TYPE to the marketplace app
This commit is contained in:
1 parent
753c885714
commit
91f7ec5bb2
13 files changed
+150
-162
No files matched your search
@@ -28,41 +28,6 @@
|
||||
class MarketPlace : public PoolObjectSQL, ObjectCollection
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* MarketPlace container types
|
||||
*/
|
||||
enum MarketPlaceType
|
||||
{
|
||||
UNKNOWN = 0, /** < Unknown types */
|
||||
IMAGE_MP = 1, /** < Image MarketPlace */
|
||||
VMTEMPLATE_MP = 2, /** < VM Template MarketPlace */
|
||||
FLOW_MP = 3 /** < Flow MarketPlace */
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the string representation of a MarketPlaceType
|
||||
* @param ob the type
|
||||
* @return the string
|
||||
*/
|
||||
static string type_to_str(MarketPlaceType ob)
|
||||
{
|
||||
switch (ob)
|
||||
{
|
||||
case IMAGE_MP: return "IMAGE_MP"; break;
|
||||
case VMTEMPLATE_MP: return "VMTEMPLATE_MP"; break;
|
||||
case FLOW_MP: return "FLOW_MP"; break;
|
||||
default: return "";
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the string representation of a MarketPlaceType, By default it will
|
||||
* return IMAGE_MP.
|
||||
* @param str_type string representing the type
|
||||
* @return the MarketPlaceType
|
||||
*/
|
||||
static MarketPlaceType str_to_type(string& str_type);
|
||||
|
||||
/**
|
||||
* Function to print the MarketPlace object into a string in XML format
|
||||
* @param xml the resulting XML string
|
||||
@@ -115,15 +80,6 @@ public:
|
||||
return market_mad;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the marketplace type
|
||||
* @return marketplace type
|
||||
*/
|
||||
MarketPlaceType get_type() const
|
||||
{
|
||||
return type;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set monitor information for the MarketPlace
|
||||
* @param total_mb
|
||||
@@ -150,11 +106,6 @@ private:
|
||||
*/
|
||||
string market_mad;
|
||||
|
||||
/**
|
||||
* The marketplace type
|
||||
*/
|
||||
MarketPlaceType type;
|
||||
|
||||
/**
|
||||
* Total capacity in MB
|
||||
*/
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
class MarketPlaceApp : public PoolObjectSQL
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* MarketPlaceApp states
|
||||
*/
|
||||
enum MarketPlaceAppState
|
||||
{
|
||||
INIT = 0, /** < Initialization state */
|
||||
@@ -53,6 +56,40 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* MarketPlaceApp container types
|
||||
*/
|
||||
enum MarketPlaceAppType
|
||||
{
|
||||
UNKNOWN = 0, /** < Unknown types */
|
||||
IMAGE = 1, /** < Image MarketPlace App*/
|
||||
VMTEMPLATE = 2, /** < VM Template MarketPlace App*/
|
||||
FLOW = 3 /** < Flow MarketPlace App*/
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the string representation of a MarketPlaceType
|
||||
* @param ob the type
|
||||
* @return the string
|
||||
*/
|
||||
static string type_to_str(MarketPlaceAppType ob)
|
||||
{
|
||||
switch (ob)
|
||||
{
|
||||
case IMAGE: return "IMAGE"; break;
|
||||
case VMTEMPLATE: return "VMTEMPLATE"; break;
|
||||
case FLOW: return "FLOW"; break;
|
||||
default: return "";
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the string representation of a MarketPlaceType, By default it will
|
||||
* return IMAGE_MP.
|
||||
* @param str_type string representing the type
|
||||
* @return the MarketPlaceType
|
||||
*/
|
||||
static MarketPlaceAppType str_to_type(string& str_type);
|
||||
|
||||
/**
|
||||
* Function to print the MarketPlaceApp object into a string in XML format
|
||||
@@ -93,6 +130,15 @@ public:
|
||||
market_name = name;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the marketplace app type
|
||||
* @return marketplace app type
|
||||
*/
|
||||
MarketPlaceAppType get_type() const
|
||||
{
|
||||
return type;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
friend class MarketPlaceAppPool;
|
||||
@@ -155,6 +201,11 @@ private:
|
||||
*/
|
||||
MarketPlaceAppState state;
|
||||
|
||||
/**
|
||||
* The marketplace type
|
||||
*/
|
||||
MarketPlaceAppType type;
|
||||
|
||||
/**
|
||||
* Origin of this App
|
||||
*/
|
||||
|
||||
@@ -135,6 +135,17 @@ public:
|
||||
limit);
|
||||
};
|
||||
|
||||
/**
|
||||
* Lists the Datastore ids
|
||||
* @param oids a vector with the oids of the objects.
|
||||
*
|
||||
* @return 0 on success
|
||||
*/
|
||||
int list(std::vector<int>& oids)
|
||||
{
|
||||
return PoolSQL::list(oids, MarketPlace::table);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,11 +21,6 @@
|
||||
:desc: Number of Marketplace Apps
|
||||
:size: 6
|
||||
|
||||
:TYPE:
|
||||
:desc: Marketplace type
|
||||
:size: 4
|
||||
:left: true
|
||||
|
||||
:MAD:
|
||||
:desc: Marketplace driver
|
||||
:size: 7
|
||||
@@ -37,5 +32,4 @@
|
||||
- :SIZE
|
||||
- :AVAIL
|
||||
- :APPS
|
||||
- :TYPE
|
||||
- :MAD
|
||||
@@ -31,6 +31,11 @@
|
||||
:desc: Publishing date for the marketplace app
|
||||
:size: 15
|
||||
|
||||
:TYPE:
|
||||
:desc: Marketplace app type
|
||||
:size: 4
|
||||
:left: true
|
||||
|
||||
:MARKET:
|
||||
:desc: Name of the marketplace
|
||||
:size: 10
|
||||
@@ -44,4 +49,5 @@
|
||||
- :SIZE
|
||||
- :STAT
|
||||
- :DATE
|
||||
- :TYPE
|
||||
- :MARKET
|
||||
@@ -98,46 +98,45 @@ class OneMarketPlaceHelper < OpenNebulaHelper::OneHelper
|
||||
OpenNebula::MarketPlacePool.new(@client)
|
||||
end
|
||||
|
||||
def format_resource(datastore, options = {})
|
||||
def format_resource(market, options = {})
|
||||
str="%-15s: %-20s"
|
||||
str_h1="%-80s"
|
||||
|
||||
CLIHelper.print_header(str_h1 % "MARKETPLACE #{datastore['ID']} INFORMATION")
|
||||
puts str % ["ID", datastore.id.to_s]
|
||||
puts str % ["NAME", datastore.name]
|
||||
puts str % ["USER", datastore['UNAME']]
|
||||
puts str % ["GROUP", datastore['GNAME']]
|
||||
puts str % ["TYPE", datastore.type_str]
|
||||
CLIHelper.print_header(str_h1 % "MARKETPLACE #{market['ID']} INFORMATION")
|
||||
puts str % ["ID", market.id.to_s]
|
||||
puts str % ["NAME", market.name]
|
||||
puts str % ["USER", market['UNAME']]
|
||||
puts str % ["GROUP", market['GNAME']]
|
||||
|
||||
puts str % ["MARKET_MAD", datastore['MARKET_MAD']]
|
||||
puts str % ["MARKET_MAD", market['MARKET_MAD']]
|
||||
puts
|
||||
|
||||
CLIHelper.print_header(str_h1 % "MARKETPLACE CAPACITY", false)
|
||||
|
||||
puts str % ["TOTAL:", OpenNebulaHelper.unit_to_str(datastore['TOTAL_MB'].to_i,{},'M')]
|
||||
puts str % ["FREE:", OpenNebulaHelper.unit_to_str(datastore['FREE_MB'].to_i, {},'M')]
|
||||
puts str % ["USED: ", OpenNebulaHelper.unit_to_str(datastore['USED_MB'].to_i, {},'M')]
|
||||
puts str % ["TOTAL:", OpenNebulaHelper.unit_to_str(market['TOTAL_MB'].to_i,{},'M')]
|
||||
puts str % ["FREE:", OpenNebulaHelper.unit_to_str(market['FREE_MB'].to_i, {},'M')]
|
||||
puts str % ["USED: ", OpenNebulaHelper.unit_to_str(market['USED_MB'].to_i, {},'M')]
|
||||
puts
|
||||
|
||||
CLIHelper.print_header(str_h1 % "PERMISSIONS",false)
|
||||
|
||||
["OWNER", "GROUP", "OTHER"].each { |e|
|
||||
mask = "---"
|
||||
mask[0] = "u" if datastore["PERMISSIONS/#{e}_U"] == "1"
|
||||
mask[1] = "m" if datastore["PERMISSIONS/#{e}_M"] == "1"
|
||||
mask[2] = "a" if datastore["PERMISSIONS/#{e}_A"] == "1"
|
||||
mask[0] = "u" if market["PERMISSIONS/#{e}_U"] == "1"
|
||||
mask[1] = "m" if market["PERMISSIONS/#{e}_M"] == "1"
|
||||
mask[2] = "a" if market["PERMISSIONS/#{e}_A"] == "1"
|
||||
|
||||
puts str % [e, mask]
|
||||
}
|
||||
puts
|
||||
|
||||
CLIHelper.print_header(str_h1 % "MARKETPLACE TEMPLATE", false)
|
||||
puts datastore.template_str
|
||||
puts market.template_str
|
||||
|
||||
puts
|
||||
|
||||
CLIHelper.print_header("%-15s" % "MARKETAPPS")
|
||||
datastore.marketapp_ids.each do |id|
|
||||
market.marketapp_ids.each do |id|
|
||||
puts "%-15s" % [id]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -64,11 +64,16 @@ class OneMarketPlaceAppHelper < OpenNebulaHelper::OneHelper
|
||||
OpenNebulaHelper.time_to_str(d["DATE"])
|
||||
end
|
||||
|
||||
column :TYPE, "Marketplace app type", :left, :size=>4 do |d|
|
||||
type = MarketPlaceApp::MARKETPLACEAPP_TYPES[d["TYPE"].to_i]
|
||||
MarketPlaceApp::SHORT_MARKETPLACEAPP_TYPES[type]
|
||||
end
|
||||
|
||||
column :MARKET, "Name of the marketplace", :left, :size=>10 do |d|
|
||||
d["MARKETPLACE"]
|
||||
end
|
||||
|
||||
default :ID,:NAME,:PUBLISHER,:VERSION,:SIZE,:STAT,:DATE,:MARKET
|
||||
default :ID,:NAME,:PUBLISHER,:VERSION,:SIZE,:STAT,:DATE,:TYPE,:MARKET
|
||||
end
|
||||
|
||||
table
|
||||
@@ -96,6 +101,7 @@ class OneMarketPlaceAppHelper < OpenNebulaHelper::OneHelper
|
||||
CLIHelper.print_header(str_h1 % "MARKETPLACE APP #{app['ID']} INFORMATION")
|
||||
puts str % ["ID", app.id.to_s]
|
||||
puts str % ["NAME", app.name]
|
||||
puts str % ["TYPE", app.type_str]
|
||||
puts str % ["USER", app['UNAME']]
|
||||
puts str % ["GROUP", app['GNAME']]
|
||||
puts str % ["MARKETPLACE", app['MARKETPLACE']]
|
||||
|
||||
@@ -47,7 +47,6 @@ MarketPlace::MarketPlace(
|
||||
PoolObjectSQL(-1, MARKETPLACE, "", uid, gid, uname, gname, table),
|
||||
ObjectCollection("MARKETPLACEAPPS"),
|
||||
market_mad(""),
|
||||
type(IMAGE_MP),
|
||||
total_mb(0),
|
||||
free_mb(0),
|
||||
used_mb(0)
|
||||
@@ -77,8 +76,6 @@ int MarketPlace::insert(SqlDB *db, string& error_str)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
||||
std::string s_mp_type;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Check default marketplace attributes
|
||||
// -------------------------------------------------------------------------
|
||||
@@ -93,15 +90,6 @@ int MarketPlace::insert(SqlDB *db, string& error_str)
|
||||
goto error_mad;
|
||||
}
|
||||
|
||||
erase_template_attribute("TYPE", s_mp_type);
|
||||
|
||||
type = str_to_type(s_mp_type);
|
||||
|
||||
if ( type == UNKNOWN )
|
||||
{
|
||||
goto error_type;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
return insert_replace(db, false, error_str);
|
||||
@@ -109,12 +97,9 @@ int MarketPlace::insert(SqlDB *db, string& error_str)
|
||||
error_mad:
|
||||
error_str = "No marketplace driver (MARKET_MAD) in template.";
|
||||
goto error_common;
|
||||
error_type:
|
||||
error_str = "Unknown marketplace type: " + s_mp_type;
|
||||
goto error_common;
|
||||
|
||||
error_common:
|
||||
NebulaLog::log("MARKETPLACE", Log::ERROR, error_str);
|
||||
NebulaLog::log("MKP", Log::ERROR, error_str);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -220,7 +205,6 @@ std::string& MarketPlace::to_xml(std::string& xml) const
|
||||
"<UNAME>" << uname << "</UNAME>" <<
|
||||
"<GNAME>" << gname << "</GNAME>" <<
|
||||
"<NAME>" << name << "</NAME>" <<
|
||||
"<TYPE>" << type << "</TYPE>" <<
|
||||
"<MARKET_MAD>"<<one_util::escape_xml(market_mad)<<"</MARKET_MAD>"<<
|
||||
"<TOTAL_MB>" << total_mb << "</TOTAL_MB>" <<
|
||||
"<FREE_MB>" << free_mb << "</FREE_MB>" <<
|
||||
@@ -241,7 +225,6 @@ std::string& MarketPlace::to_xml(std::string& xml) const
|
||||
int MarketPlace::from_xml(const std::string &xml_str)
|
||||
{
|
||||
int rc = 0;
|
||||
int itype;
|
||||
std::vector<xmlNodePtr> content;
|
||||
|
||||
// Initialize the internal XML object
|
||||
@@ -254,7 +237,6 @@ int MarketPlace::from_xml(const std::string &xml_str)
|
||||
rc += xpath(uname, "/MARKETPLACE/UNAME", "not_found");
|
||||
rc += xpath(gname, "/MARKETPLACE/GNAME", "not_found");
|
||||
rc += xpath(name, "/MARKETPLACE/NAME", "not_found");
|
||||
rc += xpath(itype, "/MARKETPLACE/TYPE", -1);
|
||||
|
||||
rc += xpath(market_mad, "/MARKETPLACE/MARKET_MAD", "not_found");
|
||||
|
||||
@@ -262,8 +244,6 @@ int MarketPlace::from_xml(const std::string &xml_str)
|
||||
rc += xpath(free_mb, "/MARKETPLACE/FREE_MB", 0);
|
||||
rc += xpath(used_mb, "/MARKETPLACE/USED_MB", 0);
|
||||
|
||||
type = static_cast<MarketPlace::MarketPlaceType>(itype);
|
||||
|
||||
// ----- Permissions -----
|
||||
rc += perms_from_xml();
|
||||
|
||||
@@ -306,28 +286,8 @@ int MarketPlace::from_xml(const std::string &xml_str)
|
||||
|
||||
int MarketPlace::post_update_template(string& error)
|
||||
{
|
||||
std::string new_s_type;
|
||||
std::string new_market_mad;
|
||||
|
||||
MarketPlaceType new_type;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Sanitize TYPE and MARKET_MAD attributes
|
||||
// -------------------------------------------------------------------------
|
||||
erase_template_attribute("TYPE", new_s_type);
|
||||
|
||||
new_type = str_to_type(new_s_type);
|
||||
|
||||
if ( new_type == UNKNOWN )
|
||||
{
|
||||
error = "Unknown marketplace type: " + new_s_type;
|
||||
return -1;
|
||||
}
|
||||
|
||||
type = new_type;
|
||||
|
||||
add_template_attribute("TYPE", type_to_str(type));
|
||||
|
||||
erase_template_attribute("MARKET_MAD", new_market_mad);
|
||||
|
||||
if (!new_market_mad.empty())
|
||||
@@ -340,26 +300,3 @@ int MarketPlace::post_update_template(string& error)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------------- */
|
||||
|
||||
MarketPlace::MarketPlaceType MarketPlace::str_to_type(string& str_type)
|
||||
{
|
||||
one_util::toupper(str_type);
|
||||
|
||||
if ( str_type == "IMAGE_MP" )
|
||||
{
|
||||
return IMAGE_MP;
|
||||
}
|
||||
else if ( str_type == "VMTEMPLATE_MP" )
|
||||
{
|
||||
return VMTEMPLATE_MP;
|
||||
}
|
||||
else if ( str_type == "FLOW_MP" )
|
||||
{
|
||||
return FLOW_MP;
|
||||
}
|
||||
|
||||
return UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,8 @@ MarketPlaceApp::MarketPlaceApp(
|
||||
apptemplate64(""),
|
||||
market_id(-1),
|
||||
market_name(""),
|
||||
state(INIT)
|
||||
state(INIT),
|
||||
type(IMAGE)
|
||||
{
|
||||
if (app_template != 0)
|
||||
{
|
||||
@@ -95,6 +96,8 @@ int MarketPlaceApp::insert(SqlDB *db, string& error_str)
|
||||
|
||||
date = time(NULL);
|
||||
|
||||
type = IMAGE;
|
||||
|
||||
//Known attributes
|
||||
//ORIGIN
|
||||
//DESCRIPTION
|
||||
@@ -134,7 +137,7 @@ int MarketPlaceApp::insert(SqlDB *db, string& error_str)
|
||||
|
||||
error_origin:
|
||||
error_str = "Missing ORIGIN for the MARKETPLACEAPP";
|
||||
NebulaLog::log("MRK", Log::ERROR, error_str);
|
||||
NebulaLog::log("MKP", Log::ERROR, error_str);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -249,6 +252,7 @@ std::string& MarketPlaceApp::to_xml(std::string& xml) const
|
||||
"<MARKETPLACE_ID>" << market_id << "</MARKETPLACE_ID>" <<
|
||||
"<MARKETPLACE>" << market_name << "</MARKETPLACE>" <<
|
||||
"<STATE>" << state << "</STATE>" <<
|
||||
"<TYPE>" << type << "</TYPE>" <<
|
||||
perms_to_xml(perm_str) <<
|
||||
obj_template->to_xml(template_xml) <<
|
||||
"</MARKETPLACEAPP>";
|
||||
@@ -265,6 +269,7 @@ int MarketPlaceApp::from_xml(const std::string &xml_str)
|
||||
{
|
||||
int rc = 0;
|
||||
int istate;
|
||||
int itype;
|
||||
std::vector<xmlNodePtr> content;
|
||||
|
||||
// Initialize the internal XML object
|
||||
@@ -281,6 +286,7 @@ int MarketPlaceApp::from_xml(const std::string &xml_str)
|
||||
rc += xpath(source, "/MARKETPLACEAPP/SOURCE","not_found");
|
||||
rc += xpath(origin, "/MARKETPLACEAPP/ORIGIN","not_found");
|
||||
rc += xpath(istate, "/MARKETPLACEAPP/STATE", -1);
|
||||
rc += xpath(itype, "/MARKETPLACEAPP/TYPE", -1);
|
||||
rc += xpath(description, "/MARKETPLACEAPP/DESCRIPTION", "not_found");
|
||||
rc += xpath(size_mb, "/MARKETPLACEAPP/SIZE", -1);
|
||||
rc += xpath(version, "/MARKETPLACEAPP/VERSION", "not_found");
|
||||
@@ -291,6 +297,7 @@ int MarketPlaceApp::from_xml(const std::string &xml_str)
|
||||
rc += xpath(market_id, "/MARKETPLACEAPP/MARKETPLACE_ID", -1);
|
||||
|
||||
state = static_cast<MarketPlaceAppState>(istate);
|
||||
type = static_cast<MarketPlaceAppType>(itype);
|
||||
|
||||
// ----- Permissions -----
|
||||
rc += perms_from_xml();
|
||||
@@ -341,3 +348,26 @@ int MarketPlaceApp::post_update_template(string& error)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------------- */
|
||||
|
||||
MarketPlaceApp::MarketPlaceAppType MarketPlaceApp::str_to_type(string& str_type)
|
||||
{
|
||||
one_util::toupper(str_type);
|
||||
|
||||
if ( str_type == "IMAGE" )
|
||||
{
|
||||
return IMAGE;
|
||||
}
|
||||
else if ( str_type == "VMTEMPLATE" )
|
||||
{
|
||||
return VMTEMPLATE;
|
||||
}
|
||||
else if ( str_type == "FLOW" )
|
||||
{
|
||||
return FLOW;
|
||||
}
|
||||
|
||||
return UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -910,6 +910,8 @@ void Nebula::start(bool bootstrap_only)
|
||||
|
||||
lcm->init_managers();
|
||||
|
||||
marketm->init_managers();
|
||||
|
||||
// ---- Start the Request Manager ----
|
||||
|
||||
rc = rm->start();
|
||||
|
||||
@@ -32,15 +32,6 @@ module OpenNebula
|
||||
:rename => "market.rename"
|
||||
}
|
||||
|
||||
MARKETPLACE_TYPES=%w{UNKNOWN IMAGE_MP VMTEMPLATE_MP FLOW_MP}
|
||||
|
||||
SHORT_MARKETPLACE_TYPES = {
|
||||
"UNKNOWN" => "unk",
|
||||
"IMAGE_MP" => "img",
|
||||
"VMTEMPLATE_MP"=> "tpl",
|
||||
"FLOW_MP" => "flo"
|
||||
}
|
||||
|
||||
# Creates a MarketPlace description with just its identifier
|
||||
# this method should be used to create plain MarketPlace objects.
|
||||
# +id+ the id of the user
|
||||
@@ -146,21 +137,6 @@ module OpenNebula
|
||||
# Helpers to get information
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
# Returns the marketplace type
|
||||
def type
|
||||
self['TYPE'].to_i
|
||||
end
|
||||
|
||||
# Returns the marketplace type (string value)
|
||||
def type_str
|
||||
MARKETPLACE_TYPES[type]
|
||||
end
|
||||
|
||||
# Returns the marketplace type (string value)
|
||||
def short_type_str
|
||||
SHORT_MARKETPLACE_TYPES[type_str]
|
||||
end
|
||||
|
||||
# Returns whether or not the marketplace app with id 'id' is part of
|
||||
# this marketplace
|
||||
def contains(id)
|
||||
|
||||
@@ -41,6 +41,14 @@ module OpenNebula
|
||||
"ERROR" => "err",
|
||||
}
|
||||
|
||||
MARKETPLACEAPP_TYPES=%w{UNKNOWN IMAGE VMTEMPLATE FLOW}
|
||||
|
||||
SHORT_MARKETPLACEAPP_TYPES = {
|
||||
"UNKNOWN" => "unk",
|
||||
"IMAGE" => "img",
|
||||
"VMTEMPLATE"=> "tpl",
|
||||
"FLOW" => "flo"
|
||||
}
|
||||
# Creates a MarketPlace description with just its identifier
|
||||
# this method should be used to create plain MarketPlace objects.
|
||||
# +id+ the id of the user
|
||||
@@ -147,6 +155,21 @@ module OpenNebula
|
||||
# Helpers to get information
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
# Returns the marketplace app type
|
||||
def type
|
||||
self['TYPE'].to_i
|
||||
end
|
||||
|
||||
# Returns the marketplace app type (string value)
|
||||
def type_str
|
||||
MARKETPLACEAPP_TYPES[type]
|
||||
end
|
||||
|
||||
# Returns the marketplace app type (string value)
|
||||
def short_type_str
|
||||
SHORT_MARKETPLACEAPP_TYPES[type_str]
|
||||
end
|
||||
|
||||
# Returns the state of the marketplace app (numeric value)
|
||||
def state
|
||||
self['STATE'].to_i
|
||||
|
||||
@@ -855,4 +855,6 @@ int MarketPlaceAppAllocate::pool_allocate(
|
||||
|
||||
mp->unlock();
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
Reference in new issue
Block a user