ds-identify doesn't properly detect ISO
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
High
|
Scott Moser |
Bug Description
I have a proper ISO image mounted for my virtual machine but still 'ds-identify' doesn't properly detect OVF datasource in my virtual machine. On further investigation, found a minor issue with 'read_fs_info()' function in ds-identify.
#######
In read_fs_info()
out=$(blkid -c /dev/null -o export) || {
ret=$?
error "failed running [$ret]: blkid -c /dev/null -o export"
return $ret
}
IFS="$CR"
set -- $out
IFS="$oifs"
for line in "$@" ""; do
case "${line}" in
TYPE=*) ftype=$
"") if [ "$ftype" = "iso9660" ]; then
fi
esac
done
This function parses the output for blkid and then sets the 'isodevs' _only_ when there is a proper blank line detected between the entry blocks.
#######
Inside the virtual machine:
$ sudo blkid -c /dev/null -o export
DEVNAME=/dev/sr0
UUID=2009-
LABEL=OVF\ Customization
TYPE=iso9660
DEVNAME=/dev/sda1
UUID=2f09aea2-
TYPE=ext4
PARTUUID=
It seems the blank line is not detected. Logging a bug to fix read_fs_info to properly parse the output of blkid.
Please let me know if any other information is required.
Thanks
Sankar.
Related branches
- Server Team CI bot: Approve (continuous-integration)
- Scott Moser: Pending requested
-
Diff: 814 lines (+371/-90)15 files modifiedChangeLog (+52/-0)
cloudinit/cmd/tests/test_clean.py (+2/-1)
cloudinit/cmd/tests/test_status.py (+2/-1)
cloudinit/sources/DataSourceOVF.py (+16/-5)
cloudinit/tests/helpers.py (+9/-11)
cloudinit/version.py (+1/-1)
config/cloud.cfg.tmpl (+2/-0)
debian/changelog (+16/-0)
tests/cloud_tests/collect.py (+3/-2)
tests/cloud_tests/platforms/lxd/instance.py (+106/-26)
tests/unittests/test_ds_identify.py (+40/-3)
tests/unittests/test_handler/test_schema.py (+7/-5)
tools/ds-identify (+34/-19)
tools/run-centos (+78/-13)
tox.ini (+3/-3)
- Chad Smith: Approve
- Server Team CI bot: Approve (continuous-integration)
-
Diff: 99 lines (+27/-21)2 files modifiedtests/unittests/test_ds_identify.py (+6/-3)
tools/ds-identify (+21/-18)
Changed in cloud-init: | |
assignee: | nobody → Scott Moser (smoser) |
status: | New → Fix Committed |
importance: | Undecided → High |
milestone: | none → 18.1 |
> From the output of blkid in my virtual machine.
DEVNAME=/dev/sr0 04-20-15- 30-24-00
UUID=2009-
LABEL=OVF\ Customization
TYPE=iso9660
TYPE is printed at the end. And after that, no other entries were printed for 'ISO'. In the output, if
1. TYPE was displayed before UUID or
2. PARTUUID (not present now) was displayed after TYPE
the ds-identify would have detected 'OVF'.
So, the main issue is 'ds-identify' doesn't detect OVF if 'TYPE=iso9660' is the last line printed for a block device in blkid.