|
|
@ -33,6 +33,7 @@ public class VolumeServiceImpl implements IVolumeService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int save(VolumeEntity entity) throws Exception {
|
|
|
|
public int save(VolumeEntity entity) throws Exception {
|
|
|
|
|
|
|
|
int rest = 1;
|
|
|
|
//createVolume("lili_test1", 0, "distributed", bricksToCreate, "/home/lili_test1_point")
|
|
|
|
//createVolume("lili_test1", 0, "distributed", bricksToCreate, "/home/lili_test1_point")
|
|
|
|
List<VolumeEntity> result = gfsService.getAllVolumes();
|
|
|
|
List<VolumeEntity> result = gfsService.getAllVolumes();
|
|
|
|
List<VolumeEntity> addVolumes = new ArrayList<VolumeEntity>();
|
|
|
|
List<VolumeEntity> addVolumes = new ArrayList<VolumeEntity>();
|
|
|
@ -76,7 +77,10 @@ public class VolumeServiceImpl implements IVolumeService {
|
|
|
|
|
|
|
|
|
|
|
|
//创建volume
|
|
|
|
//创建volume
|
|
|
|
if (bristr.size() > 0) {
|
|
|
|
if (bristr.size() > 0) {
|
|
|
|
volumeService.createVolume(add.getName(), 0, "distributed", bristr, add.getPath());
|
|
|
|
int createreslt = volumeService.createVolume(add.getName(), 0, "distributed", bristr, add.getPath());
|
|
|
|
|
|
|
|
if (createreslt != 1) {
|
|
|
|
|
|
|
|
rest = createreslt;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//记录volume信息,
|
|
|
|
//记录volume信息,
|
|
|
|
VolumeInitEntity volInSql = new VolumeInitEntity();
|
|
|
|
VolumeInitEntity volInSql = new VolumeInitEntity();
|
|
|
@ -107,7 +111,10 @@ public class VolumeServiceImpl implements IVolumeService {
|
|
|
|
newKeys.addAll(newBrickKeys);
|
|
|
|
newKeys.addAll(newBrickKeys);
|
|
|
|
// 新增brick s,
|
|
|
|
// 新增brick s,
|
|
|
|
if (newKeys.size() > 0) {
|
|
|
|
if (newKeys.size() > 0) {
|
|
|
|
volumeService.addBrickVolume(entity.getName(), newKeys, 0, "distributed");
|
|
|
|
int createreslt = volumeService.addBrickVolume(entity.getName(), newKeys, 0, "distributed");
|
|
|
|
|
|
|
|
if (createreslt != 1) {
|
|
|
|
|
|
|
|
rest = createreslt;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//待删除的Brick的 Keys
|
|
|
|
//待删除的Brick的 Keys
|
|
|
|
for (Brick brick : newBricks) {
|
|
|
|
for (Brick brick : newBricks) {
|
|
|
@ -120,7 +127,10 @@ public class VolumeServiceImpl implements IVolumeService {
|
|
|
|
deleteKeys.addAll(serverBrickKeys);
|
|
|
|
deleteKeys.addAll(serverBrickKeys);
|
|
|
|
// 删除brick s,
|
|
|
|
// 删除brick s,
|
|
|
|
if (deleteKeys.size() > 0) {
|
|
|
|
if (deleteKeys.size() > 0) {
|
|
|
|
volumeService.deleteBrickVolume(entity.getName(), deleteKeys, 0, "distributed");
|
|
|
|
int createreslt = volumeService.deleteBrickVolume(entity.getName(), deleteKeys, 0, "distributed");
|
|
|
|
|
|
|
|
if (createreslt != 1) {
|
|
|
|
|
|
|
|
rest = createreslt;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// ---对比volume信息--原数据有该volume,则对比brick信息,确认那几个brick是新增的,那几个brick是待删除的----- end
|
|
|
|
// ---对比volume信息--原数据有该volume,则对比brick信息,确认那几个brick是新增的,那几个brick是待删除的----- end
|
|
|
|
|
|
|
|
|
|
|
@ -134,7 +144,7 @@ public class VolumeServiceImpl implements IVolumeService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return rest;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -142,9 +152,9 @@ public class VolumeServiceImpl implements IVolumeService {
|
|
|
|
if (null == entity.getName() || "".equals(entity.getName())) {
|
|
|
|
if (null == entity.getName() || "".equals(entity.getName())) {
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
volumeService.deleteVolume(entity.getName());
|
|
|
|
int rest = volumeService.deleteVolume(entity.getName());
|
|
|
|
volumeDao.remove(entity.getName());
|
|
|
|
volumeDao.remove(entity.getName());
|
|
|
|
return 0;
|
|
|
|
return rest;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|