Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
bf26cd8e
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
bf26cd8e
编写于
9月 16, 2008
作者:
C
Cole Robinson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement disk volume deleting.
上级
a82bd078
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
61 addition
and
13 deletion
+61
-13
ChangeLog
ChangeLog
+4
-0
src/storage_backend_disk.c
src/storage_backend_disk.c
+57
-13
未找到文件。
ChangeLog
浏览文件 @
bf26cd8e
Tue Sep 16 12:43:00 EST 2008 Cole Robinson <crobinso@redhat.com>
* src/storack_backend_disk.c: Implement disk volume delete
Tue Sep 9 09:50:00 EST 2008 Cole Robinson <crobinso@redhat.com>
* src/xend_internal.c: fix reading vncdisplay from xend domain
...
...
src/storage_backend_disk.c
浏览文件 @
bf26cd8e
...
...
@@ -22,12 +22,16 @@
*/
#include <config.h>
#include <string.h>
#include "internal.h"
#include "storage_backend_disk.h"
#include "util.h"
#include "memory.h"
#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
enum
{
VIR_STORAGE_POOL_DISK_DOS
=
0
,
VIR_STORAGE_POOL_DISK_DVH
,
...
...
@@ -419,13 +423,6 @@ virStorageBackendDiskBuildPool(virConnectPtr conn,
return
0
;
}
static
int
virStorageBackendDiskDeleteVol
(
virConnectPtr
conn
,
virStoragePoolObjPtr
pool
,
virStorageVolDefPtr
vol
,
unsigned
int
flags
);
static
int
virStorageBackendDiskCreateVol
(
virConnectPtr
conn
,
virStoragePoolObjPtr
pool
,
...
...
@@ -489,14 +486,61 @@ virStorageBackendDiskCreateVol(virConnectPtr conn,
static
int
virStorageBackendDiskDeleteVol
(
virConnectPtr
conn
,
virStoragePoolObjPtr
pool
ATTRIBUTE_UNUSED
,
virStorageVolDefPtr
vol
ATTRIBUTE_UNUSED
,
virStoragePoolObjPtr
pool
,
virStorageVolDefPtr
vol
,
unsigned
int
flags
ATTRIBUTE_UNUSED
)
{
/* delete a partition */
virStorageReportError
(
conn
,
VIR_ERR_NO_SUPPORT
,
_
(
"Disk pools are not yet supported"
));
return
-
1
;
char
*
part_num
=
NULL
;
int
n
;
char
devpath
[
PATH_MAX
];
char
*
devname
,
*
srcname
;
if
((
n
=
readlink
(
vol
->
target
.
path
,
devpath
,
sizeof
(
devpath
)))
<
0
&&
errno
!=
EINVAL
)
{
virStorageReportError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"Couldn't read volume target path '%s'. %s"
),
vol
->
target
.
path
,
strerror
(
errno
));
return
-
1
;
}
else
if
(
n
<=
0
)
{
strncpy
(
devpath
,
vol
->
target
.
path
,
PATH_MAX
);
}
else
{
devpath
[
n
]
=
'\0'
;
}
devname
=
basename
(
devpath
);
srcname
=
basename
(
pool
->
def
->
source
.
devices
[
0
].
path
);
DEBUG
(
"devname=%s, srcname=%s"
,
devname
,
srcname
);
if
(
!
STRPREFIX
(
devname
,
srcname
))
{
virStorageReportError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"Volume path '%s' did not start with parent "
"pool source device name."
),
devname
);
return
-
1
;
}
part_num
=
devname
+
strlen
(
srcname
);
if
(
!
part_num
)
{
virStorageReportError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"cannot parse partition number from target "
"'%s'"
),
devname
);
return
-
1
;
}
/* eg parted /dev/sda rm 2 */
const
char
*
prog
[]
=
{
PARTED
,
pool
->
def
->
source
.
devices
[
0
].
path
,
"rm"
,
"--script"
,
part_num
,
NULL
,
};
if
(
virRun
(
conn
,
prog
,
NULL
)
<
0
)
return
-
1
;
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录