I have a service reservation to which I added a resource not linked to any node.
Method used is the following: manager.AddResource((Engine) engine, reservation, resource.ID);
What's the best way to remove this resource again?
The method manager.RemoveResource seems to expect a targetNodeId which the resource doesn't have as far as I'm aware.
Hi Tim,
The ServiceReservationInstance object itself has a method to assign or unassign any resource. The .UnassignResources() function accepts one or multiple AssignResourceRequest where you only need to provide the ID of the resource in your case. The TargetNodeLabel can be left empty.
An (assign) example and more information can be found on the following documentation page:
Silently assigning resource, profile and parameter values | DataMiner Docs
Short summary:
var reservationInstance = SrmManagers.ResourceManager.GetReservationInstance(reservationId) as ServiceReservationInstance;
var requests = new[] { new AssignResourceRequest { NewResourceId = Guid.Parse("4d4c6525-8fbc-419c-9250-7e8b59dd2fcb") };
reservationInstance.UnassignResources(engine, requests);
Hope this helps