From fc91d48210cb8e83a8530399c981ab7eb70100b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tino=20V=C3=A1zquez?= Date: Wed, 4 Aug 2010 13:05:13 +0200 Subject: [PATCH] bug #291: Number of DATABLOCKs than a VM can have is set to a maximum of 10 --- src/vm/VirtualMachine.cc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index 72cc62a610..a4b707febd 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -825,8 +825,9 @@ int VirtualMachine::get_disk_images() ImagePool * ipool; VectorAttribute * disk; - int n_os = 0; - int n_cd = 0; + int n_os = 0; // Number of OS images + int n_cd = 0; // Number of CDROMS + int n_db = 0; // Number of DATABLOCKS string type; ostringstream oss; @@ -858,6 +859,9 @@ int VirtualMachine::get_disk_images() case Image::CDROM: n_cd++; break; + case Image::DATABLOCK: + n_db++; + break; default: break; } @@ -871,6 +875,11 @@ int VirtualMachine::get_disk_images() { goto error_max_cd; } + + if( n_db > 10 ) // Max. number of DATABLOCK images is 10 + { + goto error_max_db; + } } else if ( rc == -1 ) { @@ -889,6 +898,11 @@ error_max_cd: NebulaLog::log("ONE",Log::ERROR, "VM can not use more than one CDROM image."); goto error_common; + +error_max_db: + NebulaLog::log("ONE",Log::ERROR, + "VM can not use more than 10 DATABLOCK images."); + goto error_common; error_image: NebulaLog::log("ONE",Log::ERROR, "Could not get disk image for VM");