mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 04:55:18 +00:00
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: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
10f5ad9b58
commit
7824bb8548
@ -1449,17 +1449,8 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
||||
virBufferAddLit(&opt, "if=none");
|
||||
virBufferAsprintf(&opt, ",id=%s", drivealias);
|
||||
} else {
|
||||
int idx = 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);
|
||||
virBufferAsprintf(&opt, "if=sd,index=%d",
|
||||
virDiskNameToIndex(disk->dst));
|
||||
}
|
||||
|
||||
/* werror/rerror are really frontend attributes, but older
|
||||
|
Loading…
x
Reference in New Issue
Block a user