//********************************************************************* /// /// <summary> /// Add a CMP VM to the CmpWap DB /// </summary> /// <param name="cmpVm"></param> /// <param name="cwdb"></param> /// //********************************************************************* private void ImportVm(CmpClient.CmpService.VmDeploymentRequest cmpVm, CmpWapDb cwdb) { try { var cmpReq = new CmpRequest() { AccessGroupId = 0, Active = true, AddressFromVm = null, CmpRequestID = cmpVm.ID, Config = cmpVm.Config, Domain = null, ExceptionMessage = cmpVm.ExceptionMessage, Id = 0, FeatureSpec = null, LastStatusUpdate = cmpVm.LastStatusUpdate, ParentAppName = cmpVm.ParentAppName, RequestType = cmpVm.RequestType, SourceImageName = null, SourceServerName = cmpVm.SourceServerName, StatusCode = cmpVm.Status, StatusMessage = cmpVm.StatusMessage, StorageSpec = null, TagData = cmpVm.TagData, TagID = cmpVm.TagID, TargetLocation = cmpVm.TargetLocation, TargetVmName = cmpVm.TargetVmName, UserSpec = null, VmSize = cmpVm.VmSize, WapSubscriptionID = null, Warnings = null, WhenRequested = cmpVm.WhenRequested, WhoRequested = cmpVm.WhoRequested }; cwdb.InsertVmDepRequest(cmpReq); } catch (Exception ex) { LogThis(ex, EventLogEntryType.Error, "Exception in SyncWorker.ImportVm()", 0, 0); } }
//********************************************************************* /// /// <summary> /// This method is used to get VM status. /// </summary> /// <param name="vdr"></param> /// <returns>VM status message string</returns> /// //********************************************************************* string GetStatusMessage(CmpClient.CmpService.VmDeploymentRequest vdr) { if (null != vdr.ExceptionMessage) { if (vdr.Status == CmpInterfaceModel.Constants.StatusEnum.Exception.ToString() || vdr.Status == CmpInterfaceModel.Constants.StatusEnum.Rejected.ToString()) { string messageOut = CmpInterfaceModel.Utilities.GetXmlInnerText(vdr.ExceptionMessage, "Message"); if (null == messageOut) { messageOut = vdr.ExceptionMessage; } return(messageOut); } } return(vdr.StatusMessage); }