Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 79E0A200BFE for ; Mon, 16 Jan 2017 20:43:32 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 78D00160B28; Mon, 16 Jan 2017 19:43:32 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C0DC9160B4D for ; Mon, 16 Jan 2017 20:43:31 +0100 (CET) Received: (qmail 1892 invoked by uid 500); 16 Jan 2017 19:43:30 -0000 Mailing-List: contact issues-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 issues@cloudstack.apache.org Received: (qmail 1883 invoked by uid 500); 16 Jan 2017 19:43:30 -0000 Delivered-To: apmail-incubator-cloudstack-issues@incubator.apache.org Received: (qmail 1880 invoked by uid 99); 16 Jan 2017 19:43:30 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jan 2017 19:43:30 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 764171A015F for ; Mon, 16 Jan 2017 19:43:30 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.198 X-Spam-Level: X-Spam-Status: No, score=-1.198 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id Yfij4fm2Dnas for ; Mon, 16 Jan 2017 19:43:29 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id CE6C45FE2D for ; Mon, 16 Jan 2017 19:43:28 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 2463AE865F for ; Mon, 16 Jan 2017 19:43:28 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 794AC2528A for ; Mon, 16 Jan 2017 19:43:26 +0000 (UTC) Date: Mon, 16 Jan 2017 19:43:26 +0000 (UTC) From: "rashmidixit (JIRA)" To: cloudstack-issues@incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CLOUDSTACK-9539) Support changing Service offering for instance with VM Snapshots MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 16 Jan 2017 19:43:32 -0000 [ https://issues.apache.org/jira/browse/CLOUDSTACK-9539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15824502#comment-15824502 ] rashmidixit commented on CLOUDSTACK-9539: ----------------------------------------- Github user nvazquez commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1727#discussion_r96294371 --- Diff: server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java --- @@ -707,16 +802,41 @@ private UserVm orchestrateRevertToVMSnapshot(Long vmSnapshotId) throws Insuffici throw new InvalidParameterValueException("There is other active vm snapshot tasks on the instance, please try again later"); } + revertUserVmDetailsFromVmSnapshot(userVm, vmSnapshotVo); + try { VMSnapshotStrategy strategy = findVMSnapshotStrategy(vmSnapshotVo); strategy.revertVMSnapshot(vmSnapshotVo); + updateUserVmServiceOffering(userVm, vmSnapshotVo); return userVm; } catch (Exception e) { s_logger.debug("Failed to revert vmsnapshot: " + vmSnapshotId, e); throw new CloudRuntimeException(e.getMessage()); } } + /** + * Update or add user vm details from vm snapshot for vms with custom service offerings + * @param userVm user vm + * @param vmSnapshotVo vm snapshot + */ + private void revertUserVmDetailsFromVmSnapshot(UserVmVO userVm, VMSnapshotVO vmSnapshotVo) { + ServiceOfferingVO serviceOfferingVO = _serviceOfferingDao.findById(vmSnapshotVo.getServiceOfferingId()); + if (serviceOfferingVO.isDynamic()) { + List vmSnapshotDetails = _vmSnapshotDetailsDao.listDetails(vmSnapshotVo.getId()); + for (VMSnapshotDetailsVO detail : vmSnapshotDetails) { --- End diff -- Done, thanks! --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. --- > Support changing Service offering for instance with VM Snapshots > ---------------------------------------------------------------- > > Key: CLOUDSTACK-9539 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9539 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the default.) > Reporter: Nicolas Vazquez > Assignee: Nicolas Vazquez > > h3. Actual behaviour > CloudStack doesn't support changing service offering for vm instances which have vm snapshots, they should be removed before changing service offering. > h3. Goal > Extend actual behaviour by supporting changing service offering for vms which have vm snapshots. In that case, previously taken snapshots (if reverted) should use previous service offering, future snapshots should use the newest. > h3. Proposed solution: > 1. Adding {{service_offering_id}} column on {{vm_snapshots}} table: This way snapshot can be reverted to original state even though service offering can be changed for vm instance. > NOTE: Existing vm snapshots are populated on update script by {{UPDATE vm_snapshots s JOIN vm_instance v ON v.id = s.vm_id SET s.service_offering_id = v.service_offering_id;}} > 2. New vm snapshots will use instance vm service offering id as {{service_offering_id}} > 3. Revert to vm snapshots should use vm snapshot's {{service_offering_id}} value. > h3. Example use case: > - Deploy vm using service offering A > - Take vm snapshot -> snap1 (service offering A) > - Stop vm > - Change vm service offering to B > - Revert to VM snapshot snap 1 > - Start vm > It is expected that vm has service offering A after last step -- This message was sent by Atlassian JIRA (v6.3.4#6332)