laurent-simon / storage-at-desk

Automatically exported from code.google.com/p/storage-at-desk
0 stars 0 forks source link

assignMapping maps wrong number of chunks #13

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Request a new volume
2. set Volume Chunk Size to 10x size of what's being requested
3. try to assign mappings

What is the expected output? What do you see instead?
This should find 1 volume Chunk and assign it to the new volume.
Instead it thinks that 0 chunks are required to satisfy the request.

Output:

443565 18:07:15,149 [RMI TCP Connection(7)-192.168.5.32] INFO 
volumecontroller.VolumeController  - Registering a volume
443566 18:07:15,150 [RMI TCP Connection(7)-192.168.5.32] INFO 
database.Volume  - No volume with name iqn.edu.virginia.cs.storagedesk:disk2
443566 18:07:15,150 [RMI TCP Connection(7)-192.168.5.32] INFO 
database.Volume  - To Insert Volume iqn.edu.virginia.cs.storagedesk:disk2
443569 18:07:15,153 [RMI TCP Connection(7)-192.168.5.32] INFO 
database.Volume  - Volume exists in the DB (id 5)
443573 18:07:15,157 [RMI TCP Connection(7)-192.168.5.32] DEBUG
database.Volume  - Mapping 1 copies 0 chunks
443574 18:07:15,158 [RMI TCP Connection(7)-192.168.5.32] INFO 
volumecontroller.VolumeController  - Getting a mapping for a volume
443575 18:07:15,159 [RMI TCP Connection(7)-192.168.5.32] INFO 
database.Volume  - Mapping doesn't exist
443575 18:07:15,159 [RMI TCP Connection(7)-192.168.5.32] INFO 
database.Machine  - Get all available machines whose chunk size is 1024000000
443583 18:07:15,167 [RMI TCP Connection(7)-192.168.5.32] INFO 
database.Volume  - 0 machines available
443584 18:07:15,168 [RMI TCP Connection(7)-192.168.5.32] INFO 
database.Volume  - Machine has 0 chunks vs. volume [0] asks for 0 chunks
443584 18:07:15,168 [RMI TCP Connection(7)-192.168.5.32] INFO 
database.Volume  - Assign mappings to 0 machines
443584 18:07:15,168 [RMI TCP Connection(7)-192.168.5.32] DEBUG
database.Volume  - Mapping 1 copies 0 chunks

Original issue reported on code.google.com by tommy.mu...@gmail.com on 15 Apr 2009 at 10:42

GoogleCodeExporter commented 8 years ago
Math.ceil() works on doubles.  There is a loss of precision in the current code 
when
calculating the number of chunks required should change to something like:

Volume volume = new Volume(targetName,
                numCopies,
                numLUNs,
                numBlocks,
                blockSize,
                (int) Math.ceil((numLUNs *
                        blockSize *
                        numBlocks)/
                        (double)volumeChunkSize),       // must make double so that ceil works correclty
                        volumeChunkSize);

Original comment by tommy.mu...@gmail.com on 15 Apr 2009 at 10:43

GoogleCodeExporter commented 8 years ago
Solution:

calculate numChunks inside Volume() constructor so that we don't need to 
calculate it
in multiple places.

Original comment by tommy.mu...@gmail.com on 15 Apr 2009 at 11:11

GoogleCodeExporter commented 8 years ago
fixed as of Revision 24.

Note: code in VirtualDisk.java is still incorrect but that code is slated to be 
removed soon.

Original comment by tommy.mu...@gmail.com on 15 Apr 2009 at 11:49