ProductConfigurationRepository.php 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726
  1. <?php
  2. /* * ********************************************************************
  3. * ProxmoxVPS product developed. (2019-09-06)
  4. * *
  5. *
  6. * CREATED BY MODULESGARDEN -> http://modulesgarden.com
  7. * CONTACT -> contact@modulesgarden.com
  8. *
  9. *
  10. * This software is furnished under a license and may be used and copied
  11. * only in accordance with the terms of such license and with the
  12. * inclusion of the above copyright notice. This software or any other
  13. * copies thereof may not be provided or otherwise made available to any
  14. * other person. No title to and ownership of the software is hereby
  15. * transferred.
  16. *
  17. *
  18. * ******************************************************************** */
  19. namespace ModulesGarden\ProxmoxAddon\App\Repositories\Cloud;
  20. use ModulesGarden\ProxmoxAddon\App\Repositories\AbstractProductConfigurationRepository;
  21. /**
  22. * Description of ProductConfigurationRepository
  23. * @author Pawel Kopec <pawelk@modulesgarden.com>
  24. * @version 1.0.0
  25. * @property $serverSockets
  26. * @property $serverCores
  27. * @property $serverVcpus
  28. * @property $serverCpulimit
  29. * @property $serverCpuunit
  30. * @property $serverMemory
  31. * @property $serverDiskSize
  32. * @property $serverIpv4
  33. * @property $serverIpv6
  34. * @property $serverSwap
  35. * @property $serverVirtualInterfaces
  36. * @property $cpuunitsPriority1
  37. * @property $cpulimitPriority1
  38. * @property string $firewalOptionPolicyIn;
  39. * @property string $firewalOptionPolicyOut;
  40. * @property string $archive;
  41. * @property string $cloudInitStorage
  42. */
  43. class ProductConfigurationRepository extends AbstractProductConfigurationRepository
  44. {
  45. public function isDebug()
  46. {
  47. return $this->get("debugMode") == "on";
  48. }
  49. public function getVirtualization()
  50. {
  51. return $this->get("virtualization", 'qemu');
  52. }
  53. public function isQemu()
  54. {
  55. return $this->getVirtualization() == "qemu";
  56. }
  57. public function isLxc()
  58. {
  59. return $this->getVirtualization() == "lxc";
  60. }
  61. public function getDefaultNode()
  62. {
  63. return $this->get("defaultNode");
  64. }
  65. public function isCheckResources()
  66. {
  67. return $this->get('checkResources') == "on";
  68. }
  69. public function isBackupVmBeforeReinstall()
  70. {
  71. return $this->get('backupVmBeforeReinstall') == "on";
  72. }
  73. public function isRebootVmAfterChangePackage()
  74. {
  75. return $this->get('rebootVmAfterChangePackage') == "on";
  76. }
  77. public function isDeleteBackups()
  78. {
  79. return $this->get('deleteBackups') == "on";
  80. }
  81. public function isServerNameservers()
  82. {
  83. return $this->get('serverNameservers') == "on";
  84. }
  85. public function getConsoleHost()
  86. {
  87. return $this->get("consoleHost");
  88. }
  89. public function getUserPrefix()
  90. {
  91. return $this->get("userPrefix");
  92. }
  93. public function getRealm()
  94. {
  95. return $this->get("realm", "pve");
  96. }
  97. public function getUserComment()
  98. {
  99. return $this->get("userComment");
  100. }
  101. public function getUserRole()
  102. {
  103. return $this->get("userRole");
  104. }
  105. public function getWelcomeEmailTemplateId()
  106. {
  107. return $this->get("welcomeEmailTemplateId");
  108. }
  109. public function getReinstallEmailTemplateId()
  110. {
  111. return $this->get("reinstallEmailTemplateId");
  112. }
  113. public function getServiceCreationFailedTemplateId()
  114. {
  115. return $this->get("serviceCreationFailedTemplateId");
  116. }
  117. public function getUpgradeNotificationTemplateId()
  118. {
  119. return $this->get("upgradeNotificationTemplateId");
  120. }
  121. public function isToDoList()
  122. {
  123. return $this->get("toDoList") == "on";
  124. }
  125. public function getCmode()
  126. {
  127. return $this->get("cmode") ;
  128. }
  129. public function getOsType()
  130. {
  131. return $this->get("ostype");
  132. }
  133. public function getPool()
  134. {
  135. return $this->get("pool");
  136. }
  137. public function getDescription()
  138. {
  139. return $this->get("description");
  140. }
  141. public function getTty()
  142. {
  143. return $this->get("tty");
  144. }
  145. public function isSshKeyPairs()
  146. {
  147. return $this->get("sshKeyPairs") == "on";
  148. }
  149. public function getArch()
  150. {
  151. return $this->get("arch");
  152. }
  153. public function isConsole()
  154. {
  155. return $this->get("console") == "on";
  156. }
  157. public function isOnboot()
  158. {
  159. return $this->get("onboot") == "on";
  160. }
  161. public function isProtection()
  162. {
  163. return $this->get("protection") == "on";
  164. }
  165. public function isStartup()
  166. {
  167. return $this->get("startup") == "on";
  168. }
  169. public function isSshDeletePrivateKey()
  170. {
  171. return $this->get("sshDeletePrivateKey") == "on";
  172. }
  173. public function getOsTemplate()
  174. {
  175. return $this->get("osTemplate");
  176. }
  177. public function getCpuunits()
  178. {
  179. return $this->get("cpuunits");
  180. }
  181. /**
  182. * @return int
  183. */
  184. public function getMemory()
  185. {
  186. return $this->get("memory");
  187. }
  188. /**
  189. * @return int
  190. */
  191. public function getProductId()
  192. {
  193. return $this->productId;
  194. }
  195. /**
  196. * @return int
  197. */
  198. public function getStorageSize()
  199. {
  200. return $this->get("storageSize");
  201. }
  202. /**
  203. * @return int
  204. * @deprecated
  205. */
  206. public function getAdditionalDiskSize()
  207. {
  208. return $this->get("additionalDiskSize");
  209. }
  210. /**
  211. * @return int
  212. */
  213. public function getMinimumRate()
  214. {
  215. return $this->get("minimumRate");
  216. }
  217. /**
  218. * @return int
  219. */
  220. public function getIpv4()
  221. {
  222. return $this->get("ipv4");
  223. }
  224. /**
  225. * @return int
  226. */
  227. public function getIpv6()
  228. {
  229. return $this->get("ipv6");
  230. }
  231. /**
  232. * @return int
  233. */
  234. public function getBackupMaxFiles()
  235. {
  236. return $this->get("backupMaxFiles");
  237. }
  238. /**
  239. * @return int
  240. */
  241. public function getCpulimit()
  242. {
  243. return $this->get("cpulimit");
  244. }
  245. /**
  246. * @return int
  247. */
  248. public function getCores()
  249. {
  250. return $this->get("cores");
  251. }
  252. /**
  253. * @return int
  254. */
  255. public function getSwap()
  256. {
  257. return $this->get("swap");
  258. }
  259. /**
  260. * @return int
  261. */
  262. public function getRate()
  263. {
  264. return $this->get("rate");
  265. }
  266. /**
  267. * @return int
  268. */
  269. public function getBackupMaxSize()
  270. {
  271. return $this->get("backupMaxSize");
  272. }
  273. /**
  274. * @return int
  275. */
  276. public function getBandwidth()
  277. {
  278. return $this->get("bandwidth");
  279. }
  280. /**
  281. * @return int
  282. */
  283. public function getSnapshotMaxFiles()
  284. {
  285. return $this->get("snapshotMaxFiles");
  286. }
  287. /**
  288. * @return int
  289. */
  290. public function getMountPointStorage()
  291. {
  292. return $this->get("mountPointStorage");
  293. }
  294. /**
  295. * @return int
  296. */
  297. public function isMountPointRo()
  298. {
  299. return $this->get("mountPointRo") == "on";
  300. }
  301. /**
  302. * @return int
  303. */
  304. public function isReplicate()
  305. {
  306. return $this->get("replicate") == "on";
  307. }
  308. /**
  309. * @return int
  310. */
  311. public function getMountPointAcl()
  312. {
  313. return $this->get("mountPointAcl");
  314. }
  315. /**
  316. * @return int
  317. */
  318. public function isMountPointQuota()
  319. {
  320. return $this->get("mountPointQuota") == "on";
  321. }
  322. /**
  323. * @return string
  324. */
  325. public function getIpv4NetworkMode()
  326. {
  327. return $this->get("ipv4NetworkMode");
  328. }
  329. /**
  330. * @return string
  331. */
  332. public function getIpv6NetworkMode()
  333. {
  334. return $this->get("ipv6NetworkMode");
  335. }
  336. /**
  337. * @return string
  338. */
  339. public function getPrivateBridge()
  340. {
  341. return $this->get("privateBridge");
  342. }
  343. /**
  344. * @return string
  345. */
  346. public function getBridge()
  347. {
  348. return $this->get("bridge");
  349. }
  350. /**
  351. * @return boolean
  352. */
  353. public function isNetworkFirewall()
  354. {
  355. return $this->get("networkFirewall") == "on";
  356. }
  357. /**
  358. * @return int
  359. */
  360. public function getTagFrom()
  361. {
  362. return $this->get("tagFrom");
  363. }
  364. /**
  365. * @return int
  366. */
  367. public function getTagTo()
  368. {
  369. return $this->get("tagTo");
  370. }
  371. /**
  372. * @return string
  373. */
  374. public function getSwapUnit()
  375. {
  376. return $this->get("swapUnit", "mb");
  377. }
  378. /**
  379. * @return string
  380. */
  381. public function getStorageUnit()
  382. {
  383. return $this->get("storageUnit", "gb");
  384. }
  385. /**
  386. * @return string
  387. */
  388. public function getMemoryUnit()
  389. {
  390. return $this->get("memoryUnit", "mb");
  391. }
  392. /**
  393. * @return string
  394. */
  395. public function getAdditionalDiskUnit()
  396. {
  397. return $this->get("additionalDiskUnit", "gb");
  398. }
  399. /**
  400. * @return array
  401. */
  402. public function getFirewallInterfaces()
  403. {
  404. return $this->get("firewallInterfaces");
  405. }
  406. /**
  407. * @return int
  408. */
  409. public function getFirewallMaxRules()
  410. {
  411. return $this->get("firewallMaxRules");
  412. }
  413. /**
  414. * @return bool
  415. */
  416. public function isLoadBalancer()
  417. {
  418. return $this->get("loadBalancer") == "on";
  419. }
  420. /**
  421. * @return bool
  422. */
  423. public function isLoadBalancerShutdownOnUpgrade()
  424. {
  425. return $this->get("loadBalancerShutdownOnUpgrade") == "on";
  426. }
  427. /**
  428. * @return string
  429. */
  430. public function getLoadBalancerOnUpgrade()
  431. {
  432. return $this->get("loadBalancerOnUpgrade");
  433. }
  434. /**
  435. * @return bool
  436. */
  437. public function isLoadBalancerStopOnUpgrade()
  438. {
  439. return $this->get("loadBalancerStopOnUpgrade") == "on";
  440. }
  441. /**
  442. * @return string
  443. */
  444. public function getBackupStorage()
  445. {
  446. return $this->get("backupStorage");
  447. }
  448. /**
  449. * @return bool
  450. */
  451. public function isBackupRouting()
  452. {
  453. return $this->get("backupRouting") == "on";
  454. }
  455. /**
  456. * @return int
  457. */
  458. public function getBackupStoreDays()
  459. {
  460. return $this->get("backupStoreDays");
  461. }
  462. /**
  463. * @return string
  464. */
  465. public function getClusterState()
  466. {
  467. return $this->get("clusterState");
  468. }
  469. /**
  470. * @return int
  471. */
  472. public function getClusterMaxRestart()
  473. {
  474. return $this->get("clusterMaxRestart");
  475. }
  476. /**
  477. * @return string
  478. */
  479. public function getClusterGroup()
  480. {
  481. return $this->get("clusterGroup");
  482. }
  483. /**
  484. * @return int
  485. */
  486. public function getClusterMaxRelocate()
  487. {
  488. return $this->get("clusterMaxRelocate");
  489. }
  490. /**
  491. * @return bool
  492. */
  493. public function isPermissionStart()
  494. {
  495. return $this->get("permissionStart") == "on";
  496. }
  497. /**
  498. * @return bool
  499. */
  500. public function isPermissionStop()
  501. {
  502. return $this->get("permissionStop") == "on";
  503. }
  504. /**
  505. * @return bool
  506. */
  507. public function isPermissionNovnc()
  508. {
  509. return $this->get("permissionNovnc") == "on";
  510. }
  511. /**
  512. * @return bool
  513. */
  514. public function isPermissionXtermjs()
  515. {
  516. return $this->get("permissionXtermjs") == "on";
  517. }
  518. /**
  519. * @return bool
  520. */
  521. public function isPermissionOsTemplate()
  522. {
  523. return $this->get("permissionOsTemplate") == "on";
  524. }
  525. /**
  526. * @return bool
  527. */
  528. public function isPermissionIsoImage()
  529. {
  530. return $this->get("permissionIsoImage") == "on";
  531. }
  532. /**
  533. * @return bool
  534. */
  535. public function isPermissionGraph()
  536. {
  537. return $this->get("permissionGraph") == "on";
  538. }
  539. /**
  540. * @return bool
  541. */
  542. public function isPermissionBackupJob()
  543. {
  544. return $this->get("permissionBackupJob") == "on";
  545. }
  546. /**
  547. * @return bool
  548. */
  549. public function isPermissionNetwork()
  550. {
  551. return $this->get("permissionNetwork") == "on";
  552. }
  553. /**
  554. * @return bool
  555. */
  556. public function isPermissionFirewall()
  557. {
  558. return $this->get("permissionFirewall") == "on";
  559. }
  560. /**
  561. * @return bool
  562. */
  563. public function isPermissionDisk()
  564. {
  565. return $this->get("permissionDisk") == "on";
  566. }
  567. /**
  568. * @return bool
  569. */
  570. public function isPermissionReboot()
  571. {
  572. return $this->get("permissionReboot") == "on";
  573. }
  574. /**
  575. * @return bool
  576. */
  577. public function isPermissionShutdown()
  578. {
  579. return $this->get("permissionShutdown") == "on";
  580. }
  581. /**
  582. * @return bool
  583. */
  584. public function isPermissionSpice()
  585. {
  586. return $this->get("permissionSpice") == "on";
  587. }
  588. /**
  589. * @return bool
  590. */
  591. public function isPermissionReinstall()
  592. {
  593. return $this->get("permissionReinstall") == "on";
  594. }
  595. /**
  596. * @return array
  597. */
  598. public function getPermissionOsTemplates()
  599. {
  600. return $this->get("permissionOsTemplates");
  601. }
  602. public function isPermissionOsTemplates()
  603. {
  604. return !empty($this->get("permissionOsTemplates"));
  605. }
  606. /**
  607. * @return bool
  608. */
  609. public function isPermissionBackup()
  610. {
  611. return $this->get("permissionBackup") == "on";
  612. }
  613. /**
  614. * @return bool
  615. */
  616. public function isPermissionTaskHistory()
  617. {
  618. return $this->get("permissionTaskHistory") == "on";
  619. }
  620. /**
  621. * @return bool
  622. */
  623. public function isPermissionSnapshot()
  624. {
  625. return $this->get("permissionSnapshot") == "on";
  626. }
  627. /**
  628. * @return bool
  629. */
  630. public function isPermissionFirewallOption()
  631. {
  632. return $this->get("permissionFirewallOption") == "on";
  633. }
  634. public function getNetworkModel()
  635. {
  636. return $this->get("networkModel");
  637. }
  638. public function getNetworkPrivateModel()
  639. {
  640. return $this->get("networkPrivateModel");
  641. }
  642. public function isCloudInit()
  643. {
  644. return $this->get("cloudInit") == "on";
  645. }
  646. /**
  647. * @return int
  648. */
  649. public function getAdditionalDiskMbpsRd()
  650. {
  651. return $this->get("additionalDiskMbps_rd");
  652. }
  653. /**
  654. * @return int
  655. */
  656. public function getAdditionalDiskIopsRd()
  657. {
  658. return $this->get("additionalDiskIops_rd");
  659. }
  660. /**
  661. * @return int
  662. */
  663. public function getAdditionalDiskIopsWr()
  664. {
  665. return $this->get("additionalDiskIops_wr");
  666. }
  667. /**
  668. * @return int
  669. */
  670. public function getAdditionalDiskMbpsWr()
  671. {
  672. return $this->get("additionalDiskMbps_wr");
  673. }
  674. /**
  675. * @return int
  676. */
  677. public function getAdditionalDiskIopsRdMax()
  678. {
  679. return $this->get("additionalDiskIops_rd_max");
  680. }
  681. /**
  682. * @return int
  683. */
  684. public function getAdditionalDiskIopsWrMax()
  685. {
  686. return $this->get("additionalDiskIops_wr_max");
  687. }
  688. /**
  689. * @return string
  690. */
  691. public function getAdditionalDiskStorage()
  692. {
  693. return $this->get("additionalDiskStorage");
  694. }
  695. /**
  696. * @return string
  697. */
  698. public function getAdditionalDiskFormat()
  699. {
  700. return $this->get("additionalDiskFormat");
  701. }
  702. /**
  703. * @return string
  704. */
  705. public function getAdditionalDiskCache()
  706. {
  707. return $this->get("additionalDiskCache");
  708. }
  709. /**
  710. * @return bool
  711. */
  712. public function isAdditionalDiskIoThread()
  713. {
  714. return $this->get("additionalDiskIoThread") == "on";
  715. }
  716. /**
  717. * @return string
  718. */
  719. public function getAdditionalDiskType()
  720. {
  721. return $this->get("additionalDiskType");
  722. }
  723. /**
  724. * @return bool
  725. */
  726. public function isAdditionalDiskReplicate()
  727. {
  728. return $this->get("additionalDiskReplicate") == "on";
  729. }
  730. /**
  731. * @return bool
  732. */
  733. public function isAdditionalDiskDiscard()
  734. {
  735. return $this->get("additionalDiskDiscard") == "on";
  736. }
  737. /**
  738. * @return bool
  739. */
  740. public function isPermissionAdditionalDiskBackup()
  741. {
  742. return $this->get("permissionAdditionalDiskBackup") == "on";
  743. }
  744. public function isPermissionMountPointBackup()
  745. {
  746. return $this->get("permissionMountPointBackup") == "on";
  747. }
  748. public function isMountPointReplicate()
  749. {
  750. return $this->get("mountPointReplicate") == "on";
  751. }
  752. public function isOsTemplatesInAllNodes()
  753. {
  754. return $this->get("osTemplatesInAllNodes") == "on";
  755. }
  756. public function getPermissionIsoImages()
  757. {
  758. return $this->get("permissionIsoImages");
  759. }
  760. public function isPermissionIsoImages()
  761. {
  762. return !empty($this->get("permissionIsoImages"));
  763. }
  764. public function getPermissionSecondaryIsoImages()
  765. {
  766. return $this->get("permissionSecondaryIsoImages");
  767. }
  768. public function isPermissionSecondaryIsoImages()
  769. {
  770. return !empty($this->get("permissionSecondaryIsoImages"));
  771. }
  772. public function getStorage()
  773. {
  774. return $this->get("storage");
  775. }
  776. /**
  777. * @return bool
  778. */
  779. public function isAgent()
  780. {
  781. return $this->get('agent') == "on";
  782. }
  783. /**
  784. * @return string
  785. */
  786. public function getCdrom()
  787. {
  788. return $this->get('cdrom');
  789. }
  790. /**
  791. * @return bool
  792. */
  793. public function isNuma()
  794. {
  795. return $this->get('numa') == "on";
  796. }
  797. /**
  798. * @return bool
  799. */
  800. public function isSpec()
  801. {
  802. return $this->get('spec') == "on";
  803. }
  804. /**
  805. * @return bool
  806. */
  807. public function isFreeze()
  808. {
  809. return $this->get('freeze') == "on";
  810. }
  811. /**
  812. * @return string
  813. */
  814. public function getKeyboard()
  815. {
  816. return $this->get('keyboard');
  817. }
  818. /**
  819. * @return string
  820. */
  821. public function getVga()
  822. {
  823. return $this->get('vga');
  824. }
  825. public function getVgaMemory()
  826. {
  827. return $this->get('vgaMemory');
  828. }
  829. /**
  830. * @return string
  831. */
  832. public function getClientNameForContainer()
  833. {
  834. return $this->get('clientNameForContainer');
  835. }
  836. /**
  837. * @return bool
  838. */
  839. public function isAcpi()
  840. {
  841. return $this->get('acpi') == "on";
  842. }
  843. /**
  844. * @return bool
  845. */
  846. public function isAutostart()
  847. {
  848. return $this->get('autostart') == "on";
  849. }
  850. /**
  851. * @return bool
  852. */
  853. public function isPcid()
  854. {
  855. return $this->get('pcid') == "on";
  856. }
  857. /**
  858. * @return bool
  859. */
  860. public function getHotplug()
  861. {
  862. return implode(",",$this->get('hotplug')) ;
  863. }
  864. /**
  865. * @return bool
  866. */
  867. public function isKvm()
  868. {
  869. return $this->get('kvm') == "on";
  870. }
  871. /**
  872. * @return bool
  873. */
  874. public function isReboot()
  875. {
  876. return $this->get('reboot') == "on";
  877. }
  878. /**
  879. * @return bool
  880. */
  881. public function isTablet()
  882. {
  883. return $this->get('tablet') == "on";
  884. }
  885. /**
  886. * @return string
  887. */
  888. public function getCloneMode()
  889. {
  890. return $this->get('cloneMode');
  891. }
  892. /**
  893. * @return string
  894. */
  895. public function getBalloon()
  896. {
  897. return $this->get('balloon');
  898. }
  899. /**
  900. * @return string
  901. */
  902. public function getArgs()
  903. {
  904. return $this->get('args');
  905. }
  906. /**
  907. * @return string
  908. */
  909. public function getMigrateSpeed()
  910. {
  911. return $this->get('migrate_speed');
  912. }
  913. /**
  914. * @return string
  915. */
  916. public function getMigrateDowntime()
  917. {
  918. return $this->get('migrate_downtime');
  919. }
  920. /**
  921. * @return string
  922. */
  923. public function getStartdate()
  924. {
  925. return $this->get('startdate');
  926. }
  927. /**
  928. * @return string
  929. */
  930. public function getShares()
  931. {
  932. return $this->get('shares');
  933. }
  934. /**
  935. * @return bool
  936. */
  937. public function isLocaltime()
  938. {
  939. return $this->get('localtime') == "on";
  940. }
  941. /**
  942. * @return string
  943. */
  944. public function getWatchdog()
  945. {
  946. return $this->get('watchdog');
  947. }
  948. /**
  949. * @return string
  950. */
  951. public function getStartup()
  952. {
  953. return $this->get('startup');
  954. }
  955. /**
  956. * @return bool
  957. */
  958. public function isTdf()
  959. {
  960. return $this->get('tdf') == "on";
  961. }
  962. /**
  963. * @return string
  964. */
  965. public function getSockets()
  966. {
  967. return $this->get('sockets');
  968. }
  969. /**
  970. * @return string
  971. */
  972. public function getVcpus()
  973. {
  974. return $this->get('vcpus');
  975. }
  976. /**
  977. * @return string
  978. */
  979. public function getIsoImage()
  980. {
  981. return $this->get('isoImage');
  982. }
  983. public function getCdromType()
  984. {
  985. return $this->get('cdromType');
  986. }
  987. /**
  988. * @return string
  989. */
  990. public function getDiskStorage()
  991. {
  992. return $this->get('diskStorage');
  993. }
  994. /**
  995. * @return string
  996. */
  997. public function getDiskFormat()
  998. {
  999. return $this->get('diskFormat');
  1000. }
  1001. /**
  1002. * @return string
  1003. */
  1004. public function getScsihw()
  1005. {
  1006. return $this->get('scsihw');
  1007. }
  1008. /**
  1009. * @return string
  1010. */
  1011. public function getDiskType()
  1012. {
  1013. return $this->get('diskType');
  1014. }
  1015. /**
  1016. * @return string
  1017. */
  1018. public function getDiskCache()
  1019. {
  1020. return $this->get('diskCache');
  1021. }
  1022. /**
  1023. * @return bool
  1024. */
  1025. public function isDiscard()
  1026. {
  1027. return $this->get('discard') == "on";
  1028. }
  1029. /**
  1030. * @return bool
  1031. */
  1032. public function isIoThread()
  1033. {
  1034. return $this->get('ioThread') == "on";
  1035. }
  1036. /**
  1037. * @return string
  1038. */
  1039. public function getMbpsRd()
  1040. {
  1041. return $this->get('mbps_rd');
  1042. }
  1043. /**
  1044. * @return string
  1045. */
  1046. public function getIopsRd()
  1047. {
  1048. return $this->get('iops_rd');
  1049. }
  1050. /**
  1051. * @return string
  1052. */
  1053. public function getIopsWr()
  1054. {
  1055. return $this->get('iops_wr');
  1056. }
  1057. /**
  1058. * @return string
  1059. */
  1060. public function getMbpsWr()
  1061. {
  1062. return $this->get('mbps_wr');
  1063. }
  1064. /**
  1065. * @return string
  1066. */
  1067. public function getIopsRdMax()
  1068. {
  1069. return $this->get('iops_rd_max');
  1070. }
  1071. /**
  1072. * @return string
  1073. */
  1074. public function getIopsWrMax()
  1075. {
  1076. return $this->get('iops_wr_max');
  1077. }
  1078. /**
  1079. * @return bool
  1080. */
  1081. public function isEtworkOneDevice()
  1082. {
  1083. return $this->get('etworkOneDevice') == "on";
  1084. }
  1085. /**
  1086. * @return string
  1087. */
  1088. public function getQueues()
  1089. {
  1090. return $this->get('queues');
  1091. }
  1092. /**
  1093. * @return string
  1094. */
  1095. public function getBootDevice1()
  1096. {
  1097. return $this->get('bootDevice1');
  1098. }
  1099. /**
  1100. * @return string
  1101. */
  1102. public function getBootDevice2()
  1103. {
  1104. return $this->get('bootDevice2');
  1105. }
  1106. /**
  1107. * @return string
  1108. */
  1109. public function getBootDevice3()
  1110. {
  1111. return $this->get('bootDevice3');
  1112. }
  1113. /**
  1114. * @return string
  1115. */
  1116. public function getBootdisk()
  1117. {
  1118. return $this->get('bootdisk');
  1119. }
  1120. /**
  1121. * @return bool
  1122. */
  1123. public function isCloudInitServicePassword()
  1124. {
  1125. return $this->get('cloudInitServicePassword') == "on";
  1126. }
  1127. /**
  1128. * @return bool
  1129. */
  1130. public function isCloudInitServiceUsername()
  1131. {
  1132. return $this->get('cloudInitServiceUsername') == "on";
  1133. }
  1134. /**
  1135. * @return bool
  1136. */
  1137. public function isCloudInitServiceNameservers()
  1138. {
  1139. return $this->get('cloudInitServiceNameservers') == "on";
  1140. }
  1141. /**
  1142. * @return string
  1143. */
  1144. public function getCiuser()
  1145. {
  1146. return $this->get('ciuser');
  1147. }
  1148. public function getSearchdomain()
  1149. {
  1150. return $this->get('searchdomain');
  1151. }
  1152. public function isRandomHostname()
  1153. {
  1154. return $this->get('randomHostname') == "on";
  1155. }
  1156. public function isUnprivileged()
  1157. {
  1158. return $this->get('unprivileged') == "on";
  1159. }
  1160. public function isIpsetIpFilter()
  1161. {
  1162. return $this->get("ipsetIpFilter") == "on";
  1163. }
  1164. public function getBootOrder()
  1165. {
  1166. $boot = [];
  1167. if ($this->getBootDevice1())
  1168. {
  1169. $boot[] = $this->getBootDevice1();
  1170. }
  1171. if ($this->getBootDevice2())
  1172. {
  1173. $boot[] = $this->getBootDevice2();
  1174. }
  1175. if ($this->getBootDevice3())
  1176. {
  1177. $boot[] = $this->getBootDevice3();
  1178. }
  1179. return implode("", $boot);
  1180. }
  1181. public function isOneNetworkDevice()
  1182. {
  1183. return $this->get("oneNetworkDevice") == "on";
  1184. }
  1185. public function getCpu()
  1186. {
  1187. return $this->get("cpu");
  1188. }
  1189. public function getSuspensionAction()
  1190. {
  1191. return $this->get("suspensionAction");
  1192. }
  1193. public function isSuspendOnBandwidthOverage()
  1194. {
  1195. return $this->get("suspendOnBandwidthOverage") == "on";
  1196. }
  1197. public function isStart()
  1198. {
  1199. return $this->get("start") == "on";
  1200. }
  1201. /**
  1202. * @return array
  1203. */
  1204. public function getTags()
  1205. {
  1206. return $this->get("tags");
  1207. }
  1208. public function getCicustom()
  1209. {
  1210. return $this->get('cicustom');
  1211. }
  1212. /**
  1213. * @return bool
  1214. */
  1215. public function isPermissionSshkeys()
  1216. {
  1217. return $this->get("permissionSshkeys") == "on";
  1218. }
  1219. public function isPermissionSnapshotJob()
  1220. {
  1221. return $this->get("permissionSnapshotJob") == "on";
  1222. }
  1223. public function getPermissionSnapshotJobPeriod()
  1224. {
  1225. return $this->get("permissionSnapshotJobPeriod");
  1226. }
  1227. public function getSnapshotJobs()
  1228. {
  1229. return $this->get("snapshotJobs");
  1230. }
  1231. public function isAgentTemplateUser()
  1232. {
  1233. return $this->get('agentTemplateUser') == "on";
  1234. }
  1235. public function isAgentPassword()
  1236. {
  1237. return $this->get('agentPassword') == "on";
  1238. }
  1239. public function isAgentConfigureNetwork()
  1240. {
  1241. return $this->get('agentConfigureNetwork') == "on";
  1242. }
  1243. /**
  1244. * @return bool
  1245. */
  1246. public function isCloneOnTheSameStorage()
  1247. {
  1248. return $this->get('cloneOnTheSameStorage') == "on";
  1249. }
  1250. public function isFeatureKeyctl()
  1251. {
  1252. return $this->get('featureKeyctl') == "on";
  1253. }
  1254. public function isFeatureNesting()
  1255. {
  1256. return $this->get('featureNesting') == "on";
  1257. }
  1258. public function isFeatureNfs()
  1259. {
  1260. return $this->get('featureNfs') == "on";
  1261. }
  1262. public function isFeatureCifs()
  1263. {
  1264. return $this->get('featureCifs') == "on";
  1265. }
  1266. public function isFeatureFuse()
  1267. {
  1268. return $this->get('featureFuse') == "on";
  1269. }
  1270. public function isFeatureMknod()
  1271. {
  1272. return $this->get('featureMknod') == "on";
  1273. }
  1274. public function hasCpuFlags(){
  1275. $configFlags =['md-clear', "pcid", "spec-ctrl", "ssbd", "ibpb", "virt-ssbd",
  1276. "amd-ssbd", "amd-no-ssb", "pdpe1gb", "hv-tlbflush","hv-evmcs", "aes" ];
  1277. foreach ($configFlags as $configFlag) {
  1278. if($this->get($configFlag)=="on"){
  1279. return true;
  1280. }
  1281. }
  1282. return false;
  1283. }
  1284. public function getCpuFlagsAsSource(){
  1285. $configFlags =['md-clear', "pcid", "spec-ctrl", "ssbd", "ibpb", "virt-ssbd",
  1286. "amd-ssbd", "amd-no-ssb", "pdpe1gb", "hv-tlbflush","hv-evmcs", "aes" ];
  1287. $cpuFlags=[];
  1288. foreach ($configFlags as $configFlag) {
  1289. if($this->get($configFlag)=="on"){
  1290. $cpuFlags[] = "+". $configFlag;
  1291. }
  1292. }
  1293. return implode(";", $cpuFlags);
  1294. }
  1295. public function isSsd()
  1296. {
  1297. return $this->get('ssd') == "on";
  1298. }
  1299. public function isAdditionalDiskSsd()
  1300. {
  1301. return $this->get('additionalDiskSsd') == "on";
  1302. }
  1303. /**
  1304. * @return array
  1305. */
  1306. public function getPermissionFirewalOptions()
  1307. {
  1308. return (array) $this->get("permissionFirewalOptions");
  1309. }
  1310. public function isFirewalOptionEnable()
  1311. {
  1312. return $this->get("firewalOptionEnable") == "on";
  1313. }
  1314. public function isFirewalOptionNdp()
  1315. {
  1316. return $this->get("firewalOptionNdp") == "on";
  1317. }
  1318. public function isFirewalOptionMacfilter()
  1319. {
  1320. return $this->get("firewalOptionMacfilter") == "on";
  1321. }
  1322. public function isFirewalOptionDhcp()
  1323. {
  1324. return $this->get("firewalOptionDhcp") == "on";
  1325. }
  1326. public function isFirewalOptionRadv()
  1327. {
  1328. return $this->get("firewalOptionRadv") == "on";
  1329. }
  1330. public function isFirewalOptionIpfilter()
  1331. {
  1332. return $this->get("firewalOptionIpfilter") == "on";
  1333. }
  1334. public function getBwLimit(){
  1335. return $this->get('bwlimit');
  1336. }
  1337. public function getBios(){
  1338. return $this->get('bios');
  1339. }
  1340. public function isPermissionVirtualNetwork()
  1341. {
  1342. return $this->get("permissionVirtualNetwork") == "on";
  1343. }
  1344. public function getLocations()
  1345. {
  1346. return $this->get("locations");
  1347. }
  1348. public function getPermissionOstype()
  1349. {
  1350. return $this->get("permissionOstype");
  1351. }
  1352. public function isPermissionUsername()
  1353. {
  1354. return $this->get("permissionUsername") == "on";
  1355. }
  1356. public function isPermissionPassword()
  1357. {
  1358. return $this->get("permissionPassword") == "on";
  1359. }
  1360. public function isPermissionNameservers()
  1361. {
  1362. return $this->get("permissionNameservers") == "on";
  1363. }
  1364. public function isPermissionSearchdomain()
  1365. {
  1366. return $this->get("permissionSearchdomain") == "on";
  1367. }
  1368. public function isPermissionIpv4()
  1369. {
  1370. return $this->get("permissionIpv4") == "on";
  1371. }
  1372. public function isPermissionIpv6()
  1373. {
  1374. return $this->get("permissionIpv6") == "on";
  1375. }
  1376. public function isPermissionSockets()
  1377. {
  1378. return $this->get("permissionSockets") == "on";
  1379. }
  1380. public function isPermissionCores()
  1381. {
  1382. return $this->get("permissionCores") == "on";
  1383. }
  1384. public function isPermissionVcpus()
  1385. {
  1386. return $this->get("permissionVcpus") == "on";
  1387. }
  1388. public function isPermissionCpuLimit()
  1389. {
  1390. return $this->get("permissionCpuLimit") == "on";
  1391. }
  1392. public function isPermissionCpuunits()
  1393. {
  1394. return $this->get("permissionCpuunits") == "on";
  1395. }
  1396. public function isPermissionSwap()
  1397. {
  1398. return $this->get("permissionSwap") == "on";
  1399. }
  1400. public function __get($name)
  1401. {
  1402. if(preg_match("/server/", $name)){
  1403. $data = new \stdClass();
  1404. $data->min = 0;
  1405. $data->max = 0;
  1406. $value = $this->get($name);
  1407. if(is_null($value)){
  1408. return $data;
  1409. }
  1410. list($data->min, $data->max) = explode("-", $this->get($name));
  1411. return $data;
  1412. }
  1413. return $this->get($name);
  1414. }
  1415. public function getVirtualNetworks(){
  1416. return $this->get('virtualNetworks');
  1417. }
  1418. public function getButtonSyle()
  1419. {
  1420. return $this->get("buttonSyle");
  1421. }
  1422. public function hasCpuPriority(){
  1423. for($i=1; $i<=5; $i++) {
  1424. if(empty($this->get('cpuunitsPriority'.$i))){
  1425. return false;
  1426. }
  1427. if(empty($this->get('cpulimitPriority'. $i))){
  1428. return false;
  1429. }
  1430. }
  1431. return true;
  1432. }
  1433. public function isPermissionCustomTemplates(){
  1434. return $this->get('permissionCustomTemplates')=='on';
  1435. }
  1436. public function isDetailsCombinedView()
  1437. {
  1438. return $this->get("detailsView")=='combined';
  1439. }
  1440. public function isCalculateSocketsAndCores()
  1441. {
  1442. return $this->get("calculateSocketsAndCores")=='on';
  1443. }
  1444. public function getCloudInitScript(){
  1445. return $this->get('cloudInitScript');
  1446. }
  1447. public function getMachine(){
  1448. return $this->get('machine');
  1449. }
  1450. /**
  1451. * @return array|null
  1452. */
  1453. public function getServerGroup(){
  1454. return $this->get('serverGroup');
  1455. }
  1456. public function isLoadBalancerMigrationWithLocalDisks()
  1457. {
  1458. return $this->get("loadBalancerMigrationWithLocalDisks") == "on";
  1459. }
  1460. public function getPermissionBackupCompress()
  1461. {
  1462. return (array) $this->get("permissionBackupCompress");
  1463. }
  1464. public function isPermissionArchive()
  1465. {
  1466. return $this->get("permissionArchive") == "on";
  1467. }
  1468. public function isOrderPublicIp()
  1469. {
  1470. return $this->get("orderPublicIp") != "off";
  1471. }
  1472. }