Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
5fce412d
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看板
提交
5fce412d
编写于
4月 12, 2016
作者:
P
Peter Krempa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
conf: disk: Extract iotune parsing into a separate func
上级
65da41de
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
163 addition
and
149 deletion
+163
-149
src/conf/domain_conf.c
src/conf/domain_conf.c
+163
-149
未找到文件。
src/conf/domain_conf.c
浏览文件 @
5fce412d
...
...
@@ -6681,6 +6681,168 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
}
static int
virDomainDiskDefIotuneParse(virDomainDiskDefPtr def,
xmlXPathContextPtr ctxt)
{
int ret;
ret = virXPathULongLong("string(./iotune/total_bytes_sec)",
ctxt,
&def->blkdeviotune.total_bytes_sec);
if (ret == -2) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("total throughput limit must be an integer"));
goto error;
} else if (ret < 0) {
def->blkdeviotune.total_bytes_sec = 0;
}
ret = virXPathULongLong("string(./iotune/read_bytes_sec)",
ctxt,
&def->blkdeviotune.read_bytes_sec);
if (ret == -2) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("read throughput limit must be an integer"));
goto error;
} else if (ret < 0) {
def->blkdeviotune.read_bytes_sec = 0;
}
ret = virXPathULongLong("string(./iotune/write_bytes_sec)",
ctxt,
&def->blkdeviotune.write_bytes_sec);
if (ret == -2) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("write throughput limit must be an integer"));
goto error;
} else if (ret < 0) {
def->blkdeviotune.write_bytes_sec = 0;
}
ret = virXPathULongLong("string(./iotune/total_iops_sec)",
ctxt,
&def->blkdeviotune.total_iops_sec);
if (ret == -2) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("total I/O operations limit must be an integer"));
goto error;
} else if (ret < 0) {
def->blkdeviotune.total_iops_sec = 0;
}
ret = virXPathULongLong("string(./iotune/read_iops_sec)",
ctxt,
&def->blkdeviotune.read_iops_sec);
if (ret == -2) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("read I/O operations limit must be an integer"));
goto error;
} else if (ret < 0) {
def->blkdeviotune.read_iops_sec = 0;
}
ret = virXPathULongLong("string(./iotune/write_iops_sec)",
ctxt,
&def->blkdeviotune.write_iops_sec);
if (ret == -2) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("write I/O operations limit must be an integer"));
goto error;
} else if (ret < 0) {
def->blkdeviotune.write_iops_sec = 0;
}
if (virXPathULongLong("string(./iotune/total_bytes_sec_max)",
ctxt,
&def->blkdeviotune.total_bytes_sec_max) < 0) {
def->blkdeviotune.total_bytes_sec_max = 0;
}
if (virXPathULongLong("string(./iotune/read_bytes_sec_max)",
ctxt,
&def->blkdeviotune.read_bytes_sec_max) < 0) {
def->blkdeviotune.read_bytes_sec_max = 0;
}
if (virXPathULongLong("string(./iotune/write_bytes_sec_max)",
ctxt,
&def->blkdeviotune.write_bytes_sec_max) < 0) {
def->blkdeviotune.write_bytes_sec_max = 0;
}
if (virXPathULongLong("string(./iotune/total_iops_sec_max)",
ctxt,
&def->blkdeviotune.total_iops_sec_max) < 0) {
def->blkdeviotune.total_iops_sec_max = 0;
}
if (virXPathULongLong("string(./iotune/read_iops_sec_max)",
ctxt,
&def->blkdeviotune.read_iops_sec_max) < 0) {
def->blkdeviotune.read_iops_sec_max = 0;
}
if (virXPathULongLong("string(./iotune/write_iops_sec_max)",
ctxt,
&def->blkdeviotune.write_iops_sec_max) < 0) {
def->blkdeviotune.write_iops_sec_max = 0;
}
if (virXPathULongLong("string(./iotune/size_iops_sec)",
ctxt,
&def->blkdeviotune.size_iops_sec) < 0) {
def->blkdeviotune.size_iops_sec = 0;
}
if ((def->blkdeviotune.total_bytes_sec &&
def->blkdeviotune.read_bytes_sec) ||
(def->blkdeviotune.total_bytes_sec &&
def->blkdeviotune.write_bytes_sec)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("total and read/write bytes_sec "
"cannot be set at the same time"));
goto error;
}
if ((def->blkdeviotune.total_iops_sec &&
def->blkdeviotune.read_iops_sec) ||
(def->blkdeviotune.total_iops_sec &&
def->blkdeviotune.write_iops_sec)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("total and read/write iops_sec "
"cannot be set at the same time"));
goto error;
}
if ((def->blkdeviotune.total_bytes_sec_max &&
def->blkdeviotune.read_bytes_sec_max) ||
(def->blkdeviotune.total_bytes_sec_max &&
def->blkdeviotune.write_bytes_sec_max)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("total and read/write bytes_sec_max "
"cannot be set at the same time"));
goto error;
}
if ((def->blkdeviotune.total_iops_sec_max &&
def->blkdeviotune.read_iops_sec_max) ||
(def->blkdeviotune.total_iops_sec_max &&
def->blkdeviotune.write_iops_sec_max)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("total and read/write iops_sec_max "
"cannot be set at the same time"));
goto error;
}
return 0;
error:
return ret;
}
#define VENDOR_LEN 8
#define PRODUCT_LEN 16
...
...
@@ -6737,7 +6899,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
char *domain_name = NULL;
int expected_secret_usage = -1;
int auth_secret_usage = -1;
int ret = 0;
if (!(def = virDomainDiskDefNew(xmlopt)))
return NULL;
...
...
@@ -6969,155 +7130,8 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error;
}
} else if (xmlStrEqual(cur->name, BAD_CAST "iotune")) {
ret = virXPathULongLong("string(./iotune/total_bytes_sec)",
ctxt,
&def->blkdeviotune.total_bytes_sec);
if (ret == -2) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("total throughput limit must be an integer"));
goto error;
} else if (ret < 0) {
def->blkdeviotune.total_bytes_sec = 0;
}
ret = virXPathULongLong("string(./iotune/read_bytes_sec)",
ctxt,
&def->blkdeviotune.read_bytes_sec);
if (ret == -2) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("read throughput limit must be an integer"));
goto error;
} else if (ret < 0) {
def->blkdeviotune.read_bytes_sec = 0;
}
ret = virXPathULongLong("string(./iotune/write_bytes_sec)",
ctxt,
&def->blkdeviotune.write_bytes_sec);
if (ret == -2) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("write throughput limit must be an integer"));
goto error;
} else if (ret < 0) {
def->blkdeviotune.write_bytes_sec = 0;
}
ret = virXPathULongLong("string(./iotune/total_iops_sec)",
ctxt,
&def->blkdeviotune.total_iops_sec);
if (ret == -2) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("total I/O operations limit must be an integer"));
goto error;
} else if (ret < 0) {
def->blkdeviotune.total_iops_sec = 0;
}
ret = virXPathULongLong("string(./iotune/read_iops_sec)",
ctxt,
&def->blkdeviotune.read_iops_sec);
if (ret == -2) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("read I/O operations limit must be an integer"));
goto error;
} else if (ret < 0) {
def->blkdeviotune.read_iops_sec = 0;
}
ret = virXPathULongLong("string(./iotune/write_iops_sec)",
ctxt,
&def->blkdeviotune.write_iops_sec);
if (ret == -2) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("write I/O operations limit must be an integer"));
if (virDomainDiskDefIotuneParse(def, ctxt) < 0)
goto error;
} else if (ret < 0) {
def->blkdeviotune.write_iops_sec = 0;
}
if (virXPathULongLong("string(./iotune/total_bytes_sec_max)",
ctxt,
&def->blkdeviotune.total_bytes_sec_max) < 0) {
def->blkdeviotune.total_bytes_sec_max = 0;
}
if (virXPathULongLong("string(./iotune/read_bytes_sec_max)",
ctxt,
&def->blkdeviotune.read_bytes_sec_max) < 0) {
def->blkdeviotune.read_bytes_sec_max = 0;
}
if (virXPathULongLong("string(./iotune/write_bytes_sec_max)",
ctxt,
&def->blkdeviotune.write_bytes_sec_max) < 0) {
def->blkdeviotune.write_bytes_sec_max = 0;
}
if (virXPathULongLong("string(./iotune/total_iops_sec_max)",
ctxt,
&def->blkdeviotune.total_iops_sec_max) < 0) {
def->blkdeviotune.total_iops_sec_max = 0;
}
if (virXPathULongLong("string(./iotune/read_iops_sec_max)",
ctxt,
&def->blkdeviotune.read_iops_sec_max) < 0) {
def->blkdeviotune.read_iops_sec_max = 0;
}
if (virXPathULongLong("string(./iotune/write_iops_sec_max)",
ctxt,
&def->blkdeviotune.write_iops_sec_max) < 0) {
def->blkdeviotune.write_iops_sec_max = 0;
}
if (virXPathULongLong("string(./iotune/size_iops_sec)",
ctxt,
&def->blkdeviotune.size_iops_sec) < 0) {
def->blkdeviotune.size_iops_sec = 0;
}
if ((def->blkdeviotune.total_bytes_sec &&
def->blkdeviotune.read_bytes_sec) ||
(def->blkdeviotune.total_bytes_sec &&
def->blkdeviotune.write_bytes_sec)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("total and read/write bytes_sec "
"cannot be set at the same time"));
goto error;
}
if ((def->blkdeviotune.total_iops_sec &&
def->blkdeviotune.read_iops_sec) ||
(def->blkdeviotune.total_iops_sec &&
def->blkdeviotune.write_iops_sec)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("total and read/write iops_sec "
"cannot be set at the same time"));
goto error;
}
if ((def->blkdeviotune.total_bytes_sec_max &&
def->blkdeviotune.read_bytes_sec_max) ||
(def->blkdeviotune.total_bytes_sec_max &&
def->blkdeviotune.write_bytes_sec_max)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("total and read/write bytes_sec_max "
"cannot be set at the same time"));
goto error;
}
if ((def->blkdeviotune.total_iops_sec_max &&
def->blkdeviotune.read_iops_sec_max) ||
(def->blkdeviotune.total_iops_sec_max &&
def->blkdeviotune.write_iops_sec_max)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("total and read/write iops_sec_max "
"cannot be set at the same time"));
goto error;
}
} else if (xmlStrEqual(cur->name, BAD_CAST "readonly")) {
def->src->readonly = true;
} else if (xmlStrEqual(cur->name, BAD_CAST "shareable")) {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录