From commits-return-82880-archive-asf-public=cust-asf.ponee.io@cloudstack.apache.org Thu Nov 15 09:46:08 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 680EE180676 for ; Thu, 15 Nov 2018 09:46:08 +0100 (CET) Received: (qmail 16604 invoked by uid 500); 15 Nov 2018 08:46:07 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 16595 invoked by uid 99); 15 Nov 2018 08:46:07 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Nov 2018 08:46:07 +0000 From: GitBox To: commits@cloudstack.apache.org Subject: [GitHub] DaanHoogland commented on a change in pull request #2848: Vmware offline migration Message-ID: <154227156687.6508.8562654837854004237.gitbox@gitbox.apache.org> Date: Thu, 15 Nov 2018 08:46:06 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit DaanHoogland commented on a change in pull request #2848: Vmware offline migration URL: https://github.com/apache/cloudstack/pull/2848#discussion_r233753180 ########## File path: engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java ########## @@ -1976,92 +1965,244 @@ public void storageMigration(final String vmUuid, final StoragePool destPool) { private void orchestrateStorageMigration(final String vmUuid, final StoragePool destPool) { final VMInstanceVO vm = _vmDao.findByUuid(vmUuid); + preStorageMigrationStateCheck(destPool, vm); + + try { + if(s_logger.isDebugEnabled()) { + s_logger.debug( + String.format("Offline migration of %s vm %s with volumes", + vm.getHypervisorType().toString(), + vm.getInstanceName())); + } + + migrateThroughHypervisorOrStorage(destPool, vm); + + } catch (ConcurrentOperationException + | InsufficientCapacityException // possibly InsufficientVirtualNetworkCapacityException or InsufficientAddressCapacityException + | StorageUnavailableException e) { + s_logger.debug("Failed to migration: " + e.toString()); + throw new CloudRuntimeException("Failed to migration: " + e.toString()); + } finally { + try { + stateTransitTo(vm, Event.AgentReportStopped, null); + } catch (final NoTransitionException e) { + s_logger.debug("Failed to change vm state: " + e.toString()); + throw new CloudRuntimeException("Failed to change vm state: " + e.toString()); + } + } + } + + private Answer[] attemptHypervisorMigration(StoragePool destPool, VMInstanceVO vm) { + boolean migrationResult = false; + final HypervisorGuru hvGuru = _hvGuruMgr.getGuru(vm.getHypervisorType()); + // OfflineVmwareMigration: in case of vmware call vcenter to do it for us. + // OfflineVmwareMigration: should we check the proximity of source and destination + // OfflineVmwareMigration: if we are in the same cluster/datacentre/pool or whatever? + // OfflineVmwareMigration: we are checking on success to optionally delete an old vm if we are not + List commandsToSend = hvGuru.finalizeMigrate(vm, destPool); + + Long hostId = vm.getHostId(); + // OfflineVmwareMigration: probaby this is null when vm is stopped + if(hostId == null) { + hostId = vm.getLastHostId(); + if (s_logger.isDebugEnabled()) { Review comment: String.format() should not be called for a string we are not logging anyway, so yes ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services