qemu-img.c (34b5d2c68eb4082c288e70fb99c61af8f7b96fde) | qemu-img.c (cc84d90ff54c025190dbe49ec5fea1268217c5f2) |
---|---|
1/* 2 * QEMU disk image utility 3 * 4 * Copyright (c) 2003-2008 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 1125 unchanged lines hidden (view full) --- 1134 BlockDriverInfo bdi; 1135 QEMUOptionParameter *param = NULL, *create_options = NULL; 1136 QEMUOptionParameter *out_baseimg_param; 1137 char *options = NULL; 1138 const char *snapshot_name = NULL; 1139 float local_progress = 0; 1140 int min_sparse = 8; /* Need at least 4k of zeros for sparse detection */ 1141 bool quiet = false; | 1/* 2 * QEMU disk image utility 3 * 4 * Copyright (c) 2003-2008 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 1125 unchanged lines hidden (view full) --- 1134 BlockDriverInfo bdi; 1135 QEMUOptionParameter *param = NULL, *create_options = NULL; 1136 QEMUOptionParameter *out_baseimg_param; 1137 char *options = NULL; 1138 const char *snapshot_name = NULL; 1139 float local_progress = 0; 1140 int min_sparse = 8; /* Need at least 4k of zeros for sparse detection */ 1141 bool quiet = false; |
1142 Error *local_err = NULL; |
|
1142 1143 fmt = NULL; 1144 out_fmt = "raw"; 1145 cache = "unsafe"; 1146 out_baseimg = NULL; 1147 compress = 0; 1148 skip_create = 0; 1149 for(;;) { --- 186 unchanged lines hidden (view full) --- 1336 "the same time"); 1337 ret = -1; 1338 goto out; 1339 } 1340 } 1341 1342 if (!skip_create) { 1343 /* Create the new image */ | 1143 1144 fmt = NULL; 1145 out_fmt = "raw"; 1146 cache = "unsafe"; 1147 out_baseimg = NULL; 1148 compress = 0; 1149 skip_create = 0; 1150 for(;;) { --- 186 unchanged lines hidden (view full) --- 1337 "the same time"); 1338 ret = -1; 1339 goto out; 1340 } 1341 } 1342 1343 if (!skip_create) { 1344 /* Create the new image */ |
1344 ret = bdrv_create(drv, out_filename, param); | 1345 ret = bdrv_create(drv, out_filename, param, &local_err); |
1345 if (ret < 0) { | 1346 if (ret < 0) { |
1346 if (ret == -ENOTSUP) { 1347 error_report("Formatting not supported for file format '%s'", 1348 out_fmt); 1349 } else if (ret == -EFBIG) { 1350 error_report("The image size is too large for file format '%s'", 1351 out_fmt); 1352 } else { 1353 error_report("%s: error while converting %s: %s", 1354 out_filename, out_fmt, strerror(-ret)); 1355 } | 1347 error_report("%s: error while converting %s: %s", 1348 out_filename, out_fmt, error_get_pretty(local_err)); 1349 error_free(local_err); |
1356 goto out; 1357 } 1358 } 1359 1360 flags = BDRV_O_RDWR; 1361 ret = bdrv_parse_cache_flags(cache, &flags); 1362 if (ret < 0) { 1363 error_report("Invalid cache option: %s", cache); --- 1296 unchanged lines hidden --- | 1350 goto out; 1351 } 1352 } 1353 1354 flags = BDRV_O_RDWR; 1355 ret = bdrv_parse_cache_flags(cache, &flags); 1356 if (ret < 0) { 1357 error_report("Invalid cache option: %s", cache); --- 1296 unchanged lines hidden --- |