You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2024/04/18 07:25:47 UTC

(cloudstack) 01/01: Merge LTS branch '4.19' into main

This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 7de8a6d0826130e7ca004b56621406755e1aa391
Merge: 38ca11f99ac cadbb563afa
Author: Daan Hoogland <da...@onecht.net>
AuthorDate: Thu Apr 18 08:54:58 2024 +0200

    Merge LTS branch '4.19' into main

 .../java/com/cloud/utils/db/GenericDaoBase.java    |    4 +
 .../kvm/storage/LinstorStorageAdaptor.java         |   50 +-
 .../network/element/VirtualRouterElement.java      |   20 +-
 .../com/cloud/storage/VolumeApiServiceImpl.java    |    3 +-
 ui/README.md                                       |    4 +-
 ui/package-lock.json                               | 1000 +++++++++-----------
 ui/package.json                                    |   12 +-
 ui/src/components/view/DetailsTab.vue              |    9 +
 ui/src/components/view/InfoCard.vue                |   12 +-
 9 files changed, 489 insertions(+), 625 deletions(-)

diff --cc framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java
index bc940c24e02,0eb45439769..a09f323905e
--- a/framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java
+++ b/framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java
@@@ -60,6 -57,8 +60,7 @@@ import javax.persistence.Table
  import javax.persistence.TableGenerator;
  
  import com.amazonaws.util.CollectionUtils;
+ import org.apache.commons.lang3.ArrayUtils;
 -import org.apache.log4j.Logger;
  
  import com.cloud.utils.DateUtil;
  import com.cloud.utils.NumbersUtil;
diff --cc plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java
index f3a70b079be,dd50c8d2214..794abfd2a38
--- a/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java
+++ b/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java
@@@ -285,8 -281,8 +286,8 @@@ public class LinstorStorageAdaptor impl
      @Override
      public boolean disconnectPhysicalDisk(String volumePath, KVMStoragePool pool)
      {
-         logger.debug("Linstor: disconnectPhysicalDisk " + pool.getUuid() + ":" + volumePath);
-         return true;
 -        s_logger.debug("Linstor: disconnectPhysicalDisk " + pool.getUuid() + ":" + volumePath);
++        logger.debug("Linstor: disconnectPhysicalDisk {}:{}", pool.getUuid(), volumePath);
+         return false;
      }
  
      @Override
@@@ -316,45 -312,50 +317,50 @@@
          Optional<KVMStoragePool> optFirstPool = MapStorageUuidToStoragePool.values().stream().findFirst();
          if (optFirstPool.isPresent())
          {
 -            s_logger.debug("Linstor: disconnectPhysicalDiskByPath " + localPath);
 +            logger.debug("Linstor: disconnectPhysicalDiskByPath " + localPath);
              final KVMStoragePool pool = optFirstPool.get();
  
 -            s_logger.debug("Linstor: Using storpool: " + pool.getUuid());
 +            logger.debug("Linstor: Using storpool: " + pool.getUuid());
              final DevelopersApi api = getLinstorAPI(pool);
  
-             try
-             {
+             Optional<ResourceWithVolumes> optRsc;
+             try {
                  List<ResourceWithVolumes> resources = api.viewResources(
-                     Collections.singletonList(localNodeName),
-                     null,
-                     null,
-                     null,
-                     null,
-                     null);
- 
-                 Optional<ResourceWithVolumes> rsc = getResourceByPath(resources, localPath);
+                         Collections.singletonList(localNodeName),
+                         null,
+                         null,
+                         null,
+                         null,
+                         null);
+ 
+                 optRsc = getResourceByPath(resources, localPath);
+             } catch (ApiException apiEx) {
+                 // couldn't query linstor controller
 -                s_logger.error(apiEx.getBestMessage());
++                logger.error(apiEx.getBestMessage());
+                 return false;
+             }
  
-                 if (rsc.isPresent())
-                 {
+             if (optRsc.isPresent()) {
+                 try {
+                     Resource rsc = optRsc.get();
                      ResourceDefinitionModify rdm = new ResourceDefinitionModify();
                      rdm.deleteProps(Collections.singletonList("DrbdOptions/Net/allow-two-primaries"));
-                     ApiCallRcList answers = api.resourceDefinitionModify(rsc.get().getName(), rdm);
+                     ApiCallRcList answers = api.resourceDefinitionModify(rsc.getName(), rdm);
                      if (answers.hasError()) {
 -                        s_logger.error(
 +                        logger.error(
                                  String.format("Failed to remove 'allow-two-primaries' on %s: %s",
-                                         rsc.get().getName(), LinstorUtil.getBestErrorMessage(answers)));
+                                         rsc.getName(), LinstorUtil.getBestErrorMessage(answers)));
                          // do not fail here as removing allow-two-primaries property isn't fatal
                      }
- 
+                 } catch(ApiException apiEx){
 -                    s_logger.error(apiEx.getBestMessage());
++                    logger.error(apiEx.getBestMessage());
+                     // do not fail here as removing allow-two-primaries property isn't fatal
 +                    return true;
                  }
-                 logger.warn("Linstor: Couldn't find resource for this path: " + localPath);
-             } catch (ApiException apiEx) {
-                 logger.error(apiEx.getBestMessage());
-                 // do not fail here as removing allow-two-primaries property isn't fatal
 -                return true;
              }
          }
-         return true;
 -        s_logger.info("Linstor: Couldn't find resource for this path: " + localPath);
++        logger.info("Linstor: Couldn't find resource for this path: {}", localPath);
+         return false;
      }
  
      @Override
diff --cc ui/src/components/view/DetailsTab.vue
index db188e0db9e,00aa92389c9..f731766f878
--- a/ui/src/components/view/DetailsTab.vue
+++ b/ui/src/components/view/DetailsTab.vue
@@@ -43,9 -43,18 +43,18 @@@
            <br/>
            <div v-if="Array.isArray(dataResource[item]) && item === 'service'">
              <div v-for="(service, idx) in dataResource[item]" :key="idx">
 -              {{ service.name }} : {{ service.provider[0].name }}
 +              {{ service.name }} : {{ service.provider?.[0]?.name }}
              </div>
            </div>
+           <div v-else-if="$route.meta.name === 'backup' && (item === 'size' || item === 'virtualsize')">
+             {{ $bytesToHumanReadableSize(dataResource[item]) }}
+             <a-tooltip placement="right">
+               <template #title>
+                 {{ dataResource[item] }} bytes
+               </template>
+               <QuestionCircleOutlined />
+             </a-tooltip>
+           </div>
            <div v-else-if="$route.meta.name === 'backup' && item === 'volumes'">
              <div v-for="(volume, idx) in JSON.parse(dataResource[item])" :key="idx">
                <router-link :to="{ path: '/volume/' + volume.uuid }">{{ volume.type }} - {{ volume.path }}</router-link> ({{ parseFloat(volume.size / (1024.0 * 1024.0 * 1024.0)).toFixed(1) }} GB)