Skip to content

Commit

Permalink
More debugging info
Browse files Browse the repository at this point in the history
Adding more debug statements in the add_repaired_disk fn so I can
follow along from the cli output.
  • Loading branch information
cholcombe973 committed Sep 19, 2017
1 parent 53c0ab9 commit a2c5fbc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,16 @@ fn add_repaired_disks(config_dir: &str, simulate: bool) -> Result<(), String> {
info!("Connecting to database to find repaired drives");
let conn = in_progress::create_repair_database(&config_location)
.map_err(|e| e.to_string())?;
debug!("Loading Ceph backend");
let backend =
backend::load_backend(&backend::BackendType::Ceph, Some(&Path::new(&config_dir)))?;
info!("Getting outstanding repair tickets");
let tickets = in_progress::get_outstanding_repair_tickets(&conn).map_err(
|e| {
e.to_string()
},
)?;
info!("Checking for resolved repair tickets");
for ticket in tickets {
let resolved = ticket_resolved(
&config.jira_host,
Expand Down
7 changes: 5 additions & 2 deletions src/test_disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
extern crate block_utils;
extern crate libatasmart;
extern crate log;
extern crate mktemp;

use self::block_utils::{Device, get_block_devices, get_mount_device, get_mountpoint,
FilesystemType, is_mounted, MediaType, RaidType};
use self::mktemp::Temp;

use std::fs::File;
use std::fs::{File, OpenOptions};
use std::io::{Error, ErrorKind};
use std::io::{Result, Write};
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -138,7 +140,8 @@ fn repair_filesystem(filesystem_type: &FilesystemType, device: &Path) -> Result<

fn check_writable(path: &Path) -> Result<()> {
debug!("Checking if {:?} is writable", path);
let mut file = File::create(format!("{}/check_disk", path.to_string_lossy()))?;
let temp_file = Temp::new_file_in(path)?;
let mut file = OpenOptions::new().write(true).open(temp_file)?;
file.write_all(b"Hello, world!")?;
Ok(())
}
Expand Down

0 comments on commit a2c5fbc

Please sign in to comment.