提交 7824bb85 编写于 作者: P Peter Krempa

qemuBuildDriveStr: Refactor formatting of command line for 'sd' cards

Remove all the universal code since the 'else' part formats commandline
only for the SD card based disk. Note that we can use virDiskNameToIndex
without the check as we already validate that 'disk->dst' contains a
properly formatted string in the validation code.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 10f5ad9b
...@@ -1449,17 +1449,8 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, ...@@ -1449,17 +1449,8 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
virBufferAddLit(&opt, "if=none"); virBufferAddLit(&opt, "if=none");
virBufferAsprintf(&opt, ",id=%s", drivealias); virBufferAsprintf(&opt, ",id=%s", drivealias);
} else { } else {
int idx = virDiskNameToIndex(disk->dst); virBufferAsprintf(&opt, "if=sd,index=%d",
virDiskNameToIndex(disk->dst));
if (idx < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported disk type '%s'"), disk->dst);
return NULL;
}
virBufferAsprintf(&opt, "if=%s",
virDomainDiskQEMUBusTypeToString(disk->bus));
virBufferAsprintf(&opt, ",index=%d", idx);
} }
/* werror/rerror are really frontend attributes, but older /* werror/rerror are really frontend attributes, but older
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册