)]}'
{
  "commit": "089eb36e471c263ff1a90376cadaba7a595fc9e8",
  "tree": "d138b9fe357397b955495de64f813fbe96e6d893",
  "parents": [
    "e2c13da419705bfd61b031142cbd46b69c5ccff4"
  ],
  "author": {
    "name": "Sergiy Kukunin",
    "email": "sergey.kukunin@gmail.com",
    "time": "Tue Apr 28 22:53:08 2026 -0700"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Wed Apr 29 11:23:08 2026 +0530"
  },
  "message": "Linstor: fix create volume from snapshot on primary storage (#13043)\n\n* Linstor: fix create volume from snapshot on primary storage\n\nWhen creating a volume from a snapshot on Linstor primary storage\n(with lin.backup.snapshots\u003dfalse), the operation fails with:\n\"Only the following image types are currently supported: VHD, OVA,\nQCOW2, RAW (for PowerFlex and FiberChannel)\"\n\nRoot cause: the Linstor driver does not handle SNAPSHOT -\u003e VOLUME in\nits canCopy()/copyAsync() methods. This causes DataMotionServiceImpl\nto fall through to StorageSystemDataMotionStrategy (selected because\nLinstor advertises STORAGE_SYSTEM_SNAPSHOT\u003dtrue). That strategy\u0027s\nverifyFormatWithPoolType() rejects RAW format for Linstor pools,\nsince RAW is only allowed for PowerFlex and FiberChannel.\n\nAdditionally, VolumeOrchestrator.createVolumeFromSnapshot() attempts\nto back up the snapshot to secondary storage when the storage plugin\ndoes not advertise CAN_CREATE_TEMPLATE_FROM_SNAPSHOT. This backup\nfails because the snapshot only exists on Linstor primary storage.\n\nFix:\n- Add CAN_CREATE_TEMPLATE_FROM_SNAPSHOT capability so the\n  orchestrator skips the backup-to-secondary path\n- Add canCopySnapshotToVolumeCond() to match SNAPSHOT -\u003e VOLUME\n  when both are on the same Linstor primary store\n- Wire it into canCopy() to intercept at DataMotionServiceImpl\n  before strategy selection, bypassing StorageSystemDataMotionStrategy\n- Implement copySnapshotToVolume() which delegates to the existing\n  createResourceFromSnapshot() for native Linstor snapshot restore\n\nThis follows the same pattern used by the StorPool plugin, which\nhandles SNAPSHOT -\u003e VOLUME directly in its driver rather than going\nthrough StorageSystemDataMotionStrategy.\n\nTested on CloudStack 4.22 with Linstor LVM_THIN storage, creating\na volume from a 1TB CNPG Postgres database snapshot. Volume creates\nsuccessfully with correct path and deletes cleanly.\n\n* Let CloudRuntimeException propagate from copySnapshotToVolume\n\nRemove try/catch in copySnapshotToVolume so that CloudRuntimeException\nfrom createResourceFromSnapshot propagates to the caller, ensuring\nCloudStack properly notices and reports the failure.\n\n* Fix CAN_CREATE_TEMPLATE_FROM_SNAPSHOT breaking template creation\n\nSetting CAN_CREATE_TEMPLATE_FROM_SNAPSHOT unconditionally to true\ncaused createTemplate from snapshot to take the StorPool-specific\ncode path in TemplateManagerImpl, which sends a CopyCommand to a\nsystem VM that Linstor cannot handle.\n\nFix: make CAN_CREATE_TEMPLATE_FROM_SNAPSHOT conditional on the same\nflag as STORAGE_SYSTEM_SNAPSHOT (!BackupSnapshots). When snapshots\nare backed up to secondary (the default), the old template creation\nflow works. When snapshots stay on primary, the direct path is used.\n\nAlso fix checkstyle: remove unused DataObject import in test.\n\nCo-authored-by: Claude Opus 4.6 (1M context) \u003cnoreply@anthropic.com\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "3f06bee8ac83655b7d03aeeb653634d957827a09",
      "old_mode": 33188,
      "old_path": "plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java",
      "new_id": "83dacf74e8dfa7b125582f75696951fea071edf2",
      "new_mode": 33188,
      "new_path": "plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java"
    },
    {
      "type": "modify",
      "old_id": "4653cfa358b0b47d99f9aef96c888fc2e16e4735",
      "old_mode": 33188,
      "old_path": "plugins/storage/volume/linstor/src/test/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImplTest.java",
      "new_id": "23266e17f4f007f718f2dab7db5bf52b1f84a3f6",
      "new_mode": 33188,
      "new_path": "plugins/storage/volume/linstor/src/test/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImplTest.java"
    }
  ]
}
