def _lungroup_export(self, container, name, initiators,
                         ports, unexport):
        """
        Internal work function for:
            export_lun_group
            unexport_lun_group

        """
        nodes = []
        nodes.append(XGNode('container', 'string', container))
        nodes.append(XGNode('name', 'string', name))
        nodes.extend(XGNode.as_node_list('initiators/{0}', 'string',
                                         initiators))
        nodes.extend(XGNode.as_node_list('ports/{0}', 'string', ports))
        nodes.append(XGNode('unexport', 'bool', unexport))

        return self._basic.perform_action('/vshare/actions/vdm' +
                                          '/lungroup/export', nodes)
Exemple #2
0
    def _snapgroup_export(self, container, lungroup, name, initiators, ports,
                          unexport):
        """
        Internal work function for:
            export_lun_group_snapshot
            unexport_lun_group_snapshot

        """
        nodes = []
        nodes.append(XGNode('container', 'string', container))
        nodes.append(XGNode('lungroup', 'string', lungroup))
        nodes.append(XGNode('name', 'string', name))
        nodes.extend(
            XGNode.as_node_list('initiators/{0}', 'string', initiators))
        nodes.extend(XGNode.as_node_list('ports/{0}', 'string', ports))
        nodes.append(XGNode('unexport', 'bool', unexport))

        return self._basic.perform_action(
            '/vshare/actions/vdm' + '/snapgroup/export', nodes)
    def _snapshot_export(self, container, lun, names, initiators,
                         ports, lun_id, unexport, force):
        """Internal work function for:
            export_lun_snapshot
            unexport_lun_snapshot

        """
        nodes = []
        nodes.append(XGNode('container', 'string', container))
        nodes.append(XGNode('lun', 'string', lun))
        nodes.extend(XGNode.as_node_list('names/{0}', 'string', names))
        nodes.extend(XGNode.as_node_list('initiators/{0}', 'string',
                                         initiators))
        nodes.extend(XGNode.as_node_list('ports/{0}', 'string', ports))
        nodes.append(XGNode('lun_id', 'string', lun_id))
        nodes.append(XGNode('unexport', 'bool', unexport))
        if force is not None:
            nodes.append(XGNode('force', 'bool', force))

        return self._basic.perform_action('/vshare/actions/vdm' +
                                          '/snapshot/export', nodes)
    def _iscsi_target_bind(self, target, ip, add):
        """Internal work function for:
            bind_ip_to_target
            unbind_ip_from_target

        """
        nodes = []
        nodes.append(XGNode('target', 'string', target))
        nodes.extend(XGNode.as_node_list('ip/{0}', 'string', ip))
        nodes.append(XGNode('add', 'bool', add))

        return self._basic.perform_action('/vshare/actions' +
                                          '/iscsi/target/bind', nodes)
Exemple #5
0
    def _snapshot_export(self, container, lun, names, initiators, ports,
                         lun_id, unexport, force):
        """
        Internal work function for:
            export_lun_snapshot
            unexport_lun_snapshot

        """
        nodes = []
        nodes.append(XGNode('container', 'string', container))
        nodes.append(XGNode('lun', 'string', lun))
        nodes.extend(XGNode.as_node_list('names/{0}', 'string', names))
        nodes.extend(
            XGNode.as_node_list('initiators/{0}', 'string', initiators))
        nodes.extend(XGNode.as_node_list('ports/{0}', 'string', ports))
        nodes.append(XGNode('lun_id', 'string', lun_id))
        nodes.append(XGNode('unexport', 'bool', unexport))
        if force is not None:
            nodes.append(XGNode('force', 'bool', force))

        return self._basic.perform_action(
            '/vshare/actions/vdm' + '/snapshot/export', nodes)
    def _lun_export(self, container, names, ports,
                    initiators, lun_id, unexport):
        """
        Internal work function for:
            export_lun
            unexport_lun

        """
        nodes = []
        nodes.append(XGNode('container', 'string', container))
        nodes.extend(XGNode.as_node_list('names/{0}', 'string', names))
        nodes.extend(XGNode.as_node_list('initiators/{0}', 'string',
                                         initiators))
        nodes.extend(XGNode.as_node_list('ports/{0}', 'string', ports))
        if lun_id == 'auto':
            nodes.append(XGNode('lun_id', 'int16', -1))
        else:
            nodes.append(XGNode('lun_id', 'int16', lun_id))
        nodes.append(XGNode('unexport', 'bool', unexport))

        return self._basic.perform_action('/vshare/actions' +
                                          '/lun/export', nodes)
    def _igroup_modify(self, igroup, initiators, delete):
        """
        Internal work function for:
            add_initiators
            delete_initiators

        """
        nodes = []
        nodes.append(XGNode("igroup", "string", igroup))
        nodes.extend(XGNode.as_node_list("initiators/{0}", "string", initiators))
        nodes.append(XGNode("delete", "bool", delete))

        return self._basic.perform_action("/vshare/actions" + "/igroup/modify", nodes)
    def _igroup_modify(self, igroup, initiators, delete):
        """Internal work function for:
            add_initiators
            delete_initiators

        """
        nodes = []
        nodes.append(XGNode('igroup', 'string', igroup))
        nodes.extend(XGNode.as_node_list('initiators/{0}', 'string',
                                         initiators))
        nodes.append(XGNode('delete', 'bool', delete))

        return self._basic.perform_action('/vshare/actions' +
                                          '/igroup/modify', nodes)
Exemple #9
0
    def _iscsi_target_bind(self, target, ip, add):
        """
        Internal work function for:
            bind_ip_to_target
            unbind_ip_from_target

        """
        nodes = []
        nodes.append(XGNode('target', 'string', target))
        nodes.extend(XGNode.as_node_list('ip/{0}', 'string', ip))
        nodes.append(XGNode('add', 'bool', add))

        return self._basic.perform_action(
            '/vshare/actions' + '/iscsi/target/bind', nodes)
Exemple #10
0
    def _igroup_modify(self, igroup, initiators, delete):
        """
        Internal work function for:
            add_initiators
            delete_initiators

        """
        nodes = []
        nodes.append(XGNode('igroup', 'string', igroup))
        nodes.extend(
            XGNode.as_node_list('initiators/{0}', 'string', initiators))
        nodes.append(XGNode('delete', 'bool', delete))

        return self._basic.perform_action('/vshare/actions' + '/igroup/modify',
                                          nodes)
    def bulk_delete_luns(self, container, luns):
        """
        Delete one or more LUNs.

        Arguments:
            container -- string
            luns      -- string (string or list)

        Returns:
            Action result as a dict.

        """
        nodes = []
        nodes.append(XGNode('container', 'string', container))
        nodes.extend(XGNode.as_node_list('lun/{0}', 'string', luns))

        return self._basic.perform_action('/vshare/actions' +
                                          '/lun/bulk_delete', nodes)
    def _lungroup_create(self, container, name,
                         lun_names, action, description):
        """
        Internal work function for:
            create_lun_group
            delete_lun_group

        """
        nodes = []
        nodes.append(XGNode('container', 'string', container))
        nodes.append(XGNode('name', 'string', name))
        nodes.extend(XGNode.as_node_list('lun_names/{0}', 'string', lun_names))
        nodes.append(XGNode('action', 'string', action))
        if description is not None:
            nodes.append(XGNode('description', 'string', description))

        return self._basic.perform_action('/vshare/actions/vdm' +
                                          '/lungroup/create', nodes)
    def _lungroup_update(self, container, name, new_name,
                         lun_names, remove, description):
        """
        Internal work function for:
            add_to_lun_group
            remove_from_lun_group

        """
        nodes = []
        nodes.append(XGNode('container', 'string', container))
        nodes.append(XGNode('name', 'string', name))
        if new_name is not None:
            nodes.append(XGNode('new_name', 'string', new_name))
        nodes.extend(XGNode.as_node_list('lun_names/{0}', 'string', lun_names))
        if remove is not None:
            nodes.append(XGNode('remove', 'bool', remove))
        if description is not None:
            nodes.append(XGNode('description', 'string', description))

        return self._basic.perform_action('/vshare/actions/vdm' +
                                          '/lungroup/update', nodes)