Skip to content

Conversation

breml
Copy link
Collaborator

@breml breml commented Feb 25, 2025

Extend generate-database such that mapping of errors can be done outside of the generated code.

Embed all the boilerplate and make the generated code self-sufficient.

Remove the dependency of the generated code on package github.com/lxc/incus/v6/internal/server/db/query

@breml breml requested a review from stgraber as a code owner February 25, 2025 08:01
@breml breml force-pushed the generate-database-customizable-errors branch from 379d620 to 64e98ff Compare February 25, 2025 09:00
@breml breml changed the title generate-database: Use deferred func to map errors generate-database: Use deferred func to map errors & make generated code self-sufficient Feb 25, 2025
@breml breml force-pushed the generate-database-customizable-errors branch 2 times, most recently from dfb637f to 5e57e1e Compare February 25, 2025 11:46
@stgraber
Copy link
Member

Approach looks good, but I'd do the commit structure a bit differently, basically something like:

  • generate-database: Add error mapping
  • incusd/db: Use error mapping
  • incusd/db: Update generated code
  • generate-database: Make self-sufficient
  • incusd/db: Update generated code

Signed-off-by: Lucas Bremgartner <lucas.bremgartner@futurfusion.io>
Signed-off-by: Lucas Bremgartner <lucas.bremgartner@futurfusion.io>
Signed-off-by: Lucas Bremgartner <lucas.bremgartner@futurfusion.io>
Signed-off-by: Lucas Bremgartner <lucas.bremgartner@futurfusion.io>
Signed-off-by: Lucas Bremgartner <lucas.bremgartner@futurfusion.io>
@breml breml force-pushed the generate-database-customizable-errors branch from 5e57e1e to bc52a6f Compare February 26, 2025 06:10
@breml
Copy link
Collaborator Author

breml commented Feb 26, 2025

@stgraber Updated the commits as requested.

@breml breml requested a review from stgraber February 26, 2025 06:11
Signed-off-by: Lucas Bremgartner <lucas.bremgartner@futurfusion.io>
@stgraber stgraber enabled auto-merge February 26, 2025 15:01
@stgraber stgraber merged commit 9d0c338 into lxc:main Feb 26, 2025
36 checks passed
@breml breml deleted the generate-database-customizable-errors branch February 27, 2025 10:42
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Mar 2, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [lxc/incus](https://github.com/lxc/incus) | minor | `v6.9.0` -> `v6.10.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>lxc/incus (lxc/incus)</summary>

### [`v6.10.0`](https://github.com/lxc/incus/releases/tag/v6.10.0): Incus 6.10

[Compare Source](lxc/incus@v6.9.0...v6.10.0)

#### What's Changed

-   incusd/instance/drivers/qmp: Handle missing log directory by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1604
-   incus-user: keep track of socket path used to connect to the server by [@&#8203;bboozzoo](https://github.com/bboozzoo) in lxc/incus#1607
-   incus-user: unify logging, support --verbose and --debug by [@&#8203;bboozzoo](https://github.com/bboozzoo) in lxc/incus#1606
-   Add project support to profiles in preseed init by [@&#8203;megheaiulian](https://github.com/megheaiulian) in lxc/incus#1608
-   incusd/network/ovn: Fix bad route check by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1616
-   incus/file/pull: Ensure we have a leading / in all paths by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1617
-   incus/file/pull: Read files in chunks by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1623
-   doc/installing: mention incus group on NixOS by [@&#8203;dawidd6](https://github.com/dawidd6) in lxc/incus#1622
-   incus/file/pull: Actually make read buffer 1MiB by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1624
-   Translations update from Hosted Weblate by [@&#8203;weblate](https://github.com/weblate) in lxc/incus#1639
-   incusd/device/disk: Allow virtiofsd on non-x86 by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1638
-   Translations update from Hosted Weblate by [@&#8203;weblate](https://github.com/weblate) in lxc/incus#1640
-   Translations update from Hosted Weblate by [@&#8203;weblate](https://github.com/weblate) in lxc/incus#1642
-   incusd/instance/drivers/qemu: Add IOMMU device by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1644
-   incus/file: Remove unused function by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1645
-   Translations update from Hosted Weblate by [@&#8203;weblate](https://github.com/weblate) in lxc/incus#1646
-   incus/network/info (ovn): Fix object not found. by [@&#8203;rxtom](https://github.com/rxtom) in lxc/incus#1628
-   incusd/instance/drivers: Improve NUMA balancing by [@&#8203;lnutimura](https://github.com/lnutimura) in lxc/incus#1626
-   incusd/network/bridge: Fix deletion of tunnels and dummy devices by [@&#8203;montag451](https://github.com/montag451) in lxc/incus#1627
-   incus/file: Move from path to filepath by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1647
-   Added LZ4 support for incus import by [@&#8203;Spitfireap](https://github.com/Spitfireap) in lxc/incus#1611
-   Add `vrf` parameter for routed-nic devices by [@&#8203;ibot3](https://github.com/ibot3) in lxc/incus#1615
-   Translations update from Hosted Weblate by [@&#8203;weblate](https://github.com/weblate) in lxc/incus#1648
-   Translations update from Hosted Weblate by [@&#8203;weblate](https://github.com/weblate) in lxc/incus#1651
-   Move generators to the cmd package by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1652
-   Fix incorrect volume group naming when `vg_name` is not specified by [@&#8203;presztak](https://github.com/presztak) in lxc/incus#1653
-   Rename incus-generate and incus-doc by [@&#8203;breml](https://github.com/breml) in lxc/incus#1654
-   Implement `smbios11` config keys by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1655
-   Fix instance copy error when using '--refresh' flag by [@&#8203;presztak](https://github.com/presztak) in lxc/incus#1658
-   Fix docs for load balancer create backend by [@&#8203;gwenya](https://github.com/gwenya) in lxc/incus#1661
-   incusd/instance/utils: Only check uid/gid for containers by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1662
-   incusd/main_nsexec: Fix change_namespaces fallback to handle multiple… by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1664
-   Check if disk is remote when migrating with an extra disk by [@&#8203;presztak](https://github.com/presztak) in lxc/incus#1669
-   incusd/instance/edk2: Look for bios.bin in /usr/share/seabios by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1672
-   Replace ast.Package with types.Package by [@&#8203;breml](https://github.com/breml) in lxc/incus#1665
-   list/format: provide more information on error by [@&#8203;rxtom](https://github.com/rxtom) in lxc/incus#1666
-   Add additional validation when joining a new cluster member by [@&#8203;presztak](https://github.com/presztak) in lxc/incus#1680
-   Upgrade flosch/pongo2 to v6 by [@&#8203;nanjj](https://github.com/nanjj) in lxc/incus#1677
-   incusd/resources: Prevent concurrent runs and cache data for 10s by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1681
-   Fix importing from older backups by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1683
-   fix: Don't attempt to download signatures for oci by [@&#8203;m2Giles](https://github.com/m2Giles) in lxc/incus#1685
-   Ensure directories have 755 permissions in `incus file push -p` command by [@&#8203;presztak](https://github.com/presztak) in lxc/incus#1687
-   devcontainer: Update Go to 1.23 by [@&#8203;breml](https://github.com/breml) in lxc/incus#1689
-   Make "Code generated" comments for generate-database Go conformant by [@&#8203;breml](https://github.com/breml) in lxc/incus#1690
-   Disclaimer internal tool for generate-database and generate-config by [@&#8203;breml](https://github.com/breml) in lxc/incus#1694
-   Truncate the block file during custom volume migration by [@&#8203;presztak](https://github.com/presztak) in lxc/incus#1696
-   Rework virtiofsd uid/gid map handling by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1692
-   Remove unused arguments and parameters by [@&#8203;presztak](https://github.com/presztak) in lxc/incus#1699
-   generate-database: Use deferred func to map errors & make generated code self-sufficient by [@&#8203;breml](https://github.com/breml) in lxc/incus#1695
-   incus/top: Fix handling of all-projects by [@&#8203;stgraber](https://github.com/stgraber) in lxc/incus#1701
-   Ceph refactor by [@&#8203;MadnessASAP](https://github.com/MadnessASAP) in lxc/incus#1538
-   incus/file: Port remaining functions to SFTP by [@&#8203;HassanAlsamahi](https://github.com/HassanAlsamahi) in lxc/incus#1649
-   Add filtering to all API collections by [@&#8203;gwenya](https://github.com/gwenya) in lxc/incus#1679
-   Add provider for DNS-01 ACME challenge by [@&#8203;accuser](https://github.com/accuser) in lxc/incus#1668

#### New Contributors

-   [@&#8203;bboozzoo](https://github.com/bboozzoo) made their first contribution in lxc/incus#1607
-   [@&#8203;dawidd6](https://github.com/dawidd6) made their first contribution in lxc/incus#1622
-   [@&#8203;rxtom](https://github.com/rxtom) made their first contribution in lxc/incus#1628
-   [@&#8203;lnutimura](https://github.com/lnutimura) made their first contribution in lxc/incus#1626
-   [@&#8203;ibot3](https://github.com/ibot3) made their first contribution in lxc/incus#1615
-   [@&#8203;gwenya](https://github.com/gwenya) made their first contribution in lxc/incus#1661
-   [@&#8203;accuser](https://github.com/accuser) made their first contribution in lxc/incus#1668

**Full Changelog**: lxc/incus@v6.9.0...v6.10.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xODIuMyIsInVwZGF0ZWRJblZlciI6IjM5LjE4Mi4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants