4343import com .cloud .vm .VirtualMachine ;
4444
4545@ APICommand (name = "migrateVirtualMachine" ,
46- description = "Attempts Migration of a VM to a different host or Root volume of the vm to a different storage pool" ,
47- responseObject = UserVmResponse .class , entityType = {VirtualMachine .class },
48- requestHasSensitiveInfo = false ,
49- responseHasSensitiveInfo = true )
46+ description = "Attempts Migration of a VM to a different host or Root volume of the vm to a different storage pool" ,
47+ responseObject = UserVmResponse .class , entityType = {VirtualMachine .class },
48+ requestHasSensitiveInfo = false ,
49+ responseHasSensitiveInfo = true )
5050public class MigrateVMCmd extends BaseAsyncCmd {
5151 public static final Logger s_logger = Logger .getLogger (MigrateVMCmd .class .getName ());
5252
@@ -57,24 +57,24 @@ public class MigrateVMCmd extends BaseAsyncCmd {
5757 /////////////////////////////////////////////////////
5858
5959 @ Parameter (name = ApiConstants .HOST_ID ,
60- type = CommandType .UUID ,
61- entityType = HostResponse .class ,
62- required = false ,
63- description = "Destination Host ID to migrate VM to. Required for live migrating a VM from host to host" )
60+ type = CommandType .UUID ,
61+ entityType = HostResponse .class ,
62+ required = false ,
63+ description = "Destination Host ID to migrate VM to. Required for live migrating a VM from host to host" )
6464 private Long hostId ;
6565
6666 @ Parameter (name = ApiConstants .VIRTUAL_MACHINE_ID ,
67- type = CommandType .UUID ,
68- entityType = UserVmResponse .class ,
69- required = true ,
70- description = "the ID of the virtual machine" )
67+ type = CommandType .UUID ,
68+ entityType = UserVmResponse .class ,
69+ required = true ,
70+ description = "the ID of the virtual machine" )
7171 private Long virtualMachineId ;
7272
7373 @ Parameter (name = ApiConstants .STORAGE_ID ,
74- type = CommandType .UUID ,
75- entityType = StoragePoolResponse .class ,
76- required = false ,
77- description = "Destination storage pool ID to migrate VM volumes to. Required for migrating the root disk volume" )
74+ type = CommandType .UUID ,
75+ entityType = StoragePoolResponse .class ,
76+ required = false ,
77+ description = "Destination storage pool ID to migrate VM volumes to. Required for migrating the root disk volume" )
7878 private Long storageId ;
7979
8080 /////////////////////////////////////////////////////
@@ -167,7 +167,7 @@ public void execute() {
167167 migratedVm = _userVmService .vmStorageMigration (getVirtualMachineId (), destStoragePool );
168168 }
169169 if (migratedVm != null ) {
170- UserVmResponse response = _responseGenerator .createUserVmResponse (ResponseView .Full , "virtualmachine" , (UserVm )migratedVm ).get (0 );
170+ UserVmResponse response = _responseGenerator .createUserVmResponse (ResponseView .Full , "virtualmachine" , (UserVm ) migratedVm ).get (0 );
171171 response .setResponseName (getCommandName ());
172172 setResponseObject (response );
173173 } else {
@@ -176,21 +176,15 @@ public void execute() {
176176 } catch (ResourceUnavailableException ex ) {
177177 s_logger .warn ("Exception: " , ex );
178178 throw new ServerApiException (ApiErrorCode .RESOURCE_UNAVAILABLE_ERROR , ex .getMessage ());
179- } catch (ConcurrentOperationException e ) {
180- s_logger .warn ("Exception: " , e );
181- throw new ServerApiException (ApiErrorCode .INTERNAL_ERROR , e .getMessage ());
182- } catch (ManagementServerException e ) {
183- s_logger .warn ("Exception: " , e );
184- throw new ServerApiException (ApiErrorCode .INTERNAL_ERROR , e .getMessage ());
185- } catch (VirtualMachineMigrationException e ) {
179+ } catch (VirtualMachineMigrationException | ConcurrentOperationException | ManagementServerException e ) {
186180 s_logger .warn ("Exception: " , e );
187181 throw new ServerApiException (ApiErrorCode .INTERNAL_ERROR , e .getMessage ());
188182 }
189183 }
190184
191185 @ Override
192186 public String getSyncObjType () {
193- return (getSyncObjId () != null )? BaseAsyncCmd .migrationSyncObject : null ;
187+ return (getSyncObjId () != null ) ? BaseAsyncCmd .migrationSyncObject : null ;
194188 }
195189
196190 @ Override
0 commit comments