[thin_repair, cache_repair] Check input file exists earlier

and zero superblock if we fail part way through a repair.

bz1499781
This commit is contained in:
Joe Thornber
2019-10-08 14:34:24 +01:00
parent a3b8e9db78
commit 1dd7b454bb
6 changed files with 72 additions and 11 deletions

View File

@@ -153,7 +153,7 @@
"the input file can't be found"
(with-empty-metadata (md)
(run-fail-rcv (_ stderr) (era-restore "-i no-such-file -o" md)
(assert-superblock-untouched md)
(assert-superblock-all-zeroes md)
(assert-starts-with "Couldn't stat file" stderr))))
(define-scenario (era-restore garbage-input-file)
@@ -161,7 +161,7 @@
(with-empty-metadata (md)
(with-temp-file-sized ((xml "era.xml" 4096))
(run-fail-rcv (_ stderr) (era-restore "-i " xml "-o" md)
(assert-superblock-untouched md)))))
(assert-superblock-all-zeroes md)))))
(define-scenario (era-restore output-unspecified)
"Fails if no metadata dev specified"