From b8929650412c803463df2569b996cc2894a60b0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 6 Sep 2013 17:11:03 +0200 Subject: [PATCH] Feature #2212: IMAGE/FSTYPE and DISK/FORMAT now default to 'raw' --- src/image/Image.cc | 19 ++++++++----------- src/tm/TransferManager.cc | 11 ++++++++--- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/image/Image.cc b/src/image/Image.cc index cacc154504..5d89810b65 100644 --- a/src/image/Image.cc +++ b/src/image/Image.cc @@ -177,12 +177,17 @@ int Image::insert(SqlDB *db, string& error_str) { if ( source.empty() && path.empty() ) { + if (type != DATABLOCK) + { + goto error_no_path; + } + erase_template_attribute("FSTYPE", fs_type); // DATABLOCK image needs FSTYPE - if (type != DATABLOCK || fs_type.empty()) + if (fs_type.empty()) { - goto error_no_path; + fs_type = "raw"; } } else if ( !source.empty() && !path.empty() ) @@ -210,15 +215,7 @@ error_type: goto error_common; error_no_path: - if ( type == DATABLOCK ) - { - error_str = "A DATABLOCK type IMAGE has to declare a PATH, or both " - "SIZE and FSTYPE."; - } - else - { - error_str = "No PATH in template."; - } + error_str = "No PATH in template."; goto error_common; error_path_and_source: diff --git a/src/tm/TransferManager.cc b/src/tm/TransferManager.cc index 859876f18f..20c627d1ab 100644 --- a/src/tm/TransferManager.cc +++ b/src/tm/TransferManager.cc @@ -284,10 +284,15 @@ int TransferManager::prolog_transfer_command( size = disk->vector_value("SIZE"); format = disk->vector_value("FORMAT"); - if ( size.empty() || format.empty() ) + if (format.empty()) { - os << "No size or format in FS"; - vm->log("TM", Log::WARNING, "No size or format in FS, skipping"); + format = "raw"; + } + + if ( size.empty() ) + { + os << "No size in FS"; + vm->log("TM", Log::WARNING, "No size in FS, skipping"); return 0; }