1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

Feature #1112: Fix save_as in mkfs datastore_mad drivers

This commit is contained in:
Carlos Martín 2012-03-06 18:08:20 +01:00
parent dabcafa2d9
commit c9cc70dc81
4 changed files with 34 additions and 3 deletions

View File

@ -65,6 +65,14 @@ SIZE="${XPATH_ELEMENTS[6]}"
set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK"
DST=`generate_image_path`
# ------------ Image to save_as disk, no need to create a FS ------------
if [ "$FSTYPE" = "save_as" ]; then
echo "$DST $SIZE"
exit 0
fi
# ------------ Create the image to the repository ------------
MKFS_CMD=`mkfs_command $DST $FSTYPE`

View File

@ -65,13 +65,20 @@ set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK"
DST=`generate_image_path`
# ------------ Image to save_as disk, no need to create a FS ------------
if [ "$FSTYPE" = "save_as" ]; then
echo "$DST $SIZE"
exit 0
fi
# ------------ Create the image to the repository ------------
DISK=$DST/disk.vmdk
DISK_TMP=$DISK.tmp
IMAGE_FORMAT=vmdk
# ------------ Create the image to the repository ------------
MKFS_CMD=`mkfs_command $DISK_TMP $FSTYPE`
exec_and_log "mkdir -p $DST" \

View File

@ -190,6 +190,23 @@ int Image::insert(SqlDB *db, string& error_str)
goto error_path_and_source;
}
}
else
{
string size_attr;
istringstream iss;
fs_type = "save_as";
erase_template_attribute("SIZE", size_attr);
iss.str(size_attr);
iss >> size_mb;
if (iss.fail() == true)
{
goto error_size_format;
}
}
state = LOCKED; //LOCKED till the ImageManager copies it to the Repository

View File

@ -496,7 +496,6 @@ void VirtualMachineSaveDisk::request_execute(xmlrpc_c::paramList const& paramLis
oss << "NAME = \"" << img_name << "\"" << endl;
oss << "SIZE = " << size << endl;
oss << "FS_TYPE = save_as" << endl;
oss << "SAVED_IMAGE_ID = " << iid_orig << endl;
oss << "SAVED_DISK_ID = " << disk_id << endl;