From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox-api-types 2/2] add cluster status api call
Date: Mon, 13 Jan 2025 16:45:41 +0100 [thread overview]
Message-ID: <20250113154550.3462139-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20250113154550.3462139-1-d.csapak@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
pve-api-types/generate.pl | 7 ++
pve-api-types/src/generated/code.rs | 12 ++-
pve-api-types/src/generated/types.rs | 114 +++++++++++++++++++++++++++
3 files changed, 132 insertions(+), 1 deletion(-)
diff --git a/pve-api-types/generate.pl b/pve-api-types/generate.pl
index 4c8e164..8be737b 100644
--- a/pve-api-types/generate.pl
+++ b/pve-api-types/generate.pl
@@ -279,6 +279,13 @@ Schema2Rust::register_api_extensions('ClusterJoinInfo', {
});
api(GET => '/cluster/config/join', 'cluster_config_join', 'return-name' => 'ClusterJoinInfo');
+# cluster status info
+Schema2Rust::register_api_extensions('ClusterNodeStatus', {
+ '/properties/id' => { description => sq("FIXME: Missing description in PVE.") },
+ '/properties/name' => { description => sq("FIXME: Missing description in PVE.") },
+});
+api(GET => '/cluster/status', 'cluster_status', 'return-name' => 'ClusterNodeStatus');
+
# api(GET => '/storage', 'list_storages', 'return-name' => 'StorageList');
Schema2Rust::register_api_extensions('ListRealm', {
'/properties/realm' => { description => sq("FIXME: Missing description in PVE.") },
diff --git a/pve-api-types/src/generated/code.rs b/pve-api-types/src/generated/code.rs
index dc17cd9..d05b519 100644
--- a/pve-api-types/src/generated/code.rs
+++ b/pve-api-types/src/generated/code.rs
@@ -127,7 +127,6 @@
/// - /cluster/sdn/vnets/{vnet}/subnets/{subnet}
/// - /cluster/sdn/zones
/// - /cluster/sdn/zones/{zone}
-/// - /cluster/status
/// - /cluster/tasks
/// - /nodes/{node}
/// - /nodes/{node}/aplinfo
@@ -395,6 +394,11 @@ pub trait PveClient {
Err(Error::Other("cluster_resources not implemented"))
}
+ /// Get cluster status information.
+ async fn cluster_status(&self) -> Result<Vec<ClusterNodeStatus>, Error> {
+ Err(Error::Other("cluster_status not implemented"))
+ }
+
/// Generate a new API token for a specific user. NOTE: returns API token
/// value, which needs to be stored as it cannot be retrieved afterwards!
async fn create_token(
@@ -688,6 +692,12 @@ where
Ok(self.0.get(&url).await?.expect_json()?.data)
}
+ /// Get cluster status information.
+ async fn cluster_status(&self) -> Result<Vec<ClusterNodeStatus>, Error> {
+ let url = format!("/api2/extjs/cluster/status");
+ Ok(self.0.get(&url).await?.expect_json()?.data)
+ }
+
/// Generate a new API token for a specific user. NOTE: returns API token
/// value, which needs to be stored as it cannot be retrieved afterwards!
async fn create_token(
diff --git a/pve-api-types/src/generated/types.rs b/pve-api-types/src/generated/types.rs
index ebbb4a0..b6a3d20 100644
--- a/pve-api-types/src/generated/types.rs
+++ b/pve-api-types/src/generated/types.rs
@@ -405,6 +405,120 @@ pub enum ClusterNodeIndexResponseStatus {
serde_plain::derive_display_from_serialize!(ClusterNodeIndexResponseStatus);
serde_plain::derive_fromstr_from_deserialize!(ClusterNodeIndexResponseStatus);
+#[api(
+ properties: {
+ id: {
+ type: String,
+ description: "FIXME: Missing description in PVE.",
+ },
+ ip: {
+ optional: true,
+ type: String,
+ },
+ level: {
+ optional: true,
+ type: String,
+ },
+ local: {
+ default: false,
+ optional: true,
+ },
+ name: {
+ type: String,
+ description: "FIXME: Missing description in PVE.",
+ },
+ nodeid: {
+ optional: true,
+ type: Integer,
+ },
+ nodes: {
+ optional: true,
+ type: Integer,
+ },
+ online: {
+ default: false,
+ optional: true,
+ },
+ quorate: {
+ default: false,
+ optional: true,
+ },
+ type: {
+ type: ClusterNodeStatusType,
+ },
+ version: {
+ optional: true,
+ type: Integer,
+ },
+ },
+)]
+/// Object.
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+pub struct ClusterNodeStatus {
+ pub id: String,
+
+ /// [node] IP of the resolved nodename.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub ip: Option<String>,
+
+ /// [node] Proxmox VE Subscription level, indicates if eligible for
+ /// enterprise support as well as access to the stable Proxmox VE Enterprise
+ /// Repository.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub level: Option<String>,
+
+ /// [node] Indicates if this is the responding node.
+ #[serde(deserialize_with = "proxmox_login::parse::deserialize_bool")]
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub local: Option<bool>,
+
+ pub name: String,
+
+ /// [node] ID of the node from the corosync configuration.
+ #[serde(deserialize_with = "proxmox_login::parse::deserialize_i64")]
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub nodeid: Option<i64>,
+
+ /// [cluster] Nodes count, including offline nodes.
+ #[serde(deserialize_with = "proxmox_login::parse::deserialize_i64")]
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub nodes: Option<i64>,
+
+ /// [node] Indicates if the node is online or offline.
+ #[serde(deserialize_with = "proxmox_login::parse::deserialize_bool")]
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub online: Option<bool>,
+
+ /// [cluster] Indicates if there is a majority of nodes online to make
+ /// decisions
+ #[serde(deserialize_with = "proxmox_login::parse::deserialize_bool")]
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub quorate: Option<bool>,
+
+ #[serde(rename = "type")]
+ pub ty: ClusterNodeStatusType,
+
+ /// [cluster] Current version of the corosync configuration file.
+ #[serde(deserialize_with = "proxmox_login::parse::deserialize_i64")]
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub version: Option<i64>,
+}
+
+#[api]
+/// Indicates the type, either cluster or node. The type defines the object
+/// properties e.g. quorate available for type cluster.
+#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
+pub enum ClusterNodeStatusType {
+ #[serde(rename = "cluster")]
+ /// cluster.
+ Cluster,
+ #[serde(rename = "node")]
+ /// node.
+ Node,
+}
+serde_plain::derive_display_from_serialize!(ClusterNodeStatusType);
+serde_plain::derive_fromstr_from_deserialize!(ClusterNodeStatusType);
+
const_regex! {
CLUSTER_RESOURCE_NODE_RE = r##"^(?i:[a-z0-9](?i:[a-z0-9\-]*[a-z0-9])?)$"##;
--
2.39.5
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2025-01-13 15:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 15:45 [pdm-devel] [PATCH proxmox-api-types/datacenter-manager] remote migration: make target endpoint selectable Dominik Csapak
2025-01-13 15:45 ` [pdm-devel] [PATCH proxmox-api-types 1/2] add more network interface methods Dominik Csapak
2025-01-13 15:45 ` Dominik Csapak [this message]
2025-01-13 15:45 ` [pdm-devel] [PATCH datacenter-manager 1/9] server: factor qemu/lxc code into own modules Dominik Csapak
2025-01-13 15:45 ` [pdm-devel] [PATCH datacenter-manager 2/9] server: api: fix remote upid tracking for qemu remote migration Dominik Csapak
2025-01-13 15:45 ` [pdm-devel] [PATCH datacenter-manager 3/9] server: connection: add new function that allows for explicit endpoint Dominik Csapak
2025-01-13 15:45 ` [pdm-devel] [PATCH datacenter-manager 4/9] server: api: add target-endpoint parameter to remote migrate api calls Dominik Csapak
2025-01-13 15:45 ` [pdm-devel] [PATCH datacenter-manager 5/9] server: api: pve: add remote cluster-status api call Dominik Csapak
2025-01-13 15:45 ` [pdm-devel] [PATCH datacenter-manager 6/9] pdm-client: add cluster status method Dominik Csapak
2025-01-13 15:45 ` [pdm-devel] [PATCH datacenter-manager 7/9] pdm-client: add target-endpoint parameter to remote migration methods Dominik Csapak
2025-01-13 15:45 ` [pdm-devel] [PATCH datacenter-manager 8/9] ui: widget: add remote endpoint selector Dominik Csapak
2025-01-13 15:45 ` [pdm-devel] [PATCH datacenter-manager 9/9] ui: migrate: make target endpoint selectable for remote migration Dominik Csapak
2025-01-14 9:35 ` [pdm-devel] [PATCH proxmox-api-types/datacenter-manager] remote migration: make target endpoint selectable Dietmar Maurer
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=20250113154550.3462139-3-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pdm-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.