Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
21aad98c
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看板
提交
21aad98c
编写于
4月 20, 2016
作者:
P
Peter Krempa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
conf: disk: Extract disk type and device right away
Additionally switch to using a common temp variable for the xml elements.
上级
5211c907
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
24 deletion
+20
-24
src/conf/domain_conf.c
src/conf/domain_conf.c
+20
-24
未找到文件。
src/conf/domain_conf.c
浏览文件 @
21aad98c
...
...
@@ -7042,8 +7042,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr sourceNode = NULL;
xmlNodePtr cur;
xmlNodePtr save_ctxt = ctxt->node;
char *type = NULL;
char *device = NULL;
char *tmp = NULL;
char *snapshot = NULL;
char *rawio = NULL;
char *sgio = NULL;
...
...
@@ -7071,16 +7070,25 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
ctxt->node = node;
type = virXMLPropString(node, "type");
if (type) {
if ((def->src->type = virStorageTypeFromString(type)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown disk type '%s'"), type);
goto error;
}
} else {
def->src->type = VIR_STORAGE_TYPE_FILE
;
/* defaults */
def->src->type = VIR_STORAGE_TYPE_FILE;
def->device = VIR_DOMAIN_DISK_DEVICE_DISK;
if ((tmp = virXMLPropString(node, "type")) &&
(def->src->type = virStorageTypeFromString(tmp)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown disk type '%s'"), tmp);
goto error
;
}
VIR_FREE(tmp);
if ((tmp = virXMLPropString(node, "device")) &&
(def->device = virDomainDiskDeviceTypeFromString(tmp)) < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown disk device '%s'"), tmp);
goto error;
}
VIR_FREE(tmp);
snapshot = virXMLPropString(node, "snapshot");
...
...
@@ -7245,16 +7253,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error;
}
device = virXMLPropString(node, "device");
if (device) {
if ((def->device = virDomainDiskDeviceTypeFromString(device)) < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown disk device '%s'"), device);
goto error;
}
} else {
def->device = VIR_DOMAIN_DISK_DEVICE_DISK;
}
/* Only CDROM and Floppy devices are allowed missing source path
* to indicate no media present. LUN is for raw access CD-ROMs
...
...
@@ -7283,7 +7281,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
if (!target && !(flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)) {
if (def->src->srcpool) {
char *tmp;
if (virAsprintf(&tmp, "pool = '%s', volume = '%s'",
def->src->srcpool->pool, def->src->srcpool->volume) < 0)
goto error;
...
...
@@ -7502,15 +7499,14 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error;
cleanup:
VIR_FREE(tmp);
VIR_FREE(bus);
VIR_FREE(type);
VIR_FREE(snapshot);
VIR_FREE(rawio);
VIR_FREE(sgio);
VIR_FREE(target);
VIR_FREE(tray);
VIR_FREE(removable);
VIR_FREE(device);
virStorageAuthDefFree(authdef);
VIR_FREE(devaddr);
VIR_FREE(serial);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录