提交 b7feabbf 编写于 作者: M Michal Privoznik

qemuDomainNamespaceSetupDisk: Simplify disk check

Firstly, instead of checking for next->path the
virStorageSourceIsEmpty() function should be used which also
takes disk type into account.
Secondly, not every disk source passed has the correct type set
(due to our laziness). Therefore, instead of checking for
virStorageSourceIsBlockLocal() and also S_ISBLK() the former can
be refined to just virStorageSourceIsLocalStorage().
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 786d8d91
......@@ -7912,7 +7912,8 @@ qemuDomainNamespaceSetupDisk(virQEMUDriverPtr driver,
return 0;
for (next = src; next; next = next->backingStore) {
if (!next->path || !virStorageSourceIsBlockLocal(src)) {
if (virStorageSourceIsEmpty(next) ||
!virStorageSourceIsLocalStorage(next)) {
/* Not creating device. Just continue. */
continue;
}
......@@ -7923,12 +7924,8 @@ qemuDomainNamespaceSetupDisk(virQEMUDriverPtr driver,
goto cleanup;
}
if (!S_ISBLK(sb.st_mode)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Disk source %s must be a block device"),
next->path);
goto cleanup;
}
if (!S_ISBLK(sb.st_mode))
continue;
if (qemuDomainAttachDeviceMknod(driver,
vm,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册