constants.go 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. package model
  2. //merlin machine status.
  3. const (
  4. // ImmediatelyFailedMachineInMerlin Paas immediately returns failed, when you create some new machines.
  5. ImmediatelyFailedMachineInMerlin = -200
  6. // InitializedFailedMachineInMerlin Scheduled detected that paas failed to execute Initialized task.
  7. InitializedFailedMachineInMerlin = -201
  8. // PodScheduledFailedMachineInMerlin Scheduled detected that paas failed to execute PodScheduled task.
  9. PodScheduledFailedMachineInMerlin = -202
  10. // ReadyFailedMachineInMerlin Scheduled detected that paas failed to execute Ready task.
  11. ReadyFailedMachineInMerlin = -203
  12. // ReadyFailedMachineInMerlin Scheduled detected that paas failed to sync the node of tree service.
  13. SynTreeFailedMachineInMerlin = -204
  14. // CreateTagFailedMachineInMerlin detected that merlin failed to create tag.
  15. CreateTagFailedMachineInMerlin = -205
  16. // RemovedMachineInMerlin the user removed the machine.
  17. RemovedMachineInMerlin = -100
  18. // CreatingMachineInMerlin Paas is creating the machine now.
  19. CreatingMachineInMerlin = 0
  20. // InitializeMachineInMerlin Paas is executing Initialize task.
  21. InitializeMachineInMerlin = 1
  22. // InitializeMachineInMerlin Paas is executing PodScheduled task.
  23. PodScheduledMachineInMerlin = 2
  24. // InitializeMachineInMerlin Paas is executing Ready task.
  25. ReadyMachineInMerlin = 3
  26. // InitializeMachineInMerlin Paas is syncing the node of tree service.
  27. SynTreeMachineInMerlin = 4
  28. // BootMachineInMerlin The machine is turned on.
  29. BootMachineInMerlin = 100
  30. // ShutdownMachineInMerlin The machine is off state.
  31. ShutdownMachineInMerlin = 200
  32. )
  33. // paas return response status.
  34. const (
  35. // CreateFailedMachineInPaas Paas created the machine failed
  36. CreateFailedMachineInPaas = 0
  37. // CreatingMachineInPass Paas is creating the machine now
  38. CreatingMachineInPass = 1
  39. // SuccessDeletePaasMachines success deleted paas machine
  40. SuccessDeletePaasMachines = 1
  41. )
  42. // pagination.
  43. const (
  44. DefaultPageSize = 5
  45. DefaultPageNum = 1
  46. )
  47. // snapshot status
  48. const (
  49. SnapshotInit = "快照初始化"
  50. SnapshotDoing = "快照进行中"
  51. SnapshotSuccess = "快照已完成"
  52. SnapShotFailed = "快照失败"
  53. )
  54. // machine log.
  55. const (
  56. GenForMachineLog = "创建"
  57. DeleteForMachineLog = "删除"
  58. TransferForMachineLog = "转移"
  59. OperationSuccessForMachineLog = "成功"
  60. OperationFailedForMachineLog = "失败"
  61. MBStartLog = "移动设备启动"
  62. MBShutDownLog = "移动设备关闭"
  63. MBBindLog = "移动设备绑定"
  64. MBReleaseLog = "移动设备释放"
  65. MBLendOutLog = "移动设备借出"
  66. MBReturnLog = "移动设备归还"
  67. )
  68. // mobile machine usage.
  69. const (
  70. MBInUse = 1
  71. MBFree = 2
  72. MBNoConnect = 3
  73. )
  74. // mobile machine usage.
  75. const (
  76. MBOnline = 1 //在线
  77. MBOffline = -1 //离线
  78. MBHostDel = -2 //删除
  79. )
  80. // is Simulator or RealMachine.
  81. const (
  82. MBSimulator = 1 //虚拟机
  83. MBReal = 0 //真机
  84. )
  85. // is real machine on site or not.
  86. const (
  87. MBOnSite = 0 //归还
  88. MBLendOut = 1 //借出
  89. )
  90. // machine suffix.
  91. const (
  92. MachinePodNameSuffix = "-0"
  93. )
  94. // delay log.
  95. const (
  96. DelayMachineEndTime = "手动延期"
  97. CancelDelayMachineEndTime = "取消延期"
  98. AuditDelayMachineEndTime = "审批延期"
  99. )
  100. // delay status.
  101. const (
  102. DelayStatusInit = 0 //延期状态初始化
  103. DelayStatusAuto = 1 //可自动延期
  104. DelayStatusApply = 2 //可申请延期
  105. DelayStatusDisable = 3 //不可申请延期
  106. )
  107. // apply status.
  108. const (
  109. ApplyDelayInit = "申请延期中"
  110. ApplyDelayCancel = "申请延期取消"
  111. ApplyDelayApprove = "申请延期通过"
  112. ApplyDelayDecline = "申请延期驳回"
  113. )
  114. // task.
  115. const (
  116. DeleteMachine = "DeleteMachine" // 删除机器
  117. )
  118. // task status.
  119. const (
  120. TaskInit = 0 //未开始
  121. TaskDone = 1 //已执行成功
  122. TaskFailed = 2 //已执行失败
  123. TaskDeleted = -1 //任务删除
  124. )
  125. // machine expired status.
  126. const (
  127. MailTypeMachineWillExpired = 1 //机器将要过期
  128. MailTypeMachineDeleted = 2 //机器已被删除
  129. MailTypeMachineTransfer = 5 //机器转移
  130. MailTypeTaskDeleteMachineFailed = 11 //删除机器任务失败
  131. MailTypeApplyDelayMachineEndTime = 3 //申请延长机器过期时间
  132. MailTypeAuditDelayMachineEndTime = 4 //审核延长机器过期时间
  133. )
  134. // image operate type.
  135. const (
  136. ImageNoSnapshot = 0
  137. ImagePullAndPush = 1
  138. ImagePull = 2
  139. ImageTag = 3
  140. ImagePush = 4
  141. ImageMachine2Image = 5
  142. )
  143. // image operate err
  144. const (
  145. ImageSuccess = 0
  146. ImageInit = -1
  147. ImagePullErr = -2
  148. ImageReTagErr = -3
  149. ImagePushErr = -4
  150. )
  151. // time format.
  152. const (
  153. TimeFormat = "2006-01-02 15:04:05"
  154. )
  155. // bool str.
  156. const (
  157. False = "False"
  158. True = "True"
  159. )
  160. // tree role admin.
  161. const (
  162. TreeRoleAdmin = 1
  163. )
  164. // image status.
  165. const (
  166. AliveImageStatus = 1
  167. DeletedImageStatus = 2
  168. )
  169. // other
  170. const (
  171. Success = "success"
  172. )
  173. // machine ratio
  174. const (
  175. CPURatio = 1000
  176. MemoryRatio = 1024
  177. )