initial import

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Gnatenko 2018-01-07 22:54:23 +01:00
parent 1120c66d41
commit adc97565a6
9 changed files with 291 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/stratisd-0.1.4.tar.gz

View File

@ -0,0 +1,24 @@
From ad3b465955dc1cb261d086d5a3984103dbcec38a Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <ignatenko@redhat.com>
Date: Fri, 5 Jan 2018 21:36:00 +0100
Subject: [PATCH 1/6] deps: update quickcheck to 0.6
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
---
Cargo.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Cargo.toml b/Cargo.toml
index 66d9176..5d7fceb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -31,5 +31,5 @@ version = "0.5"
features = ["serde", "v4"]
[dev-dependencies]
-quickcheck = "0.4"
+quickcheck = "0.6"
loopdev = "0.1.1"
--
2.15.1

View File

@ -0,0 +1,50 @@
From b68c392d3d44b7d5ec1877b935f0ea7f1d26bb6d Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <ignatenko@redhat.com>
Date: Fri, 5 Jan 2018 21:38:12 +0100
Subject: [PATCH 2/6] deps: update rand to 0.4
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
---
Cargo.toml | 2 +-
src/engine/strat_engine/blockdevmgr.rs | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index 5d7fceb..cab096a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@ byteorder = "0.3.13"
chrono = "0.4"
macro-attr = "0.2.0"
term = "0.4"
-rand = "0.3.10"
+rand = "0.4"
serde = "1"
serde_derive = "1"
serde_json = "1"
diff --git a/src/engine/strat_engine/blockdevmgr.rs b/src/engine/strat_engine/blockdevmgr.rs
index 21996fe..1939910 100644
--- a/src/engine/strat_engine/blockdevmgr.rs
+++ b/src/engine/strat_engine/blockdevmgr.rs
@@ -9,7 +9,7 @@ use std::fs::{File, OpenOptions};
use std::path::{Path, PathBuf};
use chrono::{DateTime, Duration, Utc};
-use rand::{thread_rng, sample};
+use rand::{thread_rng, seq};
use uuid::Uuid;
use devicemapper::{Bytes, Device, IEC, Sectors, Segment};
@@ -203,7 +203,8 @@ impl BlockDevMgr {
// TODO: consider making selection not entirely random, i.e, ensuring
// distribution of metadata over different paths.
- let saved = sample(&mut thread_rng(), candidates, MAX_NUM_TO_WRITE)
+ let saved = seq::sample_iter(&mut thread_rng(), candidates, MAX_NUM_TO_WRITE)
+ .unwrap()
.iter_mut()
.fold(false,
|acc, b| acc | b.save_state(&stamp_time, metadata).is_ok());
--
2.15.1

View File

@ -0,0 +1,26 @@
From 76dd377729d592d626c15db87d3909a3faf3446d Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <ignatenko@redhat.com>
Date: Fri, 5 Jan 2018 21:40:56 +0100
Subject: [PATCH 3/6] deps: update byteorder to 1
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
---
Cargo.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Cargo.toml b/Cargo.toml
index cab096a..5b57b5d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,7 +9,7 @@ clap = "1"
nix = "0.9"
devicemapper = "0.15"
crc = "1"
-byteorder = "0.3.13"
+byteorder = "1"
chrono = "0.4"
macro-attr = "0.2.0"
term = "0.4"
--
2.15.1

View File

@ -0,0 +1,26 @@
From 22e689d4fdbfb0f1d22353ccb63321700b5ccc25 Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <ignatenko@redhat.com>
Date: Fri, 5 Jan 2018 21:41:50 +0100
Subject: [PATCH 4/6] deps: update env_logger to 0.4
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
---
Cargo.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Cargo.toml b/Cargo.toml
index 5b57b5d..2664303 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,7 +19,7 @@ serde_derive = "1"
serde_json = "1"
tempdir = "0.3.5"
log = "0.3"
-env_logger="0.3.5"
+env_logger="0.4"
libc = "0.2"
clippy = {version = "*", optional = true}
mnt = "0.3.1"
--
2.15.1

View File

@ -0,0 +1,26 @@
From 483ccb16bde93ab0342a7cfd63c5de1860b90d43 Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <ignatenko@redhat.com>
Date: Fri, 5 Jan 2018 21:44:00 +0100
Subject: [PATCH 5/6] deps: update clap to 2
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
---
Cargo.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Cargo.toml b/Cargo.toml
index 2664303..3991ba0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,7 +5,7 @@ authors = ["Stratis Developers <stratis-devel@lists.fedorahosted.com>"]
[dependencies]
dbus = "0.6.1"
-clap = "1"
+clap = "2"
nix = "0.9"
devicemapper = "0.15"
crc = "1"
--
2.15.1

View File

@ -0,0 +1,52 @@
From c4a37032ec71fc783204cf505508936dee513142 Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <ignatenko@redhat.com>
Date: Fri, 5 Jan 2018 21:47:15 +0100
Subject: [PATCH 6/6] deps: update loopdev to 0.2
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
---
Cargo.toml | 2 +-
src/engine/strat_engine/tests/loopbacked.rs | 9 +++------
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index 3991ba0..3be1eb1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -32,4 +32,4 @@ features = ["serde", "v4"]
[dev-dependencies]
quickcheck = "0.6"
-loopdev = "0.1.1"
+loopdev = "0.2"
diff --git a/src/engine/strat_engine/tests/loopbacked.rs b/src/engine/strat_engine/tests/loopbacked.rs
index 129c4ca..8d92c55 100644
--- a/src/engine/strat_engine/tests/loopbacked.rs
+++ b/src/engine/strat_engine/tests/loopbacked.rs
@@ -50,12 +50,9 @@ impl LoopTestDev {
f.flush().unwrap();
let ld = lc.next_free().unwrap();
- ld.attach(path, 0).unwrap();
+ ld.attach_file(path).unwrap();
// Wipe 1 MiB at the beginning, as data sits around on the files.
- wipe_sectors(&ld.get_path().unwrap(),
- Sectors(0),
- Bytes(IEC::Mi).sectors())
- .unwrap();
+ wipe_sectors(&ld.path().unwrap(), Sectors(0), Bytes(IEC::Mi).sectors()).unwrap();
LoopTestDev { ld: ld }
}
@@ -104,7 +101,7 @@ pub fn test_with_spec<F>(limits: DeviceLimits, test: F) -> ()
let loop_devices: Vec<LoopTestDev> = get_devices(count, &tmpdir);
let device_paths: Vec<PathBuf> = loop_devices
.iter()
- .map(|x| x.ld.get_path().unwrap())
+ .map(|x| x.ld.path().unwrap())
.collect();
let device_paths: Vec<&Path> = device_paths.iter().map(|x| x.as_path()).collect();
--
2.15.1

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (stratisd-0.1.4.tar.gz) = 8a80ea4810d54ff1288869df6a8ead932304fb5d6eda434a051319ebb129f9d710ec939c6150b16c75823794c6bc68f2d39ef8fbceb62bf90a6bab6d13543182

85
stratisd.spec Normal file
View File

@ -0,0 +1,85 @@
# Generated by rust2rpm
%bcond_without check
# Not interested in packaging lib
# stratisd is supposed to be daemon used through dbus
%global __cargo_is_lib() false
Name: stratisd
Version: 0.1.4
Release: 1%{?dist}
Summary: Daemon that manages block devices to create filesystems
License: MPLv2.0
URL: https://github.com/stratis-storage/stratisd
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
Patch0001: 0001-deps-update-quickcheck-to-0.6.patch
Patch0002: 0002-deps-update-rand-to-0.4.patch
Patch0003: 0003-deps-update-byteorder-to-1.patch
Patch0004: 0004-deps-update-env_logger-to-0.4.patch
Patch0005: 0005-deps-update-clap-to-2.patch
Patch0006: 0006-deps-update-loopdev-to-0.2.patch
ExclusiveArch: %{rust_arches}
BuildRequires: rust-packaging
# [dependencies]
BuildRequires: (crate(byteorder) >= 1.0.0 with crate(byteorder) < 2.0.0)
BuildRequires: (crate(chrono) >= 0.4.0 with crate(chrono) < 0.5.0)
BuildRequires: (crate(clap) >= 2.0.0 with crate(clap) < 3.0.0)
BuildRequires: (crate(crc) >= 1.0.0 with crate(crc) < 2.0.0)
BuildRequires: (crate(dbus) >= 0.6.1 with crate(dbus) < 0.7.0)
BuildRequires: (crate(devicemapper) >= 0.15.0 with crate(devicemapper) < 0.16.0)
BuildRequires: (crate(env_logger) >= 0.4.0 with crate(env_logger) < 0.5.0)
BuildRequires: (crate(error-chain) >= 0.11.0 with crate(error-chain) < 0.12.0)
BuildRequires: (crate(libc) >= 0.2.0 with crate(libc) < 0.3.0)
BuildRequires: (crate(libudev) >= 0.2.0 with crate(libudev) < 0.3.0)
BuildRequires: (crate(log) >= 0.3.0 with crate(log) < 0.4.0)
BuildRequires: (crate(macro-attr) >= 0.2.0 with crate(macro-attr) < 0.3.0)
BuildRequires: (crate(mnt) >= 0.3.1 with crate(mnt) < 0.4.0)
BuildRequires: (crate(nix) >= 0.9.0 with crate(nix) < 0.10.0)
BuildRequires: (crate(rand) >= 0.4.0 with crate(rand) < 0.5.0)
BuildRequires: (crate(serde) >= 1.0.0 with crate(serde) < 2.0.0)
BuildRequires: (crate(serde_derive) >= 1.0.0 with crate(serde_derive) < 2.0.0)
BuildRequires: (crate(serde_json) >= 1.0.0 with crate(serde_json) < 2.0.0)
BuildRequires: (crate(tempdir) >= 0.3.5 with crate(tempdir) < 0.4.0)
BuildRequires: (crate(term) >= 0.4.0 with crate(term) < 0.5.0)
BuildRequires: ((crate(uuid) >= 0.5.0 with crate(uuid) < 0.6.0) with crate(uuid/serde) with crate(uuid/v4))
%if %{with check}
# [dev-dependencies]
BuildRequires: (crate(loopdev) >= 0.2.0 with crate(loopdev) < 0.3.0)
BuildRequires: (crate(quickcheck) >= 0.6.0 with crate(quickcheck) < 0.7.0)
%endif
%description
%{summary}.
%prep
%autosetup -p1
%cargo_prep
# XXX: propose this hack to %%cargo_prep
rm -vf Cargo.lock
# Not interested in clippy
sed -i -e "/^clippy/d" Cargo.toml
%build
%cargo_build
%install
%cargo_install
%{__install} -Dpm0644 -t %{buildroot}%{_sysconfdir}/dbus-1/system.d stratisd.conf
%if %{with check}
%check
%cargo_test -- --skip real_ --skip loop_ --skip travis_
%endif
%files
%license LICENSE
%doc README.md
%{_bindir}/stratisd
%config %{_sysconfdir}/dbus-1/system.d/stratisd.conf
%changelog
* Sun Jan 07 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.1.4-1
- Initial package