mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
storage: remove unneeded cleanup labels
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
3814e767d5
commit
abd2899d73
@ -58,36 +58,33 @@ virStorageBackendFileSystemNetFindPoolSourcesFunc(char **const groups,
|
|||||||
virNetfsDiscoverState *state = data;
|
virNetfsDiscoverState *state = data;
|
||||||
const char *name, *path;
|
const char *name, *path;
|
||||||
virStoragePoolSource *src = NULL;
|
virStoragePoolSource *src = NULL;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
path = groups[0];
|
path = groups[0];
|
||||||
|
|
||||||
if (!(name = strrchr(path, '/'))) {
|
if (!(name = strrchr(path, '/'))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("invalid netfs path (no /): %s"), path);
|
_("invalid netfs path (no /): %s"), path);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
name += 1;
|
name += 1;
|
||||||
if (*name == '\0') {
|
if (*name == '\0') {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("invalid netfs path (ends in /): %s"), path);
|
_("invalid netfs path (ends in /): %s"), path);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(src = virStoragePoolSourceListNewSource(&state->list)))
|
if (!(src = virStoragePoolSourceListNewSource(&state->list)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (VIR_ALLOC_N(src->hosts, 1) < 0)
|
if (VIR_ALLOC_N(src->hosts, 1) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
src->nhost = 1;
|
src->nhost = 1;
|
||||||
|
|
||||||
src->hosts[0].name = g_strdup(state->host);
|
src->hosts[0].name = g_strdup(state->host);
|
||||||
src->dir = g_strdup(path);
|
src->dir = g_strdup(path);
|
||||||
src->format = VIR_STORAGE_POOL_NETFS_NFS;
|
src->format = VIR_STORAGE_POOL_NETFS_NFS;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -408,17 +408,15 @@ volStorageBackendRBDGetFeatures(rbd_image_t image,
|
|||||||
const char *volname,
|
const char *volname,
|
||||||
uint64_t *features)
|
uint64_t *features)
|
||||||
{
|
{
|
||||||
int r, ret = -1;
|
int r;
|
||||||
|
|
||||||
if ((r = rbd_get_features(image, features)) < 0) {
|
if ((r = rbd_get_features(image, features)) < 0) {
|
||||||
virReportSystemError(-r, _("failed to get the features of RBD image "
|
virReportSystemError(-r, _("failed to get the features of RBD image "
|
||||||
"%s"), volname);
|
"%s"), volname);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
cleanup:
|
return 0;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LIBRBD_VERSION_CODE > 265
|
#if LIBRBD_VERSION_CODE > 265
|
||||||
@ -464,7 +462,7 @@ virStorageBackendRBDSetAllocation(virStorageVolDefPtr vol,
|
|||||||
rbd_image_t *image,
|
rbd_image_t *image,
|
||||||
rbd_image_info_t *info)
|
rbd_image_info_t *info)
|
||||||
{
|
{
|
||||||
int r, ret = -1;
|
int r;
|
||||||
size_t allocation = 0;
|
size_t allocation = 0;
|
||||||
|
|
||||||
if ((r = rbd_diff_iterate2(image, NULL, 0, info->size, 0, 1,
|
if ((r = rbd_diff_iterate2(image, NULL, 0, info->size, 0, 1,
|
||||||
@ -472,17 +470,15 @@ virStorageBackendRBDSetAllocation(virStorageVolDefPtr vol,
|
|||||||
&allocation)) < 0) {
|
&allocation)) < 0) {
|
||||||
virReportSystemError(-r, _("failed to iterate RBD image '%s'"),
|
virReportSystemError(-r, _("failed to iterate RBD image '%s'"),
|
||||||
vol->name);
|
vol->name);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
VIR_DEBUG("Found %zu bytes allocated for RBD image %s",
|
VIR_DEBUG("Found %zu bytes allocated for RBD image %s",
|
||||||
allocation, vol->name);
|
allocation, vol->name);
|
||||||
|
|
||||||
vol->target.allocation = allocation;
|
vol->target.allocation = allocation;
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
cleanup:
|
return 0;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -960,14 +956,13 @@ virStorageBackendRBDImageInfo(rbd_image_t image,
|
|||||||
uint64_t *stripe_unit,
|
uint64_t *stripe_unit,
|
||||||
uint64_t *stripe_count)
|
uint64_t *stripe_count)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
int r = 0;
|
int r = 0;
|
||||||
uint8_t oldformat;
|
uint8_t oldformat;
|
||||||
|
|
||||||
if ((r = rbd_get_old_format(image, &oldformat)) < 0) {
|
if ((r = rbd_get_old_format(image, &oldformat)) < 0) {
|
||||||
virReportSystemError(-r, _("failed to get the format of RBD image %s"),
|
virReportSystemError(-r, _("failed to get the format of RBD image %s"),
|
||||||
volname);
|
volname);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldformat != 0) {
|
if (oldformat != 0) {
|
||||||
@ -975,28 +970,25 @@ virStorageBackendRBDImageInfo(rbd_image_t image,
|
|||||||
_("RBD image %s is old format. Does not support "
|
_("RBD image %s is old format. Does not support "
|
||||||
"extended features and striping"),
|
"extended features and striping"),
|
||||||
volname);
|
volname);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (volStorageBackendRBDGetFeatures(image, volname, features) < 0)
|
if (volStorageBackendRBDGetFeatures(image, volname, features) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if ((r = rbd_get_stripe_unit(image, stripe_unit)) < 0) {
|
if ((r = rbd_get_stripe_unit(image, stripe_unit)) < 0) {
|
||||||
virReportSystemError(-r, _("failed to get the stripe unit of RBD image %s"),
|
virReportSystemError(-r, _("failed to get the stripe unit of RBD image %s"),
|
||||||
volname);
|
volname);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((r = rbd_get_stripe_count(image, stripe_count)) < 0) {
|
if ((r = rbd_get_stripe_count(image, stripe_count)) < 0) {
|
||||||
virReportSystemError(-r, _("failed to get the stripe count of RBD image %s"),
|
virReportSystemError(-r, _("failed to get the stripe count of RBD image %s"),
|
||||||
volname);
|
volname);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Callback function for rbd_diff_iterate() */
|
/* Callback function for rbd_diff_iterate() */
|
||||||
@ -1111,7 +1103,6 @@ virStorageBackendRBDSnapshotCreate(rbd_image_t image,
|
|||||||
char *imgname,
|
char *imgname,
|
||||||
char *snapname)
|
char *snapname)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
int r = -1;
|
int r = -1;
|
||||||
|
|
||||||
VIR_DEBUG("Creating RBD snapshot %s@%s", imgname, snapname);
|
VIR_DEBUG("Creating RBD snapshot %s@%s", imgname, snapname);
|
||||||
@ -1119,13 +1110,10 @@ virStorageBackendRBDSnapshotCreate(rbd_image_t image,
|
|||||||
if ((r = rbd_snap_create(image, snapname)) < 0) {
|
if ((r = rbd_snap_create(image, snapname)) < 0) {
|
||||||
virReportSystemError(-r, _("failed to create RBD snapshot %s@%s"),
|
virReportSystemError(-r, _("failed to create RBD snapshot %s@%s"),
|
||||||
imgname, snapname);
|
imgname, snapname);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1134,7 +1122,6 @@ virStorageBackendRBDSnapshotProtect(rbd_image_t image,
|
|||||||
char *snapname)
|
char *snapname)
|
||||||
{
|
{
|
||||||
int r = -1;
|
int r = -1;
|
||||||
int ret = -1;
|
|
||||||
int protected;
|
int protected;
|
||||||
|
|
||||||
VIR_DEBUG("Querying if RBD snapshot %s@%s is protected", imgname, snapname);
|
VIR_DEBUG("Querying if RBD snapshot %s@%s is protected", imgname, snapname);
|
||||||
@ -1142,7 +1129,7 @@ virStorageBackendRBDSnapshotProtect(rbd_image_t image,
|
|||||||
if ((r = rbd_snap_is_protected(image, snapname, &protected)) < 0) {
|
if ((r = rbd_snap_is_protected(image, snapname, &protected)) < 0) {
|
||||||
virReportSystemError(-r, _("failed to verify if RBD snapshot %s@%s "
|
virReportSystemError(-r, _("failed to verify if RBD snapshot %s@%s "
|
||||||
"is protected"), imgname, snapname);
|
"is protected"), imgname, snapname);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (protected == 0) {
|
if (protected == 0) {
|
||||||
@ -1152,16 +1139,13 @@ virStorageBackendRBDSnapshotProtect(rbd_image_t image,
|
|||||||
if ((r = rbd_snap_protect(image, snapname)) < 0) {
|
if ((r = rbd_snap_protect(image, snapname)) < 0) {
|
||||||
virReportSystemError(-r, _("failed to protect RBD snapshot %s@%s"),
|
virReportSystemError(-r, _("failed to protect RBD snapshot %s@%s"),
|
||||||
imgname, snapname);
|
imgname, snapname);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
VIR_DEBUG("RBD Snapshot %s@%s is already protected", imgname, snapname);
|
VIR_DEBUG("RBD Snapshot %s@%s is already protected", imgname, snapname);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1378,7 +1362,6 @@ virStorageBackendRBDVolWipeDiscard(rbd_image_t image,
|
|||||||
uint64_t stripe_count)
|
uint64_t stripe_count)
|
||||||
{
|
{
|
||||||
int r = -1;
|
int r = -1;
|
||||||
int ret = -1;
|
|
||||||
unsigned long long offset = 0;
|
unsigned long long offset = 0;
|
||||||
unsigned long long length;
|
unsigned long long length;
|
||||||
|
|
||||||
@ -1391,7 +1374,7 @@ virStorageBackendRBDVolWipeDiscard(rbd_image_t image,
|
|||||||
virReportSystemError(-r, _("discarding %llu bytes failed on "
|
virReportSystemError(-r, _("discarding %llu bytes failed on "
|
||||||
"RBD image %s at offset %llu"),
|
"RBD image %s at offset %llu"),
|
||||||
length, imgname, offset);
|
length, imgname, offset);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
VIR_DEBUG("Discarded %llu bytes of RBD image %s at offset %llu",
|
VIR_DEBUG("Discarded %llu bytes of RBD image %s at offset %llu",
|
||||||
@ -1400,10 +1383,7 @@ virStorageBackendRBDVolWipeDiscard(rbd_image_t image,
|
|||||||
offset += length;
|
offset += length;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -68,16 +68,13 @@ virStorageBackendZFSVolModeNeeded(void)
|
|||||||
if ((ret < 0) || (exit_code != 2)) {
|
if ((ret < 0) || (exit_code != 2)) {
|
||||||
VIR_WARN("Command 'zfs get' either failed "
|
VIR_WARN("Command 'zfs get' either failed "
|
||||||
"to run or exited with unexpected status");
|
"to run or exited with unexpected status");
|
||||||
goto cleanup;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strstr(error, " volmode "))
|
if (strstr(error, " volmode "))
|
||||||
ret = 1;
|
return 1;
|
||||||
else
|
else
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -291,7 +288,6 @@ virStorageBackendZFSCreateVol(virStoragePoolObjPtr pool,
|
|||||||
virStorageVolDefPtr vol)
|
virStorageVolDefPtr vol)
|
||||||
{
|
{
|
||||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||||
int ret = -1;
|
|
||||||
int volmode_needed = -1;
|
int volmode_needed = -1;
|
||||||
g_autoptr(virCommand) cmd = NULL;
|
g_autoptr(virCommand) cmd = NULL;
|
||||||
|
|
||||||
@ -311,7 +307,7 @@ virStorageBackendZFSCreateVol(virStoragePoolObjPtr pool,
|
|||||||
|
|
||||||
volmode_needed = virStorageBackendZFSVolModeNeeded();
|
volmode_needed = virStorageBackendZFSVolModeNeeded();
|
||||||
if (volmode_needed < 0)
|
if (volmode_needed < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
/**
|
/**
|
||||||
* $ zfs create -o volmode=dev -V 10240K test/volname
|
* $ zfs create -o volmode=dev -V 10240K test/volname
|
||||||
* $ zfs create -o volmode=dev -s -V 10240K test/volname
|
* $ zfs create -o volmode=dev -s -V 10240K test/volname
|
||||||
@ -342,15 +338,12 @@ virStorageBackendZFSCreateVol(virStoragePoolObjPtr pool,
|
|||||||
virCommandAddArgFormat(cmd, "%s/%s", def->source.name, vol->name);
|
virCommandAddArgFormat(cmd, "%s/%s", def->source.name, vol->name);
|
||||||
|
|
||||||
if (virCommandRun(cmd, NULL) < 0)
|
if (virCommandRun(cmd, NULL) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (virStorageBackendZFSFindVols(pool, vol) < 0)
|
if (virStorageBackendZFSFindVols(pool, vol) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -621,7 +621,6 @@ storageConnectFindStoragePoolSources(virConnectPtr conn,
|
|||||||
{
|
{
|
||||||
int backend_type;
|
int backend_type;
|
||||||
virStorageBackendPtr backend;
|
virStorageBackendPtr backend;
|
||||||
char *ret = NULL;
|
|
||||||
|
|
||||||
if (virConnectFindStoragePoolSourcesEnsureACL(conn) < 0)
|
if (virConnectFindStoragePoolSourcesEnsureACL(conn) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -630,24 +629,21 @@ storageConnectFindStoragePoolSources(virConnectPtr conn,
|
|||||||
if (backend_type < 0) {
|
if (backend_type < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unknown storage pool type %s"), type);
|
_("unknown storage pool type %s"), type);
|
||||||
goto cleanup;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
backend = virStorageBackendForType(backend_type);
|
backend = virStorageBackendForType(backend_type);
|
||||||
if (backend == NULL)
|
if (backend == NULL)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (!backend->findPoolSources) {
|
if (!backend->findPoolSources) {
|
||||||
virReportError(VIR_ERR_NO_SUPPORT,
|
virReportError(VIR_ERR_NO_SUPPORT,
|
||||||
_("pool type '%s' does not support source "
|
_("pool type '%s' does not support source "
|
||||||
"discovery"), type);
|
"discovery"), type);
|
||||||
goto cleanup;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = backend->findPoolSources(srcSpec, flags);
|
return backend->findPoolSources(srcSpec, flags);
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1771,25 +1767,22 @@ storageVolDeleteInternal(virStorageBackendPtr backend,
|
|||||||
bool updateMeta)
|
bool updateMeta)
|
||||||
{
|
{
|
||||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(obj);
|
virStoragePoolDefPtr def = virStoragePoolObjGetDef(obj);
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (!backend->deleteVol) {
|
if (!backend->deleteVol) {
|
||||||
virReportError(VIR_ERR_NO_SUPPORT,
|
virReportError(VIR_ERR_NO_SUPPORT,
|
||||||
"%s", _("storage pool does not support vol deletion"));
|
"%s", _("storage pool does not support vol deletion"));
|
||||||
|
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (backend->deleteVol(obj, voldef, flags) < 0)
|
if (backend->deleteVol(obj, voldef, flags) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
/* The disk backend updated the pool data including removing the
|
/* The disk backend updated the pool data including removing the
|
||||||
* voldef from the pool (for both the deleteVol and the createVol
|
* voldef from the pool (for both the deleteVol and the createVol
|
||||||
* failure path. */
|
* failure path. */
|
||||||
if (def->type == VIR_STORAGE_POOL_DISK) {
|
if (def->type == VIR_STORAGE_POOL_DISK)
|
||||||
ret = 0;
|
return 0;
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Update pool metadata - don't update meta data from error paths
|
/* Update pool metadata - don't update meta data from error paths
|
||||||
* in this module since the allocation/available weren't adjusted yet.
|
* in this module since the allocation/available weren't adjusted yet.
|
||||||
@ -1801,10 +1794,8 @@ storageVolDeleteInternal(virStorageBackendPtr backend,
|
|||||||
}
|
}
|
||||||
|
|
||||||
virStoragePoolObjRemoveVol(obj, voldef);
|
virStoragePoolObjRemoveVol(obj, voldef);
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
cleanup:
|
return 0;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2797,20 +2788,15 @@ static int
|
|||||||
storageConnectStoragePoolEventDeregisterAny(virConnectPtr conn,
|
storageConnectStoragePoolEventDeregisterAny(virConnectPtr conn,
|
||||||
int callbackID)
|
int callbackID)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (virConnectStoragePoolEventDeregisterAnyEnsureACL(conn) < 0)
|
if (virConnectStoragePoolEventDeregisterAnyEnsureACL(conn) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (virObjectEventStateDeregisterID(conn,
|
if (virObjectEventStateDeregisterID(conn,
|
||||||
driver->storageEventState,
|
driver->storageEventState,
|
||||||
callbackID, true) < 0)
|
callbackID, true) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ createRawFile(int fd, virStorageVolDefPtr vol,
|
|||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("cannot extend file '%s'"),
|
_("cannot extend file '%s'"),
|
||||||
vol->target.path);
|
vol->target.path);
|
||||||
goto cleanup;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Avoid issues with older kernel's <linux/fs.h> namespace pollution. */
|
/* Avoid issues with older kernel's <linux/fs.h> namespace pollution. */
|
||||||
@ -356,7 +356,7 @@ createRawFile(int fd, virStorageVolDefPtr vol,
|
|||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("cannot allocate %llu bytes in file '%s'"),
|
_("cannot allocate %llu bytes in file '%s'"),
|
||||||
vol->target.allocation, vol->target.path);
|
vol->target.allocation, vol->target.path);
|
||||||
goto cleanup;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -368,7 +368,7 @@ createRawFile(int fd, virStorageVolDefPtr vol,
|
|||||||
* been able to allocate the required space. */
|
* been able to allocate the required space. */
|
||||||
if ((ret = virStorageBackendCopyToFD(vol, inputvol, fd, &remain,
|
if ((ret = virStorageBackendCopyToFD(vol, inputvol, fd, &remain,
|
||||||
!need_alloc, reflink_copy)) < 0)
|
!need_alloc, reflink_copy)) < 0)
|
||||||
goto cleanup;
|
return ret;
|
||||||
|
|
||||||
/* If the new allocation is greater than the original capacity,
|
/* If the new allocation is greater than the original capacity,
|
||||||
* but fallocate failed, fill the rest with zeroes.
|
* but fallocate failed, fill the rest with zeroes.
|
||||||
@ -381,7 +381,7 @@ createRawFile(int fd, virStorageVolDefPtr vol,
|
|||||||
ret = -errno;
|
ret = -errno;
|
||||||
virReportSystemError(errno, _("cannot fill file '%s'"),
|
virReportSystemError(errno, _("cannot fill file '%s'"),
|
||||||
vol->target.path);
|
vol->target.path);
|
||||||
goto cleanup;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,10 +389,9 @@ createRawFile(int fd, virStorageVolDefPtr vol,
|
|||||||
ret = -errno;
|
ret = -errno;
|
||||||
virReportSystemError(errno, _("cannot sync data to file '%s'"),
|
virReportSystemError(errno, _("cannot sync data to file '%s'"),
|
||||||
vol->target.path);
|
vol->target.path);
|
||||||
goto cleanup;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3747,7 +3746,6 @@ getOldStyleBlockDevice(const char *lun_path G_GNUC_UNUSED,
|
|||||||
char **block_device)
|
char **block_device)
|
||||||
{
|
{
|
||||||
char *blockp = NULL;
|
char *blockp = NULL;
|
||||||
int retval = -1;
|
|
||||||
|
|
||||||
/* old-style; just parse out the sd */
|
/* old-style; just parse out the sd */
|
||||||
if (!(blockp = strrchr(block_name, ':'))) {
|
if (!(blockp = strrchr(block_name, ':'))) {
|
||||||
@ -3755,7 +3753,7 @@ getOldStyleBlockDevice(const char *lun_path G_GNUC_UNUSED,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Failed to parse block name %s"),
|
_("Failed to parse block name %s"),
|
||||||
block_name);
|
block_name);
|
||||||
goto cleanup;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
blockp++;
|
blockp++;
|
||||||
*block_device = g_strdup(blockp);
|
*block_device = g_strdup(blockp);
|
||||||
@ -3763,9 +3761,7 @@ getOldStyleBlockDevice(const char *lun_path G_GNUC_UNUSED,
|
|||||||
VIR_DEBUG("Block device is '%s'", *block_device);
|
VIR_DEBUG("Block device is '%s'", *block_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user