Software Development Kit (SDK) and API Discussions

VolumeInfo.Sis incorrectly parsed in SDK 5.0 .Net Bindings

ADAM_L_DEV
2,279 Views

Hello,

I'm trying to read Sis info for a Sis volume using .NET Bindings from SDK 5.0. Every time however the result is empty VolumeInfo.Sis structure (all properties are null). I've checked the SOAP envelope via WireShark and the Sis info is present there. It looks like the mapping in the bindings is done incorrectly. Does anybody have a workaround or is it possible to get a rebuilt assemblies?

I've tried all provided dlls from 7.3.1 up to 8.1 - neither works.

Thanks in advance,

Adam

The code:

       public string ProcessRecord()

        {

            NaFiler server = null;

            server = new NaFiler(_server);

            server.Trace = true;

            server.Credentials = new NetworkCredential(_user, _password);

            server.ForceUseUnsecure = true;

            VolumeListInfo input = new VolumeListInfo();

            if (_volume != null)

            {

                input.Volume = _volume;

            }               

            input.Verbose = true;

            try

            {

                VolumeListInfoResult output = input.Invoke(server);

                VolumeInfo[] volumes = output.Volumes;

                foreach (VolumeInfo volume in volumes)

                {

                    WriteObject("------------------------------------------------- ");

                    WriteObject("Name : " + volume.Name);

                    if (null != volume.Sis)

                    {

                        WriteObject("PercentDedupSaved: " + volume.Sis.PercentageSaved + "%");

                        WriteObject("TotalSaved: " + volume.Sis.SizeSaved + "%");

                        WriteObject("Sis State: " + volume.Sis.State);

                        WriteObject("Sis Status: " + volume.Sis.Status);

                    }

Envelope fragment:

<?xml version='1.0' encoding='UTF-8' ?>

<!DOCTYPE netapp SYSTEM '/na_admin/netapp_filer.dtd'>

<netapp version='1.1' xmlns='http://www.netapp.com/filer/admin'>

<results status="passed"><volumes><volume-info><name>vol1</name><uuid>39a8ca3e-0acc-11e2-abb9-0050569e3bd4</uuid><type>flex</type><block-type>64_bit</block-type>

[Lines cut]

<sis><sis-info><state>enabled</state><status>idle</status><progress>idle for 04:08:44</progress><type>regular</type><schedule>sun-sat@0</schedule><last-operation-begin>Tue Oct  2 09:35:19 GMT 2012</last-operation-begin><last-operation-end>Tue Oct  2 09:36:06 GMT 2012</last-operation-end><last-operation-size>26968064</last-operation-size><size-shared>13484032</size-shared><size-saved>13484032</size-saved><percentage-saved>49</percentage-saved><compress-saved>0</compress-saved><percent-compress-saved>0</percent-compress-saved><dedup-saved>13168</dedup-saved><percent-dedup-saved>49</percent-dedup-saved><total-saved>13168</total-saved><percent-total-saved>49</percent-total-saved></sis-info></sis>

[Lines cut]

1 REPLY 1

ADAM_L_DEV
2,279 Views

OK I kinda fixed it for my own. Basically it's enough to remove <sis-info> there and use generic NaServer.Invoke() followed with regular Xml deserialization from .NET. The input for UseBase is same VolumeListInfo as in first snippet. The code (quick draft):

        private VolumeInfo UseBase(VolumeListInfo input, NaFiler server)

        {

            XmlElement serverOutput = null;

            try

            {

                serverOutput = (XmlElement)server.Invoke(input, typeof(XmlElement));

            }

            catch (NaException e)

            {

                WriteObject(e.Message);

            }

            var volumeInfo = serverOutput.FirstChild;

            volumeInfo = FixSisInfo(volumeInfo);

            return DeserializeXmlNode<VolumeInfo>(volumeInfo);

        }

        private XmlNode FixSisInfo(XmlNode volumeInfo)

        {

            volumeInfo.InnerXml = volumeInfo.InnerXml.Replace("<sis-info>", string.Empty).Replace("</sis-info>", string.Empty);

            return volumeInfo;

        }

        private static T DeserializeXmlNode<T>(XmlNode volumeInfo)

        {

            var serializer = new XmlSerializer(typeof (T));

            var stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(volumeInfo.InnerXml));

            var returnValue = (T) serializer.Deserialize(stream);

            return returnValue;

        }

Public