VMware Cloud Community
schistad
Enthusiast
Enthusiast
Jump to solution

Creating new entity relationships (reservations)

I'm seeing some strange behaviour when attempting to add a VM network (eg a HostNic) to a reservation (eg a cluster).

On the one hand, I am receiving errors from VCAC when I create the HostNicToReservation entity (specifying only HostNicID and HostReservationID as normal properties).

[2014-09-18 15:09:19.231] [I] HTTP/1.1 500 Internal Server Error : <?xml version="1.0" encoding="utf-8" standalone="yes"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">  <code></code>  <message xml:lang="nb-NO">An error occurred while processing this request.</message>  <innererror>    <message>Entities in 'ManagementModelEntities.HostNics' participate in the 'Host_HostNic' relationship. 0 related 'Host' were found. 1 'Host' is expected.</message>    <type>System.Data.UpdateException</type>    <stacktrace>   at System.Data.Mapping.Update.Internal.UpdateTranslator.RelationshipConstraintValidator.ValidateConstraints()&#xD;   at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)&#xD;   at System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options)&#xD;   at DynamicOps.Common.Entity.ContextHelpers.EncryptEntitiesAndSaveChanges(ObjectContext entityContext, Func`2 saveFunc, SaveOptions saveOptions)&#xD;   at System.Data.Services.Providers.ObjectContextServiceProvider.SaveChanges()&#xD;   at System.Data.Services.DataService`1.HandleNonBatchRequest(RequestDescription description)&#xD;   at System.Data.Services.DataService`1.HandleRequest()</stacktrace>  </innererror></error> (Workflow:Create a vCAC model entity / Create entity (item1)#1)

On the other hand, the relationship shows up in the vCAC GUI and seems to have been correctly created.

I've done the same excersize from powershell, using the function call "AddToHostNicToReservations", which works great.

Reply
0 Kudos
1 Solution

Accepted Solutions
schistad
Enthusiast
Enthusiast
Jump to solution

Okay, this is embarrassing - I was simply using the wrong entity type for the creation because I linked the wrong attribute to the EntitySetName parameter. So this works Smiley Happy

View solution in original post

Reply
0 Kudos
1 Reply
schistad
Enthusiast
Enthusiast
Jump to solution

Okay, this is embarrassing - I was simply using the wrong entity type for the creation because I linked the wrong attribute to the EntitySetName parameter. So this works Smiley Happy

Reply
0 Kudos