Software Development Kit (SDK) and API Discussions

Cluster Mode SnapMirror

michael_england
3,797 Views

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
3,797 Views

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
3,798 Views

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);

                                                     }

                                        }

Public