shwstppr commented on code in PR #9208:
URL: https://github.com/apache/cloudstack/pull/9208#discussion_r1709342227


##########
ui/src/views/storage/FileShareTab.vue:
##########
@@ -0,0 +1,202 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+<template>
+  <a-spin :spinning="loading">
+    <a-tabs
+      :activeKey="currentTab"
+      :tabPosition="device === 'mobile' ? 'top' : 'left'"
+      :animated="false"
+      @change="handleChangeTab">
+      <a-tab-pane :tab="$t('label.details')" key="details">
+        <DetailsTab :resource="dataResource" :loading="loading" />
+      </a-tab-pane>
+      <a-tab-pane :tab="$t('label.access')" key="access">
+        <h3>{{ $t('label.mount.fileshare') }}</h3>
+        <div v-for="(nic, index) in resource.nic" :key="index" class="content">
+          <a-card>
+            <template #title>
+              <router-link :to="{ path: '/guestnetwork/' + nic.networkid }">
+                {{ nic.networkname }}
+              </router-link>
+            </template>
+            <timeline>
+              <a-timeline-item color="blue">
+                <h3>mount -t nfs -o rw,sync {{ nic.ipaddress }}:{{ 
resource.path }} [local_mount_path]</h3>

Review Comment:
   would be great to get a copy button for commands but it is just UX and can 
be added later



##########
api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:
##########
@@ -167,8 +167,6 @@ public class CreateDiskOfferingCmd extends BaseCmd {
     @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, 
description = "details to specify disk offering parameters", since = "4.16")
     private Map details;
 
-

Review Comment:
   change can be excluded



##########
ui/src/components/view/ListView.vue:
##########
@@ -675,15 +675,15 @@ export default {
         '/project', '/account', 'buckets', 'objectstore',
         '/zone', '/pod', '/cluster', '/host', '/storagepool', '/imagestore', 
'/systemvm', '/router', '/ilbvm', '/annotation',
         '/computeoffering', '/systemoffering', '/diskoffering', 
'/backupoffering', '/networkoffering', '/vpcoffering',
-        '/tungstenfabric', '/oauthsetting', '/guestos', 
'/guestoshypervisormapping', '/webhook', 'webhookdeliveries'].join('|'))
+        '/tungstenfabric', '/oauthsetting', '/guestos', 
'/guestoshypervisormapping', '/webhook', 'webhookdeliveries', 
'fileshare'].join('|'))

Review Comment:
   ```suggestion
           '/tungstenfabric', '/oauthsetting', '/guestos', 
'/guestoshypervisormapping', '/webhook', '/webhookdeliveries', 
'/fileshare'].join('|'))
   ```
   for consistency sake, I started this divergence :man_facepalming: 
   



##########
server/src/main/java/com/cloud/server/ManagementServerImpl.java:
##########
@@ -4470,6 +4471,9 @@ public Map<String, Object> listCapabilities(final 
ListCapabilitiesCmd cmd) {
             regionSecondaryEnabled = true;
         }
 
+        final Integer fsVmMinCpu = 
Integer.parseInt(_configDao.getValue("storagefsvm.min.cpu.count"));
+        final Integer fsVmMinRam = 
Integer.parseInt(_configDao.getValue("storagefsvm.min.ram.size"));

Review Comment:
   Not possible to use configkeys?



##########
server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java:
##########
@@ -983,7 +983,7 @@ public SnapshotPolicyVO 
createPolicy(CreateSnapshotPolicyCmd cmd, Account policy
             if (instanceId != null) {
                 userVmVO = _vmDao.findById(instanceId);
             }
-            if (template != null && template.getTemplateType() == 
Storage.TemplateType.SYSTEM && (userVmVO == null || 
!UserVmManager.CKS_NODE.equals(userVmVO.getUserVmType()))) {
+            if (template != null && template.getTemplateType() == 
Storage.TemplateType.SYSTEM && (userVmVO == null || 
!UserVmManager.CKS_NODE.equals(userVmVO.getUserVmType()) || 
!UserVmManager.STORAGEFSVM.equals(userVmVO.getUserVmType()))) {

Review Comment:
   Not within scope of this PR but there should be some common framework to 
check operation support for different uservm types



##########
plugins/storage/fileshare/storagefsvm/src/main/resources/conf/fsvm-init.yml:
##########
@@ -0,0 +1,196 @@
+#cloud-config
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+---
+write_files:
+  - path: /usr/local/bin/add-partition
+    permissions: '0700'
+    owner: root:root
+    content: |
+      #!/bin/bash -e
+
+      LOG_FILE="/var/log/userdata.log"
+      log() {
+        echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> $LOG_FILE
+      }
+
+      log "Running add script"
+
+      # Variables
+      PARTITION="$1"
+      MOUNT_POINT="/mnt/fs"
+      EXPORT_DIR="$MOUNT_POINT/share"
+      PERMISSIONS="rw,sync,no_subtree_check"
+
+      mkdir -p "$MOUNT_POINT"
+
+      FS_TYPE=$(lsblk -no FSTYPE "$PARTITION")
+
+      if [ -z "$FS_TYPE" ]; then
+        FILESYSTEM={{ fsvm.filesystem }}
+        if [ "$FILESYSTEM" == "xfs" ]; then
+          mkfs.xfs "$PARTITION"
+          log "Formatted Partition $PARTITION with XFS Filesystem."
+        elif [ "$FILESYSTEM" == "ext4" ]; then
+          mkfs.ext4 "$PARTITION"
+          log "Formatted Partition $PARTITION with EXT4 Filesystem."
+        else
+          log "Invalid filesystem type specified. Use 'xfs' or 'ext4'."
+          exit 1
+        fi
+      else
+        log "Partition $PARTITION already has a filesystem of type $FS_TYPE. 
Skipping format."
+      fi
+
+      FS_INFO=$(blkid "$PARTITION")
+      UUID=$(echo "$FS_INFO" | grep -oP "UUID=\"\K[^\"]+")
+      TYPE=$(echo "$FS_INFO" | grep -oP "TYPE=\"\K[^\"]+")
+
+      if [ -z "$UUID" ] || [ -z "$TYPE" ]; then
+        log "Failed to retrieve UUID or TYPE for $PARTITION"
+        exit 1
+      fi
+
+      echo "UUID=$UUID $MOUNT_POINT $TYPE defaults 0 2" >> /etc/fstab
+      log "Added fstab entry."
+
+      mount -a
+
+      if mountpoint -q "$MOUNT_POINT"; then
+        log "$PARTITION is successfully mounted on $MOUNT_POINT"
+      else
+        log "Failed to mount $PARTITION on $MOUNT_POINT"
+        exit 1
+      fi
+
+      if [ ! -d "$EXPORT_DIR" ]; then
+        log "Creating export directory..."
+        mkdir -p "$EXPORT_DIR"
+        chown nobody:nogroup "$EXPORT_DIR"
+        chmod 777 "$EXPORT_DIR"
+      fi
+
+      log "Configuring NFS export..."
+      EXPORT_ENTRY="$EXPORT_DIR *($PERMISSIONS)"
+      if ! grep -qF "$EXPORT_ENTRY" /etc/exports; then
+        echo "$EXPORT_ENTRY" | tee -a /etc/exports > /dev/null
+      fi
+      exportfs -ra
+
+      log "Enable and restart NFS server..."
+      systemctl enable nfs-kernel-server
+      systemctl restart nfs-kernel-server
+
+      log "NFS share created successfully."
+      log "Finished running add script."
+
+  - path: /usr/local/bin/resize-partition
+    permissions: '0700'
+    owner: root:root
+    content: |
+      #!/bin/bash -e
+
+      LOG_FILE="/var/log/userdata.log"
+      log() {
+        echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> $LOG_FILE
+      }
+      log "Running resize script."
+      PARTITION="$1"
+
+      FILESYSTEM={{ fsvm.filesystem }}
+      if [ "$FILESYSTEM" == "xfs" ]; then
+        xfs_growfs "$PARTITION"
+      elif [ "$FILESYSTEM" == "ext4" ]; then
+        resize2fs "$PARTITION"
+      else
+        log "Invalid filesystem type specified. Use 'xfs' or 'ext4'."
+        exit 1
+      fi
+
+      log "Finished running resize script."
+
+  - path: /etc/systemd/system/[email protected]
+    permissions: '0700'
+    owner: root:root
+    content: |
+      [Unit]
+      Description=CloudStack service to start dhclient
+
+      [Install]
+      WantedBy=multi-user.target
+
+      [Service]
+      Type=simple
+      ExecStart=/usr/sbin/dhclient %I
+      Restart=on-failure
+
+  - path: /usr/local/bin/fsvm-setup
+    permissions: '0700'
+    owner: root:root
+    content: |
+      #!/bin/bash -e
+
+      LOG_FILE="/var/log/userdata.log"
+      log() {
+        echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> $LOG_FILE
+      }
+
+      HYPERVISOR_INFO=$(dmesg | grep -i hypervisor)

Review Comment:
   @abh1sar based on the code I see, template (and in turn hypervisor) is 
already selected when `createAdvancedVirtualMachine` is passed so would it make 
sense to pass same hypervisor type?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to