public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-cluster 01/10] buildsys: add rust workspace under src/rust
Date: Fri, 18 Sep 2026 16:41:43 +0200	[thread overview]
Message-ID: <20260918144152.575163-2-h.laimer@proxmox.com> (raw)
In-Reply-To: <20260918144152.575163-1-h.laimer@proxmox.com>

Add a Cargo workspace under src/rust, next to the C and Perl trees, for
the Rust code that goes into pmxcfs, a server crate and a small C ABI
crate. Their dependencies resolve through the Debian cargo registry as
pve-rs does, and cargo hooks into the src/Makefile recursion ahead of
pmxcfs so a static library built here is linked into the daemon.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
 .gitignore                        |  2 ++
 Makefile                          |  1 +
 debian/control                    | 16 +++++++++++++++-
 debian/rules                      | 16 ++++++++++++++++
 src/Makefile                      |  2 +-
 src/rust/.cargo/config.toml       |  8 ++++++++
 src/rust/Cargo.toml               | 22 ++++++++++++++++++++++
 src/rust/Makefile                 | 18 ++++++++++++++++++
 src/rust/pmxcfs-notify/Cargo.toml | 11 +++++++++++
 src/rust/pmxcfs-notify/src/lib.rs |  1 +
 src/rust/rustfmt.toml             |  2 ++
 11 files changed, 97 insertions(+), 2 deletions(-)
 create mode 100644 src/rust/.cargo/config.toml
 create mode 100644 src/rust/Cargo.toml
 create mode 100644 src/rust/Makefile
 create mode 100644 src/rust/pmxcfs-notify/Cargo.toml
 create mode 100644 src/rust/pmxcfs-notify/src/lib.rs
 create mode 100644 src/rust/rustfmt.toml

diff --git a/.gitignore b/.gitignore
index 84bb09a..bb6e54b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,5 @@
 /*.dsc
 /*.tar*
 /pve-cluster-*/
+/src/rust/target/
+/src/rust/Cargo.lock
diff --git a/Makefile b/Makefile
index 5fa96ab..3e1c5b9 100644
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,7 @@ tidy:
 $(BUILDDIR):
 	rm -rf $@ $@.tmp
 	cp -a src $@.tmp
+	rm -rf $@.tmp/rust/target $@.tmp/rust/Cargo.lock
 	cp -a debian $@.tmp/
 	echo "git clone git://git.proxmox.com/git/pve-cluster.git\\ngit checkout $(GITVERSION)" > $@.tmp/debian/SOURCE
 	mv $@.tmp $@
diff --git a/debian/control b/debian/control
index 995e2d8..c3cb27a 100644
--- a/debian/control
+++ b/debian/control
@@ -2,8 +2,10 @@ Source: pve-cluster
 Section: admin
 Priority: optional
 Maintainer: Proxmox Support Team <support@proxmox.com>
-Build-Depends: check,
+Build-Depends: cargo:native,
+               check,
                debhelper-compat (= 13),
+               dh-cargo (>= 25),
                libcmap-dev (>= 0.17.1),
                libcorosync-common-dev,
                libcpg-dev (>= 2.3.4),
@@ -17,11 +19,23 @@ Build-Depends: check,
                libquorum-dev (>= 2.3.4),
                librrd-dev,
                librrds-perl,
+               librust-anyhow-1+default-dev,
+               librust-libc-0.2+default-dev,
+               librust-log-0.4+default-dev,
+               librust-nix-0.29+default-dev,
+               librust-nix-0.29+event-dev,
+               librust-nix-0.29+poll-dev,
+               librust-nix-0.29+socket-dev,
+               librust-serde-1+default-dev,
+               librust-serde-1+derive-dev,
+               librust-serde-json-1+default-dev,
                libsqlite3-dev,
+               libstd-rust-dev,
                libtest-mockmodule-perl,
                libuuid-perl,
                pve-doc-generator (>= 6.0-9~),
                rrdcached,
+               rustc:native (>= 1.88),
                sqlite3,
 Standards-Version: 4.6.2
 
diff --git a/debian/rules b/debian/rules
index 01efb49..0717d86 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,12 +1,28 @@
 #!/usr/bin/make -f
 # -*- makefile -*-
 
+include /usr/share/dpkg/pkg-info.mk
+include /usr/share/rustc/architecture.mk
+
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
+CARGO=/usr/share/cargo/bin/cargo
+
+export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
+export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
+export CARGO_HOME = $(CURDIR)/debian/cargo_home
+
+export DEB_CARGO_CRATE=pmxcfs-notify_$(DEB_VERSION_UPSTREAM)
+export DEB_CARGO_PACKAGE=pmxcfs-notify
+
 %:
 	dh $@
 
+override_dh_auto_configure:
+	$(CARGO) prepare-debian $(CURDIR)/debian/cargo_registry --link-from-system
+	dh_auto_configure
+
 override_dh_installinit:
 
 override_dh_missing:
diff --git a/src/Makefile b/src/Makefile
index 50dd6aa..ac78c89 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,4 +1,4 @@
-SUBDIRS := PVE pmxcfs test
+SUBDIRS := PVE rust pmxcfs test
 
 export LD_LIBRARY_PATH+=$(CURDIR)/PVE
 export PERLLIB+=$(CURDIR)/PVE
diff --git a/src/rust/.cargo/config.toml b/src/rust/.cargo/config.toml
new file mode 100644
index 0000000..7b442dc
--- /dev/null
+++ b/src/rust/.cargo/config.toml
@@ -0,0 +1,8 @@
+[source]
+[source.debian-packages]
+directory = "/usr/share/cargo/registry"
+[source.crates-io]
+replace-with = "debian-packages"
+
+[profile.release]
+debug = true
diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml
new file mode 100644
index 0000000..6de0ab8
--- /dev/null
+++ b/src/rust/Cargo.toml
@@ -0,0 +1,22 @@
+[workspace]
+members = [
+    "pmxcfs-notify",
+]
+resolver = "3"
+
+[workspace.package]
+authors = ["Proxmox Support Team <support@proxmox.com>"]
+edition = "2024"
+license = "AGPL-3"
+homepage = "https://proxmox.com"
+rust-version = "1.88"
+
+[workspace.dependencies]
+anyhow = "1.0"
+libc = "0.2"
+log = "0.4"
+nix = { version = "0.29", features = ["event", "poll", "socket"] }
+serde = { version = "1.0", features = ["derive"] }
+serde_json = "1.0"
+
+pmxcfs-notify = { path = "pmxcfs-notify" }
diff --git a/src/rust/Makefile b/src/rust/Makefile
new file mode 100644
index 0000000..aba5cb9
--- /dev/null
+++ b/src/rust/Makefile
@@ -0,0 +1,18 @@
+all:
+	cargo build --release
+
+.PHONY: check
+check:
+	cargo test --release
+
+.PHONY: fmt
+fmt:
+	cargo fmt
+
+.PHONY: install
+install:
+
+.PHONY: clean
+clean:
+	cargo clean
+	rm -f Cargo.lock
diff --git a/src/rust/pmxcfs-notify/Cargo.toml b/src/rust/pmxcfs-notify/Cargo.toml
new file mode 100644
index 0000000..3de30b5
--- /dev/null
+++ b/src/rust/pmxcfs-notify/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+name = "pmxcfs-notify"
+version = "0.1.0"
+description = "Change notification socket server for pmxcfs"
+authors.workspace = true
+edition.workspace = true
+license.workspace = true
+homepage.workspace = true
+rust-version.workspace = true
+
+[dependencies]
diff --git a/src/rust/pmxcfs-notify/src/lib.rs b/src/rust/pmxcfs-notify/src/lib.rs
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/src/rust/pmxcfs-notify/src/lib.rs
@@ -0,0 +1 @@
+
diff --git a/src/rust/rustfmt.toml b/src/rust/rustfmt.toml
new file mode 100644
index 0000000..f3e454b
--- /dev/null
+++ b/src/rust/rustfmt.toml
@@ -0,0 +1,2 @@
+edition = "2024"
+style_edition = "2024"
-- 
2.47.3





  reply	other threads:[~2026-09-18 14:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18 14:41 [RFC cluster/manager 00/10] pmxcfs: add a change notification socket Hannes Laimer
2026-09-18 14:41 ` Hannes Laimer [this message]
2026-09-18 14:41 ` [PATCH pve-cluster 02/10] rust: notify: add change notification socket server Hannes Laimer
2026-09-18 14:41 ` [PATCH pve-cluster 03/10] rust: ffi: add C ABI staticlib for pmxcfs Hannes Laimer
2026-09-18 14:41 ` [PATCH pve-cluster 04/10] pmxcfs: memdb: add change notification hook Hannes Laimer
2026-09-18 14:41 ` [PATCH pve-cluster 05/10] buildsys: link pmxcfs against the rust notify staticlib Hannes Laimer
2026-09-18 14:41 ` [PATCH pve-cluster 06/10] pmxcfs: notify: emit change events over the notification socket Hannes Laimer
2026-09-18 14:41 ` [PATCH pve-cluster 07/10] cfs: add perl client for the change " Hannes Laimer
2026-09-18 14:41 ` [PATCH pve-cluster 08/10] cfs: add hook registry for change notification consumers Hannes Laimer
2026-09-18 14:41 ` [PATCH pve-manager 09/10] hooks: add runner executing cluster change hooks in children Hannes Laimer
2026-09-18 14:41 ` [PATCH pve-manager 10/10] pvescheduler: run cluster change hooks from a listener child Hannes Laimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260918144152.575163-2-h.laimer@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal