I'm trying to swap a resource for another. Node MC Heartbeat contains resource MC Heartbeat but I want to change it for the WP Heartbeat instead.
Node Label shows the node, plus the resource if the node has a resource assigned.
But it's giving this exception: Run Subscript 'SRM_ResourceActions' Failed: 0x80004005
The method being used
Information being sent:
That calls the SwapResource method from the booking manager.
Any suggestion? Should I use the booking.UnassignResources() and Booking.AssignResources() instead suggested here?
I was trying a different approach but also gives this exception. I’ve tried to first remove the resource from the node and then add a different one.
Script Failure (RBM ChangeResource): EXIT: “(Code: 0x80131500)
Skyline.DataMiner.Net.Exceptions.DataMinerException: Run Subscript ‘SRM_ResourceActions’ Failed: 0x80004005
at Skyline.DataMiner.Automation.Engine.InternalLaunchSubScript(String scriptName, List`1 finalOptions, Int32 inheritSubScript, Int32 extendedErrorInfo, Dictionary`2& subScriptOutput, List`1& errorMessages)
at Skyline.DataMiner.Automation.SubScriptOptions.StartScript()
at Skyline.DataMiner.Library.Solutions.SRM.BookingManager.RemoveResource(Engine engine, ReservationInstance reservation, Guid targetedResourceGuid, Int32 targetedNode)
I’ve tried this method and works from removal:
var requests = new[]
{
new AssignResourceRequest
{
TargetNodeLabel = nodeLabel,
NewResourceId = Guid.Empty
},
};
model.Reservation.AssignResources(engine, requests);
The one for calling Swap:
Script Failure (RBM ChangeResource): EXIT: “(Code: 0x80131500) Skyline.DataMiner.Net.Exceptions.DataMinerException: Run Subscript ‘SRM_ResourceActions’ Failed: 0x80004005
at Skyline.DataMiner.Automation.Engine.InternalLaunchSubScript(String scriptName, List`1 finalOptions, Int32 inheritSubScript, Int32 extendedErrorInfo, Dictionary`2& subScriptOutput, List`1& errorMessages)
at Skyline.DataMiner.Automation.SubScriptOptions.StartScript()
at Skyline.DataMiner.Library.Solutions.SRM.BookingManager.SwapResource(Engine engine, ReservationInstance reservation, Guid oldResourceGuid, Guid newResourceGuid, Int32 targetedNodeId)
at RBM_ChangeResource_3.Controller.UpdateResourceController.ChangeResource(Engine engine, Guid selectedResourceGuid, ChangeResourceDialogModel model, ResourceManagerHelper resHelper)
at RBM_ChangeResource_3.Controller.UpdateResourceController.UpdateResource(Engine engine, ChangeResourceDialogModel model, ResourceManagerHelper resHelper)
at RBM_ChangeResource_3.ChangeResourceDialog.ChangeButtonPressed()
at RBM_ChangeResource_3.ChangeResourceDialog.b__31_2(Object sender, EventArgs args)
at Skyline.DataMiner.Utils.InteractiveAutomationScript.Button.RaiseResultEvents()
at Skyline.DataMiner.Utils.InteractiveAutomationScript.Dialog.RaiseResultEvents(UIResults uir)
at Skyline.DataMiner.Utils.InteractiveAutomationScript.InteractiveController.Run(Dialog startDialog)
at RBM_ChangeResource_3.Script.Run(Engine engine)” (see comment for more details)
The one calling Remove:
Script Failure (RBM ChangeResource): EXIT: “(Code: 0x80131500) Skyline.DataMiner.Net.Exceptions.DataMinerException: Run Subscript ‘SRM_ResourceActions’ Failed: 0x80004005
at Skyline.DataMiner.Automation.Engine.InternalLaunchSubScript(String scriptName, List`1 finalOptions, Int32 inheritSubScript, Int32 extendedErrorInfo, Dictionary`2& subScriptOutput, List`1& errorMessages)
at Skyline.DataMiner.Automation.SubScriptOptions.StartScript()
at Skyline.DataMiner.Library.Solutions.SRM.BookingManager.RemoveResource(Engine engine, ReservationInstance reservation, Guid targetedResourceGuid, Int32 targetedNode)
at RBM_ChangeResource_3.Controller.UpdateResourceController.ChangeResource(Engine engine, Guid selectedResourceGuid, ChangeResourceDialogModel model, ResourceManagerHelper resHelper)
at RBM_ChangeResource_3.Controller.UpdateResourceController.UpdateResource(Engine engine, ChangeResourceDialogModel model, ResourceManagerHelper resHelper)
at RBM_ChangeResource_3.ChangeResourceDialog.ChangeButtonPressed()
at RBM_ChangeResource_3.ChangeResourceDialog.b__31_2(Object sender, EventArgs args)
at Skyline.DataMiner.Utils.InteractiveAutomationScript.Button.RaiseResultEvents()
at Skyline.DataMiner.Utils.InteractiveAutomationScript.Dialog.RaiseResultEvents(UIResults uir)
at Skyline.DataMiner.Utils.InteractiveAutomationScript.InteractiveController.Run(Dialog startDialog)
at RBM_ChangeResource_3.Script.Run(Engine engine)” (see comment for more details)
Hi Daniel,
The recommended way to swap an existing resource in a booking is to use method: ReservationInstanceExtensions.AssignResources(). You shouldn't need anything else.
E.g.:
var assignRequest = new AssignResourceRequest
{
TargetNodeLabel = "Decoding",
NewResourceId = resource.ID
};
var serviceReservation = reservationIntance as ServiceReservationInstance;
serviceReservation = serviceReservation.AssignResources(engine, assignRequest);
Seems to work both for remove, add or change. It’s just a matter or giving the correct resource Guid or Guid.Empty if removing.
Thanks!
Hi Daniel, can you check the exception stack trace that you have in the booking log file? The image you posted cuts some of the exception details.