pve/nodes/node/lxc/vmid/
remote_migrate.rs

1#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2pub struct PostParameters {
3    #[doc = "Override I/O bandwidth limit (in KiB/s)."]
4    #[serde(skip_serializing_if = "Option::is_none", default)]
5    pub bwlimit: Option<f64>,
6    #[doc = "Delete the original CT and related data after successful migration. By default the original CT is kept on the source cluster in a stopped state."]
7    #[serde(
8        skip_serializing_if = "Option::is_none",
9        default,
10        deserialize_with = "crate::common::deserialize_option_bool_lax",
11        serialize_with = "crate::common::serialize_option_bool_as_u64"
12    )]
13    pub delete: Option<bool>,
14    #[doc = "Use online/live migration."]
15    #[serde(
16        skip_serializing_if = "Option::is_none",
17        default,
18        deserialize_with = "crate::common::deserialize_option_bool_lax",
19        serialize_with = "crate::common::serialize_option_bool_as_u64"
20    )]
21    pub online: Option<bool>,
22    #[doc = "Use restart migration"]
23    #[serde(
24        skip_serializing_if = "Option::is_none",
25        default,
26        deserialize_with = "crate::common::deserialize_option_bool_lax",
27        serialize_with = "crate::common::serialize_option_bool_as_u64"
28    )]
29    pub restart: Option<bool>,
30    #[doc = "Mapping from source to target bridges. Providing only a single bridge ID maps all source bridges to that bridge. Providing the special value '1' will map each source bridge to itself."]
31    #[serde(rename = "target-bridge")]
32    pub target_bridge: String,
33    #[doc = "Remote target endpoint"]
34    #[serde(rename = "target-endpoint")]
35    pub target_endpoint: String,
36    #[doc = "Mapping from source to target storages. Providing only a single storage ID maps all source storages to that storage. Providing the special value '1' will map each source storage to itself."]
37    #[serde(rename = "target-storage")]
38    pub target_storage: String,
39    #[doc = "The (unique) ID of the VM."]
40    #[serde(
41        rename = "target-vmid",
42        skip_serializing_if = "Option::is_none",
43        default
44    )]
45    pub target_vmid: Option<u64>,
46    #[doc = "Timeout in seconds for shutdown for restart migration"]
47    #[serde(skip_serializing_if = "Option::is_none", default)]
48    pub timeout: Option<u64>,
49}
50
51#[derive(Debug, Clone)]
52pub struct RemoteMigrateClient<T> {
53    client: T,
54    path: String,
55}
56
57impl<T> RemoteMigrateClient<T>
58where
59    T: Clone,
60{
61    pub fn new(client: T, parent_path: &str) -> Self {
62        Self {
63            client,
64            path: format!("{}/{}", parent_path, "remote_migrate"),
65        }
66    }
67}
68impl<T> RemoteMigrateClient<T>
69where
70    T: crate::client::HttpClient,
71{
72    #[doc = "Migrate the container to another cluster. Creates a new migration task. EXPERIMENTAL feature!"]
73    pub fn post(&self, parameters: PostParameters) -> Result<String, T::Error> {
74        self.client.post(&self.path, &parameters)
75    }
76}
77#[derive(Debug, Clone)]
78pub struct AsyncRemoteMigrateClient<T> {
79    client: T,
80    path: String,
81}
82
83impl<T> AsyncRemoteMigrateClient<T>
84where
85    T: Clone,
86{
87    pub fn new(client: T, parent_path: &str) -> Self {
88        Self {
89            client,
90            path: format!("{}/{}", parent_path, "remote_migrate"),
91        }
92    }
93}
94impl<T> AsyncRemoteMigrateClient<T>
95where
96    T: crate::client::AsyncHttpClient,
97{
98    #[doc = "Migrate the container to another cluster. Creates a new migration task. EXPERIMENTAL feature!"]
99    pub async fn post(&self, parameters: PostParameters) -> Result<String, T::Error> {
100        self.client.post(&self.path, &parameters).await
101    }
102}