Ejemplo n.º 1
0
    def test_hide_object(self):
        jdssd, ctx = self.get_driver(CONFIG_OK)
        vname = jcom.vname(UUID_1)

        jdssd.ra.modify_lun.return_value = None
        jdssd._hide_object(vname)

        hidden_volume = {"name": jcom.hidden(UUID_1)}
        jdssd.ra.modify_lun.assert_called_once_with(vname, hidden_volume)
Ejemplo n.º 2
0
    def test_delete_back_recursively_single_snapshot(self):

        jdssd, ctx = self.get_driver(CONFIG_OK)
        opvname = jcom.hidden(UUID_2)
        opsname = jcom.sname(UUID_3)

        jdssd.ra.get_snapshots.side_effect = [
            SNAPSHOTS_RECURSIVE_CHAIN_1.copy(),
            SNAPSHOTS_RECURSIVE_CHAIN_2.copy()
        ]

        origin = "Pool-0/{vorig}@{sorig}".format(vorig=jcom.vname(UUID_1),
                                                 sorig=jcom.vname(UUID_2))
        get_lun_resp = {
            'origin': origin,
            'vscan': None,
            'full_name': 'Pool-0/' + jcom.hidden(UUID_2),
            'userrefs': None,
            'primarycache': 'all',
            'logbias': 'latency',
            'creation': '1591543140',
            'sync': 'always',
            'is_clone': True,
            'dedup': 'off',
            'sharenfs': None,
            'receive_resume_token': None,
            'volsize': '1073741824'
        }
        jdssd.ra.get_lun.return_value = get_lun_resp
        jdssd._delete_back_recursively(opvname, opsname)

        jdssd.ra.delete_snapshot.assert_called_once_with(
            jcom.vname(UUID_1),
            jcom.vname(UUID_2),
            recursively_children=True,
            recursively_dependents=True,
            force_umount=True)

        get_snapshots_expected = [mock.call(opvname)]
        jdssd.ra.get_snapshots.assert_has_calls(get_snapshots_expected)
Ejemplo n.º 3
0
    def _hide_object(self, vname):
        """Mark volume/snapshot as hidden

        :param vname: physical volume name
        """
        rename = {'name': jcom.hidden(vname)}
        try:
            self.ra.modify_lun(vname, rename)
        except jexc.JDSSException as err:
            msg = _('Failure in hidding {object}, err: {error},'
                    ' object have to be removed manually')
            emsg = msg.format(object=vname, error=err)
            LOG.warning(emsg)
            raise exception.VolumeBackendAPIException(emsg)
Ejemplo n.º 4
0
    def _hide_object(self, vname):
        """Mark volume/snapshot as hidden

        :param vname: physical volume name
        """
        rename = {'name': jcom.hidden(vname)}
        try:
            self.ra.modify_lun(vname, rename)
        except jexc.JDSSException as jerr:
            emsg = _('Failure in hiding %(object)s, err: %(error)s,'
                     ' object has to be removed manually') % {
                         'object': vname,
                         'error': jerr
                     }
            LOG.warning(emsg)
            raise exception.VolumeBackendAPIException(emsg)
Ejemplo n.º 5
0
    def test_delete_back_recursively_hidden_have_snapshots(self):

        jdssd, ctx = self.get_driver(CONFIG_OK)
        opvname = jcom.hidden(UUID_1)
        opsname = jcom.sname(UUID_2)

        jdssd.ra.get_snapshots.return_value = SNAPSHOTS_RECURSIVE_1.copy()

        jdssd._delete_back_recursively(opvname, opsname)

        jdssd.ra.delete_snapshot.assert_called_once_with(
            opvname,
            opsname,
            recursively_children=True,
            recursively_dependents=True,
            force_umount=True)
Ejemplo n.º 6
0
}]

SNAPSHOTS_GARBAGE = [{
    "name": jcom.sname(UUID_1),
    "clones": "Pool-0/" + jcom.vname(UUID_2)
}, {
    "name": jcom.sname(UUID_2),
    "clones": ""
}]

SNAPSHOTS_RECURSIVE_1 = [{
    "name": jcom.sname(UUID_1),
    "clones": "Pool-0/" + jcom.sname(UUID_1)
}, {
    "name": jcom.sname(UUID_2),
    "clones": "Pool-0/" + jcom.hidden(UUID_2)
}]

SNAPSHOTS_RECURSIVE_CHAIN_1 = [{
    "name": jcom.sname(UUID_3),
    "clones": "Pool-0/" + jcom.hidden(UUID_3)
}]

SNAPSHOTS_RECURSIVE_CHAIN_2 = [{
    "name": jcom.vname(UUID_2),
    "clones": "Pool-0/" + jcom.hidden(UUID_2)
}]


def get_jdss_exceptions():