ProductConfigurationRepository.php 31 KB

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