[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-7003?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14046416#comment-14046416
 ] 

Mike Tutkowski commented on CLOUDSTACK-7003:
--------------------------------------------

That retry logic was useful in 4.2 when VDIs were being created that consumed 
almost the entire size of the SR.

I think we can get away with this logic nowadays:

    protected VDI createVdi(SR sr, String vdiNameLabel, Long volumeSize) throws 
Types.XenAPIException, XmlRpcException {
        Connection conn = getConnection();

        VDI.Record vdir = new VDI.Record();

        vdir.nameLabel = vdiNameLabel;
        vdir.SR = sr;
        vdir.type = Types.VdiType.USER;

        long totalSrSpace = sr.getPhysicalSize(conn);
        long unavailableSrSpace = sr.getPhysicalUtilisation(conn);
        long availableSrSpace = totalSrSpace - unavailableSrSpace;

        if (availableSrSpace < volumeSize) {
            throw new CloudRuntimeException("Available space for SR cannot be 
less than " + volumeSize + ".");
        }

        vdir.virtualSize = volumeSize;

        VDI vdi = VDI.create(conn, vdir);

        return vdi;
    }

> Arithmetic exception while creating a vdi on nfs volume in managed storage.
> ---------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-7003
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-7003
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Management Server
>    Affects Versions: 4.5.0
>            Reporter: punith
>
> it seems we have a bug while creating a nfs disk on managed storage,
> file - CitrixResourceBase.java
> api - createVdi
> long unavailableSrSpace = sr.getPhysicalUtilisation(conn);
> 6216  long maxNumberOfTries = (totalSrSpace / unavailableSrSpace >= 1) ? 
> (totalSrSpace / unavailableSrSpace) : 1;
> since while creation nfs disk does not have a meta data written on it like in 
> iscsi , unavailableSrSpace might turn out to be 0(zero), hence throwing an 
> divide bt zero exception.
> sometimes the unavailable 



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to