Skip to content

vmedia_get_existing_uri() does not handle missing ending "/" for CommVMediaMap: remote_share property on M7 #257

@mikeslowik

Description

@mikeslowik

return [vmedia.mapping_status for vmedia in vmedias]

Apparently on M7 the CommVMediaMap Managed Object does not store ending / for remote_share property:

Managed Object                  :       CommVMediaMap
--------------
admin_action                    :no-op
child_action                    :None
dn                              :sys/svc-ext/vmedia-svc/vmmap-192.168.100.100_1732055105.3979845.iso
drive_type                      :None
map                             :www
mapping_status                  :OK
mount_options                   :noauto
password                        :
remote_file                     :192.168.100.100_1732055105.3979845.iso
remote_share                    :http://192.168.100.2/iso
rn                              :vmmap-192.168.100.100_1732055105.3979845.iso
status                          :None
username                        :None
volume_name                     :192.168.100.100_1732055105.3979845.iso 

Example from M5:

Managed Object			:	CommVMediaMap
--------------
admin_action                    :no-op
child_action                    :None
dn                              :sys/svc-ext/vmedia-svc/vmmap-192.168.100.100_1674818398.237378.iso
drive_type                      :None
map                             :www
mapping_status                  :OK
mount_options                   :noauto
password                        :
remote_file                     :192.168.100.100_1674818398.237378.iso
remote_share                    :http://192.168.100.2/custom-iso/
rn                              :vmmap-192.168.100.100_1674818398.237378.iso
status                          :None
username                        :None
volume_name                     :192.168.100.100_1674818398.237378.iso 

Hence simple string concatenation vmedia.remote_share + vmedia.remote_file does not render a valid URI.

Possible solution has been tested successfully on both - M7 and older models:

def vmedia_get_existing_uri(handle, server_id=1):
    """
    This method will return list of URIs of existing mountd media
    Args:
        handle (ImcHandle)
        server_id (int): Server Id to be specified for C3260 platforms

    Returns:
        List of URIs of currently mounted virtual media

    Examples:
        vmedia_get_existing_uri(handle)
    """
    # Create list of URIs of all current virtually mapped ISOs

    vmedias = handle.query_children(in_dn=_get_vmedia_mo_dn(handle, server_id))
    uris = []
    for vmedia in vmedias:
        if not vmedia.remote_share.endswith('/'):
            vmedia.remote_share += '/'
        uri = vmedia.remote_share + vmedia.remote_file
        uris.append(uri)
    return uris

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions