Subscribe

Unable to create flexclone in different vserver using API

I am attempting to create a flexclone that resides in a different vserver from the parent volume.  These attempts are using Python SDK with ONTAP 9.2.  The CLI equivalant of the API commands works just fine.

 

The XML of my request is below [1] used by doing toEncodedString() on the API request. Message I get is "Extra input: junction-path". If I run the same command via CLI , I am successful:

 

netapp-home::> volume clone create -parent-vserver systems -parent-volume owens_root_rhel73_3 -parent-snapshot clone.owens_root_rhel73_test -vserver test -flexclone owens_root_rhel73_test -type rw -space-guarantee volume -junction-path /owens_root_rhel73_test

[Job 19548] Job is queued: Create owens_root_rhel73_test.

 

 

The code I'm using is below.  My parameters are logged below too:

 

[2017-08-29 08:33:46,611] INFO: Creating flexclone parent-volume=owens_root_rhel73_3 parent-snapshot=clone.owens_root_rhel73_test2 volume=owens_root_rhel73_test2 junction-path=/owens_root_rhel73_test2

 

    def create_flexclone(self, parent_volume, parent_snapshot, volume, parent_vserver=None, vserver=None, space_reserve='volume'):
        flexclone_create = NaElement('volume-clone-create')
        if parent_vserver != vserver:
            flexclone_create.child_add_string('parent-vserver', parent_vserver)
            flexclone_create.child_add_string('vserver', vserver)
            # Force connection to be not to specific vserver
            self.clear_vserver()
        flexclone_create.child_add_string('parent-volume', parent_volume)
        flexclone_create.child_add_string('parent-snapshot', parent_snapshot)
        flexclone_create.child_add_string('volume', volume)
        flexclone_create.child_add_string('volume-type', 'rw')
        flexclone_create.child_add_string('junction-path', "/%s" % volume)
        flexclone_create.child_add_string('space-reserve', space_reserve)

        log.info("Creating flexclone parent-volume=%s parent-snapshot=%s volume=%s junction-path=/%s",
                    parent_volume, parent_snapshot, volume, volume)
        print flexclone_create.toEncodedString()
        out = self.s.invoke_elem(flexclone_create)
        log.info("Create flexclone %s", out.results_status())
        if out.results_errno() != 0:
            log.error("Create flexclone %s reason=%s", out.results_status(), out.results_reason())
        return out.results_errno()

The error:

 

[2017-08-29 08:33:46,744] ERROR: Create flexclone failed reason=Extra input: junction-path

 

[1]: 

<volume-clone-create><parent-vserver>systems</parent-vserver><vserver>test</vserver><parent-volume>owens_root_rhel73_3</parent-volume><parent-snapshot>clone.owens_root_rhel73_test2</parent-snapshot><volume>owens_root_rhel73_test2</volume><volume-type>rw</volume-type><junction-path>/owens_root_rhel73_test2</junction-path><space-reserve>volume</space-reserve></volume-clone-create>

Re: Unable to create flexclone in different vserver using API

Hello @treydock,

 

Does it work without providing the junction path?  If so, what is the state after creating the clone (e.g. is it junctioned or not)?  If it's not junctioned, would it be an acceptable solution to make a separate API call to "volume-mount" to junction the clone?

 

Hope that helps.

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Re: Unable to create flexclone in different vserver using API

If I leave off the junction-path in API call then one is not setup and the volume is not mounted.  I could issue a volume-mount API call but it seems like that should be unnecessary when the same operation is successful in the CLI.  This seems like a potential bug in the API unless the "volume clone" CLI does a separate mount that is not then exposed in the same way via the API.

 

Thanks,

- Trey