Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,18 @@ private String getStorageVmConfig(final String fileSystem, final String hypervis
return fsVmConfig;
}

private String getStorageVmName(String fileShareName) {
private String getStorageVmPrefix(String fileShareName) {
String prefix = String.format("%s-%s", SharedFSVmNamePrefix, fileShareName);
String suffix = Long.toHexString(System.currentTimeMillis());

if (!NetUtils.verifyDomainNameLabel(prefix, true)) {
prefix = prefix.replaceAll("[^a-zA-Z0-9-]", "");
}
return prefix;
}

private String getStorageVmName(String fileShareName) {
String prefix = getStorageVmPrefix(fileShareName);
String suffix = Long.toHexString(System.currentTimeMillis());

int nameLength = prefix.length() + suffix.length() + SharedFSVmNamePrefix.length();
if (nameLength > 63) {
int prefixLength = prefix.length() - (nameLength - 63);
Expand Down Expand Up @@ -236,8 +241,18 @@ public Pair<Long, Long> deploySharedFS(SharedFS sharedFS, Long networkId, Long d
Account owner = accountMgr.getActiveAccountById(sharedFS.getAccountId());
UserVm vm = deploySharedFSVM(sharedFS.getDataCenterId(), owner, List.of(networkId), sharedFS.getName(), sharedFS.getServiceOfferingId(), diskOfferingId, sharedFS.getFsType(), size, minIops, maxIops);

List<VolumeVO> volumes = volumeDao.findByInstanceAndType(vm.getId(), Volume.Type.DATADISK);
return new Pair<>(volumes.get(0).getId(), vm.getId());
List<VolumeVO> volumes = volumeDao.findByInstance(vm.getId());
VolumeVO dataVol = null;
for (VolumeVO vol : volumes) {
String volumeName = vol.getName();
String updatedVolumeName = SharedFSVmNamePrefix + "-" + volumeName;
vol.setName(updatedVolumeName);
volumeDao.update(vol.getId(), vol);
if (vol.getVolumeType() == Volume.Type.DATADISK) {
dataVol = vol;
}
}
return new Pair<>(dataVol.getId(), vm.getId());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,14 @@ public void testDeploySharedFS() throws ResourceUnavailableException, Insufficie
anyMap(), isNull(), isNull(), isNull(), isNull(),
anyBoolean(), anyString(), isNull())).thenReturn(vm);

VolumeVO volume = mock(VolumeVO.class);
when(volume.getId()).thenReturn(s_volumeId);
when(volumeDao.findByInstanceAndType(s_vmId, Volume.Type.DATADISK)).thenReturn(List.of(volume));
VolumeVO rootVol = mock(VolumeVO.class);
when(rootVol.getVolumeType()).thenReturn(Volume.Type.ROOT);
when(rootVol.getName()).thenReturn("ROOT-1");
VolumeVO dataVol = mock(VolumeVO.class);
when(dataVol.getId()).thenReturn(s_volumeId);
when(dataVol.getName()).thenReturn("DATA-1");
when(dataVol.getVolumeType()).thenReturn(Volume.Type.DATADISK);
when(volumeDao.findByInstance(s_vmId)).thenReturn(List.of(rootVol, dataVol));

Pair<Long, Long> result = lifeCycle.deploySharedFS(sharedFS, s_networkId, s_diskOfferingId, s_size, s_minIops, s_maxIops);
Assert.assertEquals(Optional.ofNullable(result.first()), Optional.ofNullable(s_volumeId));
Expand Down
7 changes: 6 additions & 1 deletion ui/src/components/view/InfoCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
<span v-if="(resource.icon && resource.icon.base64image || images.template || images.iso || resourceIcon) && !['router', 'systemvm', 'volume'].includes($route.path.split('/')[1])">
<resource-icon :image="getImage(resource.icon && resource.icon.base64image || images.template || images.iso || resourceIcon)" size="4x" style="margin-right: 5px"/>
</span>
<span v-else-if="resource.vmtype === 'sharedfsvm'">
<file-text-outlined style="font-size: 36px;" />
</span>
<span v-else>
<os-logo v-if="resource.ostypeid || resource.ostypename || ['guestoscategory'].includes($route.path.split('/')[1])" :osId="resource.ostypeid" :osName="resource.ostypename || resource.name" size="3x" @update-osname="setResourceOsType"/>
<render-icon v-else-if="typeof $route.meta.icon ==='string'" style="font-size: 36px" :icon="$route.meta.icon" />
Expand Down Expand Up @@ -876,6 +879,7 @@ import UploadResourceIcon from '@/components/view/UploadResourceIcon'
import eventBus from '@/config/eventBus'
import ResourceIcon from '@/components/view/ResourceIcon'
import ResourceLabel from '@/components/widgets/ResourceLabel'
import { FileTextOutlined } from '@ant-design/icons-vue'

export default {
name: 'InfoCard',
Expand All @@ -887,7 +891,8 @@ export default {
TooltipButton,
UploadResourceIcon,
ResourceIcon,
ResourceLabel
ResourceLabel,
FileTextOutlined
},
props: {
resource: {
Expand Down
7 changes: 6 additions & 1 deletion ui/src/components/view/ListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<span v-if="record.icon && record.icon.base64image">
<resource-icon :image="record.icon.base64image" size="2x"/>
</span>
<span v-else-if="record.vmtype === 'sharedfsvm'">
<file-text-outlined style="font-size: 18px;" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abh1sar do we need to specify font-size: 18px?
At some places where we are using render-icon we've used 16px and the places where we directly use icon as component we seem to be not specifying size

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shwstppr Without any font-size specified (default I think is 16px), the Instance name of the sharedfs was not aligning properly with the other instances (maybe because of the icon used)
Screenshot 2025-05-16 at 12 29 50 PM

</span>
<os-logo v-else :osId="record.ostypeid" :osName="record.osdisplayname" size="xl" />
</span>
<span style="min-width: 120px" >
Expand Down Expand Up @@ -591,6 +594,7 @@ import { createPathBasedOnVmType } from '@/utils/plugins'
import { validateLinks } from '@/utils/links'
import cronstrue from 'cronstrue/i18n'
import moment from 'moment-timezone'
import { FileTextOutlined } from '@ant-design/icons-vue'

export default {
name: 'ListView',
Expand All @@ -601,7 +605,8 @@ export default {
CopyLabel,
TooltipButton,
ResourceIcon,
ResourceLabel
ResourceLabel,
FileTextOutlined
},
props: {
columns: {
Expand Down
Loading