本文整理汇总了Python中marvin.lib.base.Configurations.update方法的典型用法代码示例。如果您正苦于以下问题:Python Configurations.update方法的具体用法?Python Configurations.update怎么用?Python Configurations.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marvin.lib.base.Configurations
的用法示例。
在下文中一共展示了Configurations.update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_03_concurrent_snapshot_global_value_assignment
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import update [as 别名]
def test_03_concurrent_snapshot_global_value_assignment(self):
""" Test verifies that exception is raised if string value is assigned to
concurrent.snapshots.threshold.perhost parameter.
"""
with self.assertRaises(Exception):
Configurations.update(
self.apiclient,
"concurrent.snapshots.threshold.perhost",
"String"
)
return
示例2: tearDownClass
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import update [as 别名]
def tearDownClass(cls):
try:
# Cleanup resources used
if cls.updateclone:
Configurations.update(cls.api_client,
"vmware.create.full.clone",
value="false",storageid=cls.storageID)
cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
示例3: update_NuageVspGlobalDomainTemplate
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import update [as 别名]
def update_NuageVspGlobalDomainTemplate(self, value):
self.debug("Updating global setting nuagevsp.vpc.domaintemplate.name "
"with value - %s" % value)
self.user_apikey = self.api_client.connection.apiKey
self.user_secretkey = self.api_client.connection.securityKey
self.api_client.connection.apiKey = self.default_apikey
self.api_client.connection.securityKey = self.default_secretkey
Configurations.update(self.api_client,
name="nuagevsp.vpc.domaintemplate.name",
value=value)
self.api_client.connection.apiKey = self.user_apikey
self.api_client.connection.securityKey = self.user_secretkey
self.debug("Successfully updated global setting "
"nuagevsp.vpc.domaintemplate.name with value - %s" % value)
示例4: test_01_cluster_settings
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import update [as 别名]
def test_01_cluster_settings(self):
"""change cpu/mem.overprovisioning.factor at cluster level and
verify the change """
listHost = Host.list(self.apiclient,
id=self.deployVmResponse.hostid
)
self.assertEqual(
validateList(listHost)[0],
PASS,
"check list host response for host id %s" %
self.deployVmResponse.hostid)
Configurations.update(self.apiclient,
clusterid=listHost[0].clusterid,
name="mem.overprovisioning.factor",
value=2)
Configurations.update(self.apiclient,
clusterid=listHost[0].clusterid,
name="cpu.overprovisioning.factor",
value=3)
list_cluster = Cluster.list(self.apiclient,
id=listHost[0].clusterid)
self.assertEqual(
validateList(list_cluster)[0],
PASS,
"check list cluster response for cluster id %s" %
listHost[0].clusterid)
self.assertEqual(int(list_cluster[0].cpuovercommitratio),
3,
"check the cpu overcommit value at cluster level ")
self.assertEqual(int(list_cluster[0].memoryovercommitratio),
2,
"check memory overcommit value at cluster level")
Configurations.update(self.apiclient,
clusterid=listHost[0].clusterid,
name="mem.overprovisioning.factor",
value=1)
Configurations.update(self.apiclient,
clusterid=listHost[0].clusterid,
name="cpu.overprovisioning.factor",
value=1)
list_cluster1 = Cluster.list(self.apiclient,
id=listHost[0].clusterid)
self.assertEqual(
validateList(list_cluster1)[0],
PASS,
"check the list cluster response for id %s" %
listHost[0].clusterid)
self.assertEqual(int(list_cluster1[0].cpuovercommitratio),
1,
"check the cpu overcommit value at cluster level ")
self.assertEqual(int(list_cluster1[0].memoryovercommitratio),
1,
"check memory overcommit value at cluster level")
示例5: test_es_1223_apply_algo_to_pods
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import update [as 别名]
def test_es_1223_apply_algo_to_pods(self):
"""
@Desc: Test VM creation while "apply.allocation.algorithm.to.pods" is
set to true
@Reference: https://issues.apache.org/jira/browse/CLOUDSTACK-4947
@Steps:
Step1: Set global configuration "apply.allocation.algorithm.to.pods"
to true
Step2: Restart management server
Step3: Verifying that VM creation is successful
"""
# Step1: set global configuration
# "apply.allocation.algorithm.to.pods" to true
# Configurations.update(self.apiClient,
# "apply.allocation.algorithm.to.pods", "true")
# TODO: restart management server
if not is_config_suitable(apiclient=self.apiClient,
name='apply.allocation.algorithm.to.pods',
value='true'):
self.skipTest('apply.allocation.algorithm.to.pods '
'should be true. skipping')
# TODO:Step2: Restart management server
self.services["virtual_machine"]["zoneid"] = self.zone.id
self.services["virtual_machine"]["template"] = self.template.id
# Step3: Verifying that VM creation is successful
virtual_machine = VirtualMachine.create(
self.apiClient,
self.services["virtual_machine2"],
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
)
self.cleanup.append(virtual_machine)
# Verify VM state
self.assertEqual(
virtual_machine.state,
'Running',
"Check VM state is Running or not"
)
# cleanup: set global configuration
# "apply.allocation.algorithm.to.pods" back to false
Configurations.update(
self.apiClient,
name="apply.allocation.algorithm.to.pods",
value="false"
)
# TODO:cleanup: Restart management server
return
示例6: test_vms_with_same_name
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import update [as 别名]
def test_vms_with_same_name(self):
""" Test vm deployment with same name
# 1. Deploy a VM on with perticular name from account_1
# 2. Try to deploy another vm with same name from account_2
# 3. Verify that second VM deployment fails
"""
# Step 1
# Create VM on cluster wide
configs = Configurations.list(
self.apiclient,
name="vm.instancename.flag")
orig_value = configs[0].value
if orig_value == "false":
Configurations.update(self.apiclient,
name="vm.instancename.flag",
value="true"
)
# Restart management server
self.RestartServer()
time.sleep(120)
self.testdata["small"]["displayname"]="TestName"
self.testdata["small"]["name"]="TestName"
VirtualMachine.create(
self.userapiclient_1,
self.testdata["small"],
templateid=self.template.id,
accountid=self.account_1.name,
domainid=self.account_1.domainid,
serviceofferingid=self.service_offering.id,
zoneid=self.zone.id,
)
with self.assertRaises(Exception):
VirtualMachine.create(
self.userapiclient_2,
self.testdata["small"],
templateid=self.template.id,
accountid=self.account_2.name,
domainid=self.account_2.domainid,
serviceofferingid=self.service_offering.id,
zoneid=self.zone.id,
)
return
示例7: execute_internallb_haproxy_tests
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import update [as 别名]
def execute_internallb_haproxy_tests(self, vpc_offering):
settings = self.get_lb_stats_settings()
dummy_port = 90
network_gw = "10.1.2.1"
default_visibility = "global"
# Update global setting if it is not set to our test default
if settings["visibility"] != default_visibility:
config_update = Configurations.update(
self.apiclient, "network.loadbalancer.haproxy.stats.visibility", default_visibility)
self.logger.debug(
"Updated global setting stats haproxy.stats.visibility to %s" % (default_visibility))
settings = self.get_lb_stats_settings()
# Create and enable network offering
network_offering_intlb = self.create_and_enable_network_serviceoffering(
self.services["network_offering_internal_lb"])
# Create VPC
vpc = self.create_vpc(vpc_offering)
# Create network tier with internal lb service enabled
network_internal_lb = self.create_network_tier(
"intlb_test02", vpc.id, network_gw, network_offering_intlb)
# Create 1 lb vm in internal lb network tier
vm = self.deployvm_in_network(vpc, network_internal_lb.id)
# Acquire 1 public ip and attach to the internal lb network tier
public_ip = self.acquire_publicip(vpc, network_internal_lb)
# Create an internal loadbalancer in the internal lb network tier
applb = self.create_internal_loadbalancer(
dummy_port, dummy_port, "leastconn", network_internal_lb.id)
# Assign the 1 VM to the Internal Load Balancer
self.logger.debug("Assigning virtual machines to LB: %s" % applb.id)
try:
applb.assign(self.apiclient, vms=[vm])
except Exception as e:
self.fail(
"Failed to assign virtual machine(s) to loadbalancer: %s" % e)
# Create nat rule to access client vm
self.create_natrule(
vpc, vm, "22", "22", public_ip, network_internal_lb)
# Verify access to and the contents of the admin stats page on the
# private address via a vm in the internal lb tier
stats = self.verify_lb_stats(
applb.sourceipaddress, self.get_ssh_client(vm, 5), settings)
self.assertTrue(stats, "Failed to verify LB HAProxy stats")
示例8: get_lb_stats_settings
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import update [as 别名]
def get_lb_stats_settings(self):
self.logger.debug("Retrieving haproxy stats settings")
settings = {}
try:
settings["stats_port"] = Configurations.list(
self.apiclient, name="network.loadbalancer.haproxy.stats.port")[0].value
settings["stats_uri"] = Configurations.list(
self.apiclient, name="network.loadbalancer.haproxy.stats.uri")[0].value
# Update global setting network.loadbalancer.haproxy.stats.auth to a known value
haproxy_auth = "admin:password"
Configurations.update(self.apiclient, "network.loadbalancer.haproxy.stats.auth", haproxy_auth)
self.logger.debug(
"Updated global setting stats network.loadbalancer.haproxy.stats.auth to %s" % (haproxy_auth))
settings["username"], settings["password"] = haproxy_auth.split(":")
settings["visibility"] = Configurations.list(
self.apiclient, name="network.loadbalancer.haproxy.stats.visibility")[0].value
self.logger.debug(settings)
except Exception as e:
self.fail("Failed to retrieve stats settings " % e)
return settings
示例9: tearDownClass
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import update [as 别名]
def tearDownClass(cls):
try:
# Cleanup resources used
if cls.updateclone:
Configurations.update(cls.api_client,
"vmware.create.full.clone",
value="false",storageid=cls.storageID)
Configurations.update(cls.api_client,
"vmware.create.full.clone",
value="false")
Configurations.update(cls.api_client,
"vmware.root.disk.controller",
value=cls.defaultdiskcontroller)
StoragePool.update(cls.api_client, id=cls.storageID,
tags="")
cls.restartServer()
#Giving 30 seconds to management to warm-up,
#Experienced failures when trying to deploy a VM exactly when management came up
time.sleep(30)
cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
示例10: tearDownClass
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import update [as 别名]
def tearDownClass(cls):
try:
# Cleanup resources used
if cls.updateclone:
Configurations.update(cls.api_client,
"vmware.root.disk.controller",
value=cls.defaultdiskcontroller)
Configurations.update(cls.api_client,
"vmware.create.full.clone",
value="false")
Configurations.update(cls.api_client,
"vmware.create.full.clone",
value="false", storageid=cls.storageID)
if cls.storageID:
StoragePool.update(cls.api_client, id=cls.storageID,
tags="")
cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
示例11: test_03_cluste_capacity_check
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import update [as 别名]
def test_03_cluste_capacity_check(self):
"""change cpu/mem.overprovisioning.factor at cluster level and
verify cluster capacity """
listHost = Host.list(self.apiclient,
id=self.deployVmResponse.hostid
)
self.assertEqual(
validateList(listHost)[0],
PASS,
"check list host for host id %s" %
self.deployVmResponse.hostid)
Configurations.update(self.apiclient,
clusterid=listHost[0].clusterid,
name="mem.overprovisioning.factor",
value=1)
Configurations.update(self.apiclient,
clusterid=listHost[0].clusterid,
name="cpu.overprovisioning.factor",
value=1)
time.sleep(self.wait_time)
capacity = Capacities.list(self.apiclient,
clusterid=listHost[0].clusterid)
self.assertEqual(
validateList(capacity)[0],
PASS,
"check list capacity response for cluster id %s" %
listHost[0].clusterid)
cpu, mem = capacity_parser(capacity)
Configurations.update(self.apiclient,
clusterid=listHost[0].clusterid,
name="mem.overprovisioning.factor",
value=2)
Configurations.update(self.apiclient,
clusterid=listHost[0].clusterid,
name="cpu.overprovisioning.factor",
value=2)
time.sleep(self.wait_time)
capacity1 = Capacities.list(self.apiclient,
clusterid=listHost[0].clusterid)
self.assertEqual(
validateList(capacity1)[0],
PASS,
"check list capacity response for cluster id %s" %
listHost[0].clusterid)
cpu1, mem1 = capacity_parser(capacity1)
self.assertEqual(2 * cpu[0],
cpu1[0],
"check total capacity ")
self.assertEqual(2 * cpu[1],
cpu1[1],
"check capacity used")
self.assertEqual(cpu[2],
cpu1[2],
"check capacity % used")
self.assertEqual(2 * mem[0],
mem1[0],
"check mem total capacity ")
self.assertEqual(2 * mem[1],
mem1[1],
"check mem capacity used")
self.assertEqual(mem[2],
mem1[2],
"check mem capacity % used")
示例12: addLdapConfiguration1
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import update [as 别名]
def addLdapConfiguration1(cls, ldapConfiguration):
"""
:param ldapConfiguration
"""
cls.chkConfig = checkLdapConfiguration(cls, ldapConfiguration)
if not cls.chkConfig:
return 0
# Setup Global settings
Configurations.update(
cls.apiClient,
name="ldap.basedn",
value=ldapConfiguration['basedn']
)
Configurations.update(
cls.apiClient,
name="ldap.bind.password",
value=ldapConfiguration['bindpassword']
)
Configurations.update(
cls.apiClient,
name="ldap.bind.principal",
value=ldapConfiguration['principal']
)
Configurations.update(
cls.apiClient,
name="ldap.email.attribute",
value=ldapConfiguration['emailAttribute']
)
Configurations.update(
cls.apiClient,
name="ldap.user.object",
value=ldapConfiguration['userObject']
)
Configurations.update(
cls.apiClient,
name="ldap.username.attribute",
value=ldapConfiguration['usernameAttribute']
)
Configurations.update(
cls.apiClient,
name="ldap.nested.groups.enable",
value="true"
)
ldapServer = addLdapConfiguration.addLdapConfigurationCmd()
ldapServer.hostname = ldapConfiguration['hostname']
ldapServer.port = ldapConfiguration['port']
cls.debug("calling addLdapConfiguration API command")
try:
cls.apiClient.addLdapConfiguration(ldapServer)
cls.debug("addLdapConfiguration was successful")
return 1
except Exception as e:
cls.debug(
"addLdapConfiguration failed %s Check the Passed passed"
" ldap attributes" %
e)
cls.reason = "addLdapConfiguration failed %s Check the Passed " \
"passed ldap attributes" % e
raise Exception(
"addLdapConfiguration failed %s Check the Passed passed"
" ldap attributes" %
e)
return 1
示例13: setUpClass
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import update [as 别名]
def setUpClass(cls):
testClient = super(TestDeltaSnapshots, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.testdata = testClient.getParsedTestDataConfig()
cls.hypervisor = cls.testClient.getHypervisorInfo()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.template = get_template(
cls.apiclient,
cls.zone.id,
cls.testdata["ostype"])
cls.snapshots_created = []
cls._cleanup = []
cls.mgtSvrDetails = cls.config.__dict__["mgtSvr"][0].__dict__
cls.skiptest = False
if cls.hypervisor.lower() not in ["xenserver"]:
cls.skiptest = True
try:
# Create an account
cls.account = Account.create(
cls.apiclient,
cls.testdata["account"],
domainid=cls.domain.id
)
cls._cleanup.append(cls.account)
# Create user api client of the account
cls.userapiclient = testClient.getUserApiClient(
UserName=cls.account.name,
DomainName=cls.account.domain
)
# Create Service offering
cls.service_offering = ServiceOffering.create(
cls.apiclient,
cls.testdata["service_offering"],
)
cls._cleanup.append(cls.service_offering)
if cls.testdata["configurableData"][
"restartManagementServerThroughTestCase"]:
# Set snapshot delta max value
Configurations.update(cls.apiclient,
name="snapshot.delta.max",
value="3"
)
# Restart management server
cls.RestartServer()
time.sleep(120)
configs = Configurations.list(
cls.apiclient,
name="snapshot.delta.max")
cls.delta_max = configs[0].value
cls.vm = VirtualMachine.create(
cls.apiclient,
cls.testdata["small"],
templateid=cls.template.id,
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
zoneid=cls.zone.id,
mode=cls.zone.networktype
)
except Exception as e:
cls.tearDownClass()
raise e
return
示例14: updateConfigurAndRestart
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import update [as 别名]
def updateConfigurAndRestart(self, name, value):
Configurations.update(self.apiclient, name, value)
self.RestartServers()
time.sleep(self.services["sleep"])
示例15: test_02_concurrent_snapshots_configuration
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import update [as 别名]
def test_02_concurrent_snapshots_configuration(self):
"""Concurrent Snapshots
1. Verify that CreateSnapshot command fails when it
takes more time than job.expire.minute
2. Verify that snapshot creation fails if CreateSnapshot command
takes more time than concurrent.snapshots.threshold.perhost
3. Check the event generation when snapshot creation
fails if CreateSnapshot takes more time than
concurrent.snapshots.threshold.perhost
"""
# Step 1
if not self.testdata["configurableData"][
"restartManagementServerThroughTestCase"]:
self.skipTest(
"Skip test if restartManagementServerThroughTestCase \
is not provided")
configs = Configurations.list(
self.apiclient,
name="job.expire.minutes")
orig_expire = configs[0].value
Configurations.update(self.apiclient,
name="concurrent.snapshots.threshold.perhost",
value="2"
)
Configurations.update(self.apiclient,
name="job.expire.minutes",
value="1"
)
# Restart management server
self.RestartServer()
time.sleep(120)
try:
thread_pool = []
for i in range(4):
create_snapshot_thread_1 = Thread(
target=CreateSnapshot,
args=(
self,
self.root_pool[i],
False))
thread_pool.append(create_snapshot_thread_1)
for thread in thread_pool:
thread.start()
for thread in thread_pool:
thread.join()
except Exception as e:
raise Exception(
"Warning: Exception unable to start thread : %s" %
e)
Configurations.update(self.apiclient,
name="job.expire.minutes",
value=orig_expire
)
# Restart management server
self.RestartServer()
time.sleep(120)
# Step 2
Configurations.update(self.apiclient,
name="concurrent.snapshots.threshold.perhost",
value="3"
)
Configurations.update(self.apiclient,
name="job.expire.minutes",
value="1"
)
# Restart management server
self.RestartServer()
time.sleep(120)
configs = Configurations.list(
self.apiclient,
name="job.expire.minutes")
with self.assertRaises(Exception):
CreateSnapshot(self, self.root_pool[0], False)
Configurations.update(self.apiclient,
name="job.expire.minutes",
value=orig_expire
)
# Restart management server
self.RestartServer()
time.sleep(120)
#.........这里部分代码省略.........