forked from uncloud/uncloud
Added --conf-dir, --etcd-{host,port,ca_cert,cert_cert,cert_key} parameters to cli and settings is now accessbile through uncloud.shared.shared.settings
This commit is contained in:
parent
e6d22a73c5
commit
c3b42aabc6
19 changed files with 176 additions and 154 deletions
|
|
@ -22,7 +22,6 @@ import bitmath
|
|||
from uncloud.common.host import HostStatus
|
||||
from uncloud.common.vm import VMStatus
|
||||
from uncloud.common.shared import shared
|
||||
from uncloud.common.settings import settings
|
||||
from . import helper, logger
|
||||
from .common_fields import Field, VmUUIDField
|
||||
from .helper import check_otp, resolve_vm_name
|
||||
|
|
@ -112,7 +111,7 @@ class CreateImageSchema(BaseSchema):
|
|||
def file_uuid_validation(self):
|
||||
file_entry = shared.etcd_client.get(
|
||||
os.path.join(
|
||||
settings["etcd"]["file_prefix"], self.uuid.value
|
||||
shared.shared.shared.shared.shared.settings["etcd"]["file_prefix"], self.uuid.value
|
||||
)
|
||||
)
|
||||
if file_entry is None:
|
||||
|
|
@ -125,7 +124,7 @@ class CreateImageSchema(BaseSchema):
|
|||
def image_store_name_validation(self):
|
||||
image_stores = list(
|
||||
shared.etcd_client.get_prefix(
|
||||
settings["etcd"]["image_store_prefix"]
|
||||
shared.shared.shared.shared.shared.settings["etcd"]["image_store_prefix"]
|
||||
)
|
||||
)
|
||||
|
||||
|
|
@ -283,7 +282,7 @@ class CreateVMSchema(OTPSchema):
|
|||
for net in _network:
|
||||
network = shared.etcd_client.get(
|
||||
os.path.join(
|
||||
settings["etcd"]["network_prefix"],
|
||||
shared.shared.shared.shared.shared.settings["etcd"]["network_prefix"],
|
||||
self.name.value,
|
||||
net,
|
||||
),
|
||||
|
|
@ -488,7 +487,7 @@ class VmMigrationSchema(OTPSchema):
|
|||
self.add_error("Can't migrate non-running VM")
|
||||
|
||||
if vm.hostname == os.path.join(
|
||||
settings["etcd"]["host_prefix"], self.destination.value
|
||||
shared.shared.shared.shared.shared.settings["etcd"]["host_prefix"], self.destination.value
|
||||
):
|
||||
self.add_error(
|
||||
"Destination host couldn't be same as Source Host"
|
||||
|
|
@ -539,9 +538,7 @@ class CreateNetwork(OTPSchema):
|
|||
super().__init__(data, fields=fields)
|
||||
|
||||
def network_name_validation(self):
|
||||
print(self.name.value, self.network_name.value)
|
||||
key = os.path.join(settings["etcd"]["network_prefix"], self.name.value, self.network_name.value)
|
||||
print(key)
|
||||
key = os.path.join(shared.shared.shared.shared.shared.settings["etcd"]["network_prefix"], self.name.value, self.network_name.value)
|
||||
network = shared.etcd_client.get(key, value_in_json=True)
|
||||
if network:
|
||||
self.add_error(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue