|
40 | 40 | import javax.inject.Inject; |
41 | 41 | import javax.naming.ConfigurationException; |
42 | 42 |
|
43 | | -import org.apache.commons.codec.binary.Base64; |
44 | | -import org.apache.log4j.Logger; |
45 | | - |
46 | 43 | import org.apache.cloudstack.acl.ControlledEntity; |
47 | | -import org.apache.cloudstack.acl.SecurityChecker.AccessType; |
48 | 44 | import org.apache.cloudstack.affinity.AffinityGroupProcessor; |
49 | 45 | import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao; |
50 | 46 | import org.apache.cloudstack.api.ApiConstants; |
51 | | -import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd; |
52 | 47 | import org.apache.cloudstack.api.command.admin.account.CreateAccountCmd; |
53 | 48 | import org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd; |
54 | 49 | import org.apache.cloudstack.api.command.admin.account.DisableAccountCmd; |
|
465 | 460 | import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; |
466 | 461 | import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; |
467 | 462 | import org.apache.cloudstack.utils.identity.ManagementServerNode; |
| 463 | +import org.apache.commons.codec.binary.Base64; |
| 464 | +import org.apache.log4j.Logger; |
468 | 465 |
|
469 | 466 | import com.cloud.agent.AgentManager; |
470 | 467 | import com.cloud.agent.api.GetVncPortAnswer; |
|
556 | 553 | import com.cloud.storage.GuestOSHypervisorVO; |
557 | 554 | import com.cloud.storage.GuestOSVO; |
558 | 555 | import com.cloud.storage.GuestOsCategory; |
559 | | -import com.cloud.storage.Storage.ImageFormat; |
560 | | -import com.cloud.storage.Storage.TemplateType; |
561 | 556 | import com.cloud.storage.StorageManager; |
562 | 557 | import com.cloud.storage.StoragePool; |
563 | | -import com.cloud.storage.VMTemplateVO; |
564 | 558 | import com.cloud.storage.Volume; |
565 | 559 | import com.cloud.storage.VolumeVO; |
566 | 560 | import com.cloud.storage.dao.DiskOfferingDao; |
567 | 561 | import com.cloud.storage.dao.GuestOSCategoryDao; |
568 | 562 | import com.cloud.storage.dao.GuestOSDao; |
569 | 563 | import com.cloud.storage.dao.GuestOSHypervisorDao; |
570 | | -import com.cloud.storage.dao.VMTemplateDao; |
571 | 564 | import com.cloud.storage.dao.VolumeDao; |
572 | 565 | import com.cloud.storage.secondary.SecondaryStorageVmManager; |
573 | 566 | import com.cloud.tags.ResourceTagVO; |
574 | 567 | import com.cloud.tags.dao.ResourceTagDao; |
575 | 568 | import com.cloud.template.TemplateManager; |
576 | 569 | import com.cloud.user.Account; |
577 | 570 | import com.cloud.user.AccountManager; |
578 | | -import com.cloud.user.AccountService; |
579 | 571 | import com.cloud.user.SSHKeyPair; |
580 | 572 | import com.cloud.user.SSHKeyPairVO; |
581 | 573 | import com.cloud.user.User; |
582 | 574 | import com.cloud.user.UserVO; |
583 | 575 | import com.cloud.user.dao.AccountDao; |
584 | 576 | import com.cloud.user.dao.SSHKeyPairDao; |
585 | 577 | import com.cloud.user.dao.UserDao; |
586 | | -import com.cloud.utils.EnumUtils; |
587 | 578 | import com.cloud.utils.NumbersUtil; |
588 | 579 | import com.cloud.utils.Pair; |
589 | 580 | import com.cloud.utils.PasswordGenerator; |
@@ -668,8 +659,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe |
668 | 659 | @Inject |
669 | 660 | private DiskOfferingDao _diskOfferingDao; |
670 | 661 | @Inject |
671 | | - private VMTemplateDao _templateDao; |
672 | | - @Inject |
673 | 662 | private DomainDao _domainDao; |
674 | 663 | @Inject |
675 | 664 | private AccountDao _accountDao; |
@@ -734,15 +723,11 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe |
734 | 723 | @Inject |
735 | 724 | private UserVmManager _userVmMgr; |
736 | 725 | @Inject |
737 | | - private AccountService _accountService; |
738 | | - @Inject |
739 | 726 | private ServiceOfferingDao _offeringDao; |
740 | | - |
741 | 727 | @Inject |
742 | 728 | private DeploymentPlanningManager _dpMgr; |
743 | 729 |
|
744 | 730 | private LockMasterListener _lockMasterListener; |
745 | | - |
746 | 731 | private final ScheduledExecutorService _eventExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("EventChecker")); |
747 | 732 | private final ScheduledExecutorService _alertExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("AlertChecker")); |
748 | 733 | @Inject |
@@ -1809,108 +1794,6 @@ private Set<Pair<Long, Long>> listTemplates(Long templateId, String name, String |
1809 | 1794 | } |
1810 | 1795 | */ |
1811 | 1796 |
|
1812 | | - private VMTemplateVO updateTemplateOrIso(BaseUpdateTemplateOrIsoCmd cmd) { |
1813 | | - Long id = cmd.getId(); |
1814 | | - String name = cmd.getTemplateName(); |
1815 | | - String displayText = cmd.getDisplayText(); |
1816 | | - String format = cmd.getFormat(); |
1817 | | - Long guestOSId = cmd.getOsTypeId(); |
1818 | | - Boolean passwordEnabled = cmd.isPasswordEnabled(); |
1819 | | - Boolean bootable = cmd.isBootable(); |
1820 | | - Integer sortKey = cmd.getSortKey(); |
1821 | | - Boolean isDynamicallyScalable = cmd.isDynamicallyScalable(); |
1822 | | - Boolean isRoutingTemplate = cmd.isRoutingType(); |
1823 | | - Account account = CallContext.current().getCallingAccount(); |
1824 | | - |
1825 | | - // verify that template exists |
1826 | | - VMTemplateVO template = _templateDao.findById(id); |
1827 | | - if (template == null || template.getRemoved() != null) { |
1828 | | - InvalidParameterValueException ex = new InvalidParameterValueException("unable to find template/iso with specified id"); |
1829 | | - ex.addProxyObject(id.toString(), "templateId"); |
1830 | | - throw ex; |
1831 | | - } |
1832 | | - |
1833 | | - // Don't allow to modify system template |
1834 | | - if (id.equals(Long.valueOf(1))) { |
1835 | | - InvalidParameterValueException ex = new InvalidParameterValueException("Unable to update template/iso of specified id"); |
1836 | | - ex.addProxyObject(template.getUuid(), "templateId"); |
1837 | | - throw ex; |
1838 | | - } |
1839 | | - |
1840 | | - // do a permission check |
1841 | | - _accountMgr.checkAccess(account, AccessType.ModifyEntry, true, template); |
1842 | | - |
1843 | | - if (cmd.isRoutingType() != null) { |
1844 | | - if (!_accountService.isRootAdmin(account.getType())) { |
1845 | | - throw new PermissionDeniedException("Parameter isrouting can only be specified by a Root Admin, permission denied"); |
1846 | | - } |
1847 | | - } |
1848 | | - boolean updateNeeded = !(name == null && displayText == null && format == null && guestOSId == null && passwordEnabled == null && bootable == null && sortKey == null |
1849 | | - && isDynamicallyScalable == null && isRoutingTemplate == null); |
1850 | | - if (!updateNeeded) { |
1851 | | - return template; |
1852 | | - } |
1853 | | - |
1854 | | - template = _templateDao.createForUpdate(id); |
1855 | | - |
1856 | | - if (name != null) { |
1857 | | - template.setName(name); |
1858 | | - } |
1859 | | - |
1860 | | - if (displayText != null) { |
1861 | | - template.setDisplayText(displayText); |
1862 | | - } |
1863 | | - |
1864 | | - if (sortKey != null) { |
1865 | | - template.setSortKey(sortKey); |
1866 | | - } |
1867 | | - |
1868 | | - ImageFormat imageFormat = null; |
1869 | | - if (format != null) { |
1870 | | - try { |
1871 | | - imageFormat = ImageFormat.valueOf(format.toUpperCase()); |
1872 | | - } catch (IllegalArgumentException e) { |
1873 | | - throw new InvalidParameterValueException("Image format: " + format + " is incorrect. Supported formats are " + EnumUtils.listValues(ImageFormat.values())); |
1874 | | - } |
1875 | | - |
1876 | | - template.setFormat(imageFormat); |
1877 | | - } |
1878 | | - |
1879 | | - if (guestOSId != null) { |
1880 | | - GuestOSVO guestOS = _guestOSDao.findById(guestOSId); |
1881 | | - |
1882 | | - if (guestOS == null) { |
1883 | | - throw new InvalidParameterValueException("Please specify a valid guest OS ID."); |
1884 | | - } else { |
1885 | | - template.setGuestOSId(guestOSId); |
1886 | | - } |
1887 | | - } |
1888 | | - |
1889 | | - if (passwordEnabled != null) { |
1890 | | - template.setEnablePassword(passwordEnabled); |
1891 | | - } |
1892 | | - |
1893 | | - if (bootable != null) { |
1894 | | - template.setBootable(bootable); |
1895 | | - } |
1896 | | - |
1897 | | - if (isDynamicallyScalable != null) { |
1898 | | - template.setDynamicallyScalable(isDynamicallyScalable); |
1899 | | - } |
1900 | | - |
1901 | | - if (isRoutingTemplate != null) { |
1902 | | - if (isRoutingTemplate) { |
1903 | | - template.setTemplateType(TemplateType.ROUTING); |
1904 | | - } else { |
1905 | | - template.setTemplateType(TemplateType.USER); |
1906 | | - } |
1907 | | - } |
1908 | | - |
1909 | | - _templateDao.update(id, template); |
1910 | | - |
1911 | | - return _templateDao.findById(id); |
1912 | | - } |
1913 | | - |
1914 | 1797 | @Override |
1915 | 1798 | public Pair<List<? extends IpAddress>, Integer> searchForIPAddresses(ListPublicIpAddressesCmd cmd) { |
1916 | 1799 | Object keyword = cmd.getKeyword(); |
@@ -3462,7 +3345,7 @@ public Map<String, Object> listCapabilities(ListCapabilitiesCmd cmd) { |
3462 | 3345 | } |
3463 | 3346 | } |
3464 | 3347 |
|
3465 | | - long diskOffMaxSize = _volumeMgr.CustomDiskOfferingMaxSize.value(); |
| 3348 | + long diskOffMaxSize = VolumeOrchestrationService.CustomDiskOfferingMaxSize.value(); |
3466 | 3349 | KVMSnapshotEnabled = Boolean.parseBoolean(_configDao.getValue("KVM.snapshot.enabled")); |
3467 | 3350 |
|
3468 | 3351 | boolean userPublicTemplateEnabled = TemplateManager.AllowPublicUserTemplates.valueIn(caller.getId()); |
|
0 commit comments