def test_04_zone_capacity_check(self): """change cpu/mem.overprovisioning.factor at cluster level for all cluster in a zone and verify capacity at zone level """ list_cluster = Cluster.list(self.apiclient, zoneid=self.zone.id) self.assertEqual( validateList(list_cluster)[0], PASS, "check list cluster response for zone id %s" % self.zone.id) k = len(list_cluster) for id in xrange(k): Configurations.update(self.apiclient, clusterid=list_cluster[id].id, name="mem.overprovisioning.factor", value=1) Configurations.update(self.apiclient, clusterid=list_cluster[id].id, name="cpu.overprovisioning.factor", value=1) time.sleep(self.wait_time) capacity = Capacities.list(self.apiclient, zoneid=self.zone.id) self.assertEqual( validateList(capacity)[0], PASS, "check list capacity response for zone id %s" % self.zone.id) cpu, mem = capacity_parser(capacity) for id in xrange(k): Configurations.update(self.apiclient, clusterid=list_cluster[id].id, name="mem.overprovisioning.factor", value=2) Configurations.update(self.apiclient, clusterid=list_cluster[id].id, name="cpu.overprovisioning.factor", value=2) time.sleep(self.wait_time) capacity1 = Capacities.list(self.apiclient, zoneid=self.zone.id) self.assertEqual( validateList(capacity1)[0], PASS, "check list capacity for zone id %s" % self.zone.id) 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") for id in xrange(k): Configurations.update(self.apiclient, clusterid=list_cluster[id].id, name="mem.overprovisioning.factor", value=1) Configurations.update(self.apiclient, clusterid=list_cluster[id].id, name="cpu.overprovisioning.factor", value=1)
def test_02_Overcommit_factor(self): """change mem.overprovisioning.factor and verify vm memory """ 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) if listHost[0].hypervisor.lower() not in ['kvm', 'xenserver']: self.skipTest( "Skiping test because of not supported hypervisor type %s" % listHost[0].hypervisor) Configurations.update(self.apiclient, clusterid=listHost[0].clusterid, name="mem.overprovisioning.factor", value=1) self.deployVmResponse.stop(self.apiclient) self.deployVmResponse.start(self.apiclient) if listHost[0].hypervisor.lower() == 'xenserver': k = ssh_xen_host(self.hostConfig["password"], self.hostConfig["username"], listHost[0].ipaddress, self.deployVmResponse.instancename) elif listHost[0].hypervisor.lower() == 'kvm': k = ssh_kvm_host(self.hostConfig["password"], self.hostConfig["username"], listHost[0].ipaddress, self.deployVmResponse.instancename) self.assertEqual(k[0], k[1], "Check static max ,min on host for overcommit 1 ") Configurations.update(self.apiclient, clusterid=listHost[0].clusterid, name="mem.overprovisioning.factor", value=2) self.deployVmResponse.stop(self.apiclient) self.deployVmResponse.start(self.apiclient) if listHost[0].hypervisor.lower() == 'xenserver': k1 = ssh_xen_host(self.hostConfig["password"], self.hostConfig["username"], listHost[0].ipaddress, self.deployVmResponse.instancename) elif listHost[0].hypervisor.lower() == 'kvm': time.sleep(200) k1 = ssh_kvm_host(self.hostConfig["password"], self.hostConfig["username"], listHost[0].ipaddress, self.deployVmResponse.instancename) self.assertEqual(k1[0], 2 * k1[1], "Check static max ,min on host for overcommit 2")
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")
def test_04_zone_capacity_check(self): """change cpu/mem.overprovisioning.factor at cluster level for all cluster in a zone and verify capacity at zone level """ list_cluster = Cluster.list(self.apiclient, zoneid=self.zone.id) self.assertEqual( validateList(list_cluster)[0], PASS, "check list cluster response for zone id %s" % self.zone.id) k = len(list_cluster) for id in xrange(k): Configurations.update(self.apiclient, clusterid=list_cluster[id].id, name="mem.overprovisioning.factor", value=1) Configurations.update(self.apiclient, clusterid=list_cluster[id].id, name="cpu.overprovisioning.factor", value=1) time.sleep(self.wait_time) capacity = Capacities.list(self.apiclient, zoneid=self.zone.id) self.assertEqual( validateList(capacity)[0], PASS, "check list capacity response for zone id %s" % self.zone.id) cpu, mem = capacity_parser(capacity) for id in xrange(k): Configurations.update(self.apiclient, clusterid=list_cluster[id].id, name="mem.overprovisioning.factor", value=2) Configurations.update(self.apiclient, clusterid=list_cluster[id].id, name="cpu.overprovisioning.factor", value=2) time.sleep(self.wait_time) capacity1 = Capacities.list(self.apiclient, zoneid=self.zone.id) self.assertEqual(validateList(capacity1)[0], PASS, "check list capacity for zone id %s" % self.zone.id) 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") for id in xrange(k): Configurations.update(self.apiclient, clusterid=list_cluster[id].id, name="mem.overprovisioning.factor", value=1) Configurations.update(self.apiclient, clusterid=list_cluster[id].id, name="cpu.overprovisioning.factor", value=1)
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")
def test_02_Overcommit_factor(self): """change mem.overprovisioning.factor and verify vm memory """ 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) if listHost[0].hypervisor.lower() not in ['kvm', 'xenserver']: self.skipTest( "Skiping test because of not supported hypervisor type %s" % listHost[0].hypervisor) Configurations.update(self.apiclient, clusterid=listHost[0].clusterid, name="mem.overprovisioning.factor", value=1) self.deployVmResponse.stop(self.apiclient) self.deployVmResponse.start(self.apiclient) if listHost[0].hypervisor.lower() == 'xenserver': k = ssh_xen_host( self.testdata["configurableData"]["password"], listHost[0].ipaddress, self.deployVmResponse.instancename) elif listHost[0].hypervisor.lower() == 'kvm': k = ssh_kvm_host( self.testdata["configurableData"]["password"], listHost[0].ipaddress, self.deployVmResponse.instancename) self.assertEqual(k[0], k[1], "Check static max ,min on host for overcommit 1 ") Configurations.update(self.apiclient, clusterid=listHost[0].clusterid, name="mem.overprovisioning.factor", value=2) self.deployVmResponse.stop(self.apiclient) self.deployVmResponse.start(self.apiclient) if listHost[0].hypervisor.lower() == 'xenserver': k1 = ssh_xen_host( self.testdata["configurableData"]["password"], listHost[0].ipaddress, self.deployVmResponse.instancename) elif listHost[0].hypervisor.lower() == 'kvm': time.sleep(200) k1 = ssh_kvm_host( self.testdata["configurableData"]["password"], listHost[0].ipaddress, self.deployVmResponse.instancename) self.assertEqual(k1[0], 2 * k1[1], "Check static max ,min on host for overcommit 2")