Skip to content

Commit e7ebbea

Browse files
committed
fixups & UI enhancements
1 parent c81d9b0 commit e7ebbea

12 files changed

Lines changed: 291 additions & 70 deletions

File tree

server/src/main/java/com/cloud/resource/ResourceManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3179,9 +3179,9 @@ private HostVO persistNewHost(HostVO host, StartupCommand startup) {
31793179
// Check for GPU devices again because we couldn't persist the GPU devices earlier due to missing host ID
31803180
if (startup instanceof StartupRoutingCommand &&
31813181
CollectionUtils.isNotEmpty(((StartupRoutingCommand) startup).getGpuDevices())) {
3182-
// Add GPU devices to the host
31833182
StartupRoutingCommand ssCmd = ((StartupRoutingCommand) startup);
3184-
gpuService.addGpuDevicesToHost(hostVo, ssCmd.getGpuDevices());
3183+
host.setGpuGroups(getGroupDetails(host, ssCmd.getGpuDevices(), ssCmd.getGpuGroupDetails()));
3184+
_hostDao.update(hostVo.getId(), host);
31853185
}
31863186
return hostVo;
31873187
}

server/src/main/java/org/apache/cloudstack/gpu/GpuServiceImpl.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@
8383
import java.util.ArrayList;
8484
import java.util.Comparator;
8585
import java.util.HashMap;
86+
import java.util.HashSet;
8687
import java.util.List;
8788
import java.util.Map;
89+
import java.util.Set;
8890
import java.util.stream.Collectors;
8991

9092
@Component
@@ -792,6 +794,10 @@ public HashMap<String, HashMap<String, VgpuTypesInfo>> getGpuGroupDetailsFromGpu
792794
HashMap<String, HashMap<String, VgpuTypesInfo>> gpuGroupDetails = new HashMap<>();
793795
List<GpuDeviceVO> gpuDevices = gpuDeviceDao.listByHostId(host.getId());
794796
for (final GpuDeviceVO device : gpuDevices) {
797+
if (GpuDevice.ManagedState.Unmanaged.equals(device.getManagedState())) {
798+
// Skip unmanaged devices
799+
continue;
800+
}
795801

796802
// Calculate GPU capacity and update gpuGroupDetails
797803
GpuCardVO card = gpuCardDao.findById(device.getCardId());
@@ -1052,6 +1058,7 @@ private boolean updateGpuDeviceManagedState(List<Long> gpuDeviceIds, GpuDevice.M
10521058
throw new InvalidParameterValueException("GPU device IDs cannot be empty");
10531059
}
10541060
List<GpuDeviceVO> gpuDevices = new ArrayList<>();
1061+
Set<Long> hostIds = new HashSet<>();
10551062
for (Long gpuDeviceId : gpuDeviceIds) {
10561063
GpuDeviceVO gpuDevice = gpuDeviceDao.findById(gpuDeviceId);
10571064
if (gpuDevice == null) {
@@ -1069,12 +1076,20 @@ private boolean updateGpuDeviceManagedState(List<Long> gpuDeviceIds, GpuDevice.M
10691076
gpuDevice, gpuDevice.getVmId()));
10701077
}
10711078
gpuDevices.add(gpuDevice);
1079+
hostIds.add(gpuDevice.getHostId());
10721080
}
10731081

10741082
for (GpuDeviceVO gpuDevice : gpuDevices) {
10751083
gpuDevice.setManagedState(managedState);
10761084
gpuDeviceDao.update(gpuDevice.getId(), gpuDevice);
10771085
}
1086+
1087+
for (Long hostId : hostIds) {
1088+
HostVO host = hostDao.findById(hostId);
1089+
host.setGpuGroups(getGpuGroupDetailsFromGpuDevicesOnHost(host));
1090+
hostDao.update(hostId, host);
1091+
}
1092+
10781093
return true;
10791094
}
10801095

ui/public/locales/en.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
"label.action.delete.egress.firewall": "Delete egress firewall rule",
9090
"label.action.delete.firewall": "Delete firewall rule",
9191
"label.action.delete.interface.static.route": "Remove Tungsten Fabric interface static route",
92+
"label.action.delete.gpu.card": "Delete GPU card",
9293
"label.action.delete.guest.os": "Delete guest OS",
9394
"label.action.delete.guest.os.category": "Delete guest OS category",
9495
"label.action.delete.guest.os.hypervisor.mapping": "Delete guest OS hypervisor mapping",
@@ -110,6 +111,7 @@
110111
"label.action.delete.template": "Delete Template",
111112
"label.action.delete.tungsten.router.table": "Remove Tungsten Fabric route table from Network",
112113
"label.action.delete.user": "Delete User",
114+
"label.action.delete.vgpu.profile": "Delete vGPU profile",
113115
"label.action.delete.volume": "Delete volume",
114116
"label.action.delete.zone": "Delete zone",
115117
"label.action.destroy.instance": "Destroy Instance",
@@ -1080,6 +1082,7 @@
10801082
"label.gpu.device": "GPU Device",
10811083
"label.gpu.devices": "GPU Devices",
10821084
"label.gpu.enabled": "GPU Enabled",
1085+
"label.gpuenabled": "GPU Enabled",
10831086
"label.gpudevicetype": "Device Type",
10841087
"label.gpu.devices.add": "Add GPU Device",
10851088
"label.gpu.devices.delete": "Delete GPU Device",
@@ -1474,7 +1477,7 @@
14741477
"label.maxerrorretry": "Max error retry",
14751478
"label.maxgpu": "Max. GPUs",
14761479
"label.maxguestslimit": "Max guest limit",
1477-
"label.maxheads": "Max heads",
1480+
"label.maxheads": "Max. heads",
14781481
"label.maxhostspercluster": "Max hosts per cluster",
14791482
"label.maximum": "Maximum",
14801483
"label.maxinstance": "Max Instances",
@@ -2491,6 +2494,7 @@
24912494
"label.update.bgp.peer": "Update BGP peer",
24922495
"label.update.condition": "Update condition",
24932496
"label.update.gpu.device": "Update GPU device",
2497+
"label.update.vgpu.profile": "Update vGPU profile",
24942498
"label.update.sharedfs": "Update Shared FileSystem",
24952499
"label.update.instance.group": "Update Instance group",
24962500
"label.update.ip.range": "Update IP range",
@@ -2785,6 +2789,7 @@
27852789
"message.action.delete.external.load.balancer": "Please confirm that you would like to remove this external load balancer. Warning: If you are planning to add back the same external load balancer, you must reset usage data on the device.",
27862790
"message.action.delete.ingress.rule": "Please confirm that you want to delete this ingress rule.",
27872791
"message.action.delete.ipv4.subnet": "Please confirm that you want to delete this IPv4 subnet.",
2792+
"message.action.delete.gpu.card": "Please confirm that you want to delete this GPU card.",
27882793
"message.action.delete.guest.os": "Please confirm that you want to delete this guest os. System defined entry cannot be deleted.",
27892794
"message.action.delete.guest.os.category": "Please confirm that you want to delete this guest os category.",
27902795
"message.action.delete.guest.os.hypervisor.mapping": "Please confirm that you want to delete this guest os hypervisor mapping. System defined entry cannot be deleted.",
@@ -2803,6 +2808,7 @@
28032808
"message.action.delete.snapshot": "Please confirm that you want to delete this Snapshot.",
28042809
"message.action.delete.template": "Please confirm that you want to delete this Template.",
28052810
"message.action.delete.tungsten.router.table": "Please confirm that you want to remove Route Table from this Network?",
2811+
"message.action.delete.vgpu.profile": "Please confirm that you want to delete this vGPU profile.",
28062812
"message.action.delete.volume": "Please confirm that you want to delete this volume. Note: this will not delete any Snapshots of this volume.",
28072813
"message.action.delete.vpn.user": "Please confirm that you want to delete the VPN user.",
28082814
"message.action.delete.zone": "Please confirm that you want to delete this zone.",
@@ -3014,6 +3020,7 @@
30143020
"message.confirm.delete.ciscoasa1000v": "Please confirm you want to delete CiscoASA1000v.",
30153021
"message.confirm.delete.ciscovnmc.resource": "Please confirm you want to delete CiscoVNMC resource.",
30163022
"message.confirm.delete.gpu.devices": "Please confirm that you would like to delete this GPU device?",
3023+
"message.confirm.delete.vgpu.profile": "Please confirm that you want to delete this vGPU profile?",
30173024
"message.confirm.delete.f5": "Please confirm that you would like to delete F5.",
30183025
"message.confirm.delete.internal.lb": "Please confirm you want to delete internal LB.",
30193026
"message.confirm.delete.netscaler": "Please confirm that you would like to delete NetScaler.",
@@ -3746,6 +3753,9 @@
37463753
"message.success.update.bucket": "Successfully updated bucket",
37473754
"message.success.update.condition": "Successfully updated condition",
37483755
"message.success.update.gpu.device": "Successfully updated GPU device",
3756+
"message.success.create.vgpu.profile": "Successfully created vGPU profile",
3757+
"message.success.update.vgpu.profile": "Successfully updated vGPU profile",
3758+
"message.success.delete.vgpu.profile": "Successfully deleted vGPU profile",
37493759
"message.success.update.sharedfs": "Successfully updated Shared FileSystem",
37503760
"message.success.update.ipaddress": "Successfully updated IP address",
37513761
"message.success.update.iprange": "Successfully updated IP range",

ui/src/components/view/ListView.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
{{ record.maxresolutionx }}x{{ record.maxresolutiony }}
221221
</span>
222222
<span v-else>
223-
{{ text }}
223+
{{ text }}
224224
</span>
225225
</template>
226226
<template v-if="column.key === 'templateid'">
@@ -973,6 +973,9 @@
973973
@onClick="removeVMSchedule(record)"
974974
/>
975975
</template>
976+
<template v-if="column.key === 'vgpuActions'">
977+
<slot name="actionButtons" :record="record" :actions="actions"></slot>
978+
</template>
976979
</template>
977980
<template #footer>
978981
<span v-if="hasSelected">

ui/src/components/view/SearchView.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export default {
320320
if (['zoneid', 'domainid', 'imagestoreid', 'storageid', 'state', 'account', 'hypervisor', 'level',
321321
'clusterid', 'podid', 'groupid', 'entitytype', 'accounttype', 'systemvmtype', 'scope', 'provider',
322322
'type', 'scope', 'managementserverid', 'serviceofferingid',
323-
'diskofferingid', 'networkid', 'usagetype', 'restartrequired',
323+
'diskofferingid', 'networkid', 'usagetype', 'restartrequired', 'gpuenabled',
324324
'displaynetwork', 'guestiptype', 'usersource', 'arch', 'oscategoryid', 'templatetype', 'gpucardid', 'vgpuprofileid'].includes(item)
325325
) {
326326
type = 'list'
@@ -429,6 +429,16 @@ export default {
429429
this.fields[restartRequiredIndex].loading = false
430430
}
431431
432+
if (arrayField.includes('gpuenabled')) {
433+
const gpuEnabledIndex = this.fields.findIndex(item => item.name === 'gpuenabled')
434+
this.fields[gpuEnabledIndex].loading = true
435+
this.fields[gpuEnabledIndex].opts = [
436+
{ id: 'true', name: 'label.yes' },
437+
{ id: 'false', name: 'label.no' }
438+
]
439+
this.fields[gpuEnabledIndex].loading = false
440+
}
441+
432442
if (arrayField.includes('resourcetype')) {
433443
const resourceTypeIndex = this.fields.findIndex(item => item.name === 'resourcetype')
434444
this.fields[resourceTypeIndex].loading = true

0 commit comments

Comments
 (0)