Feature #1612: Enforce correct format for DISK/SIZE

This commit is contained in:
Carlos Martín committed 2013-10-31 16:22:38 +01:00
1 parent 779d2d6dbc
commit 19acb3fd9b
2 files changed
+14

No files matched your search

+11
View File
@@ -357,6 +357,17 @@ int ImagePool::disk_attribute(int vm_id,
return -1;
}
int rc;
long long size;
rc = disk->vector_value("SIZE", size);
if ( rc != 0 || size <= 0 )
{
error_str = "SIZE attribute must be a positive integer value.";
return -1;
}
img_type = Image::DATABLOCK;
dev_prefix = disk->vector_value("DEV_PREFIX");
+3
View File
@@ -1729,6 +1729,9 @@ int VirtualMachine::get_disk_images(string& error_str)
}
else
{
oss << "DISK " << i << ": " << error_str;
error_str = oss.str();
goto error_common;
}
}