Program: 106030
Project: 106030
Buggy source:
@Override public KVMPhysicalDisk createPhysicalDisk(String name,KVMStoragePool pool,PhysicalDiskFormat format,long size){
  LibvirtStoragePool libvirtPool=(LibvirtStoragePool)pool;
  StoragePool virtPool=libvirtPool.getPool();
  LibvirtStorageVolumeDef.volFormat libvirtformat=null;
  String volPath=null;
  String volName=null;
  long volAllocation=0;
  long volCapacity=0;
  if (pool.getType() == StoragePoolType.RBD) {
    format=PhysicalDiskFormat.RAW;
    try {
      s_logger.info("String_Node_Str" + pool.getSourceDir() + "String_Node_Str"+ name+ "String_Node_Str"+ size);
      Rados r=new Rados(pool.getAuthUserName());
      r.confSet("String_Node_Str",pool.getSourceHost() + "String_Node_Str" + pool.getSourcePort());
      r.confSet("String_Node_Str",pool.getAuthSecret());
      r.connect();
      s_logger.debug("String_Node_Str" + r.confGet("String_Node_Str"));
      IoCTX io=r.ioCtxCreate(pool.getSourceDir());
      Rbd rbd=new Rbd(io);
      rbd.create(name,size,this.rbdFeatures,this.rbdOrder);
      r.ioCtxDestroy(io);
    }
 catch (    RadosException e) {
      throw new CloudRuntimeException(e.toString());
    }
catch (    RbdException e) {
      throw new CloudRuntimeException(e.toString());
    }
    volPath=pool.getSourceDir() + "String_Node_Str" + name;
    volName=name;
    volCapacity=size;
    volAllocation=size;
  }
 else {
    if (format == PhysicalDiskFormat.QCOW2) {
      libvirtformat=LibvirtStorageVolumeDef.volFormat.QCOW2;
    }
 else     if (format == PhysicalDiskFormat.RAW) {
      libvirtformat=LibvirtStorageVolumeDef.volFormat.RAW;
    }
 else     if (format == PhysicalDiskFormat.DIR) {
      libvirtformat=LibvirtStorageVolumeDef.volFormat.DIR;
    }
 else     if (format == PhysicalDiskFormat.TAR) {
      libvirtformat=LibvirtStorageVolumeDef.volFormat.TAR;
    }
    LibvirtStorageVolumeDef volDef=new LibvirtStorageVolumeDef(name,size,libvirtformat,null,null);
    s_logger.debug(volDef.toString());
    try {
      StorageVol vol=virtPool.storageVolCreateXML(volDef.toString(),0);
      volPath=vol.getPath();
      volName=vol.getName();
      volAllocation=vol.getInfo().allocation;
      volCapacity=vol.getInfo().capacity;
    }
 catch (    LibvirtException e) {
      throw new CloudRuntimeException(e.toString());
    }
  }
  KVMPhysicalDisk disk=new KVMPhysicalDisk(volPath,volName,pool);
  disk.setFormat(format);
  disk.setSize(volAllocation);
  disk.setVirtualSize(volCapacity);
  return disk;
}

Fixed version (ground truth):
@Override public KVMPhysicalDisk createPhysicalDisk(String name,KVMStoragePool pool,PhysicalDiskFormat format,long size){
  LibvirtStoragePool libvirtPool=(LibvirtStoragePool)pool;
  StoragePool virtPool=libvirtPool.getPool();
  LibvirtStorageVolumeDef.volFormat libvirtformat=null;
  String volPath=null;
  String volName=null;
  long volAllocation=0;
  long volCapacity=0;
  if (pool.getType() == StoragePoolType.RBD) {
    format=PhysicalDiskFormat.RAW;
    try {
      s_logger.info("String_Node_Str" + pool.getSourceDir() + "String_Node_Str"+ name+ "String_Node_Str"+ size);
      Rados r=new Rados(pool.getAuthUserName());
      r.confSet("String_Node_Str",pool.getSourceHost() + "String_Node_Str" + pool.getSourcePort());
      r.confSet("String_Node_Str",pool.getAuthSecret());
      r.connect();
      s_logger.debug("String_Node_Str" + r.confGet("String_Node_Str"));
      IoCTX io=r.ioCtxCreate(pool.getSourceDir());
      Rbd rbd=new Rbd(io);
      rbd.create(name,size,rbdFeatures,rbdOrder);
      r.ioCtxDestroy(io);
    }
 catch (    RadosException e) {
      throw new CloudRuntimeException(e.toString());
    }
catch (    RbdException e) {
      throw new CloudRuntimeException(e.toString());
    }
    volPath=pool.getSourceDir() + "String_Node_Str" + name;
    volName=name;
    volCapacity=size;
    volAllocation=size;
  }
 else {
    if (format == PhysicalDiskFormat.QCOW2) {
      libvirtformat=LibvirtStorageVolumeDef.volFormat.QCOW2;
    }
 else     if (format == PhysicalDiskFormat.RAW) {
      libvirtformat=LibvirtStorageVolumeDef.volFormat.RAW;
    }
 else     if (format == PhysicalDiskFormat.DIR) {
      libvirtformat=LibvirtStorageVolumeDef.volFormat.DIR;
    }
 else     if (format == PhysicalDiskFormat.TAR) {
      libvirtformat=LibvirtStorageVolumeDef.volFormat.TAR;
    }
    LibvirtStorageVolumeDef volDef=new LibvirtStorageVolumeDef(name,size,libvirtformat,null,null);
    s_logger.debug(volDef.toString());
    try {
      StorageVol vol=virtPool.storageVolCreateXML(volDef.toString(),0);
      volPath=vol.getPath();
      volName=vol.getName();
      volAllocation=vol.getInfo().allocation;
      volCapacity=vol.getInfo().capacity;
    }
 catch (    LibvirtException e) {
      throw new CloudRuntimeException(e.toString());
    }
  }
  KVMPhysicalDisk disk=new KVMPhysicalDisk(volPath,volName,pool);
  disk.setFormat(format);
  disk.setSize(volAllocation);
  disk.setVirtualSize(volCapacity);
  return disk;
}