Пример #1
0
  private void handle(final CreateDataVolumeTemplateFromDataVolumeMsg msg) {
    final CreateTemplateFromVolumeOnPrimaryStorageMsg cmsg =
        new CreateTemplateFromVolumeOnPrimaryStorageMsg();
    cmsg.setBackupStorageUuid(msg.getBackupStorageUuid());
    cmsg.setImageInventory(
        ImageInventory.valueOf(dbf.findByUuid(msg.getImageUuid(), ImageVO.class)));
    cmsg.setVolumeInventory(getSelfInventory());
    bus.makeTargetServiceIdByResourceUuid(
        cmsg, PrimaryStorageConstant.SERVICE_ID, self.getPrimaryStorageUuid());
    bus.send(
        cmsg,
        new CloudBusCallBack(msg) {
          @Override
          public void run(MessageReply r) {
            CreateDataVolumeTemplateFromDataVolumeReply reply =
                new CreateDataVolumeTemplateFromDataVolumeReply();
            if (!r.isSuccess()) {
              reply.setError(r.getError());
            } else {
              CreateTemplateFromVolumeOnPrimaryStorageReply creply = r.castReply();
              String backupStorageInstallPath = creply.getTemplateBackupStorageInstallPath();
              reply.setFormat(creply.getFormat());
              reply.setInstallPath(backupStorageInstallPath);
              reply.setMd5sum(null);
              reply.setBackupStorageUuid(msg.getBackupStorageUuid());
            }

            bus.reply(msg, reply);
          }
        });
  }
Пример #2
0
 private void handleBase(CreateTemplateFromVolumeOnPrimaryStorageMsg msg) {
   checkIfBackupStorageAttachedToMyZone(msg.getBackupStorageUuid());
   handle(msg);
 }