mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
devices: disk: Remove dead code in get_target_prefix
The goal of this was to handle the case of a new libvirt bus that we didn't know the prefix for. I suspect all new buses will in practice use the 'sd' prefix, so this will never trigger Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
519fed3b91
commit
d46b89ec09
@ -802,7 +802,7 @@ class DeviceDisk(Device):
|
||||
return ret
|
||||
|
||||
|
||||
def get_target_prefix(self, used_targets=None):
|
||||
def get_target_prefix(self):
|
||||
"""
|
||||
Returns the suggested disk target prefix (hd, xvd, sd ...) for the
|
||||
disk.
|
||||
@ -828,18 +828,10 @@ class DeviceDisk(Device):
|
||||
return _return("fd")
|
||||
elif self.bus == "ide":
|
||||
return _return("hd")
|
||||
elif self.bus or not used_targets:
|
||||
# sata, scsi, usb, sd
|
||||
return _return("sd")
|
||||
|
||||
# If guest already has some disks defined
|
||||
preforder = ["vd", "xvd", "sd", "hd"]
|
||||
for pref in preforder:
|
||||
for target in used_targets:
|
||||
if target.startswith(pref):
|
||||
return _return(pref)
|
||||
# sata, scsi, usb, sd
|
||||
return _return("sd")
|
||||
|
||||
|
||||
def generate_target(self, skip_targets):
|
||||
"""
|
||||
Generate target device ('hda', 'sdb', etc..) for disk, excluding
|
||||
@ -849,7 +841,7 @@ class DeviceDisk(Device):
|
||||
:param skip_targets: list of targets to exclude
|
||||
:returns: generated target
|
||||
"""
|
||||
prefix, maxnode = self.get_target_prefix(skip_targets)
|
||||
prefix, maxnode = self.get_target_prefix()
|
||||
skip_targets = [t for t in skip_targets if t and t.startswith(prefix)]
|
||||
skip_targets.sort()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user