@@ -245,66 +245,32 @@ public Map<AgentResourceBase, Map<String, String>> createServerResources(Map<Str
245245 */
246246 private void createPhysicalGpuDevices (long hostId ) {
247247 // 1. Create passthrough-only GPU devices across different NUMA nodes and PCI roots
248- createPassthroughGpu (hostId , "00:01.0" , "1234" , "5678" , "Apache CloudStack Simulator" ,
249- "Simulated Graphics Card Pro" , 0 , "pci0000:00" , 8192L , 4096L , 2160L , 1L );
250- createPassthroughGpu (hostId , "00:02.0" , "1234" , "5678" , "Apache CloudStack Simulator" ,
251- "Simulated Graphics Card Pro" , 0 , "pci0000:00" , 8192L , 4096L , 2160L , 1L );
252- createPassthroughGpu (hostId , "00:03.0" , "1234" , "6789" , "Apache CloudStack Simulator" ,
253- "Simulated Graphics Card Basic" , 1 , "pci0000:00" , 4096L , 1920L , 1080L , 2L );
254- createPassthroughGpu (hostId , "00:04.0" , "1234" , "6789" , "Apache CloudStack Simulator" ,
255- "Simulated Graphics Card Basic" , 1 , "pci0000:00" , 4096L , 1920L , 1080L , 2L );
256-
248+ createPassthroughGpu (hostId , "00:01.0" , "1234" , "5678" , "ACS" ,
249+ "Simulated Graphics Card Basic" , 0 , "pci0000:00" , 8192L , 4096L , 2160L , 1L );
250+ createPassthroughGpu (hostId , "00:02.0" , "1234" , "5678" , "ACS" ,
251+ "Simulated Graphics Card Basic" , 0 , "pci0000:00" , 8192L , 4096L , 2160L , 1L );
257252 // Additional passthrough GPUs on different PCI roots
258- createPassthroughGpu (hostId , "17:00.0" , "1234" , "5678" , "Apache CloudStack Simulator" ,
259- "Simulated Graphics Card Pro" , 2 , "pci0000:17" , 8192L , 4096L , 2160L , 1L );
260- createPassthroughGpu (hostId , "3a:00.0" , "1234" , "6789" , "Apache CloudStack Simulator" ,
261- "Simulated Graphics Card Basic" , 3 , "pci0000:3a" , 4096L , 1920L , 1080L , 2L );
262- createPassthroughGpu (hostId , "5d:00.0" , "1234" , "5678" , "Apache CloudStack Simulator" ,
263- "Simulated Graphics Card Pro" , 2 , "pci0000:5d" , 8192L , 4096L , 2160L , 1L );
264- createPassthroughGpu (hostId , "80:00.0" , "1234" , "6789" , "Apache CloudStack Simulator" ,
265- "Simulated Graphics Card Basic" , 3 , "pci0000:80" , 4096L , 1920L , 1080L , 2L );
266-
267- // 2. Create GPUs with Virtual Functions support on different NUMA nodes
268- MockGpuDeviceVO vfParentDevice1 = createVfCapableGpu (hostId , "00:05.0" , "1234" , "789a" , "Apache CloudStack Simulator" ,
269- "Simulated Graphics Card VF" , 0 , "pci0000:00" );
270- createVirtualFunctions (hostId , vfParentDevice1 );
271-
272- MockGpuDeviceVO vfParentDevice2 = createVfCapableGpu (hostId , "00:06.0" , "1234" , "789a" , "Apache CloudStack Simulator" ,
273- "Simulated Graphics Card VF" , 1 , "pci0000:00" );
274- createVirtualFunctions (hostId , vfParentDevice2 );
275-
276- MockGpuDeviceVO vfParentDevice3 = createVfCapableGpu (hostId , "17:01.0" , "1234" , "789a" , "Apache CloudStack Simulator" ,
277- "Simulated Graphics Card VF" , 2 , "pci0000:17" );
278- createVirtualFunctions (hostId , vfParentDevice3 );
279-
280- MockGpuDeviceVO vfParentDevice4 = createVfCapableGpu (hostId , "3a:01.0" , "1234" , "789a" , "Apache CloudStack Simulator" ,
281- "Simulated Graphics Card VF" , 3 , "pci0000:3a" );
282- createVirtualFunctions (hostId , vfParentDevice4 );
253+ createPassthroughGpu (hostId , "00:03.0" , "1234" , "5678" , "ACS" ,
254+ "Simulated Graphics Card Basic" , 1 , "pci0000:17" , 8192L , 4096L , 2160L , 1L );
255+ createPassthroughGpu (hostId , "00:04.0" , "1234" , "5678" , "ACS" ,
256+ "Simulated Graphics Card Basic" , 1 , "pci0000:5d" , 8192L , 4096L , 2160L , 1L );
283257
284258 // 3. Create GPUs with MDEV support across different NUMA nodes
285- MockGpuDeviceVO mdevParentDevice1 = createMdevCapableGpu (hostId , "00:07 .0" , "1234" , "89ab" , "Apache CloudStack Simulator " ,
286- "Simulated Graphics Card MDEV " , 0 , "pci0000:00" );
259+ MockGpuDeviceVO mdevParentDevice1 = createMdevCapableGpu (hostId , "00:05 .0" , "1234" , "89ab" , "ACS " ,
260+ "Simulated Graphics Card Pro " , 0 , "pci0000:00" );
287261 createMdevDevices (hostId , mdevParentDevice1 );
288262
289- MockGpuDeviceVO mdevParentDevice2 = createMdevCapableGpu (hostId , "00:08 .0" , "1234" , "89ab" , "Apache CloudStack Simulator " ,
290- "Simulated Graphics Card MDEV " , 1 , "pci0000:00" );
263+ MockGpuDeviceVO mdevParentDevice2 = createMdevCapableGpu (hostId , "00:06 .0" , "1234" , "89ab" , "ACS " ,
264+ "Simulated Graphics Card Pro " , 0 , "pci0000:00" );
291265 createMdevDevices (hostId , mdevParentDevice2 );
292266
293- MockGpuDeviceVO mdevParentDevice3 = createMdevCapableGpu (hostId , "17:02 .0" , "1234" , "89ab" , "Apache CloudStack Simulator " ,
294- "Simulated Graphics Card MDEV " , 2 , "pci0000:17" );
267+ MockGpuDeviceVO mdevParentDevice3 = createMdevCapableGpu (hostId , "00:07 .0" , "1234" , "89ab" , "ACS " ,
268+ "Simulated Graphics Card Pro " , 1 , "pci0000:17" );
295269 createMdevDevices (hostId , mdevParentDevice3 );
296270
297- MockGpuDeviceVO mdevParentDevice4 = createMdevCapableGpu (hostId , "3a:02 .0" , "1234" , "89ab" , "Apache CloudStack Simulator " ,
298- "Simulated Graphics Card MDEV " , 3 , "pci0000:3a" );
271+ MockGpuDeviceVO mdevParentDevice4 = createMdevCapableGpu (hostId , "00:08 .0" , "1234" , "89ab" , "ACS " ,
272+ "Simulated Graphics Card Pro " , 1 , "pci0000:3a" );
299273 createMdevDevices (hostId , mdevParentDevice4 );
300-
301- MockGpuDeviceVO mdevParentDevice5 = createMdevCapableGpu (hostId , "5d:01.0" , "1234" , "89ab" , "Apache CloudStack Simulator" ,
302- "Simulated Graphics Card MDEV" , 2 , "pci0000:5d" );
303- createMdevDevices (hostId , mdevParentDevice5 );
304-
305- MockGpuDeviceVO mdevParentDevice6 = createMdevCapableGpu (hostId , "80:01.0" , "1234" , "89ab" , "Apache CloudStack Simulator" ,
306- "Simulated Graphics Card MDEV" , 3 , "pci0000:80" );
307- createMdevDevices (hostId , mdevParentDevice6 );
308274 }
309275
310276 /**
@@ -332,67 +298,6 @@ private void createPassthroughGpu(long hostId, String busAddress, String vendorI
332298 _mockGpuDeviceDao .persist (device );
333299 }
334300
335- /**
336- * Creates a GPU device capable of Virtual Functions
337- */
338- private MockGpuDeviceVO createVfCapableGpu (long hostId , String busAddress , String vendorId , String deviceId ,
339- String vendorName , String deviceName , Integer numaNode , String pciRoot ) {
340- MockGpuDeviceVO device = new MockGpuDeviceVO ();
341- device .setBusAddress (busAddress );
342- device .setVendorId (vendorId );
343- device .setDeviceId (deviceId );
344- device .setVendorName (vendorName );
345- device .setDeviceName (deviceName );
346- device .setHostId (hostId );
347- device .setState (MockGpuDevice .State .Available );
348- device .setDeviceType (GpuDevice .DeviceType .PCI );
349- device .setProfileName ("passthrough" );
350- device .setPassthroughEnabled (false );
351- device .setNumaNode (numaNode );
352- device .setPciRoot (pciRoot );
353- MockGpuDeviceVO savedDevice = _mockGpuDeviceDao .persist (device );
354- return savedDevice ;
355- }
356-
357- /**
358- * Creates Virtual Function devices as children of a VF-capable GPU
359- */
360- private void createVirtualFunctions (long hostId , MockGpuDeviceVO parentDevice ) {
361- // Create 3 Virtual Function devices
362- String [] vfProfiles = {"VF-P1" , "VF-P2" , "VF-P2" };
363- Long [] maxVgpuPerGpu = {2L , 4L , 4L };
364- String parentBussAdressPrefix = parentDevice .getBusAddress ().substring (0 , parentDevice .getBusAddress ().length () - 1 );
365- String [] vfAddresses = {parentBussAdressPrefix + "1" , parentBussAdressPrefix + "2" , parentBussAdressPrefix + "3" };
366- Long [] videoRam = {8192L , 4096L , 4096L };
367- Long [] resoultionX = {4096L , 1920L , 1920L };
368- Long [] resoultionY = {2160L , 1080L , 1080L };
369- Long [] maxHeads = {1L , 2L , 2L };
370-
371- for (int i = 0 ; i < vfAddresses .length ; i ++) {
372- MockGpuDeviceVO vfDevice = new MockGpuDeviceVO ();
373- vfDevice .setBusAddress (vfAddresses [i ]);
374- vfDevice .setVendorId ("1234" );
375- vfDevice .setDeviceId ("789a" ); // Different device ID for VF
376- vfDevice .setVendorName ("Apache CloudStack Simulator" );
377- vfDevice .setDeviceName ("Simulated Graphics Card VF" );
378- vfDevice .setHostId (hostId );
379- vfDevice .setState (MockGpuDevice .State .Available );
380- vfDevice .setDeviceType (GpuDevice .DeviceType .PCI );
381- vfDevice .setParentDeviceId (parentDevice .getId ());
382- vfDevice .setProfileName (vfProfiles [i ]);
383- vfDevice .setPassthroughEnabled (true );
384- vfDevice .setMaxVgpuPerPgpu (maxVgpuPerGpu [i ]);
385- vfDevice .setVideoRam (videoRam [i ]);
386- vfDevice .setMaxResolutionX (resoultionX [i ]);
387- vfDevice .setMaxResolutionY (resoultionY [i ]);
388- vfDevice .setMaxHeads (maxHeads [i ]);
389- // VF devices inherit NUMA node and PCI root from parent
390- vfDevice .setNumaNode (parentDevice .getNumaNode ());
391- vfDevice .setPciRoot (parentDevice .getPciRoot ());
392- _mockGpuDeviceDao .persist (vfDevice );
393- }
394- }
395-
396301 /**
397302 * Creates a GPU device capable of MDEV (Mediated Devices)
398303 */
@@ -411,31 +316,30 @@ private MockGpuDeviceVO createMdevCapableGpu(long hostId, String busAddress, Str
411316 device .setPassthroughEnabled (false ); // MDEV parent doesn't use passthrough
412317 device .setNumaNode (numaNode );
413318 device .setPciRoot (pciRoot );
414- MockGpuDeviceVO savedDevice = _mockGpuDeviceDao .persist (device );
415- return savedDevice ;
319+ return _mockGpuDeviceDao .persist (device );
416320 }
417321
418322 /**
419323 * Creates MDEV devices with different profiles
420324 */
421325 private void createMdevDevices (long hostId , MockGpuDeviceVO parentDevice ) {
422326 // Create MDEV devices with different profiles (similar to NVIDIA/Intel naming)
423- String [] mdevProfiles = { "sim-8q" , "sim-4q" , "sim-2q" , "sim-1q" , "sim-1q" };
327+ String [] mdevProfiles = { "sim-8q" , "sim-4q" , "sim-2q" , "sim-2q" };
424328 String [] mdevUuids = {UUID .randomUUID ().toString (), UUID .randomUUID ().toString (), UUID .randomUUID ().toString (),
425- UUID .randomUUID ().toString (), UUID . randomUUID (). toString () };
426- Long [] videoRam = {8192L , 4096L , 2048L , 1024L , 1024L };
427- Long [] resoultionX = {4096L , 1920L , 1920L , 1920L , 1920L };
428- Long [] resoultionY = {2160L , 1080L , 1080L , 1080L , 1080L };
429- Long [] maxVgpuPerGpu = {2L , 4L , 8L , 16L , 16L };
430- Long [] maxHeads = {1L , 2L , 4L , 8L , 8L };
329+ UUID .randomUUID ().toString ()};
330+ Long [] videoRam = {8192L , 4096L , 2048L , 2048L };
331+ Long [] resoultionX = {4096L , 1920L , 1920L , 1920L };
332+ Long [] resoultionY = {2160L , 1080L , 1080L , 1080L };
333+ Long [] maxVgpuPerGpu = {2L , 4L , 8L , 8L };
334+ Long [] maxHeads = {4L , 2L , 1L , 1L };
431335
432336 for (int i = 0 ; i < mdevProfiles .length ; i ++) {
433337 MockGpuDeviceVO mdevDevice = new MockGpuDeviceVO ();
434338 mdevDevice .setBusAddress (mdevUuids [i ]); // MDEV uses UUID as bus address
435- mdevDevice .setVendorId ("1234" );
436- mdevDevice .setDeviceId ("89ab" ); // Different device ID for MDEV
437- mdevDevice .setVendorName ("Apache CloudStack Simulator" );
438- mdevDevice .setDeviceName ("Simulated Graphics Card MDEV" );
339+ mdevDevice .setVendorId (parentDevice . getVendorId () );
340+ mdevDevice .setDeviceId (parentDevice . getDeviceId ());
341+ mdevDevice .setVendorName (parentDevice . getVendorName () );
342+ mdevDevice .setDeviceName (parentDevice . getDeviceName () + " " + mdevProfiles [ i ] );
439343 mdevDevice .setHostId (hostId );
440344 mdevDevice .setState (MockGpuDevice .State .Available );
441345 mdevDevice .setDeviceType (GpuDevice .DeviceType .MDEV );
0 commit comments