Use storage path if disks don't have valid serial numbers

Some disk devices (virtio) don't have serial numbers by default.
This breaks curtin which requires a serial or a path to uniquely
find the target disks.  Add a fallback to device path if the
current device includes the eye catcher 'Unknown Serial' which
is set by probert for devices that do not have a serial number.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
This commit is contained in:
Ryan Harper 2015-10-21 09:28:51 -05:00
parent 8a9b38fb7d
commit b5bea5110f
1 changed files with 6 additions and 0 deletions

View File

@ -115,6 +115,12 @@ class DiskAction():
}
if self._wipe:
action.update({'wipe': self._wipe})
# if we don't have a valid serial, then we must use
# device path, which is stored in action_id
if self._serial in ['Unknown Serial']:
del action['serial']
action.update({'path': '/dev/{}'.format(self.action_id)})
return action
def dump(self):