You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Alex Hitchins <al...@shapeblue.com> on 2014/03/18 14:11:21 UTC

orchestrateTakeVolumeSnapshot Call

All,

I'm looking at the following issue[0]. The reporter says in the second sentence the method is always returning success even when an exception occurs or otherwise fails. Looking at the code, if the inside call to orchestrateTakeVolumeSnapshot raises an exception, it should bubble up and not return the SUCCEEDED message surely?


    private Pair<JobInfo.Status, String> orchestrateTakeVolumeSnapshot(VmWorkTakeVolumeSnapshot work) throws Exception {
        Account account = _accountDao.findById(work.getAccountId());
        orchestrateTakeVolumeSnapshot(work.getVolumeId(), work.getPolicyId(), work.getSnapshotId(),
                account, work.isQuiesceVm());
        return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED,
                _jobMgr.marshallResultObject(work.getSnapshotId()));
    }

[0] https://issues.apache.org/jira/browse/CLOUDSTACK-5825
Need Enterprise Grade Support for Apache CloudStack?
Our CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/> offers the best 24/7 SLA for CloudStack Environments.

Apache CloudStack Bootcamp training courses

**NEW!** CloudStack 4.2.1 training<http://shapeblue.com/cloudstack-training/>
18th-19th February 2014, Brazil. Classroom<http://shapeblue.com/cloudstack-training/>
17th-23rd March 2014, Region A. Instructor led, On-line<http://shapeblue.com/cloudstack-training/>
24th-28th March 2014, Region B. Instructor led, On-line<http://shapeblue.com/cloudstack-training/>
16th-20th June 2014, Region A. Instructor led, On-line<http://shapeblue.com/cloudstack-training/>
23rd-27th June 2014, Region B. Instructor led, On-line<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

RE: orchestrateTakeVolumeSnapshot Call

Posted by Alex Hitchins <al...@shapeblue.com>.
Just a note to say I've got the fix in testing. Even if it's not used, if it's still in the code it should at least work. Dangerous to have something saying it's worked when it hasn't.


Regards

Alex Hitchins

D: +44 1892 523 587 | S: +44 2036 030 540 | M: +44 7788 423 969

alex.hitchins@shapeblue.com

-----Original Message-----
From: Alex Hitchins [mailto:alex.hitchins@shapeblue.com]
Sent: 18 March 2014 14:21
To: dev@cloudstack.apache.org
Subject: RE: orchestrateTakeVolumeSnapshot Call

Thanks for the information Chris,

I can check for the returned null to decide if the snapshot took place. Concerning that you are getting reports of it being orphaned though.


Regards

Alex Hitchins

D: +44 1892 523 587 | S: +44 2036 030 540 | M: +44 7788 423 969

alex.hitchins@shapeblue.com

-----Original Message-----
From: SuichII, Christopher [mailto:Chris.Suich@netapp.com]
Sent: 18 March 2014 14:08
To: dev
Subject: Re: orchestrateTakeVolumeSnapshot Call

Ah, yes. Now seeing this snippet I can explain the issue.

So, during "orchestrateTakeVolumeSnapshot(work.getVolumeId(), work.getPolicyId(), work.getSnapshotId(), account, work.isQuiesceVm());" if an exception is thrown, it is caught and ignored by VolumeServiceImpl.takeSnapshot(VolumeInfo):

@Override
public SnapshotInfo takeSnapshot(VolumeInfo volume) {
    SnapshotInfo snapshot = null;
    try {
        snapshot = snapshotMgr.takeSnapshot(volume);
    } catch (Exception e) {
        s_logger.debug("Take snapshot: " + volume.getId() + " failed", e);
    }

    return snapshot;
}

So, "return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED,  _jobMgr.marshallResultObject(work.getSnapshotId()));" will return JobInfo.Status.SUCCEEDED even when an exception was thrown.

That said, I'm now getting a warning that VolumeApiServiceImpl.orchestrateTakeVolumeSnapshot(VmWorkTakeVolumeSnapshot) is never called, so I'm not sure if this method trace has changed since I reported the issue.

(FYI, I've copied this info into the ticket as well)

-Chris
--
Chris Suich
chris.suich@netapp.com<ma...@netapp.com>
NetApp Software Engineer
Data Center Platforms - Cloud Solutions
Citrix, Cisco & Red Hat

On Mar 18, 2014, at 9:11 AM, Alex Hitchins <al...@shapeblue.com>> wrote:

All,

I'm looking at the following issue[0]. The reporter says in the second sentence the method is always returning success even when an exception occurs or otherwise fails. Looking at the code, if the inside call to orchestrateTakeVolumeSnapshot raises an exception, it should bubble up and not return the SUCCEEDED message surely?


   private Pair<JobInfo.Status, String> orchestrateTakeVolumeSnapshot(VmWorkTakeVolumeSnapshot work) throws Exception {
       Account account = _accountDao.findById(work.getAccountId());
       orchestrateTakeVolumeSnapshot(work.getVolumeId(), work.getPolicyId(), work.getSnapshotId(),
               account, work.isQuiesceVm());
       return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED,
               _jobMgr.marshallResultObject(work.getSnapshotId()));
   }

[0] https://issues.apache.org/jira/browse/CLOUDSTACK-5825
Need Enterprise Grade Support for Apache CloudStack?
Our CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/> offers the best 24/7 SLA for CloudStack Environments.

Apache CloudStack Bootcamp training courses

**NEW!** CloudStack 4.2.1 training<http://shapeblue.com/cloudstack-training/>
18th-19th February 2014, Brazil. Classroom<http://shapeblue.com/cloudstack-training/>
17th-23rd March 2014, Region A. Instructor led, On-line<http://shapeblue.com/cloudstack-training/>
24th-28th March 2014, Region B. Instructor led, On-line<http://shapeblue.com/cloudstack-training/>
16th-20th June 2014, Region A. Instructor led, On-line<http://shapeblue.com/cloudstack-training/>
23rd-27th June 2014, Region B. Instructor led, On-line<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue is a registered trademark.
This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

RE: orchestrateTakeVolumeSnapshot Call

Posted by Alex Hitchins <al...@shapeblue.com>.
Thanks for the information Chris,

I can check for the returned null to decide if the snapshot took place. Concerning that you are getting reports of it being orphaned though.


Regards

Alex Hitchins

D: +44 1892 523 587 | S: +44 2036 030 540 | M: +44 7788 423 969

alex.hitchins@shapeblue.com

-----Original Message-----
From: SuichII, Christopher [mailto:Chris.Suich@netapp.com]
Sent: 18 March 2014 14:08
To: dev
Subject: Re: orchestrateTakeVolumeSnapshot Call

Ah, yes. Now seeing this snippet I can explain the issue.

So, during "orchestrateTakeVolumeSnapshot(work.getVolumeId(), work.getPolicyId(), work.getSnapshotId(), account, work.isQuiesceVm());" if an exception is thrown, it is caught and ignored by VolumeServiceImpl.takeSnapshot(VolumeInfo):

@Override
public SnapshotInfo takeSnapshot(VolumeInfo volume) {
    SnapshotInfo snapshot = null;
    try {
        snapshot = snapshotMgr.takeSnapshot(volume);
    } catch (Exception e) {
        s_logger.debug("Take snapshot: " + volume.getId() + " failed", e);
    }

    return snapshot;
}

So, "return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED,  _jobMgr.marshallResultObject(work.getSnapshotId()));" will return JobInfo.Status.SUCCEEDED even when an exception was thrown.

That said, I'm now getting a warning that VolumeApiServiceImpl.orchestrateTakeVolumeSnapshot(VmWorkTakeVolumeSnapshot) is never called, so I'm not sure if this method trace has changed since I reported the issue.

(FYI, I've copied this info into the ticket as well)

-Chris
--
Chris Suich
chris.suich@netapp.com<ma...@netapp.com>
NetApp Software Engineer
Data Center Platforms - Cloud Solutions
Citrix, Cisco & Red Hat

On Mar 18, 2014, at 9:11 AM, Alex Hitchins <al...@shapeblue.com>> wrote:

All,

I'm looking at the following issue[0]. The reporter says in the second sentence the method is always returning success even when an exception occurs or otherwise fails. Looking at the code, if the inside call to orchestrateTakeVolumeSnapshot raises an exception, it should bubble up and not return the SUCCEEDED message surely?


   private Pair<JobInfo.Status, String> orchestrateTakeVolumeSnapshot(VmWorkTakeVolumeSnapshot work) throws Exception {
       Account account = _accountDao.findById(work.getAccountId());
       orchestrateTakeVolumeSnapshot(work.getVolumeId(), work.getPolicyId(), work.getSnapshotId(),
               account, work.isQuiesceVm());
       return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED,
               _jobMgr.marshallResultObject(work.getSnapshotId()));
   }

[0] https://issues.apache.org/jira/browse/CLOUDSTACK-5825
Need Enterprise Grade Support for Apache CloudStack?
Our CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/> offers the best 24/7 SLA for CloudStack Environments.

Apache CloudStack Bootcamp training courses

**NEW!** CloudStack 4.2.1 training<http://shapeblue.com/cloudstack-training/>
18th-19th February 2014, Brazil. Classroom<http://shapeblue.com/cloudstack-training/>
17th-23rd March 2014, Region A. Instructor led, On-line<http://shapeblue.com/cloudstack-training/>
24th-28th March 2014, Region B. Instructor led, On-line<http://shapeblue.com/cloudstack-training/>
16th-20th June 2014, Region A. Instructor led, On-line<http://shapeblue.com/cloudstack-training/>
23rd-27th June 2014, Region B. Instructor led, On-line<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Re: orchestrateTakeVolumeSnapshot Call

Posted by "SuichII, Christopher" <Ch...@netapp.com>.
Ah, yes. Now seeing this snippet I can explain the issue.

So, during "orchestrateTakeVolumeSnapshot(work.getVolumeId(), work.getPolicyId(), work.getSnapshotId(), account, work.isQuiesceVm());” if an exception is thrown, it is caught and ignored by VolumeServiceImpl.takeSnapshot(VolumeInfo):

@Override
public SnapshotInfo takeSnapshot(VolumeInfo volume) {
    SnapshotInfo snapshot = null;
    try {
        snapshot = snapshotMgr.takeSnapshot(volume);
    } catch (Exception e) {
        s_logger.debug("Take snapshot: " + volume.getId() + " failed", e);
    }

    return snapshot;
}

So, "return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED,  _jobMgr.marshallResultObject(work.getSnapshotId()));” will return JobInfo.Status.SUCCEEDED even when an exception was thrown.

That said, I’m now getting a warning that VolumeApiServiceImpl.orchestrateTakeVolumeSnapshot(VmWorkTakeVolumeSnapshot) is never called, so I’m not sure if this method trace has changed since I reported the issue.

(FYI, I’ve copied this info into the ticket as well)

-Chris
--
Chris Suich
chris.suich@netapp.com<ma...@netapp.com>
NetApp Software Engineer
Data Center Platforms – Cloud Solutions
Citrix, Cisco & Red Hat

On Mar 18, 2014, at 9:11 AM, Alex Hitchins <al...@shapeblue.com>> wrote:

All,

I'm looking at the following issue[0]. The reporter says in the second sentence the method is always returning success even when an exception occurs or otherwise fails. Looking at the code, if the inside call to orchestrateTakeVolumeSnapshot raises an exception, it should bubble up and not return the SUCCEEDED message surely?


   private Pair<JobInfo.Status, String> orchestrateTakeVolumeSnapshot(VmWorkTakeVolumeSnapshot work) throws Exception {
       Account account = _accountDao.findById(work.getAccountId());
       orchestrateTakeVolumeSnapshot(work.getVolumeId(), work.getPolicyId(), work.getSnapshotId(),
               account, work.isQuiesceVm());
       return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED,
               _jobMgr.marshallResultObject(work.getSnapshotId()));
   }

[0] https://issues.apache.org/jira/browse/CLOUDSTACK-5825
Need Enterprise Grade Support for Apache CloudStack?
Our CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/> offers the best 24/7 SLA for CloudStack Environments.

Apache CloudStack Bootcamp training courses

**NEW!** CloudStack 4.2.1 training<http://shapeblue.com/cloudstack-training/>
18th-19th February 2014, Brazil. Classroom<http://shapeblue.com/cloudstack-training/>
17th-23rd March 2014, Region A. Instructor led, On-line<http://shapeblue.com/cloudstack-training/>
24th-28th March 2014, Region B. Instructor led, On-line<http://shapeblue.com/cloudstack-training/>
16th-20th June 2014, Region A. Instructor led, On-line<http://shapeblue.com/cloudstack-training/>
23rd-27th June 2014, Region B. Instructor led, On-line<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue is a registered trademark.