提交 ce943935 编写于 作者: D Daniel Veillard

Fix creating and cleaning up logical volumes if a target path is specified

* src/storage_backend_logical.c: Patch from Cole Robinson, fix
  creating and cleaning up logical volumes if a target path is
  specified.
Daniel
上级 ace1b6bf
Wed Aug 20 15:31:47 CEST 2008 Daniel Veillard <veillard@redhat.com>
* src/storage_backend_logical.c: Patch from Cole Robinson, fix
creating and cleaning up logical volumes if a target path is
specified.
Wed Aug 20 15:18:54 CEST 2008 Daniel Veillard <veillard@redhat.com>
* src/parthelper.c: Patch from Cole Robinson, fix size reporting for
......
......@@ -453,6 +453,19 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
snprintf(size, sizeof(size)-1, "%lluK", vol->capacity/1024);
size[sizeof(size)-1] = '\0';
if (vol->target.path != NULL) {
/* A target path passed to CreateVol has no meaning */
VIR_FREE(vol->target.path);
}
if (VIR_ALLOC_N(vol->target.path, strlen(pool->def->target.path) +
1 + strlen(vol->name) + 1) < 0) {
virStorageReportError(conn, VIR_ERR_NO_MEMORY, "%s", _("volume"));
return -1;
}
strcpy(vol->target.path, pool->def->target.path);
strcat(vol->target.path, "/");
strcat(vol->target.path, vol->name);
if (virRun(conn, cmdargv, NULL) < 0)
return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册