bug 7237: disk size is passed in diskProfile, no need size parameter in createcommand

status 7237: rresolved fixed
This commit is contained in:
edison 2010-11-19 11:54:08 -08:00
parent e9145e4011
commit 0c35f2f743
3 changed files with 8 additions and 17 deletions

View File

@ -27,7 +27,6 @@ public class CreateCommand extends Command {
private StorageFilerTO pool; private StorageFilerTO pool;
private DiskProfile diskCharacteristics; private DiskProfile diskCharacteristics;
private String templateUrl; private String templateUrl;
private long size;
protected CreateCommand() { protected CreateCommand() {
super(); super();
@ -43,7 +42,7 @@ public class CreateCommand extends Command {
* @param pool * @param pool
*/ */
public CreateCommand(DiskProfile diskCharacteristics, String templateUrl, StorageFilerTO pool) { public CreateCommand(DiskProfile diskCharacteristics, String templateUrl, StorageFilerTO pool) {
this(diskCharacteristics, pool, 0); this(diskCharacteristics, pool);
this.templateUrl = templateUrl; this.templateUrl = templateUrl;
} }
@ -55,20 +54,19 @@ public class CreateCommand extends Command {
* @param diskCharacteristics * @param diskCharacteristics
* @param pool * @param pool
*/ */
public CreateCommand(DiskProfile diskCharacteristics, StorageFilerTO pool, long size) { public CreateCommand(DiskProfile diskCharacteristics, StorageFilerTO pool) {
this.volId = diskCharacteristics.getVolumeId(); this.volId = diskCharacteristics.getVolumeId();
this.diskCharacteristics = diskCharacteristics; this.diskCharacteristics = diskCharacteristics;
this.pool = pool; this.pool = pool;
this.templateUrl = null; this.templateUrl = null;
this.size = size;
} }
public CreateCommand(DiskProfile diskCharacteristics, String templateUrl, StoragePool pool) { public CreateCommand(DiskProfile diskCharacteristics, String templateUrl, StoragePool pool) {
this(diskCharacteristics, templateUrl, new StorageFilerTO(pool)); this(diskCharacteristics, templateUrl, new StorageFilerTO(pool));
} }
public CreateCommand(DiskProfile diskCharacteristics, StoragePool pool, long size) { public CreateCommand(DiskProfile diskCharacteristics, StoragePool pool) {
this(diskCharacteristics, new StorageFilerTO(pool), size); this(diskCharacteristics, new StorageFilerTO(pool));
} }
@Override @Override
@ -92,10 +90,6 @@ public class CreateCommand extends Command {
return volId; return volId;
} }
public long getSize(){
return this.size;
}
@Deprecated @Deprecated
public String getInstanceName() { public String getInstanceName() {
return null; return null;

View File

@ -4695,11 +4695,8 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
vdir.nameLabel = dskch.getName(); vdir.nameLabel = dskch.getName();
vdir.SR = poolSr; vdir.SR = poolSr;
vdir.type = Types.VdiType.USER; vdir.type = Types.VdiType.USER;
if(cmd.getSize()!=0) vdir.virtualSize = dskch.getSize();
vdir.virtualSize = (cmd.getSize()*1024*1024*1L);
else
vdir.virtualSize = dskch.getSize();
vdi = VDI.create(conn, vdir); vdi = VDI.create(conn, vdir);
} }

View File

@ -791,7 +791,7 @@ public class StorageManagerImpl implements StorageManager {
} }
cmd = new CreateCommand(dskCh, tmpltStoredOn.getLocalDownloadPath(), new StorageFilerTO(pool)); cmd = new CreateCommand(dskCh, tmpltStoredOn.getLocalDownloadPath(), new StorageFilerTO(pool));
} else { } else {
cmd = new CreateCommand(dskCh, new StorageFilerTO(pool), size); cmd = new CreateCommand(dskCh, new StorageFilerTO(pool));
} }
Answer answer = sendToPool(pool, cmd); Answer answer = sendToPool(pool, cmd);
@ -2813,7 +2813,7 @@ public class StorageManagerImpl implements StorageManager {
} }
cmd = new CreateCommand(diskProfile, tmpltStoredOn.getLocalDownloadPath(), new StorageFilerTO(pool)); cmd = new CreateCommand(diskProfile, tmpltStoredOn.getLocalDownloadPath(), new StorageFilerTO(pool));
} else { } else {
cmd = new CreateCommand(diskProfile, new StorageFilerTO(pool), diskProfile.getSize()); cmd = new CreateCommand(diskProfile, new StorageFilerTO(pool));
} }
Answer answer = sendToPool(pool, cmd); Answer answer = sendToPool(pool, cmd);
if (answer.getResult()) { if (answer.getResult()) {