Skip to Main Content

zfs cli scripting - how to change the properties of all LUN's

User_6TWVPApr 13 2018 — edited Apr 13 2018

we want to create a simple cli script for changing the targetgroup of all available LUN's. for now we don't succeed. Can someone tell me how to change this script?

-------------------------

script

function getPools()

    {

            run('cd /');

            run ('status');

            run ('storage');

            pools=list();

            for (i=0; i < pools.length; i++)

            {

                    var pool=pools[i];

                    getPoolStat(pool);

                    getProjects(pool);

            }

            run('done');

    }

function getPoolStat(pool)

    {

            run('cd /');

            run ('status');

            run ('storage');

            run ('select ' + pool);

            printf("%-10s %-10s \n","Poolname: ",pool);

            run('done');

    }

function getProjects(pool)

    {

            run('cd /');

            run('shares');

            run('set pool=' + pool);

            projects=list();

            for (a=0; a < projects.length; a++)

            {

                var project = projects[a];

                getLuns(project);

            }

      //      run('done');

    }

function getLuns(project)

    {

      run('select ' + project);

      printf("%-10s %-10s \n","Projectname: ",project);

      lns=run('list lun');

            for (y=0; y < lns.length; y++)

            {

                   var lun = lns[y];

                   run ('select ' + lun);

                   printf("%-10s %-10s \n","LUN : ",lun);

                   //run ('set targetgroup="PCA"');

                   //run ('commit');

                  run('done');

             }

      run('done');  // exit selected project

     }

getPools();

---------------------------------------------

Comments
Post Details
Added on Apr 13 2018
3 comments
127 views