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

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

commit 50fe265017c2400357a3c42cfd457ffc92c1d1c8
Merge: 2dd1e6d786f d26122bf22b
Author: Wei Zhou <[email protected]>
AuthorDate: Fri Nov 7 17:19:53 2025 +0100

    Merge remote-tracking branch 'apache/4.20' into 4.22

 .../main/java/com/cloud/vm/dao/UserVmDaoImpl.java  |  2 +-
 .../cloudstack/backup/veeam/VeeamClient.java       | 45 ++++++++--------------
 .../cloudstack/backup/veeam/VeeamClientTest.java   |  4 +-
 .../java/com/cloud/hypervisor/guru/VMwareGuru.java |  7 +++-
 .../cluster/KubernetesClusterService.java          |  2 +-
 5 files changed, 28 insertions(+), 32 deletions(-)

diff --cc 
plugins/backup/veeam/src/main/java/org/apache/cloudstack/backup/veeam/VeeamClient.java
index e2df854f16d,0a8b18fd65e..98851e6359a
--- 
a/plugins/backup/veeam/src/main/java/org/apache/cloudstack/backup/veeam/VeeamClient.java
+++ 
b/plugins/backup/veeam/src/main/java/org/apache/cloudstack/backup/veeam/VeeamClient.java
@@@ -105,8 -107,10 +105,9 @@@ public class VeeamClient 
      private static final String REPOSITORY_REFERENCE = "RepositoryReference";
      private static final String RESTORE_POINT_REFERENCE = 
"RestorePointReference";
      private static final String BACKUP_FILE_REFERENCE = "BackupFileReference";
-     private static final SimpleDateFormat dateFormat = new 
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+     private static final SimpleDateFormat DATE_FORMAT = new 
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+     private static final ObjectMapper OBJECT_MAPPER = new XmlMapper();
  
 -
      private String veeamServerIp;
      private final Integer veeamServerVersion;
      private String veeamServerUsername;
@@@ -852,13 -872,10 +842,12 @@@
          return new ArrayList<>();
      }
  
 -    public List<Backup.RestorePoint> 
processHttpResponseForVmRestorePoints(InputStream content, String 
vmInternalName) {
 +    public List<Backup.RestorePoint> 
processHttpResponseForVmRestorePoints(InputStream content, String vmwareDcName, 
String vmInternalName, Map<String, Backup.Metric> metricsMap) {
          List<Backup.RestorePoint> vmRestorePointList = new ArrayList<>();
          try {
-             final ObjectMapper objectMapper = new XmlMapper();
-             final VmRestorePoints vmRestorePoints = 
objectMapper.readValue(content, VmRestorePoints.class);
+             final VmRestorePoints vmRestorePoints = 
OBJECT_MAPPER.readValue(content, VmRestorePoints.class);
 +            final String hierarchyId = findDCHierarchy(vmwareDcName);
 +            final String hierarchyUuid = 
StringUtils.substringAfterLast(hierarchyId, ":");
              if (vmRestorePoints == null) {
                  throw new CloudRuntimeException("Could not get VM restore 
points via Veeam B&R API");
              }
@@@ -907,13 -911,11 +896,13 @@@
      }
  
      private Date formatDate(String date) throws ParseException {
-         return dateFormat.parse(StringUtils.substring(date, 0, 19));
+         return DATE_FORMAT.parse(StringUtils.substring(date, 0, 19));
      }
  
 -    public Pair<Boolean, String> restoreVMToDifferentLocation(String 
restorePointId, String hostIp, String dataStoreUuid) {
 -        final String restoreLocation = RESTORE_VM_SUFFIX + 
UUID.randomUUID().toString();
 +    public Pair<Boolean, String> restoreVMToDifferentLocation(String 
restorePointId, String restoreLocation, String hostIp, String dataStoreUuid) {
 +        if (restoreLocation == null) {
 +            restoreLocation = RESTORE_VM_SUFFIX + 
UUID.randomUUID().toString();
 +        }
          final String datastoreId = dataStoreUuid.replace("-","");
          final List<String> cmds = Arrays.asList(
                  "$points = Get-VBRRestorePoint",

Reply via email to