volume修改

web_backend_develope
chenlw 8 years ago
parent 896640d332
commit 2866403dd8

@ -41,10 +41,10 @@ public class VolumeServiceImpl implements IVolumeService {
int rest = 1;
//createVolume("lili_test1", 0, "distributed", bricksToCreate, "/home/lili_test1_point")
List<VolumeInitEntity> vols = volumeDao.findAll();
Map<String, Object> volMap = new HashMap<String, Object>();
Map<String, VolumeInitEntity> volMap = new HashMap<String, VolumeInitEntity>();
if (null!= vols) {
for (VolumeInitEntity volumeInitEntity : vols) {
volMap.put(volumeInitEntity.getPath(), null);
volMap.put(volumeInitEntity.getPath(), volumeInitEntity);
}
}
List<VolumeDataEntity> result = gfsService.getAllVolumes();
@ -67,6 +67,19 @@ public class VolumeServiceImpl implements IVolumeService {
}
}
//记录volume信息
VolumeInitEntity volInSql = new VolumeInitEntity();
volInSql.setName(entity.getName());
volInSql.setPath(entity.getPath());
volInSql.setMark(entity.getHot());
if (volMap.keySet().contains(volInSql.getPath())) {
VolumeInitEntity tmp = volMap.get(volInSql.getPath());
volInSql.setId(tmp.getId());
volumeDao.update(volInSql);
}
else {
volumeDao.save(volInSql);
}
boolean isContinue = true;
// 对比volume信息--原数据没有该volume则新增volume:
for (VolumeDataEntity add : addVolumes) {
@ -95,13 +108,7 @@ public class VolumeServiceImpl implements IVolumeService {
rest = createreslt;
}
}
//记录volume信息
VolumeInitEntity volInSql = new VolumeInitEntity();
volInSql.setName(add.getName());
volInSql.setPath(add.getPath());
if (!volMap.keySet().contains(volInSql.getPath())) {
volumeDao.save(volInSql);
}
isContinue = false;
}
// 修改 brick

Loading…
Cancel
Save