Revision 2ce40099 src/vm/VirtualMachine.cc

View differences:

src/vm/VirtualMachine.cc
951 951
/* -------------------------------------------------------------------------- */
952 952
/* -------------------------------------------------------------------------- */
953 953

  
954
int VirtualMachine::save_disk(int disk_id, int img_id)
954
int VirtualMachine::save_disk(int disk_id, int img_id, string& error_str)
955 955
{
956 956
    int                   num_disks;
957 957
    vector<Attribute  * > disks;
......
959 959

  
960 960
    string                disk_id_str;
961 961
    int                   tmp_disk_id;
962
    string                tmp_img_id_str;
963
    int                   tmp_img_id;
962 964

  
963 965
    ostringstream oss;
964 966
    istringstream iss;
......
982 984

  
983 985
        if( tmp_disk_id == disk_id )
984 986
        {
987
            if( disk->vector_value("SAVE_AS") != "" )
988
            {
989
                goto error_saved;
990
            }
991

  
985 992
            disk->replace("SAVE", "YES");
986 993

  
987 994
            oss << (img_id);
......
991 998
        }
992 999
    }
993 1000

  
1001
    goto error_not_found;
1002

  
1003
error_saved:
1004
    oss << "The DISK " << disk_id << " is already suppossed to be saved.";
1005
    goto error_common;
1006

  
1007
error_not_found:
1008
    oss << "The DISK " << disk_id << " does not exist for VM " << oid << ".";
1009

  
1010
error_common:
1011
    NebulaLog::log("VM",Log::ERROR, oss);
1012
    error_str = oss.str();
1013

  
994 1014
    return -1;
995 1015
}
996 1016

  

Also available in: Unified diff