Return-Path: X-Original-To: apmail-cloudstack-issues-archive@www.apache.org Delivered-To: apmail-cloudstack-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EB9B7180DA for ; Thu, 30 Jul 2015 08:31:09 +0000 (UTC) Received: (qmail 37947 invoked by uid 500); 30 Jul 2015 08:31:04 -0000 Delivered-To: apmail-cloudstack-issues-archive@cloudstack.apache.org Received: (qmail 37915 invoked by uid 500); 30 Jul 2015 08:31:04 -0000 Mailing-List: contact issues-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list issues@cloudstack.apache.org Received: (qmail 37903 invoked by uid 500); 30 Jul 2015 08:31:04 -0000 Delivered-To: apmail-incubator-cloudstack-issues@incubator.apache.org Received: (qmail 37897 invoked by uid 99); 30 Jul 2015 08:31:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Jul 2015 08:31:04 +0000 Date: Thu, 30 Jul 2015 08:31:04 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: cloudstack-issues@incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CLOUDSTACK-8689) Verify change in value of XenServer "Max guest limit" is honoured or not MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CLOUDSTACK-8689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14647341#comment-14647341 ] ASF GitHub Bot commented on CLOUDSTACK-8689: -------------------------------------------- Github user sanju1010 commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/638#discussion_r35848734 --- Diff: test/integration/testpaths/testpath_hypervisor_limit.py --- @@ -0,0 +1,191 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +""" Test cases to Verify effect of changing value of XenServer + Max guest limit on previously added hosts +""" + +from nose.plugins.attrib import attr +from marvin.cloudstackTestCase import cloudstackTestCase +from marvin.lib.utils import (cleanup_resources, + validateList) +from marvin.lib.base import (Account, + ServiceOffering, + VirtualMachine, + Host + ) +from marvin.lib.common import (get_domain, + get_zone, + get_template, + ) + + +from marvin.cloudstackAPI import (updateHypervisorCapabilities, + listHypervisorCapabilities) + +from marvin.codes import PASS + + + +class TestMaxHyperviosrLimit(cloudstackTestCase): + + @classmethod + def setUpClass(cls): + testClient = super(TestMaxHyperviosrLimit, 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 = [] + hostList = Host.list(cls.apiclient, zoneid=cls.zone.id, type="Routing") + cls.host = Host(hostList[0].__dict__) + try: + + cls.skiptest = False + if cls.hypervisor.lower() not in ['xenserver']: + cls.skiptest = 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 + + @classmethod + def tearDownClass(cls): + try: + cleanup_resources(cls.apiclient, cls._cleanup) + except Exception as e: + raise Exception("Warning: Exception during cleanup : %s" % e) + + def setUp(self): + self.cleanup = [] + if self.skiptest: + self.skipTest("This test is to be checked on xenserver \ + only Hence, skip for %s" % self.hypervisor) + + self.apiclient = self.testClient.getApiClient() + self.dbclient = self.testClient.getDbConnection() + + def tearDown(self): + try: + + cmd = updateHypervisorCapabilities.updateHypervisorCapabilitiesCmd() + cmd.id = self.hostCapId + cmd.maxguestslimit = self.originalLimit + self.apiclient.updateHypervisorCapabilities(cmd) + + cleanup_resources(self.apiclient, self.cleanup) + except Exception as e: + raise Exception("Warning: Exception during cleanup : %s" % e) + return + + @attr(tags=["advanced", "basic"], required_hardware="false") + def test_check_hypervisor_max_limit_effect(self): + """ Test hypervisor max limits effect + + # 1. Read maxguestslimit global setting and + modify it to 4 + # 2. Deploy a VM + # 2. Try to deploy another vm + # 3. Verify that second VM + deployment fails (2 SSVMs 1 VR VM and 1 deployed VM) + """ + qresultset = self.dbclient.execute( + "select hypervisor_version from host where uuid='%s'" % self.host.id) + + event_validation_result = validateList(qresultset) + self.assertEqual( + event_validation_result[0], + PASS, + "event list validation failed due to %s" % + event_validation_result[2]) + + # Step 1 + cmdList = listHypervisorCapabilities.listHypervisorCapabilitiesCmd() + cmdList.hypervisor = self.hypervisor + config = self.apiclient.listHypervisorCapabilities(cmdList) + + for host in config: + if host.hypervisorversion == qresultset[0][0]: + self.hostCapId = host.id + self.originalLimit = host.maxguestslimit + break + else: + self.skipTest("No hypervisor capabilities found for %s \ + with version %s" % (self.hypervisor, qresultset[0][0])) + + cmdUpdate = updateHypervisorCapabilities.\ + updateHypervisorCapabilitiesCmd() + cmdUpdate.id = self.hostCapId + cmdUpdate.maxguestslimit = "4" + self.apiclient.updateHypervisorCapabilities(cmdUpdate) + + # Step 2 + vm = VirtualMachine.create( + self.userapiclient, + self.testdata["small"], + templateid=self.template.id, + accountid=self.account.name, + domainid=self.account.domainid, + serviceofferingid=self.service_offering.id, + zoneid=self.zone.id, + ) + + self.cleanup.append(vm) + # Step 3 + with self.assertRaises(Exception): + VirtualMachine.create( + self.userapiclient, + self.testdata["small"], + templateid=self.template.id, + accountid=self.account.name, + domainid=self.account.domainid, + serviceofferingid=self.service_offering.id, + zoneid=self.zone.id, + ) + --- End diff -- Also we need to check if there are any vms running on a chosen host(including system vms and guest vms) and then try to deploy the vms until we reach the max supported value. > Verify change in value of XenServer "Max guest limit" is honoured or not > ------------------------------------------------------------------------ > > Key: CLOUDSTACK-8689 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8689 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the default.) > Components: Automation > Affects Versions: 4.2.1 > Reporter: Priti Sarap > Fix For: 4.2.1 > > > Verify effect of changing value of "Max guest limit" of XenServer > -Check if it reads changed value and act accordingly -- This message was sent by Atlassian JIRA (v6.3.4#6332)