/// <summary> /// Saves the VTNCordinator information. /// </summary> /// <param name="txnMng">Transaction Manager.</param> /// <param name="VtnHostName">Host name of the VTNCoordinator.</param> private void SaveVtncoInfo(TransactionManager txnMng, string VtnHostName) { OdlInformation odlInfo = new OdlInformation(VtnHostName); txnMng.SetConfigManager(odlInfo, TransactionManager.OpenMode.WriteMode); odlInfo.SetCredentials(this.Credential, this.ConnectionString); }
/// <summary> /// Initializes a new instance of the VSEMSynchronization class. /// </summary> /// <param name="txnMng">Transaction Manager.</param> public VSEMSynchronization(TransactionManager txnMng) { var JavaScriptSerializer = new JavaScriptSerializer(); JavaScriptSerializer.MaxJsonLength = int.MaxValue; StringBuilder json = new StringBuilder("\"txnMng\":" + JavaScriptSerializer.Serialize(txnMng)); ODLVSEMETW.EventWriteStartLibrary(MethodBase.GetCurrentMethod().DeclaringType.Name.ToString(), json.ToString()); if (txnMng == null) { ODLVSEMETW.EventWriteArgumentError( MethodBase.GetCurrentMethod().DeclaringType.Name.ToString(), MethodBase.GetCurrentMethod().Name, "The parameter 'transaction' is null or invalid."); throw new ArgumentException("The parameter 'transaction' is null or invalid."); } var vSEMConfig = new VSEMConfig(); try { txnMng.SetConfigManager(vSEMConfig, TransactionManager.OpenMode.ReadMode); } catch (Exception ex) { ODLVSEMETW.EventWriteConfigManagerFileIOError( MethodBase.GetCurrentMethod().Name, string.Format(CultureInfo.CurrentCulture, "VSEM.config {0}\n", configFileIOErrorValidationMessage) + ex.Message); ODLVSEMETW.EventWriteEndLibrary(MethodBase.GetCurrentMethod().Name, string.Empty); throw new InvalidOperationException( string.Format(CultureInfo.CurrentCulture, "Either the NetworkService is not added in SCVMM or VSEM.config {0}", configFileIOErrorValidationMessage)); } try { var odlInformation = new OdlInformation(vSEMConfig.Info.ServerName); txnMng.SetConfigManager(odlInformation, TransactionManager.OpenMode.ReadMode); this.ConnectionString = odlInformation.GetConnectionString(); this.Credential = odlInformation.GetCredentials(); } catch (Exception ex) { ODLVSEMETW.EventWriteConfigManagerFileIOError( MethodBase.GetCurrentMethod().Name, string.Format(CultureInfo.CurrentCulture, "ODLInformation.config {0}\n", configFileIOErrorValidationMessage) + ex.Message); ODLVSEMETW.EventWriteEndLibrary(MethodBase.GetCurrentMethod().Name, string.Empty); throw new InvalidOperationException( string.Format(CultureInfo.CurrentCulture, "ODLInformation.config {0}", configFileIOErrorValidationMessage)); } }