本文整理汇总了Python中marvin.lib.base.Configurations类的典型用法代码示例。如果您正苦于以下问题:Python Configurations类的具体用法?Python Configurations怎么用?Python Configurations使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Configurations类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_04_rvpc_network_garbage_collector_nics
def test_04_rvpc_network_garbage_collector_nics(self):
""" Create a redundant VPC with 1 Tier, 1 VM, 1 ACL, 1 PF and test Network GC Nics"""
self.logger.debug("Starting test_04_rvpc_network_garbage_collector_nics")
self.query_routers()
self.networks.append(self.create_network(self.services["network_offering"], "10.1.1.1", nr_vms=1))
self.check_routers_state()
self.add_nat_rules()
self.do_vpc_test(False)
self.stop_vm()
gc_wait = Configurations.list(self.apiclient, name="network.gc.wait")
gc_interval = Configurations.list(self.apiclient, name="network.gc.interval")
self.logger.debug("network.gc.wait is ==> %s" % gc_wait)
self.logger.debug("network.gc.interval is ==> %s" % gc_wait)
total_sleep = 120
if gc_wait and gc_interval:
total_sleep = int(gc_wait[0].value) + int(gc_interval[0].value)
else:
self.logger.debug("Could not retrieve the keys 'network.gc.interval' and 'network.gc.wait'. Sleeping for 2 minutes.")
time.sleep(total_sleep * 3)
self.check_routers_interface(interface_to_check="eth2", expected_exists=False)
self.start_vm()
self.check_routers_state(status_to_check="MASTER")
self.check_routers_interface(interface_to_check="eth2", expected_exists=True)
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:29,代码来源:test_vpc_redundant.py
示例2: test_09_expunge_vm
def test_09_expunge_vm(self):
"""Test destroy(expunge) Virtual Machine
"""
# Validate the following
# 1. listVM command should NOT return this VM any more.
self.debug("Expunge VM-ID: %s" % self.small_virtual_machine.id)
cmd = destroyVirtualMachine.destroyVirtualMachineCmd()
cmd.id = self.small_virtual_machine.id
self.apiclient.destroyVirtualMachine(cmd)
config = Configurations.list(self.apiclient, name="expunge.delay")
expunge_delay = int(config[0].value)
time.sleep(expunge_delay * 2)
# VM should be destroyed unless expunge thread hasn't run
# Wait for two cycles of the expunge thread
config = Configurations.list(self.apiclient, name="expunge.interval")
expunge_cycle = int(config[0].value)
wait_time = expunge_cycle * 2
while wait_time >= 0:
list_vm_response = VirtualMachine.list(self.apiclient, id=self.small_virtual_machine.id)
if list_vm_response:
time.sleep(expunge_cycle)
wait_time = wait_time - expunge_cycle
else:
break
self.debug("listVirtualMachines response: %s" % list_vm_response)
self.assertEqual(list_vm_response, None, "Check Expunged virtual machine is in listVirtualMachines response")
return
开发者ID:ktenzer,项目名称:cloudstack,代码行数:34,代码来源:test_vm_life_cycle.py
示例3: test_03_concurrent_snapshot_global_value_assignment
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
开发者ID:Accelerite,项目名称:cloudstack,代码行数:11,代码来源:test_concurrent_snapshots_limit.py
示例4: tearDownClass
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
开发者ID:Accelerite,项目名称:cloudstack,代码行数:13,代码来源:test_rootvolume_resize.py
示例5: update_NuageVspGlobalDomainTemplate
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)
开发者ID:Accelerite,项目名称:cloudstack,代码行数:14,代码来源:test_nuage_vsp_domain_template.py
示例6: test_es_1223_apply_algo_to_pods
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
开发者ID:Accelerite,项目名称:cloudstack,代码行数:49,代码来源:test_bugs.py
示例7: test_01_cluster_settings
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")
开发者ID:Accelerite,项目名称:cloudstack,代码行数:59,代码来源:test_overcommit.py
示例8: test_vms_with_same_name
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
开发者ID:rarotonga82,项目名称:cloudstack,代码行数:48,代码来源:testpath_same_vm_name.py
示例9: setUpClass
def setUpClass(cls):
# We want to fail quicker if it's failure
socket.setdefaulttimeout(60)
cls.testClient = super(TestVPCRedundancy, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.template = get_test_template(cls.api_client, cls.zone.id, cls.hypervisor)
if cls.template == FAILED:
assert False, "get_test_template() failed to return template"
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"])
cls._cleanup = [cls.service_offering]
cls.logger = logging.getLogger('TestVPCRedundancy')
cls.stream_handler = logging.StreamHandler()
cls.logger.setLevel(logging.DEBUG)
cls.logger.addHandler(cls.stream_handler)
cls.advert_int = int(Configurations.list(cls.api_client, name="router.redundant.vrrp.interval")[0].value)
开发者ID:exoscale,项目名称:cloudstack,代码行数:32,代码来源:test_vpc_redundant.py
示例10: test_01_VPN_user_limit
def test_01_VPN_user_limit(self):
"""VPN remote access user limit tests"""
# Validate the following
# prerequisite: change management configuration setting of
# remote.access.vpn.user.limit
# 1. provision more users than is set in the limit
# Provisioning of users after the limit should failProvisioning of
# users after the limit should fail
self.debug("Fetching the limit for remote access VPN users")
configs = Configurations.list(
self.apiclient,
name='remote.access.vpn.user.limit',
listall=True)
self.assertEqual(isinstance(configs, list),
True,
"List configs should return a valid response")
limit = int(configs[0].value)
self.debug("Enabling the VPN access for IP: %s" %
self.public_ip.ipaddress)
self.create_VPN(self.public_ip)
self.debug("Creating %s VPN users" % limit)
for x in range(limit):
self.create_VPN_Users()
self.debug("Adding another user exceeding limit for remote VPN users")
with self.assertRaises(Exception):
self.create_VPN_Users()
self.debug("Limit exceeded exception raised!")
return
开发者ID:CIETstudents,项目名称:cloudstack,代码行数:34,代码来源:test_vpn_users.py
示例11: setUpClass
def setUpClass(cls):
testClient = super(TestVerifyEventsTable, 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._cleanup = []
try:
cls.unsupportedHypervisor = False
if cls.hypervisor.lower() in ['hyperv', 'lxc', 'kvm']:
if cls.hypervisor.lower() == 'kvm':
configs = Configurations.list(
cls.apiclient,
name='kvm.snapshot.enabled'
)
if configs[0].value == "false":
cls.unsupportedHypervisor = True
else:
cls.unsupportedHypervisor = True
return
# Create an account
cls.account = Account.create(
cls.apiclient,
cls.testdata["account"],
domainid=cls.domain.id
)
# 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 = [
cls.account,
cls.service_offering,
]
except Exception as e:
cls.tearDownClass()
raise e
return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:59,代码来源:testpath_uuid_event.py
示例12: get_lb_stats_settings
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
settings["username"], settings["password"] = Configurations.list(
self.apiclient, name="network.loadbalancer.haproxy.stats.auth")[0].value.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
开发者ID:dxia88,项目名称:cloudstack,代码行数:17,代码来源:test_internal_lb.py
示例13: is_config_suitable
def is_config_suitable(apiclient, name, value):
"""
Ensure if the deployment has the expected `value` for the global setting `name'
@return: true if value is set, else false
"""
configs = Configurations.list(apiclient, name=name)
assert configs is not None and isinstance(configs, list) and len(configs) > 0
return configs[0].value == value
开发者ID:rafaelthedevops,项目名称:cloudstack,代码行数:8,代码来源:common.py
示例14: tearDown
def tearDown(self):
try:
self.debug("Cleaning up the resources")
cleanup_resources(self.apiclient, self.cleanup)
interval = Configurations.list(
self.apiclient,
name='network.gc.interval'
)
wait = Configurations.list(
self.apiclient,
name='network.gc.wait'
)
#time.sleep(int(interval[0].value) + int(wait[0].value))
self.debug("Cleanup complete!")
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
开发者ID:aali-dincloud,项目名称:cloudstack,代码行数:17,代码来源:test_nuage_vsp.py
示例15: tearDown
def tearDown(self):
try:
self.debug("Cleaning up the resources")
#Clean up, terminate the created network offerings
#cleanup_resources(self.apiclient, self.cleanup)
interval = Configurations.list(
self.apiclient,
name='network.gc.interval'
)
wait = Configurations.list(
self.apiclient,
name='network.gc.wait'
)
# Sleep to ensure that all resources are deleted
time.sleep(int(interval[0].value) + int(wait[0].value))
self.debug("Cleanup complete!")
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:19,代码来源:test_brocade_vcs.py
示例16: setUpClass
def setUpClass(cls):
testClient = super(Overcommit, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.testdata = testClient.getParsedTestDataConfig()
# Get Zone,Domain and templates
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient)
cls.testdata["mode"] = cls.zone.networktype
cls.testdata["configurableData"]["password"] = "xenroot"
cls.hypervisor = testClient.getHypervisorInfo()
cls.template = get_template(
cls.apiclient,
cls.zone.id,
cls.testdata["ostype"])
cls.testdata["template"]["ostypeid"] = cls.template.ostypeid
list_conf = Configurations.list(cls.apiclient,
name="capacity.check.period"
)
cls.wait_time = 5 + int(list_conf[0].value) / 1000
if cls.template == FAILED:
cls.fail(
"get_template() failed to return template with description \
%s" %
cls.testdata["ostype"])
cls._cleanup = []
try:
cls.account = Account.create(cls.apiclient,
cls.testdata["account"],
domainid=cls.domain.id
)
cls._cleanup.append(cls.account)
cls.service_offering = ServiceOffering.create(
cls.apiclient,
cls.testdata["service_offerings"]["small"])
cls._cleanup.append(cls.service_offering)
cls.deployVmResponse = VirtualMachine.create(
cls.apiclient,
services=cls.testdata["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id,
zoneid=cls.zone.id,
)
except Exception as e:
cls.tearDownClass()
raise e
return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:54,代码来源:test_overcommit.py
示例17: execute_internallb_haproxy_tests
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")
开发者ID:PCextreme,项目名称:cloudstack,代码行数:54,代码来源:test_internal_lb.py
示例18: test_vm_ha
def test_vm_ha(self):
"""Test VM HA
# Validate the following:
# VM started on other host in cluster
"""
#wait for VM to HA
ping_timeout = Configurations.list(self.apiclient, name="ping.timeout")
ping_interval = Configurations.list(self.apiclient, name="ping.interval")
total_duration = int(float(ping_timeout[0].value) * float(ping_interval[0].value))
time.sleep(total_duration)
duration = 0
vm = None
while duration < total_duration:
list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
self.assertTrue(isinstance(list_vms, list) and len(list_vms) == 1, msg = "List VM response was empty")
vm = list_vms[0]
if vm.hostid != self.virtual_machine.hostid and vm.state == "Running":
break
else:
time.sleep(10)
duration = duration + 10
self.assertEqual(
vm.id,
self.virtual_machine.id,
"VM ids do not match")
self.assertEqual(
vm.name,
self.virtual_machine.name,
"VM names do not match")
self.assertEqual(
vm.state,
"Running",
msg="VM is not in Running state")
self.assertNotEqual(
vm.hostid,
self.virtual_machine.hostid,
msg="VM is not started on another host as part of HA")
开发者ID:aali-dincloud,项目名称:cloudstack,代码行数:41,代码来源:test_vm_ha.py
示例19: get_lb_stats_settings
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
开发者ID:PCextreme,项目名称:cloudstack,代码行数:21,代码来源:test_internal_lb.py
示例20: tearDownClass
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
开发者ID:Accelerite,项目名称:cloudstack,代码行数:26,代码来源:test_deploy_vm_root_resize.py
注:本文中的marvin.lib.base.Configurations类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论