harikrishna-patnala commented on code in PR #11560:
URL: https://github.com/apache/cloudstack/pull/11560#discussion_r2329691991


##########
plugins/backup/nas/src/main/java/org/apache/cloudstack/backup/NASBackupProvider.java:
##########
@@ -115,27 +130,38 @@ public class NASBackupProvider extends AdapterBase 
implements BackupProvider, Co
     @Inject
     private DiskOfferingDao diskOfferingDao;
 
+    protected Long getClusterIdFromRootVolume(VirtualMachine vm) {
+        VolumeVO rootVolume = _volsDao.getInstanceRootVolume(vm.getId());
+        StoragePoolVO rootDiskPool = 
_storagePoolDao.findById(rootVolume.getPoolId());

Review Comment:
   do we need a null check for poolId here ? 



##########
ui/src/components/view/DeployVMFromBackup.vue:
##########
@@ -45,14 +45,76 @@
                   </div>
                 </template>
               </a-step>
+              <a-step
+                v-if="isDRaaSEnabled"
+                :title="$t('label.select.a.zone')"
+                status="process">
+                <template #description>
+                  <div style="margin-top: 15px">
+                    <a-form-item :label="$t('label.zoneid')" name="zoneid" 
ref="zoneid">
+                      <div v-if="zones.length <= 8">
+                        <a-row type="flex" :gutter="[16, 18]" justify="start">
+                          <div v-for="(zoneItem, idx) in zones" :key="idx">
+                            <a-radio-group
+                              :key="idx"
+                              v-model:value="form.zoneid"
+                              @change="onSelectZoneId(zoneItem.id)">
+                              <a-col :span="6">
+                                <a-radio-button
+                                  :value="zoneItem.id"
+                                  style="border-width: 2px"
+                                  class="zone-radio-button">
+                                  <span>
+                                    <resource-icon
+                                      v-if="zoneItem && zoneItem.icon && 
zoneItem.icon.base64image"
+                                      :image="zoneItem.icon.base64image"
+                                      size="2x" />
+                                    <global-outlined size="2x" v-else />
+                                    {{ zoneItem.name }}
+                                    </span>
+                                </a-radio-button>
+                              </a-col>
+                            </a-radio-group>
+                          </div>
+                        </a-row>
+                      </div>
+                      <a-select
+                        v-else
+                        v-model:value="form.zoneid"
+                        showSearch
+                        optionFilterProp="label"
+                        :filterOption="(input, option) => {
+                          return 
option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
+                        }"
+                        @change="onSelectZoneId"
+                        :loading="loading.zones"
+                        v-focus="true"
+                      >
+                        <a-select-option v-for="zone1 in zones" 
:key="zone1.id" :label="zone1.name">
+                          <span>
+                            <resource-icon v-if="zone1.icon && 
zone1.icon.base64image" :image="zone1.icon.base64image" size="2x" 
style="margin-right: 5px"/>
+                            <global-outlined v-else style="margin-right: 5px" 
/>
+                            {{ zone1.name }}
+                          </span>
+                        </a-select-option>
+                      </a-select>
+                    </a-form-item>
+                    <a-alert
+                      v-if="isDifferentZoneFromBackup">
+                      <template #message>
+                        <div 
v-html="$t('message.create.instance.from.backup.different.zone')"></div>
+                      </template>
+                    </a-alert>
+                  </div>
+                </template>
+              </a-step>
               <a-step
                 v-if="!isNormalAndDomainUser"
                 :title="$t('label.select.deployment.infrastructure')"
                 status="process">
                 <template #description>
                   <div style="margin-top: 15px">
                     <a-form-item
-                      v-if="!isNormalAndDomainUser"

Review Comment:
   any reason for removal of this check ?



##########
engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java:
##########
@@ -1476,16 +1476,29 @@ public void orchestrateStart(final String vmUuid, final 
Map<VirtualMachineProfil
 
                     processPrepareExternalProvisioning(firstStart, 
dest.getHost(), vmProfile, dest.getDataCenter());
 
-                    _networkMgr.prepare(vmProfile, dest, ctx);
                     if (vm.getHypervisorType() != HypervisorType.BareMetal && 
vm.getHypervisorType() != HypervisorType.External) {
                         checkAndAttemptMigrateVmAcrossCluster(vm, clusterId, 
dest.getStorageForDisks());
                         volumeMgr.prepare(vmProfile, dest);
                     }
 
+                    Boolean returnAfterVolumePrepare = (Boolean) 
params.get(VirtualMachineProfile.Param.ReturnAfterVolumePrepare);

Review Comment:
   Can you please help me understand why these changes are required



##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -9612,20 +9615,15 @@ public UserVm 
allocateVMFromBackup(CreateVMFromBackupCmd cmd) throws Insufficien
     @Override
     public UserVm restoreVMFromBackup(CreateVMFromBackupCmd cmd) throws 
ResourceUnavailableException, InsufficientCapacityException, 
ResourceAllocationException {
         long vmId = cmd.getEntityId();
+        UserVm vm;
         Map<Long, DiskOffering> diskOfferingMap = 
cmd.getDataDiskTemplateToDiskOfferingMap();
         Map<VirtualMachineProfile.Param, Object> additonalParams = new 
HashMap<>();
-        UserVm vm;
+        
additonalParams.put(VirtualMachineProfile.Param.ReturnAfterVolumePrepare, true);
 
         try {
-            vm = startVirtualMachine(vmId, null, null, null, diskOfferingMap, 
additonalParams, null);
-
-            boolean status =  
stopVirtualMachine(CallContext.current().getCallingUserId(), vm.getId()) ;

Review Comment:
   Don't we need this cleanup now ?



##########
api/src/main/java/org/apache/cloudstack/api/command/user/backup/repository/UpdateBackupRepositoryCmd.java:
##########
@@ -0,0 +1,116 @@
+// 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.
+
+package org.apache.cloudstack.api.command.user.backup.repository;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.BackupRepositoryResponse;
+import org.apache.cloudstack.backup.BackupRepository;
+import org.apache.cloudstack.backup.BackupRepositoryService;
+import org.apache.cloudstack.context.CallContext;
+
+import javax.inject.Inject;
+
+@APICommand(name = "updateBackupRepository",
+        description = "Update a backup repository",
+        responseObject = BackupRepositoryResponse.class, since = "4.22.0",
+        authorized = {RoleType.Admin})
+public class UpdateBackupRepositoryCmd extends BaseCmd {
+
+    @Inject
+    private BackupRepositoryService backupRepositoryService;
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = 
BackupRepositoryResponse.class, description = "ID of the backup repository")
+    private Long id;
+
+    @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = 
true, description = "name of the backup repository")
+    private String name;
+
+    @Parameter(name = ApiConstants.ADDRESS, type = CommandType.STRING, 
required = true, description = "address of the backup repository")
+    private String address;
+
+    @Parameter(name = ApiConstants.MOUNT_OPTIONS, type = CommandType.STRING, 
description = "shared storage mount options")
+    private String mountOptions;
+
+    @Parameter(name = ApiConstants.DRAAS_ENABLED, type = CommandType.BOOLEAN, 
description = "the backup repository is configured to be used for disaster 
recovery on other Zones")
+    private Boolean draasEnabled;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public BackupRepositoryService getBackupRepositoryService() {
+        return backupRepositoryService;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public String getMountOptions() {
+        return mountOptions == null ? "" : mountOptions;
+    }
+
+    public Boolean isDraasEnabled() {
+        return draasEnabled;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public void execute() {
+        try {
+            BackupRepository result = 
backupRepositoryService.updateBackupRepository(this);
+            if (result != null) {
+                BackupRepositoryResponse response = 
_responseGenerator.createBackupRepositoryResponse(result);
+                response.setResponseName(getCommandName());
+                this.setResponseObject(response);
+            } else {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, 
"Failed to add backup repository");

Review Comment:
   Failed to update !



-- 
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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to