Пример #1
0
    def setUp(self):
        # One node
        node = vsapi.VizNode(hostName="localhost", model='Test')
        # GPU0 is a FX5800 with a phony Bus ID
        gpu0 = vsapi.GPU(0, model='Quadro FX 5800', busID='PCI:1:0:0')
        gpu0.setUseScanOut(True)
        node.addResource(gpu0)
        # GPU1 is a FX5800 with a phony Bus ID
        gpu1 = vsapi.GPU(1, model='Quadro FX 5800', busID='PCI:2:0:0')
        gpu1.setUseScanOut(True)
        node.addResource(gpu1)
        # GPU0 & GPU1 are part of a quadroplex
        sli0 = vsapi.SLI(0, sliType='quadroplex', gpu0=0, gpu1=1)
        node.addResource(sli0)

        gpu1 = vsapi.GPU(2, model='Quadro NVS 420', busID='PCI:3:0:0')
        gpu1.setUseScanOut(True)
        node.addResource(gpu1)

        # Generate a node config file for this
        self.node_config_path = 'input-node-config.xml'
        f = open(self.node_config_path, 'w')
        print >> f, """
		<nodeconfig>
			<nodes>
				%s
			</nodes>
		</nodeconfig>""" % (node.serializeToXML())
        f.close()
Пример #2
0
	def test_00302_allocate_all_GPUs_one_by_one(self):
		allGPUs = getResources(vsapi.GPU())
		self.assertTrue(len(allGPUs)>0)
		numGPUs = len(allGPUs)
		allocs = []
		for i in range(numGPUs):
			allocObj = doAllocate([vsapi.GPU()])
			allocs.append(allocObj)
		for ob in allocs:
			doDeallocate(ob)
Пример #3
0
    def test_success_00018_2_gpu_sli(self):
        srv = vsapi.Server(0)
        scr = vsapi.Screen(0)
        gpu0 = vsapi.GPU(0)
        gpu0.setScanout(0, 'HP LP2065')
        gpu1 = vsapi.GPU(1)
        scr.setGPUs([gpu0, gpu1])
        sli = vsapi.SLI(0)
        scr.setGPUCombiner(sli)
        srv.addScreen(scr)

        self.genValidConfigFile(srv)
Пример #4
0
    def test_success_00022_2_gpu_sli_mosaic_2x1(self):
        srv = vsapi.Server(0)
        scr = vsapi.Screen(0)
        gpu0 = vsapi.GPU(0)
        gpu0.setScanout(0, 'HP LP2065')
        gpu1 = vsapi.GPU(1)
        gpu1.setScanout(0, 'HP LP2065', outputX=1600, outputY=0)
        scr.setGPUs([gpu0, gpu1])
        sli = vsapi.SLI(0)
        sli.setMode("mosaic")
        scr.setGPUCombiner(sli)
        srv.addScreen(scr)

        self.genValidConfigFile(srv)
Пример #5
0
	def test_00300_allocate_GPUs_of_all_types(self):
		gpuTypes = getTemplates(vsapi.GPU())
		self.assertTrue(len(gpuTypes)>0)
		allGPUs = getResources(vsapi.GPU())
		self.assertTrue(len(allGPUs)>0)
		validGPUResTypes = map(lambda x: x.getType(), allGPUs)
		self.assertTrue(len(validGPUResTypes)>0)
		for gpu in gpuTypes:
			# Ignore GPUs 
			if gpu.getType() not in validGPUResTypes:
				continue
			self.allocObj = doAllocate([gpu])
			res = self.allocObj.getResources()[0]
			self.assertEqual(res.getType(), gpu.getType(), "Asked for GPU of type '%s', got '%s'"%(gpu.getType(), res.getType()))
			self.freeResources()
Пример #6
0
	def test_00319_allocate_all_rgs_sessions(self):
		s = vsapi.Server(0)
		allRGSServers = getResources(s)
		self.assertTrue(len(allRGSServers)>0)
		allocs = []
		for srv in allRGSServers:
			allocObj = doAllocate([ [ s, vsapi.GPU(0) ] ])
			allocs.append(allocObj)

		failed = False
		try:
			allocObj = doAllocate([ [ s, vsapi.GPU(0) ] ])
			allocs.append(allocObj)
			failed = True
		except vsapi.VizError, e:
			pass
Пример #7
0
	def test_00313_allocate_all_GPUs_with_server(self):
		allGPUs = getResources(vsapi.GPU())
		self.assertTrue(len(allGPUs)>0)
		resList = []
		for gpu in allGPUs:
			resList.append([ gpu, vsapi.Server() ])
		self.allocObj = doAllocate(resList)
Пример #8
0
    def test_success_00009_2_gpu_single_scanout(self):
        srv = vsapi.Server(0)

        scr0 = vsapi.Screen(0)
        gpu0 = vsapi.GPU(0)
        gpu0.setScanout(0, 'HP LP2065')
        scr0.setGPU(gpu0)
        srv.addScreen(scr0)

        scr1 = vsapi.Screen(1)
        gpu1 = vsapi.GPU(1)
        gpu1.setScanout(0, 'HP LP2065')
        scr1.setGPU(gpu1)
        srv.addScreen(scr1)

        self.genValidConfigFile(srv)
Пример #9
0
    def test_success_00008_2_gpu_vfb(self):
        srv = vsapi.Server(0)

        scr0 = vsapi.Screen(0)
        gpu0 = vsapi.GPU(0)
        scr0.setFBProperty('resolution', [1024, 768])
        scr0.setGPU(gpu0)
        srv.addScreen(scr0)

        scr1 = vsapi.Screen(1)
        gpu1 = vsapi.GPU(1)
        scr1.setFBProperty('resolution', [1024, 768])
        scr1.setGPU(gpu1)
        srv.addScreen(scr1)

        self.genValidConfigFile(srv)
Пример #10
0
	def test_00314_allocate_all_GPUs_with_server_and_virtual_server(self):
		allGPUs = getResources(vsapi.GPU())
		self.assertTrue(len(allGPUs)>0)
		resList = []
		for gpu in allGPUs:
			resList.append([gpu, vsapi.Server(), vsapi.Server(serverType=vsapi.VIRTUAL_SERVER)])
		self.allocObj = doAllocate(resList)
Пример #11
0
 def test_success_00001_1_gpu_1scanout(self):
     srv = vsapi.Server(0)
     scr = vsapi.Screen(0)
     gpu = vsapi.GPU(2)  # Quadro NVS 420
     gpu.setScanout(3, 'HP LP2065')  # Configure scanout 3
     scr.setGPU(gpu)
     srv.addScreen(scr)
     self.genValidConfigFile(srv)
Пример #12
0
 def test_success_00000_1_gpu_vfb(self):
     srv = vsapi.Server(0)
     scr = vsapi.Screen(0)
     gpu = vsapi.GPU(0)
     scr.setFBProperty('resolution', [1024, 768])
     scr.setGPU(gpu)
     srv.addScreen(scr)
     self.genValidConfigFile(srv)
Пример #13
0
 def test_success_00002_1_gpu_2scanout_nvs420_dp(self):
     srv = vsapi.Server(0)
     scr = vsapi.Screen(0)
     gpu = vsapi.GPU(2)  # NVS 420
     gpu.setScanout(2, 'HP LP2065')
     gpu.setScanout(3, 'HP LP2065')
     scr.setGPU(gpu)
     srv.addScreen(scr)
     self.genValidConfigFile(srv)
Пример #14
0
    def test_success_00011_2_gpu_single_scanout_1x2(self):
        srv = vsapi.Server(0)

        scr0 = vsapi.Screen(0)
        gpu0 = vsapi.GPU(0)
        gpu0.setScanout(0, 'HP LP2065')
        scr0.setGPU(gpu0)
        scr0.setFBProperty('position', [0, 0])
        srv.addScreen(scr0)

        scr1 = vsapi.Screen(1)
        gpu1 = vsapi.GPU(1)
        gpu1.setScanout(0, 'HP LP2065')
        scr1.setFBProperty('position', [0, 1200])
        scr1.setGPU(gpu1)
        srv.addScreen(scr1)

        self.genValidConfigFile(srv)
Пример #15
0
 def test_success_00006_1_gpu_2scanout_1x2_vert_overlap(self):
     srv = vsapi.Server(0)
     scr = vsapi.Screen(0)
     gpu = vsapi.GPU(0)
     gpu.setScanout(0, 'HP LP2065')
     gpu.setScanout(1, 'HP LP2065', outputX=0, outputY=1190)
     scr.setGPU(gpu)
     srv.addScreen(scr)
     self.genValidConfigFile(srv)
Пример #16
0
 def test_success_00005_1_gpu_2scanout_2x1_horiz_overalap(self):
     srv = vsapi.Server(0)
     scr = vsapi.Screen(0)
     gpu = vsapi.GPU(0)
     gpu.setScanout(0, 'HP LP2065')
     gpu.setScanout(1, 'HP LP2065', outputX=1590, outputY=0)
     scr.setGPU(gpu)
     srv.addScreen(scr)
     self.genValidConfigFile(srv)
Пример #17
0
 def test_success_00002_1_gpu_2scanout(self):
     srv = vsapi.Server(0)
     scr = vsapi.Screen(0)
     gpu = vsapi.GPU(0)
     gpu.setScanout(0, 'HP LP2065')
     gpu.setScanout(1, 'HP LP2065')
     scr.setGPU(gpu)
     srv.addScreen(scr)
     self.genValidConfigFile(srv)
Пример #18
0
	def test_00303_allocate_all_GPUs_one_by_one_each_separate(self):
		allGPUs = getResources(vsapi.GPU())
		self.assertTrue(len(allGPUs)>0)
		allocs = []
		for gpu in allGPUs:
			allocObj = doAllocate([gpu])
			allocs.append(allocObj)
		for ob in allocs:
			doDeallocate(ob)
Пример #19
0
	def test_00315_allocate_all_shared_GPUs_with_virtual_server(self):
		g = vsapi.GPU()
		g.setShared(True)
		allSharedGPUs = getResources(g)
		self.assertTrue(len(allSharedGPUs)>0)
		resList = []
		for gpu in allSharedGPUs:
			for i in range(gpu.getShareLimit()):
				resList.append([g, vsapi.Server(serverType=vsapi.VIRTUAL_SERVER)])
		self.allocObj = doAllocate(resList)
Пример #20
0
    def test_success_00012_2_gpu_single_scanout_2x1_xinerama(self):
        srv = vsapi.Server(0)

        scr0 = vsapi.Screen(0)
        gpu0 = vsapi.GPU(0)
        gpu0.setScanout(0, 'HP LP2065')
        scr0.setGPU(gpu0)
        scr0.setFBProperty('position', [0, 0])
        srv.addScreen(scr0)

        scr1 = vsapi.Screen(1)
        gpu1 = vsapi.GPU(1)
        gpu1.setScanout(0, 'HP LP2065')
        scr1.setFBProperty('position', [1600, 0])
        scr1.setGPU(gpu1)
        srv.addScreen(scr1)

        srv.combineScreens(True)
        self.genValidConfigFile(srv)
Пример #21
0
	def test_00312_allocate_all_GPUs_each_separate_with_server(self):
		allGPUs = getResources(vsapi.GPU())
		self.assertTrue(len(allGPUs)>0)
		allocs = []
		for gpu in allGPUs:
			# allocate each GPU with additional server on the same node
			# this is what apps will use
			allocObj = doAllocate([ [gpu, vsapi.Server() ]])
			allocs.append(allocObj)
		for ob in allocs:
			doDeallocate(ob)
Пример #22
0
	def test_00310_allocate_all_shared_GPUs_one_by_one(self):
		g = vsapi.GPU()
		g.setShared(True)
		allSharedGPUs = getResources(g)
		self.assertTrue(len(allSharedGPUs)>0)
		allocs = []
		for i in range(1, len(allSharedGPUs)):
			allocObj = doAllocate([g])
			allocs.append(allocObj)
		for ob in allocs:
			doDeallocate(ob)
Пример #23
0
    def test_success_00015_2_gpu_3x1_xinerama(self):
        srv = vsapi.Server(0)

        # 2 screens on first GPU, 1 on the second GPU
        # all placed in a horizontal layout
        scr0 = vsapi.Screen(0)
        gpu0 = vsapi.GPU(0)
        gpu0.setScanout(0, 'HP LP2065')
        gpu0.setScanout(1, 'HP LP2065', outputX=1600, outputY=0)
        scr0.setGPU(gpu0)
        scr0.setFBProperty('position', [0, 0])
        srv.addScreen(scr0)

        scr1 = vsapi.Screen(1)
        gpu1 = vsapi.GPU(1)
        gpu1.setScanout(0, 'HP LP2065')
        scr1.setFBProperty('position', [1600 * 2, 0])
        scr1.setGPU(gpu1)
        srv.addScreen(scr1)

        srv.combineScreens(True)
        self.genValidConfigFile(srv)
Пример #24
0
	def test_00315_allocate_all_shared_GPUs_with_dof3_reference_and_virtual_server(self):
		g = vsapi.GPU()
		g.setShared(True)
		allSharedGPUs = getResources(g)
		self.assertTrue(len(allSharedGPUs)>0)
		resList = []
		for gpu in allSharedGPUs:
			gpu.setShared(True)
			for i in range(gpu.getShareLimit()):
				# the difference between this test and the previous one is that 
				# it asks for a particular shared GPU. The tests in the VizStack
				# framework check DOF=0 resources, and these must not report errors
				resList.append([gpu, vsapi.Server(serverType=vsapi.VIRTUAL_SERVER)])
		self.allocObj = doAllocate(resList)
Пример #25
0
    def test_success_00016_2_gpu_2x2_xinerama(self):
        srv = vsapi.Server(0)

        # 2 screens on first GPU, 2 on the second GPU
        # placed one below the other
        scr0 = vsapi.Screen(0)
        gpu0 = vsapi.GPU(0)
        gpu0.setScanout(0, 'HP LP2065')
        gpu0.setScanout(1, 'HP LP2065', outputX=1600, outputY=0)
        scr0.setGPU(gpu0)
        scr0.setFBProperty('position', [0, 0])
        srv.addScreen(scr0)

        scr1 = vsapi.Screen(1)
        gpu1 = vsapi.GPU(1)
        gpu1.setScanout(0, 'HP LP2065')
        gpu1.setScanout(1, 'HP LP2065', outputX=1600, outputY=0)
        scr1.setFBProperty('position', [0, 1200])
        scr1.setGPU(gpu1)
        srv.addScreen(scr1)

        srv.combineScreens(True)
        self.genValidConfigFile(srv)
Пример #26
0
 def test_failure_00001_1_gpu_1scanout(self):
     srv = vsapi.Server(0)
     scr = vsapi.Screen(0)
     gpu = vsapi.GPU(0)
     gpu.setScanout(
         3, 'HP LP2065'
     )  # Configure scanout. This would fail since the 5800 does not have the third scanout
     scr.setGPU(gpu)
     srv.addScreen(scr)
     try:
         print 'Trying to setup invalid port index 3 for scanout'
         self.genValidConfigFile(srv)
         self.fail("Succeeded to setup scanout 3 - this should have failed")
     except:
         # If we come here, there is failure -which is right
         print "Failed to generate config- the correct result right"
Пример #27
0
    def test_success_00007_1_gpu_two_vfb(self):
        # One server, one GPU, but two virtual screens
        # on the same GPU
        srv = vsapi.Server(0)
        gpu = vsapi.GPU(0)

        scr0 = vsapi.Screen(0)
        scr0.setFBProperty('resolution', [1024, 768])
        scr0.setGPU(gpu)
        srv.addScreen(scr0)

        scr1 = vsapi.Screen(1)
        scr1.setFBProperty('resolution', [1024, 768])
        scr1.setGPU(gpu)
        srv.addScreen(scr1)

        self.genValidConfigFile(srv)
Пример #28
0
 def test_failure_00002_1_gpu_1scanout(self):
     srv = vsapi.Server(0)
     scr = vsapi.Screen(0)
     gpu = vsapi.GPU(0)
     # configure 3 scanouts - this should also fail
     gpu.setScanout(0, 'HP LP2065')
     gpu.setScanout(1, 'HP LP2065')
     gpu.setScanout(2, 'HP LP2065')
     scr.setGPU(gpu)
     srv.addScreen(scr)
     try:
         print 'Trying to setup three scanouts on the GPU'
         self.genValidConfigFile(srv)
         self.fail(
             "Succeeded to setup three scanouts - this should have failed")
     except:
         # If we come here, there is failure -which is right
         print "Failed to generate config - the correct result right"
Пример #29
0
	def test_00317_allocate_all_tvnc_shared_sessions_fixed_gpus(self):
		g = vsapi.GPU()
		g.setShared(True)
		allSharedGPUs = getResources(g)
		self.assertTrue(len(allSharedGPUs)>0)
		allocs = []
		for gpu in allSharedGPUs:
			gpu.setShared(True)
			for i in range(gpu.getShareLimit()):
				allocObj = doAllocate([ [ gpu, vsapi.Server(serverType=vsapi.VIRTUAL_SERVER)] ])
				allocs.append(allocObj)

		failed = False
		try:
			allocObj = doAllocate([ [ g, vsapi.Server(serverType=vsapi.VIRTUAL_SERVER) ] ])
			allocs.append(allocObj)
			failed = True
		except vsapi.VizError, e:
			pass
Пример #30
0
the configuration.

Concepts demonstrated:
1. This script shows one use of vsapi without connecting to SSM.
2. How to get configuration XML corresponding to an X server.
3. Generate X configuration file for X server using VizStack
   tools.

"""
import vsapi
import os
import tempfile
import sys

# Create & configure the first GPU on the system. 
gpu0 = vsapi.GPU(0)
gpu0.setScanout(0, "HP LP2065") # LP2065 connected to port 0
# If you need the other output, comment out the following line
# This will configure the 
#gpu0.setScanout(1, "LP2065", outputX=1600)

# Create & configure the second GPU on the system. 
gpu1 = vsapi.GPU(1)
gpu1.setScanout(0, "HP LP2065") # LP2065 connected to port 0
# If you need the other output, comment out the following line
# This will configure the 
#gpu1.setScanout(1, "LP2065", outputX=1600)

# Create an X screen, and assign the first GPU
# to drive this screen
scr0 = vsapi.Screen(0)