pepabo/go-netapp

AggrSpaceOptions with aggrName filter got nothing return

jenningsloy318 opened this issue · 3 comments

Hi , I am using first opt for AggrOptions to get all aggr, and use second one to filter out particular
aggr's AggrSpace, but unfortunately I can't

Options for AggrOptions:

	opts := &netapp.AggrOptions {
		Query: &netapp.AggrInfo{
			AggrRaidAttributes: &netapp.AggrRaidAttributes{
				IsRootAggregate: ff,
			},
		},
		DesiredAttributes: &netapp.AggrInfo{
			AggrOwnershipAttributes: &netapp.AggrOwnershipAttributes{
				OwnerName           :"x",
				Cluster            :"x",
			
			},
			AggrSpaceAttributes:     &netapp.AggrSpaceAttributes{
				SizeUsed            : 1,
				SizeTotal           : 1,
				SizeAvailable       : 1,
				TotalReservedSpace  : 1,
				PercentUsedCapacity : "x",
				PhysicalUsed        : 1,
				PhysicalUsedPercent : 1,
			},
		},
	}

The will fetch all aggr for me.

Options for AggrSpaceOptions:

	opts := &netapp.AggrSpaceOptions{
		Query:  &netapp.AggrSpaceInfoQuery{
			AggrSpaceInfo: &netapp.AggrSpaceInfo{
				Aggregate:  aggrName, 
			},
		},
		DesiredAttributes: &netapp.AggrSpaceInfoQuery{
			AggrSpaceInfo: &netapp.AggrSpaceInfo{
				SnapSizeTotal : "x",
			},
		},
	}

the request become

<netapp version="1.130" xmlsns="http://www.netapp.com/filer/admin">
  <aggr-space-get-iter>
    <desired-attributes>
      <space-information>
        <aggregate></aggregate>
        <aggregate-metadata></aggregate-metadata>
        <aggregate-metadata-percent></aggregate-metadata-percent>
        <aggregate-size></aggregate-size>
        <percent-snapshot-space></percent-snapshot-space>
        <physical-used></physical-used>
        <physical-used-percent></physical-used-percent>
        <snap-size-total>x</snap-size-total>
        <snapshot-reserve-unusable></snapshot-reserve-unusable>
        <snapshot-reserve-unusable-percent></snapshot-reserve-unusable-percent>
        <used-including-snapshot-reserve></used-including-snapshot-reserve>
        <used-including-snapshot-reserve-percent></used-including-snapshot-reserve-percent>
        <volume-footprints></volume-footprints>
        <volume-footprints-percent></volume-footprints-percent>
      </space-information>
    </desired-attributes>
    <query>
      <space-information>
        <aggregate>MainCluster01_01_sas</aggregate>
        <aggregate-metadata></aggregate-metadata>
        <aggregate-metadata-percent></aggregate-metadata-percent>
        <aggregate-size></aggregate-size>
        <percent-snapshot-space></percent-snapshot-space>
        <physical-used></physical-used>
        <physical-used-percent></physical-used-percent>
        <snap-size-total></snap-size-total>
        <snapshot-reserve-unusable></snapshot-reserve-unusable>
        <snapshot-reserve-unusable-percent></snapshot-reserve-unusable-percent>
        <used-including-snapshot-reserve></used-including-snapshot-reserve>
        <used-including-snapshot-reserve-percent></used-including-snapshot-reserve-percent>
        <volume-footprints></volume-footprints>
        <volume-footprints-percent></volume-footprints-percent>
      </space-information>
    </query>
  </aggr-space-get-iter>
</netapp>

and the response is

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE netapp SYSTEM 'file:/etc/netapp_gx.dtd'>
<netapp version='1.130' xmlns='http://www.netapp.com/filer/admin'>
<results status="passed"><num-records>0</num-records></results></netapp>

My assumption is that there are different process for aggrInfo and aggrSpaceInfo, can you please help check why?

Hi,
which do you think the cause is api or the client?
You should contact netapp if you think the cause has API.
Because go-netapp is simple client for netapp...
I'm sorry I can't help.

Hi ,
I think add omitempty on these items should solve these problems,since you can see that I only provide aggr name ,but other item still exist,so this would be the problems

add pull request to fix it #34

pull request merged, this issue fixed