Software Development Kit (SDK) and API Discussions

Cluster Mode SnapMirror

michael_england

I'm trying to retrieve a list of snapmirror volumes (XDP to be specific) for a given source volume using the JAVA API.  Under 7-mode I would issue a "snapvault-primary-get-relationship-status" but of course snapvault doesn't really exist anymore.  I can get the information I'm looking for from the command line with something like "snapmirror list-destinations -source-volume <volume_name>" but I can't seem to find an API equivalent.  Does anyone have suggestions for doing this in cluster mode?

1 ACCEPTED SOLUTION

michael_england

For anyone else that runs into this problem.  The way I solved it is by using version 1.20 (sdk 5.1) and "snapmirror-get-destination-iter".  It's kind of unfortunate I can't call "snapmirror-get-destination" as that requires a known destination and the main point of my query is to ask the source what mirrors it has.  The java code looks something like this:

NaServer netappServer("my_vserver");

netappServer.setTransportType(NaServer.TRANSPORT_TYPE_HTTPS);

netappServer.setPort(443);

netappServer.setStyle(NaServer.STYLE_LOGIN_PASSWORD);

netappServer.setAdminUser("my_user", "my_password");

NaElement request, response;

NaElement destInfo = new NaElement("snapmirror-destination-info");

destInfo.addNewChild("source-volume", volumePath);

NaElement query = new NaElement("query");

query.addChildElem(destInfo);

 

request = new NaElement("snapmirror-get-destination-iter");

request.addChildElem(query);

response = netappServer.invokeElem(request);

if (response.getChildByName("attributes-list") != null) {

                                                     @SuppressWarnings("unchecked")

                                                     List<NaElement> vaultElementList = response.getChildByName("attributes-list").getChildren();

                                                     for (NaElement element : vaultElementList) {

                                                                    String snapVaultPath = element.getChildContent("destination-volume");

                                                                    String snapVaultArray = element.getChildContent("destination-vserver");

                                                                    vaultList.put(snapVaultArray, snapVaultPath);

          System.out.println("cluster vault array is "+snapVaultArray+", path is "+snapVaultPath);

                                                     }

                                        }

View solution in original post

1 REPLY 1

michael_england

For anyone else that runs into this problem.  The way I solved it is by using version 1.20 (sdk 5.1) and "snapmirror-get-destination-iter".  It's kind of unfortunate I can't call "snapmirror-get-destination" as that requires a known destination and the main point of my query is to ask the source what mirrors it has.  The java code looks something like this:

NaServer netappServer("my_vserver");

netappServer.setTransportType(NaServer.TRANSPORT_TYPE_HTTPS);

netappServer.setPort(443);

netappServer.setStyle(NaServer.STYLE_LOGIN_PASSWORD);

netappServer.setAdminUser("my_user", "my_password");

NaElement request, response;

NaElement destInfo = new NaElement("snapmirror-destination-info");

destInfo.addNewChild("source-volume", volumePath);

NaElement query = new NaElement("query");

query.addChildElem(destInfo);

 

request = new NaElement("snapmirror-get-destination-iter");

request.addChildElem(query);

response = netappServer.invokeElem(request);

if (response.getChildByName("attributes-list") != null) {

                                                     @SuppressWarnings("unchecked")

                                                     List<NaElement> vaultElementList = response.getChildByName("attributes-list").getChildren();

                                                     for (NaElement element : vaultElementList) {

                                                                    String snapVaultPath = element.getChildContent("destination-volume");

                                                                    String snapVaultArray = element.getChildContent("destination-vserver");

                                                                    vaultList.put(snapVaultArray, snapVaultPath);

          System.out.println("cluster vault array is "+snapVaultArray+", path is "+snapVaultPath);

                                                     }

                                        }

View solution in original post

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public