Hi,
I deleted a reservation instance using:
SrmManagers.ResourceManager.RemoveReservationInstances(reservation);
But apparently that does not delete it properly, as it still shows up in the Booking Manager UI.
Now I want to use:
var bookingManager = new BookingManager("My Booking Manager");
bookingManager.Delete(engine, reservation);
But I'm getting an error:
An unexpected exception occurred when trying to update the main element '127207/4134'. The element is not reachable. (Code: 0x80040312) Skyline.DataMiner.Net.Exceptions.DataMinerCOMException: Unable to find hosting agent. The agent might still be starting up.
But the agent is up.
Is there any way I can delete the reservation for good?
Hi Razvan,
If you created your booking using the BookingManager class you should indeed delete it, using the BookingManager class as well.
Can you please post the entire exception stack trace? Does it come from the method Delete or from the BookingManager constructor?
That stack trace doesn’t seem to come from the methods in the original question, can you post the one that you get from there?
Does the element mentioned in the exception exists in your system? Element with ID 127207/4134
The methods in the original question do not throw any exception themselves, but this stacktrace is the one I could find, related to those actions.
Later Edit, Ignore the above.
This is the trace that shows up in Cube when I run the code:
Skyline.DataMiner.Library.Exceptions.ReservationNotDeletedException: Unable to delete contributing booking MyBookingName and it’s resource. —> Skyline.DataMiner.Library.Exceptions.ResourceManagerException: TraceData: (amount = 1)
– ErrorData: (amount = 1)
– ResourceManagerErrorData: ErrorReason: MainElementNotReachable,
SubjectId: 11d284a8-57fa-4321-bfa2-82a95c5f98dc,
ElementId: 127207/4106,
— End of inner exception stack trace —
at CManagedAutomation.RunWrapped(CManagedAutomation* , Int32 iCookie, IUnknown* pIAutomation, tagVARIANT* varParameters, tagVARIANT* pvarReturn, String scriptName)
at CManagedAutomation.Run(CManagedAutomation* , Int32 iCookie, Char* bstrScriptName, IUnknown* pIAutomation, tagVARIANT* varParameters, tagVARIANT* varEntryPoint, tagVARIANT* pvarReturn, tagVARIANT* pvarEntryPointResult) (CSharp; 0x80004005h):
This is the code I’m using:
public class Script
{
public void Run(Engine engine)
{
var reservationId = engine.GetScriptParam(“Reservation Id”).Value;
if (string.IsNullOrEmpty(reservationId))
{
engine.Log($”reservationId is null or empty, exiting”, LogType.Debug, 3);
return;
}
var reservationGuid = Guid.Parse(reservationId);
var reservation = SrmManagers.ResourceManager.GetReservationInstance(reservationGuid);
if (reservation == null)
{
engine.Log($”could not find reservation”, LogType.Debug, 3);
}
else
{
engine.Log($”reservation id: {reservationId}, name: {reservation.Name}”, LogType.Debug, 3);
DeleteReservation(engine, reservation);
}
}
public void DeleteReservation(Engine engine, ReservationInstance reservation)
{
var bookingManager = new BookingManager(“Playout Booking Manager”);
bookingManager.Delete(engine, reservation);
}
}
Full stack trace:
2023/10/31 09:25:39.138|SLNet.exe|TryUpdateFunctionResourceElements|ERR|0|194|An unexpected exception occurred when trying to update the main element ‘127207/4134’. The element is not reachable. (Code: 0x80040312) Skyline.DataMiner.Net.Exceptions.DataMinerCOMException: Unable to find hosting agent. The agent might still be starting up.
—> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80040312
Server stack trace:
at Interop.SLDataMiner.IDataMiner.NotifyDataMiner(String bstrUser, Int32 iType, Object varValue, Object varValue2, Object& pvarReturnValue)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Interop.SLDataMiner.IDataMiner.NotifyDataMiner(String bstrUser, Int32 iType, Object varValue, Object varValue2, Object& pvarReturnValue)
at Skyline.DataMiner.Net.MessageHandler.HandleSetDataMinerInfo(IConnectionInfo connInfo, SetDataMinerInfoMessage request)
at Skyline.DataMiner.Net.Facade.HandleClientRequestMessage(IConnectionInfo connInfo, ClientRequestMessage oneMsg, Boolean canQueue)
at Skyline.DataMiner.Net.Facade.HandleMessageInternal(IConnectionInfo connInfo, DMSMessage oneMsg, Int32 groupID, Int32 groupTotal)
at Skyline.DataMiner.Net.Facade.HandleMessage(IConnectionInfo connInfo, DMSMessage oneMsg, Int32 groupID, Int32 groupTotal)
at Skyline.DataMiner.Net.BaseFacade.HandleMessages(IConnectionInfo connInfo, DMSMessage[] msgs)
at Skyline.DataMiner.Net.Facade.HandleMessage(IConnectionInfo connInfo, DMSMessage oneMsg, Int32 groupID, Int32 groupTotal)
at Skyline.DataMiner.Net.BaseFacade.HandleMessages(IConnectionInfo connInfo, DMSMessage[] msgs)
at Skyline.DataMiner.Net.Facade.HandleMessagesForClient(IConnectionInfo connInfo, DMSMessage[] messages)
at Skyline.DataMiner.Net.Transport.Remoting.InternalHandleMessages(ConnectionToken token, DMSMessage[] inputMessages, ConnectionTransportType ctt)
— End of inner exception stack trace —
Server stack trace:
at Skyline.DataMiner.Net.Transport.Remoting.InternalHandleMessages(ConnectionToken token, DMSMessage[] inputMessages, ConnectionTransportType ctt)
at Skyline.DataMiner.Net.Transport.Remoting.HandleMessages(ConnectionToken token, DMSMessage[] inputMessages, ConnectionTransportType ctt)
at Skyline.DataMiner.Net.Transport.Remoting.HandleMessages(ConnectionToken token, DMSMessage[] inputMessages)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Skyline.DataMiner.Net.ISLNet.HandleMessages(ConnectionToken token, DMSMessage[] inputMessages)
at Skyline.DataMiner.Net.LegacyRemotingConnection.TransportSpecificHandleMessage(ConnectionToken tok, DMSMessage[] msgs, Int32 timeout)
at Skyline.DataMiner.Net.Connection.InternalHandlePackedMessages(ConnectionToken tok, DMSMessage[] msgs, Int32 timeout)
at Skyline.DataMiner.Net.Connection.InternalHandleUnpackedMessages(DMSMessage[] msgs, Int32 timeout)
at Skyline.DataMiner.Net.Connection.HandleMessages(DMSMessage[] msgs, Int32 timeout)
at Skyline.DataMiner.Net.DataMinerConnection.ForwardRemote(DMSMessage[] msgs)
at Skyline.DataMiner.Net.DataMinerConnection.Forward(DMSMessage[] msgs)
at Skyline.DataMiner.Net.RemoteAccess.Forward(MessageTarget target, DMSMessage[] messages)
at Skyline.DataMiner.Net.RemoteAccess.Forward(MessageTarget target, DMSMessage message)
at Skyline.DataMiner.Net.RemoteAccess.Forward(Int32 dataMinerID, DMSMessage message)
at Skyline.DataMiner.Net.Facade.HandleClientRequestMessage(IConnectionInfo connInfo, ClientRequestMessage oneMsg, Boolean canQueue)
at Skyline.DataMiner.Net.Facade.HandleMessageInternal(IConnectionInfo connInfo, DMSMessage oneMsg, Int32 groupID, Int32 groupTotal)
at Skyline.DataMiner.Net.Facade.HandleMessage(IConnectionInfo connInfo, DMSMessage oneMsg, Int32 groupID, Int32 groupTotal)
at Skyline.DataMiner.Net.BaseFacade.HandleMessage(DMSMessage oneMsg)
at Skyline.DataMiner.Net.ResourceManager.ResourceManager.TryUpdateFunctionResourceElements(HashSet`1 functionResourceIds, Boolean force, HashSet`1& failedDeletes)