提交 e76a848e 编写于 作者: P Peter Krempa

conf: Extract code that checks disk serial/wwn conflict

Put it into a separate function that can be called on two disk def
pointers.
上级 9e92a0b4
无相关合并请求
...@@ -23988,6 +23988,28 @@ virDomainDefNeedsPlacementAdvice(virDomainDefPtr def) ...@@ -23988,6 +23988,28 @@ virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
} }
static int
virDomainDiskDefCheckDuplicateInfo(virDomainDiskDefPtr a,
virDomainDiskDefPtr b)
{
if (a->wwn && b->wwn && STREQ(a->wwn, b->wwn)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Disks '%s' and '%s' have identical WWN"),
a->dst, b->dst);
return -1;
}
if (a->serial && b->serial && STREQ(a->serial, b->serial)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Disks '%s' and '%s' have identical serial"),
a->dst, b->dst);
return -1;
}
return 0;
}
int int
virDomainDefCheckDuplicateDiskInfo(virDomainDefPtr def) virDomainDefCheckDuplicateDiskInfo(virDomainDefPtr def)
{ {
...@@ -23997,25 +24019,9 @@ virDomainDefCheckDuplicateDiskInfo(virDomainDefPtr def) ...@@ -23997,25 +24019,9 @@ virDomainDefCheckDuplicateDiskInfo(virDomainDefPtr def)
for (i = 0; i < def->ndisks; i++) { for (i = 0; i < def->ndisks; i++) {
if (def->disks[i]->wwn || def->disks[i]->serial) { if (def->disks[i]->wwn || def->disks[i]->serial) {
for (j = i + 1; j < def->ndisks; j++) { for (j = i + 1; j < def->ndisks; j++) {
if (def->disks[i]->wwn && if (virDomainDiskDefCheckDuplicateInfo(def->disks[i],
STREQ_NULLABLE(def->disks[i]->wwn, def->disks[j]) < 0)
def->disks[j]->wwn)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Disks '%s' and '%s' have identical WWN"),
def->disks[i]->dst,
def->disks[j]->dst);
return -1; return -1;
}
if (def->disks[i]->serial &&
STREQ_NULLABLE(def->disks[i]->serial,
def->disks[j]->serial)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Disks '%s' and '%s' have identical serial"),
def->disks[i]->dst,
def->disks[j]->dst);
return -1;
}
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部