Skip to content

Commit

Permalink
OVF: identify label iso9660 filesystems with label 'OVF ENV'.
Browse files Browse the repository at this point in the history
When deploying an OVA, at least some versions of vmware
attach a cdrom with an ISO9660 filesystem label of 'OVF ENV'.
This was seen on Vmware vCenter Server, 6.0.0, 2776510.

In order to accomplish this we had to change the content of
the DI_ISO9660_DEVS variable to be comma delimited rather
than space delimited.
  • Loading branch information
smoser authored and Server Team CI Bot committed Nov 27, 2018
1 parent e9d57b8 commit 530850f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/unittests/test_ds_identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ def test_ovf_on_vmware_iso_found_by_cdrom_with_matching_fs_label(self):

# Add recognized labels
valid_ovf_labels = ['ovf-transport', 'OVF-TRANSPORT',
"OVFENV", "ovfenv"]
"OVFENV", "ovfenv", "OVF ENV", "ovf env"]
for valid_ovf_label in valid_ovf_labels:
ovf_cdrom_by_label['mocks'][0]['out'] = blkid_out([
{'DEVNAME': 'sda1', 'TYPE': 'ext4', 'LABEL': 'rootfs'},
Expand Down
17 changes: 11 additions & 6 deletions tools/ds-identify
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ read_fs_info() {
case "${line}" in
DEVNAME=*)
[ -n "$dev" -a "$ftype" = "iso9660" ] &&
isodevs="${isodevs} ${dev}=$label"
isodevs="${isodevs},${dev}=$label"
ftype=""; dev=""; label="";
dev=${line#DEVNAME=};;
LABEL=*) label="${line#LABEL=}";
Expand All @@ -247,11 +247,11 @@ read_fs_info() {
esac
done
[ -n "$dev" -a "$ftype" = "iso9660" ] &&
isodevs="${isodevs} ${dev}=$label"
isodevs="${isodevs},${dev}=$label"

DI_FS_LABELS="${labels%${delim}}"
DI_FS_UUIDS="${uuids%${delim}}"
DI_ISO9660_DEVS="${isodevs# }"
DI_ISO9660_DEVS="${isodevs#,}"
}

cached() {
Expand Down Expand Up @@ -735,9 +735,10 @@ is_cdrom_ovf() {
return 1;;
esac

debug 1 "got label=$label"
# fast path known 'OVF' labels
case "$label" in
OVF-TRANSPORT|ovf-transport|OVFENV|ovfenv) return 0;;
OVF-TRANSPORT|ovf-transport|OVFENV|ovfenv|OVF\ ENV|ovf\ env) return 0;;
esac

# explicitly skip known labels of other types. rd_rdfe is azure.
Expand All @@ -757,9 +758,13 @@ dscheck_OVF() {
# Azure provides ovf. Skip false positive by dis-allowing.
is_azure_chassis && return $DS_NOT_FOUND

# DI_ISO9660_DEVS is <device>=label, like /dev/sr0=OVF-TRANSPORT
# DI_ISO9660_DEVS is <device>=label,<device>=label2
# like /dev/sr0=OVF-TRANSPORT,/dev/other=with spaces
if [ "${DI_ISO9660_DEVS#${UNAVAILABLE}:}" = "${DI_ISO9660_DEVS}" ]; then
for tok in ${DI_ISO9660_DEVS}; do
local oifs="$IFS"
# shellcheck disable=2086
{ IFS=","; set -- ${DI_ISO9660_DEVS}; IFS="$oifs"; }
for tok in "$@"; do
is_cdrom_ovf "${tok%%=*}" "${tok#*=}" && return $DS_FOUND
done
fi
Expand Down

0 comments on commit 530850f

Please sign in to comment.