mkvdiskhostmap should use the force flag with multihostmap

Bug #1511751 reported by Gerald McBrearty
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Medium
Gerald McBrearty

Bug Description

The mkvdiskhostmap method is inefficient for volumes that will be mapped to multiple host entries on the back-end
When multihostmap is true is calls off to the svc sees if it fails and only then add the '-force' option
    def mkvdiskhostmap(self, host, vdisk, lun, multihostmap):
        """Map vdisk to host.

        If vdisk already mapped and multihostmap is True, use the force flag.
        """
        ssh_cmd = ['svctask', 'mkvdiskhostmap', '-host', '"%s"' % host,
                   '-scsi', lun, vdisk]
        out, err = self._ssh(ssh_cmd, check_exit_code=False)
        if 'successfully created' in out:
            return
        if not err:
            msg = (_('Did not find success message nor error for %(fun)s: '
                     '%(out)s') % {'out': out, 'fun': ssh_cmd})
            raise exception.VolumeBackendAPIException(data=msg)
        if err.startswith('CMMVC6071E'):
            if not multihostmap:
                LOG.error(_LE('storwize_svc_multihostmap_enabled is set '
                              'to False, not allowing multi host mapping.'))
                msg = 'CMMVC6071E The VDisk-to-host mapping '\
                      'was not created because the VDisk is '\
                      'already mapped to a host.\n"'
                raise exception.VolumeDriverException(message=msg)

        ssh_cmd.insert(ssh_cmd.index('mkvdiskhostmap') + 1, '-force')
        return self.run_ssh_check_created(ssh_cmd)

If the -force is added if multihostmap we don't call out of ssh to the back-end svc twice to complete the operation

    def mkvdiskhostmap(self, host, vdisk, lun, multihostmap):
        """Map vdisk to host.

        If vdisk already mapped and multihostmap is True, use the force flag.
        """
        ssh_cmd = ['svctask', 'mkvdiskhostmap', '-host', '"%s"' % host,
                   '-scsi', lun, vdisk]
        if multihostmap:
            ssh_cmd.insert(ssh_cmd.index('mkvdiskhostmap') + 1, '-force')
        return self.run_ssh_check_created(ssh_cmd)

Gerald McBrearty (gfm-r)
Changed in cinder:
assignee: nobody → Gerald McBrearty (gfm-r)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/248225

Changed in cinder:
status: New → In Progress
tags: added: drivers ibm storwize
Jay Bryant (jsbryant)
Changed in cinder:
importance: Undecided → Medium
milestone: none → mitaka-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/248225
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=cffad569f82bb5b6b52129015e37cfd62701622c
Submitter: Jenkins
Branch: master

commit cffad569f82bb5b6b52129015e37cfd62701622c
Author: Gerald McBrearty <email address hidden>
Date: Fri Nov 20 13:23:21 2015 -0600

    Storwize: Add force flag on vdisk mapping call

    If a vdisk is already mapped and multihostmap is True,
    use the force flag on the first call to mkvdiskhostmap.
    There is no functional change associated with this defect
    for this method, a vdisk that is already mapped to a
    host without the multihostmap flag will fail and it
    will be successful if the multihostmap is True.

    The code was waiting for the first call to svcinfo
    mkvdiskhostmap to fail before trying a second time with
    the force option if multihostmap is set to true. This fix
    adds the force option before the call to svcinfo
    mkvdiskhostmap to avoid this overhead. The svcinfo
    mkvdiskhostmap call accepts the force option when
    a volume is not already mapped, and mkvdiskhostmap()
    already has a force parameter,
    so the existing testcase is still valid.

    Fixed a bug where mkvdiskhostmap() was returning
    data, and add a testcase to check that it is not
    returning data.

    Change-Id: I2320aeec9422625ce2a01aa5d28801207e8671a5
    Closes-Bug: 1511751

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/cinder 8.0.0.0b3

This issue was fixed in the openstack/cinder 8.0.0.0b3 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.