ProductConfigurationRepository.php 29 KB

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