Feature #2494: Change the meaning of limit_mb, add it to oned

Now limit_mb does not replace total_mb. It is the max amount of
storage that OpenNebula will use, regardless of the total disk
or the usage of the disk outside the DS dir

(cherry picked from commit 37af594b97)
This commit is contained in:
Carlos Martín authored and Javi Fontan committed 2013-11-26 23:00:18 +01:00
1 parent d846a663d9
commit df0f430977
2 files changed
+13 -5

No files matched your search

+12 -4
View File
@@ -712,19 +712,27 @@ int Datastore::replace_template(const string& tmpl_str, string& error_str)
bool Datastore::get_avail_mb(long long &avail)
{
long long max_used_size;
long long limit_mb;
long long free_limited;
bool check;
avail = free_mb;
if (get_template_attribute("MAX_USED_SIZE", max_used_size))
if (get_template_attribute("LIMIT_MB", limit_mb))
{
if (used_mb >= max_used_size)
free_limited = limit_mb - used_mb;
if (free_limited < free_mb)
{
avail = 0;
avail = free_limited;
}
}
if (avail < 0)
{
avail = 0;
}
if (!get_template_attribute("DATASTORE_CAPACITY_CHECK", check))
{
Nebula& nd = Nebula::instance();
+1 -1
View File
@@ -48,7 +48,7 @@ void DatastoreXML::init_attributes()
if (!strings.empty())
{
long long limit_mb = atoll(strings[0].c_str());
long long free_limited = limit_mb - (total_mb - free_mb);
long long free_limited = limit_mb - used_mb;
if (free_limited < free_mb)
{