feature #1288 #1284: Memory and CPU are now mandatory for VMs. Default values have been removed from the driver configuration files

This commit is contained in:
Ruben S. Montero committed 2012-06-11 12:16:14 +02:00
1 parent 32f72f56e7
commit 0875bef833
7 files changed
+35 -30

No files matched your search

+29 -4
View File
@@ -203,8 +203,8 @@ int VirtualMachine::insert(SqlDB * db, string& error_str)
int rc;
string name;
string value;
ostringstream oss;
string value;
ostringstream oss;
// ------------------------------------------------------------------------
// Set a name if the VM has not got one and VM_ID
@@ -232,6 +232,24 @@ int VirtualMachine::insert(SqlDB * db, string& error_str)
this->name = name;
// ------------------------------------------------------------------------
// Check for CPU and MEMORY attributes
// ------------------------------------------------------------------------
get_template_attribute("MEMORY", value);
if ( value.empty())
{
goto error_no_memory;
}
get_template_attribute("CPU", value);
if ( value.empty())
{
goto error_no_cpu;
}
// ------------------------------------------------------------------------
// Get network leases
// ------------------------------------------------------------------------
@@ -312,9 +330,16 @@ error_leases_rollback:
release_network_leases();
goto error_common;
error_no_cpu:
error_str = "CPU attribute missing.";
goto error_common;
error_no_memory:
error_str = "MEMORY attribute missing.";
goto error_common;
error_name_length:
oss << "NAME is too long; max length is 128 chars.";
error_str = oss.str();
error_str = "NAME is too long; max length is 128 chars.";
goto error_common;
error_common:
-5
View File
@@ -131,11 +131,6 @@ int LibVirtDriver::deployment_description_kvm(
vm->get_template_attribute("MEMORY",memory);
if (memory.empty())
{
get_default("MEMORY",memory);
}
if (!memory.empty())
{
memory_in_kb = atoi(memory.c_str()) * 1024;
-5
View File
@@ -119,11 +119,6 @@ int LibVirtDriver::deployment_description_vmware(
vm->get_template_attribute("MEMORY",memory);
if (memory.empty())
{
get_default("MEMORY",memory);
}
if (!memory.empty())
{
memory_in_kb = atoi(memory.c_str()) * 1024;
-5
View File
@@ -109,11 +109,6 @@ int XenDriver::deployment_description(
vm->get_template_attribute("MEMORY",memory);
if (memory.empty())
{
get_default("MEMORY",memory);
}
if (!memory.empty())
{
file << "memory = '" << memory << "'" << endl;
-3
View File
@@ -19,8 +19,6 @@
# be overridden in each VM template. Valid atributes are:
# - emulator
# - os [kernel,initrd,boot,root,kernel_cmd,arch]
# - memory
# - cpu
# - vcpu
# - features [acpi, pae]
# - disk [driver, cache]
@@ -29,7 +27,6 @@
#EMULATOR = /usr/libexec/qemu-kvm
#VCPU = 1
#MEMORY = 128
OS = [ boot = "hd", arch = "i686" ]
FEATURES = [ PAE = "no", ACPI = "yes" ]
+3 -4
View File
@@ -17,14 +17,13 @@
# Default configuration attributes for the VMware driver
# (all domains will use these values as defaults)
# Valid atributes:
# - memory
# - cpu
# - vcpu
# - os[arch]
# - disk[dirver]
# - datastore
CPU = 1
MEMORY = 256
#VCPU = 1
OS = [ ARCH = i686 ]
DISK = [ DRIVER = file ]
+3 -4
View File
@@ -19,12 +19,11 @@
# be overridden in each VM template. Valid atributes are:
# - credit
# - os [kernel,initrd,root,kernel_cmd]
# - memory
# - vcpu
# - disk[driver]
#VCPU = 1
#MEMORY = 128
#OS = [ kernel="/vmlinuz", initrd="/initrd.img", root="sda1", kernel_cmd="ro" ]
#VCPU = 1
#OS = [ kernel="/vmlinuz", initrd="/initrd.img", root="sda1", kernel_cmd="ro" ]
CREDIT = 256
DISK = [ driver = "tap:aio:" ]