Quantcast
Channel: VMware Communities : Discussion List - Virtual Disk Development Kit
Viewing all articles
Browse latest Browse all 2039

obtaining shadow vm's references

$
0
0

Hello,

 

When I try to call

List<ReferenceType> refs = com.vmware.vcloud.sdk.VappTemplate.GetVappTemplateByReference(client, vdc.GetVappTemplateRefs()[0]).              GetChildren()[0].GetShadowVmReferences();

 

my sample crashes with an error "Object reference not set to an instance of an object."

This happens because type.Reference is null... =(

By the way, I am surethat the shadow vm exists.

Can someoneconfirm this?

 

namespace com.vmware.vcloud.sdk

{

    public class VappTemplate : VcloudEntity<VAppTemplateType>

    {

          //..........some code ................

        public List<ReferenceType> GetShadowVmReferences()
        {
            List<ReferenceType> list2;
            try
            {
                if (!this.IsVm())
                {
                    throw new VCloudException(SdkUtil.GetI18nString(SdkMessage.OPERATION_NOT_SUPPORTED));
                }
                string url = base.Reference.href + "/shadowVms";
                ReferencesType type = SdkUtil.Get<ShadowVMReferencesType>(base.VcloudClient, url, 200);
                List<ReferenceType> list = new List<ReferenceType>();
                foreach (ReferenceType type2 in type.Reference)
                {
                    list.Add(type2);
                }
                list2 = list;
            }
            catch (Exception exception)
            {
                throw new VCloudException(exception.Message);
            }
            return list2;
         }
         //..........some code ................
     }
}

Viewing all articles
Browse latest Browse all 2039

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>