mirror of
https://github.com/sol1/rustguac.git
synced 2026-09-10 09:35:45 +00:00
deps: bump bollard 0.18 to 0.20, update VDI Docker driver
Bollard 0.20 moved container option types from bollard::container to bollard::query_parameters, replaced Config<T> with ContainerCreateBody, and changed several fields to Option types. Update all imports and call sites in the VDI Docker driver accordingly.
This commit is contained in:
Generated
+5
-6
@@ -445,9 +445,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bollard"
|
||||
version = "0.18.1"
|
||||
version = "0.20.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97ccca1260af6a459d75994ad5acc1651bcabcbdbc41467cc9786519ab854c30"
|
||||
checksum = "ee04c4c84f1f811b017f2fbb7dd8815c976e7ca98593de9c1e2afad0f636bff4"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bollard-stubs",
|
||||
@@ -466,7 +466,6 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"serde_repr",
|
||||
"serde_urlencoded",
|
||||
"thiserror 2.0.18",
|
||||
"tokio",
|
||||
@@ -478,13 +477,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bollard-stubs"
|
||||
version = "1.47.1-rc.27.3.1"
|
||||
version = "1.52.1-rc.29.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f179cfbddb6e77a5472703d4b30436bff32929c0aa8a9008ecf23d1d3cdd0da"
|
||||
checksum = "0f0a8ca8799131c1837d1282c3f81f31e76ceb0ce426e04a7fe1ccee3287c066"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_repr",
|
||||
"serde_with",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ webpki-roots = "1"
|
||||
russh = "0.60"
|
||||
|
||||
# Docker (VDI container management)
|
||||
bollard = "0.18"
|
||||
bollard = "0.20"
|
||||
|
||||
# LUKS drive management (uid/gid for chown)
|
||||
libc = "0.2"
|
||||
|
||||
+26
-14
@@ -1,12 +1,12 @@
|
||||
//! Docker-based VDI driver using bollard (unix socket).
|
||||
|
||||
use super::{ContainerInfo, ContainerSpec, VdiDriver, VdiError};
|
||||
use bollard::container::{
|
||||
Config as ContainerConfig, CreateContainerOptions, ListContainersOptions,
|
||||
RemoveContainerOptions, StartContainerOptions, StopContainerOptions,
|
||||
};
|
||||
use bollard::exec::CreateExecOptions;
|
||||
use bollard::models::{HostConfig, PortBinding};
|
||||
use bollard::models::{ContainerCreateBody, HostConfig, PortBinding};
|
||||
use bollard::query_parameters::{
|
||||
CreateContainerOptions, ListContainersOptions, RemoveContainerOptions, StartContainerOptions,
|
||||
StopContainerOptions,
|
||||
};
|
||||
use bollard::Docker;
|
||||
use std::collections::HashMap;
|
||||
use std::time::Duration;
|
||||
@@ -247,7 +247,7 @@ impl DockerDriver {
|
||||
// Container exists but stopped — start it
|
||||
tracing::info!(container = %name, "Starting stopped VDI container");
|
||||
self.client
|
||||
.start_container(&name, None::<StartContainerOptions<String>>)
|
||||
.start_container(&name, None::<StartContainerOptions>)
|
||||
.await
|
||||
.map_err(|e| VdiError::Docker(format!("failed to start container: {}", e)))?;
|
||||
|
||||
@@ -368,7 +368,7 @@ impl DockerDriver {
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let config = ContainerConfig {
|
||||
let config = ContainerCreateBody {
|
||||
image: Some(spec.image.clone()),
|
||||
env: Some(env_vec),
|
||||
labels: Some(labels),
|
||||
@@ -377,7 +377,7 @@ impl DockerDriver {
|
||||
};
|
||||
|
||||
let opts = CreateContainerOptions {
|
||||
name: name.clone(),
|
||||
name: Some(name.clone()),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
@@ -388,7 +388,7 @@ impl DockerDriver {
|
||||
.map_err(|e| VdiError::Docker(format!("failed to create container: {}", e)))?;
|
||||
|
||||
self.client
|
||||
.start_container(&name, None::<StartContainerOptions<String>>)
|
||||
.start_container(&name, None::<StartContainerOptions>)
|
||||
.await
|
||||
.map_err(|e| VdiError::Docker(format!("failed to start container: {}", e)))?;
|
||||
|
||||
@@ -428,7 +428,13 @@ impl DockerDriver {
|
||||
// Stop with 5s grace period
|
||||
let _ = self
|
||||
.client
|
||||
.stop_container(container_id, Some(StopContainerOptions { t: 5 }))
|
||||
.stop_container(
|
||||
container_id,
|
||||
Some(StopContainerOptions {
|
||||
t: Some(5),
|
||||
signal: Default::default(),
|
||||
}),
|
||||
)
|
||||
.await;
|
||||
|
||||
// Force remove
|
||||
@@ -458,11 +464,14 @@ impl DockerDriver {
|
||||
#[allow(dead_code)]
|
||||
async fn do_list_managed_containers(&self) -> Result<Vec<String>, VdiError> {
|
||||
let mut filters = HashMap::new();
|
||||
filters.insert("label", vec!["rustguac.managed=true"]);
|
||||
filters.insert(
|
||||
"label".to_string(),
|
||||
vec!["rustguac.managed=true".to_string()],
|
||||
);
|
||||
|
||||
let opts = ListContainersOptions {
|
||||
all: true,
|
||||
filters,
|
||||
filters: Some(filters),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
@@ -479,11 +488,14 @@ impl DockerDriver {
|
||||
&self,
|
||||
) -> Result<Vec<super::ManagedContainer>, VdiError> {
|
||||
let mut filters = HashMap::new();
|
||||
filters.insert("label", vec!["rustguac.managed=true"]);
|
||||
filters.insert(
|
||||
"label".to_string(),
|
||||
vec!["rustguac.managed=true".to_string()],
|
||||
);
|
||||
|
||||
let opts = ListContainersOptions {
|
||||
all: false, // only running containers
|
||||
filters,
|
||||
filters: Some(filters),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user