oracle.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package guestdrivers
  15. import (
  16. "yunion.io/x/cloudmux/pkg/cloudprovider"
  17. "yunion.io/x/pkg/util/billing"
  18. "yunion.io/x/pkg/util/rbacscope"
  19. api "yunion.io/x/onecloud/pkg/apis/compute"
  20. "yunion.io/x/onecloud/pkg/cloudcommon/db/quotas"
  21. "yunion.io/x/onecloud/pkg/compute/models"
  22. "yunion.io/x/onecloud/pkg/mcclient"
  23. )
  24. type SOracleGuestDriver struct {
  25. SManagedVirtualizedGuestDriver
  26. }
  27. func init() {
  28. driver := SOracleGuestDriver{}
  29. models.RegisterGuestDriver(&driver)
  30. }
  31. func (self *SOracleGuestDriver) DoScheduleSKUFilter() bool { return false }
  32. func (self *SOracleGuestDriver) GetHypervisor() string {
  33. return api.HYPERVISOR_ORACLE
  34. }
  35. func (self *SOracleGuestDriver) GetProvider() string {
  36. return api.CLOUD_PROVIDER_ORACLE
  37. }
  38. func (self *SOracleGuestDriver) GetDefaultSysDiskBackend() string {
  39. return ""
  40. }
  41. func (self *SOracleGuestDriver) GetMinimalSysDiskSizeGb() int {
  42. return 20
  43. }
  44. func (self *SOracleGuestDriver) GetComputeQuotaKeys(scope rbacscope.TRbacScope, ownerId mcclient.IIdentityProvider, brand string) models.SComputeResourceKeys {
  45. keys := models.SComputeResourceKeys{}
  46. keys.SBaseProjectQuotaKeys = quotas.OwnerIdProjectQuotaKeys(scope, ownerId)
  47. keys.CloudEnv = api.CLOUD_ENV_PUBLIC_CLOUD
  48. keys.Provider = api.CLOUD_PROVIDER_ORACLE
  49. keys.Brand = api.CLOUD_PROVIDER_ORACLE
  50. keys.Hypervisor = api.HYPERVISOR_ORACLE
  51. return keys
  52. }
  53. func (self *SOracleGuestDriver) GetInstanceCapability() cloudprovider.SInstanceCapability {
  54. return cloudprovider.SInstanceCapability{
  55. Hypervisor: self.GetHypervisor(),
  56. Provider: self.GetProvider(),
  57. DefaultAccount: cloudprovider.SDefaultAccount{
  58. Linux: cloudprovider.SOsDefaultAccount{
  59. DefaultAccount: api.VM_DEFAULT_LINUX_LOGIN_USER,
  60. Changeable: false,
  61. },
  62. Windows: cloudprovider.SOsDefaultAccount{
  63. DefaultAccount: api.VM_DEFAULT_WINDOWS_LOGIN_USER,
  64. Changeable: false,
  65. },
  66. },
  67. }
  68. }
  69. func (self *SOracleGuestDriver) GetGuestInitialStateAfterCreate() string {
  70. return api.VM_READY
  71. }
  72. func (self *SOracleGuestDriver) GetGuestInitialStateAfterRebuild() string {
  73. return api.VM_READY
  74. }
  75. func (self *SOracleGuestDriver) AllowReconfigGuest() bool {
  76. return true
  77. }
  78. func (self *SOracleGuestDriver) IsSupportedBillingCycle(bc billing.SBillingCycle) bool {
  79. return false
  80. }
  81. func (self *SOracleGuestDriver) IsSupportPublicipToEip() bool {
  82. return false
  83. }
  84. func (self *SOracleGuestDriver) IsSupportSetAutoRenew() bool {
  85. return false
  86. }