diff --git a/api/protos/service.proto b/api/protos/service.proto index f529aef..da1a2ae 100644 --- a/api/protos/service.proto +++ b/api/protos/service.proto @@ -116,6 +116,10 @@ enum Op { SafeToRemove = 5; //return tickets created GetCreatedTickets = 7; + //setting maintanence status + SetMaintenance = 8; + //removing maintanence status + UnsetMaintenance = 9; } // Datacenter related API's diff --git a/api/src/service.rs b/api/src/service.rs new file mode 100644 index 0000000..790053a --- /dev/null +++ b/api/src/service.rs @@ -0,0 +1,3785 @@ +// This file is generated by rust-protobuf 2.8.0. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] +//! Generated file from `service.proto` + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_8_0; + +#[derive(PartialEq,Clone,Default)] +pub struct Osd { + // message fields + fsid: ::protobuf::SingularField<::std::string::String>, + id: ::std::option::Option, + block_device: ::protobuf::SingularField<::std::string::String>, + journal: ::protobuf::SingularField<::std::string::String>, + active: ::std::option::Option, + used_space: ::std::option::Option, + total_space: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Osd { + fn default() -> &'a Osd { + ::default_instance() + } +} + +impl Osd { + pub fn new() -> Osd { + ::std::default::Default::default() + } + + // optional string fsid = 1; + + + pub fn get_fsid(&self) -> &str { + match self.fsid.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_fsid(&mut self) { + self.fsid.clear(); + } + + pub fn has_fsid(&self) -> bool { + self.fsid.is_some() + } + + // Param is passed by value, moved + pub fn set_fsid(&mut self, v: ::std::string::String) { + self.fsid = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_fsid(&mut self) -> &mut ::std::string::String { + if self.fsid.is_none() { + self.fsid.set_default(); + } + self.fsid.as_mut().unwrap() + } + + // Take field + pub fn take_fsid(&mut self) -> ::std::string::String { + self.fsid.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint64 id = 2; + + + pub fn get_id(&self) -> u64 { + self.id.unwrap_or(0) + } + pub fn clear_id(&mut self) { + self.id = ::std::option::Option::None; + } + + pub fn has_id(&self) -> bool { + self.id.is_some() + } + + // Param is passed by value, moved + pub fn set_id(&mut self, v: u64) { + self.id = ::std::option::Option::Some(v); + } + + // optional string block_device = 3; + + + pub fn get_block_device(&self) -> &str { + match self.block_device.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_block_device(&mut self) { + self.block_device.clear(); + } + + pub fn has_block_device(&self) -> bool { + self.block_device.is_some() + } + + // Param is passed by value, moved + pub fn set_block_device(&mut self, v: ::std::string::String) { + self.block_device = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_block_device(&mut self) -> &mut ::std::string::String { + if self.block_device.is_none() { + self.block_device.set_default(); + } + self.block_device.as_mut().unwrap() + } + + // Take field + pub fn take_block_device(&mut self) -> ::std::string::String { + self.block_device.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string journal = 4; + + + pub fn get_journal(&self) -> &str { + match self.journal.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_journal(&mut self) { + self.journal.clear(); + } + + pub fn has_journal(&self) -> bool { + self.journal.is_some() + } + + // Param is passed by value, moved + pub fn set_journal(&mut self, v: ::std::string::String) { + self.journal = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_journal(&mut self) -> &mut ::std::string::String { + if self.journal.is_none() { + self.journal.set_default(); + } + self.journal.as_mut().unwrap() + } + + // Take field + pub fn take_journal(&mut self) -> ::std::string::String { + self.journal.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required bool active = 5; + + + pub fn get_active(&self) -> bool { + self.active.unwrap_or(false) + } + pub fn clear_active(&mut self) { + self.active = ::std::option::Option::None; + } + + pub fn has_active(&self) -> bool { + self.active.is_some() + } + + // Param is passed by value, moved + pub fn set_active(&mut self, v: bool) { + self.active = ::std::option::Option::Some(v); + } + + // required uint64 used_space = 6; + + + pub fn get_used_space(&self) -> u64 { + self.used_space.unwrap_or(0) + } + pub fn clear_used_space(&mut self) { + self.used_space = ::std::option::Option::None; + } + + pub fn has_used_space(&self) -> bool { + self.used_space.is_some() + } + + // Param is passed by value, moved + pub fn set_used_space(&mut self, v: u64) { + self.used_space = ::std::option::Option::Some(v); + } + + // required uint64 total_space = 7; + + + pub fn get_total_space(&self) -> u64 { + self.total_space.unwrap_or(0) + } + pub fn clear_total_space(&mut self) { + self.total_space = ::std::option::Option::None; + } + + pub fn has_total_space(&self) -> bool { + self.total_space.is_some() + } + + // Param is passed by value, moved + pub fn set_total_space(&mut self, v: u64) { + self.total_space = ::std::option::Option::Some(v); + } +} + +impl ::protobuf::Message for Osd { + fn is_initialized(&self) -> bool { + if self.id.is_none() { + return false; + } + if self.active.is_none() { + return false; + } + if self.used_space.is_none() { + return false; + } + if self.total_space.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.fsid)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.id = ::std::option::Option::Some(tmp); + }, + 3 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.block_device)?; + }, + 4 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.journal)?; + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.active = ::std::option::Option::Some(tmp); + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.used_space = ::std::option::Option::Some(tmp); + }, + 7 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.total_space = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.fsid.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.id { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.block_device.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + if let Some(ref v) = self.journal.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + if let Some(v) = self.active { + my_size += 2; + } + if let Some(v) = self.used_space { + my_size += ::protobuf::rt::value_size(6, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.total_space { + my_size += ::protobuf::rt::value_size(7, v, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.fsid.as_ref() { + os.write_string(1, &v)?; + } + if let Some(v) = self.id { + os.write_uint64(2, v)?; + } + if let Some(ref v) = self.block_device.as_ref() { + os.write_string(3, &v)?; + } + if let Some(ref v) = self.journal.as_ref() { + os.write_string(4, &v)?; + } + if let Some(v) = self.active { + os.write_bool(5, v)?; + } + if let Some(v) = self.used_space { + os.write_uint64(6, v)?; + } + if let Some(v) = self.total_space { + os.write_uint64(7, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Osd { + Osd::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "fsid", + |m: &Osd| { &m.fsid }, + |m: &mut Osd| { &mut m.fsid }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "id", + |m: &Osd| { &m.id }, + |m: &mut Osd| { &mut m.id }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "block_device", + |m: &Osd| { &m.block_device }, + |m: &mut Osd| { &mut m.block_device }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "journal", + |m: &Osd| { &m.journal }, + |m: &mut Osd| { &mut m.journal }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "active", + |m: &Osd| { &m.active }, + |m: &mut Osd| { &mut m.active }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "used_space", + |m: &Osd| { &m.used_space }, + |m: &mut Osd| { &mut m.used_space }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "total_space", + |m: &Osd| { &m.total_space }, + |m: &mut Osd| { &mut m.total_space }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Osd", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Osd { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Osd, + }; + unsafe { + instance.get(Osd::new) + } + } +} + +impl ::protobuf::Clear for Osd { + fn clear(&mut self) { + self.fsid.clear(); + self.id = ::std::option::Option::None; + self.block_device.clear(); + self.journal.clear(); + self.active = ::std::option::Option::None; + self.used_space = ::std::option::Option::None; + self.total_space = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Osd { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Osd { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Partition { + // message fields + uuid: ::protobuf::SingularField<::std::string::String>, + first_lba: ::std::option::Option, + last_lba: ::std::option::Option, + flags: ::std::option::Option, + name: ::protobuf::SingularField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Partition { + fn default() -> &'a Partition { + ::default_instance() + } +} + +impl Partition { + pub fn new() -> Partition { + ::std::default::Default::default() + } + + // required string uuid = 1; + + + pub fn get_uuid(&self) -> &str { + match self.uuid.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_uuid(&mut self) { + self.uuid.clear(); + } + + pub fn has_uuid(&self) -> bool { + self.uuid.is_some() + } + + // Param is passed by value, moved + pub fn set_uuid(&mut self, v: ::std::string::String) { + self.uuid = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_uuid(&mut self) -> &mut ::std::string::String { + if self.uuid.is_none() { + self.uuid.set_default(); + } + self.uuid.as_mut().unwrap() + } + + // Take field + pub fn take_uuid(&mut self) -> ::std::string::String { + self.uuid.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required uint64 first_lba = 2; + + + pub fn get_first_lba(&self) -> u64 { + self.first_lba.unwrap_or(0) + } + pub fn clear_first_lba(&mut self) { + self.first_lba = ::std::option::Option::None; + } + + pub fn has_first_lba(&self) -> bool { + self.first_lba.is_some() + } + + // Param is passed by value, moved + pub fn set_first_lba(&mut self, v: u64) { + self.first_lba = ::std::option::Option::Some(v); + } + + // required uint64 last_lba = 3; + + + pub fn get_last_lba(&self) -> u64 { + self.last_lba.unwrap_or(0) + } + pub fn clear_last_lba(&mut self) { + self.last_lba = ::std::option::Option::None; + } + + pub fn has_last_lba(&self) -> bool { + self.last_lba.is_some() + } + + // Param is passed by value, moved + pub fn set_last_lba(&mut self, v: u64) { + self.last_lba = ::std::option::Option::Some(v); + } + + // required uint64 flags = 4; + + + pub fn get_flags(&self) -> u64 { + self.flags.unwrap_or(0) + } + pub fn clear_flags(&mut self) { + self.flags = ::std::option::Option::None; + } + + pub fn has_flags(&self) -> bool { + self.flags.is_some() + } + + // Param is passed by value, moved + pub fn set_flags(&mut self, v: u64) { + self.flags = ::std::option::Option::Some(v); + } + + // optional string name = 5; + + + pub fn get_name(&self) -> &str { + match self.name.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_name(&mut self) { + self.name.clear(); + } + + pub fn has_name(&self) -> bool { + self.name.is_some() + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + if self.name.is_none() { + self.name.set_default(); + } + self.name.as_mut().unwrap() + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + self.name.take().unwrap_or_else(|| ::std::string::String::new()) + } +} + +impl ::protobuf::Message for Partition { + fn is_initialized(&self) -> bool { + if self.uuid.is_none() { + return false; + } + if self.first_lba.is_none() { + return false; + } + if self.last_lba.is_none() { + return false; + } + if self.flags.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.uuid)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.first_lba = ::std::option::Option::Some(tmp); + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.last_lba = ::std::option::Option::Some(tmp); + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.flags = ::std::option::Option::Some(tmp); + }, + 5 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.name)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.uuid.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.first_lba { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.last_lba { + my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.flags { + my_size += ::protobuf::rt::value_size(4, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.name.as_ref() { + my_size += ::protobuf::rt::string_size(5, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.uuid.as_ref() { + os.write_string(1, &v)?; + } + if let Some(v) = self.first_lba { + os.write_uint64(2, v)?; + } + if let Some(v) = self.last_lba { + os.write_uint64(3, v)?; + } + if let Some(v) = self.flags { + os.write_uint64(4, v)?; + } + if let Some(ref v) = self.name.as_ref() { + os.write_string(5, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Partition { + Partition::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "uuid", + |m: &Partition| { &m.uuid }, + |m: &mut Partition| { &mut m.uuid }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "first_lba", + |m: &Partition| { &m.first_lba }, + |m: &mut Partition| { &mut m.first_lba }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "last_lba", + |m: &Partition| { &m.last_lba }, + |m: &mut Partition| { &mut m.last_lba }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "flags", + |m: &Partition| { &m.flags }, + |m: &mut Partition| { &mut m.flags }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + |m: &Partition| { &m.name }, + |m: &mut Partition| { &mut m.name }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Partition", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Partition { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Partition, + }; + unsafe { + instance.get(Partition::new) + } + } +} + +impl ::protobuf::Clear for Partition { + fn clear(&mut self) { + self.uuid.clear(); + self.first_lba = ::std::option::Option::None; + self.last_lba = ::std::option::Option::None; + self.flags = ::std::option::Option::None; + self.name.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Partition { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Partition { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct PartitionInfo { + // message fields + partition: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a PartitionInfo { + fn default() -> &'a PartitionInfo { + ::default_instance() + } +} + +impl PartitionInfo { + pub fn new() -> PartitionInfo { + ::std::default::Default::default() + } + + // repeated .ceph_disk.Partition partition = 1; + + + pub fn get_partition(&self) -> &[Partition] { + &self.partition + } + pub fn clear_partition(&mut self) { + self.partition.clear(); + } + + // Param is passed by value, moved + pub fn set_partition(&mut self, v: ::protobuf::RepeatedField) { + self.partition = v; + } + + // Mutable pointer to the field. + pub fn mut_partition(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.partition + } + + // Take field + pub fn take_partition(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.partition, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for PartitionInfo { + fn is_initialized(&self) -> bool { + for v in &self.partition { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.partition)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.partition { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.partition { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> PartitionInfo { + PartitionInfo::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "partition", + |m: &PartitionInfo| { &m.partition }, + |m: &mut PartitionInfo| { &mut m.partition }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "PartitionInfo", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static PartitionInfo { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PartitionInfo, + }; + unsafe { + instance.get(PartitionInfo::new) + } + } +} + +impl ::protobuf::Clear for PartitionInfo { + fn clear(&mut self) { + self.partition.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for PartitionInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PartitionInfo { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Disk { + // message fields + field_type: ::std::option::Option, + dev_path: ::protobuf::SingularField<::std::string::String>, + partitions: ::protobuf::SingularPtrField, + serial_number: ::protobuf::SingularField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Disk { + fn default() -> &'a Disk { + ::default_instance() + } +} + +impl Disk { + pub fn new() -> Disk { + ::std::default::Default::default() + } + + // required .ceph_disk.DiskType type = 1; + + + pub fn get_field_type(&self) -> DiskType { + self.field_type.unwrap_or(DiskType::LOOPBACK) + } + pub fn clear_field_type(&mut self) { + self.field_type = ::std::option::Option::None; + } + + pub fn has_field_type(&self) -> bool { + self.field_type.is_some() + } + + // Param is passed by value, moved + pub fn set_field_type(&mut self, v: DiskType) { + self.field_type = ::std::option::Option::Some(v); + } + + // required string dev_path = 2; + + + pub fn get_dev_path(&self) -> &str { + match self.dev_path.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_dev_path(&mut self) { + self.dev_path.clear(); + } + + pub fn has_dev_path(&self) -> bool { + self.dev_path.is_some() + } + + // Param is passed by value, moved + pub fn set_dev_path(&mut self, v: ::std::string::String) { + self.dev_path = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_dev_path(&mut self) -> &mut ::std::string::String { + if self.dev_path.is_none() { + self.dev_path.set_default(); + } + self.dev_path.as_mut().unwrap() + } + + // Take field + pub fn take_dev_path(&mut self) -> ::std::string::String { + self.dev_path.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required .ceph_disk.PartitionInfo partitions = 3; + + + pub fn get_partitions(&self) -> &PartitionInfo { + self.partitions.as_ref().unwrap_or_else(|| PartitionInfo::default_instance()) + } + pub fn clear_partitions(&mut self) { + self.partitions.clear(); + } + + pub fn has_partitions(&self) -> bool { + self.partitions.is_some() + } + + // Param is passed by value, moved + pub fn set_partitions(&mut self, v: PartitionInfo) { + self.partitions = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_partitions(&mut self) -> &mut PartitionInfo { + if self.partitions.is_none() { + self.partitions.set_default(); + } + self.partitions.as_mut().unwrap() + } + + // Take field + pub fn take_partitions(&mut self) -> PartitionInfo { + self.partitions.take().unwrap_or_else(|| PartitionInfo::new()) + } + + // optional string serial_number = 4; + + + pub fn get_serial_number(&self) -> &str { + match self.serial_number.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_serial_number(&mut self) { + self.serial_number.clear(); + } + + pub fn has_serial_number(&self) -> bool { + self.serial_number.is_some() + } + + // Param is passed by value, moved + pub fn set_serial_number(&mut self, v: ::std::string::String) { + self.serial_number = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_serial_number(&mut self) -> &mut ::std::string::String { + if self.serial_number.is_none() { + self.serial_number.set_default(); + } + self.serial_number.as_mut().unwrap() + } + + // Take field + pub fn take_serial_number(&mut self) -> ::std::string::String { + self.serial_number.take().unwrap_or_else(|| ::std::string::String::new()) + } +} + +impl ::protobuf::Message for Disk { + fn is_initialized(&self) -> bool { + if self.field_type.is_none() { + return false; + } + if self.dev_path.is_none() { + return false; + } + if self.partitions.is_none() { + return false; + } + for v in &self.partitions { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 1, &mut self.unknown_fields)? + }, + 2 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.dev_path)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.partitions)?; + }, + 4 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.serial_number)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.field_type { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(ref v) = self.dev_path.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(ref v) = self.partitions.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.serial_number.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.field_type { + os.write_enum(1, v.value())?; + } + if let Some(ref v) = self.dev_path.as_ref() { + os.write_string(2, &v)?; + } + if let Some(ref v) = self.partitions.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.serial_number.as_ref() { + os.write_string(4, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Disk { + Disk::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "type", + |m: &Disk| { &m.field_type }, + |m: &mut Disk| { &mut m.field_type }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "dev_path", + |m: &Disk| { &m.dev_path }, + |m: &mut Disk| { &mut m.dev_path }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "partitions", + |m: &Disk| { &m.partitions }, + |m: &mut Disk| { &mut m.partitions }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "serial_number", + |m: &Disk| { &m.serial_number }, + |m: &mut Disk| { &mut m.serial_number }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Disk", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Disk { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Disk, + }; + unsafe { + instance.get(Disk::new) + } + } +} + +impl ::protobuf::Clear for Disk { + fn clear(&mut self) { + self.field_type = ::std::option::Option::None; + self.dev_path.clear(); + self.partitions.clear(); + self.serial_number.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Disk { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Disk { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Disks { + // message fields + disk: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Disks { + fn default() -> &'a Disks { + ::default_instance() + } +} + +impl Disks { + pub fn new() -> Disks { + ::std::default::Default::default() + } + + // repeated .ceph_disk.Disk disk = 1; + + + pub fn get_disk(&self) -> &[Disk] { + &self.disk + } + pub fn clear_disk(&mut self) { + self.disk.clear(); + } + + // Param is passed by value, moved + pub fn set_disk(&mut self, v: ::protobuf::RepeatedField) { + self.disk = v; + } + + // Mutable pointer to the field. + pub fn mut_disk(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.disk + } + + // Take field + pub fn take_disk(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.disk, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for Disks { + fn is_initialized(&self) -> bool { + for v in &self.disk { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.disk)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.disk { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.disk { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Disks { + Disks::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "disk", + |m: &Disks| { &m.disk }, + |m: &mut Disks| { &mut m.disk }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Disks", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Disks { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Disks, + }; + unsafe { + instance.get(Disks::new) + } + } +} + +impl ::protobuf::Clear for Disks { + fn clear(&mut self) { + self.disk.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Disks { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Disks { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct OpResult { + // message fields + result: ::std::option::Option, + error_msg: ::protobuf::SingularField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a OpResult { + fn default() -> &'a OpResult { + ::default_instance() + } +} + +impl OpResult { + pub fn new() -> OpResult { + ::std::default::Default::default() + } + + // required .ceph_disk.ResultType result = 1; + + + pub fn get_result(&self) -> ResultType { + self.result.unwrap_or(ResultType::OK) + } + pub fn clear_result(&mut self) { + self.result = ::std::option::Option::None; + } + + pub fn has_result(&self) -> bool { + self.result.is_some() + } + + // Param is passed by value, moved + pub fn set_result(&mut self, v: ResultType) { + self.result = ::std::option::Option::Some(v); + } + + // optional string error_msg = 2; + + + pub fn get_error_msg(&self) -> &str { + match self.error_msg.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_error_msg(&mut self) { + self.error_msg.clear(); + } + + pub fn has_error_msg(&self) -> bool { + self.error_msg.is_some() + } + + // Param is passed by value, moved + pub fn set_error_msg(&mut self, v: ::std::string::String) { + self.error_msg = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error_msg(&mut self) -> &mut ::std::string::String { + if self.error_msg.is_none() { + self.error_msg.set_default(); + } + self.error_msg.as_mut().unwrap() + } + + // Take field + pub fn take_error_msg(&mut self) -> ::std::string::String { + self.error_msg.take().unwrap_or_else(|| ::std::string::String::new()) + } +} + +impl ::protobuf::Message for OpResult { + fn is_initialized(&self) -> bool { + if self.result.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.result, 1, &mut self.unknown_fields)? + }, + 2 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.error_msg)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.result { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(ref v) = self.error_msg.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.result { + os.write_enum(1, v.value())?; + } + if let Some(ref v) = self.error_msg.as_ref() { + os.write_string(2, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> OpResult { + OpResult::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "result", + |m: &OpResult| { &m.result }, + |m: &mut OpResult| { &mut m.result }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "error_msg", + |m: &OpResult| { &m.error_msg }, + |m: &mut OpResult| { &mut m.error_msg }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "OpResult", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static OpResult { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const OpResult, + }; + unsafe { + instance.get(OpResult::new) + } + } +} + +impl ::protobuf::Clear for OpResult { + fn clear(&mut self) { + self.result = ::std::option::Option::None; + self.error_msg.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for OpResult { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for OpResult { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct OpBoolResult { + // message fields + result: ::std::option::Option, + value: ::std::option::Option, + error_msg: ::protobuf::SingularField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a OpBoolResult { + fn default() -> &'a OpBoolResult { + ::default_instance() + } +} + +impl OpBoolResult { + pub fn new() -> OpBoolResult { + ::std::default::Default::default() + } + + // required .ceph_disk.ResultType result = 1; + + + pub fn get_result(&self) -> ResultType { + self.result.unwrap_or(ResultType::OK) + } + pub fn clear_result(&mut self) { + self.result = ::std::option::Option::None; + } + + pub fn has_result(&self) -> bool { + self.result.is_some() + } + + // Param is passed by value, moved + pub fn set_result(&mut self, v: ResultType) { + self.result = ::std::option::Option::Some(v); + } + + // optional bool value = 2; + + + pub fn get_value(&self) -> bool { + self.value.unwrap_or(false) + } + pub fn clear_value(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: bool) { + self.value = ::std::option::Option::Some(v); + } + + // optional string error_msg = 3; + + + pub fn get_error_msg(&self) -> &str { + match self.error_msg.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_error_msg(&mut self) { + self.error_msg.clear(); + } + + pub fn has_error_msg(&self) -> bool { + self.error_msg.is_some() + } + + // Param is passed by value, moved + pub fn set_error_msg(&mut self, v: ::std::string::String) { + self.error_msg = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error_msg(&mut self) -> &mut ::std::string::String { + if self.error_msg.is_none() { + self.error_msg.set_default(); + } + self.error_msg.as_mut().unwrap() + } + + // Take field + pub fn take_error_msg(&mut self) -> ::std::string::String { + self.error_msg.take().unwrap_or_else(|| ::std::string::String::new()) + } +} + +impl ::protobuf::Message for OpBoolResult { + fn is_initialized(&self) -> bool { + if self.result.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.result, 1, &mut self.unknown_fields)? + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.value = ::std::option::Option::Some(tmp); + }, + 3 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.error_msg)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.result { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(v) = self.value { + my_size += 2; + } + if let Some(ref v) = self.error_msg.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.result { + os.write_enum(1, v.value())?; + } + if let Some(v) = self.value { + os.write_bool(2, v)?; + } + if let Some(ref v) = self.error_msg.as_ref() { + os.write_string(3, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> OpBoolResult { + OpBoolResult::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "result", + |m: &OpBoolResult| { &m.result }, + |m: &mut OpBoolResult| { &mut m.result }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "value", + |m: &OpBoolResult| { &m.value }, + |m: &mut OpBoolResult| { &mut m.value }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "error_msg", + |m: &OpBoolResult| { &m.error_msg }, + |m: &mut OpBoolResult| { &mut m.error_msg }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "OpBoolResult", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static OpBoolResult { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const OpBoolResult, + }; + unsafe { + instance.get(OpBoolResult::new) + } + } +} + +impl ::protobuf::Clear for OpBoolResult { + fn clear(&mut self) { + self.result = ::std::option::Option::None; + self.value = ::std::option::Option::None; + self.error_msg.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for OpBoolResult { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for OpBoolResult { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct OpStringResult { + // message fields + result: ::std::option::Option, + value: ::protobuf::SingularField<::std::string::String>, + error_msg: ::protobuf::SingularField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a OpStringResult { + fn default() -> &'a OpStringResult { + ::default_instance() + } +} + +impl OpStringResult { + pub fn new() -> OpStringResult { + ::std::default::Default::default() + } + + // required .ceph_disk.ResultType result = 1; + + + pub fn get_result(&self) -> ResultType { + self.result.unwrap_or(ResultType::OK) + } + pub fn clear_result(&mut self) { + self.result = ::std::option::Option::None; + } + + pub fn has_result(&self) -> bool { + self.result.is_some() + } + + // Param is passed by value, moved + pub fn set_result(&mut self, v: ResultType) { + self.result = ::std::option::Option::Some(v); + } + + // optional string value = 2; + + + pub fn get_value(&self) -> &str { + match self.value.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_value(&mut self) { + self.value.clear(); + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::string::String) { + self.value = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::string::String { + if self.value.is_none() { + self.value.set_default(); + } + self.value.as_mut().unwrap() + } + + // Take field + pub fn take_value(&mut self) -> ::std::string::String { + self.value.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string error_msg = 3; + + + pub fn get_error_msg(&self) -> &str { + match self.error_msg.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_error_msg(&mut self) { + self.error_msg.clear(); + } + + pub fn has_error_msg(&self) -> bool { + self.error_msg.is_some() + } + + // Param is passed by value, moved + pub fn set_error_msg(&mut self, v: ::std::string::String) { + self.error_msg = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error_msg(&mut self) -> &mut ::std::string::String { + if self.error_msg.is_none() { + self.error_msg.set_default(); + } + self.error_msg.as_mut().unwrap() + } + + // Take field + pub fn take_error_msg(&mut self) -> ::std::string::String { + self.error_msg.take().unwrap_or_else(|| ::std::string::String::new()) + } +} + +impl ::protobuf::Message for OpStringResult { + fn is_initialized(&self) -> bool { + if self.result.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.result, 1, &mut self.unknown_fields)? + }, + 2 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.value)?; + }, + 3 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.error_msg)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.result { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(ref v) = self.value.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(ref v) = self.error_msg.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.result { + os.write_enum(1, v.value())?; + } + if let Some(ref v) = self.value.as_ref() { + os.write_string(2, &v)?; + } + if let Some(ref v) = self.error_msg.as_ref() { + os.write_string(3, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> OpStringResult { + OpStringResult::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "result", + |m: &OpStringResult| { &m.result }, + |m: &mut OpStringResult| { &mut m.result }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "value", + |m: &OpStringResult| { &m.value }, + |m: &mut OpStringResult| { &mut m.value }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "error_msg", + |m: &OpStringResult| { &m.error_msg }, + |m: &mut OpStringResult| { &mut m.error_msg }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "OpStringResult", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static OpStringResult { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const OpStringResult, + }; + unsafe { + instance.get(OpStringResult::new) + } + } +} + +impl ::protobuf::Clear for OpStringResult { + fn clear(&mut self) { + self.result = ::std::option::Option::None; + self.value.clear(); + self.error_msg.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for OpStringResult { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for OpStringResult { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct JiraInfo { + // message fields + ticket_id: ::protobuf::SingularField<::std::string::String>, + server_name: ::protobuf::SingularField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a JiraInfo { + fn default() -> &'a JiraInfo { + ::default_instance() + } +} + +impl JiraInfo { + pub fn new() -> JiraInfo { + ::std::default::Default::default() + } + + // required string ticket_id = 1; + + + pub fn get_ticket_id(&self) -> &str { + match self.ticket_id.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_ticket_id(&mut self) { + self.ticket_id.clear(); + } + + pub fn has_ticket_id(&self) -> bool { + self.ticket_id.is_some() + } + + // Param is passed by value, moved + pub fn set_ticket_id(&mut self, v: ::std::string::String) { + self.ticket_id = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_ticket_id(&mut self) -> &mut ::std::string::String { + if self.ticket_id.is_none() { + self.ticket_id.set_default(); + } + self.ticket_id.as_mut().unwrap() + } + + // Take field + pub fn take_ticket_id(&mut self) -> ::std::string::String { + self.ticket_id.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // required string server_name = 2; + + + pub fn get_server_name(&self) -> &str { + match self.server_name.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_server_name(&mut self) { + self.server_name.clear(); + } + + pub fn has_server_name(&self) -> bool { + self.server_name.is_some() + } + + // Param is passed by value, moved + pub fn set_server_name(&mut self, v: ::std::string::String) { + self.server_name = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_server_name(&mut self) -> &mut ::std::string::String { + if self.server_name.is_none() { + self.server_name.set_default(); + } + self.server_name.as_mut().unwrap() + } + + // Take field + pub fn take_server_name(&mut self) -> ::std::string::String { + self.server_name.take().unwrap_or_else(|| ::std::string::String::new()) + } +} + +impl ::protobuf::Message for JiraInfo { + fn is_initialized(&self) -> bool { + if self.ticket_id.is_none() { + return false; + } + if self.server_name.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.ticket_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.server_name)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.ticket_id.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(ref v) = self.server_name.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.ticket_id.as_ref() { + os.write_string(1, &v)?; + } + if let Some(ref v) = self.server_name.as_ref() { + os.write_string(2, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> JiraInfo { + JiraInfo::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "ticket_id", + |m: &JiraInfo| { &m.ticket_id }, + |m: &mut JiraInfo| { &mut m.ticket_id }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "server_name", + |m: &JiraInfo| { &m.server_name }, + |m: &mut JiraInfo| { &mut m.server_name }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "JiraInfo", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static JiraInfo { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const JiraInfo, + }; + unsafe { + instance.get(JiraInfo::new) + } + } +} + +impl ::protobuf::Clear for JiraInfo { + fn clear(&mut self) { + self.ticket_id.clear(); + self.server_name.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for JiraInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for JiraInfo { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct OpJiraTicketsResult { + // message fields + result: ::std::option::Option, + tickets: ::protobuf::RepeatedField, + error_msg: ::protobuf::SingularField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a OpJiraTicketsResult { + fn default() -> &'a OpJiraTicketsResult { + ::default_instance() + } +} + +impl OpJiraTicketsResult { + pub fn new() -> OpJiraTicketsResult { + ::std::default::Default::default() + } + + // required .ceph_disk.ResultType result = 1; + + + pub fn get_result(&self) -> ResultType { + self.result.unwrap_or(ResultType::OK) + } + pub fn clear_result(&mut self) { + self.result = ::std::option::Option::None; + } + + pub fn has_result(&self) -> bool { + self.result.is_some() + } + + // Param is passed by value, moved + pub fn set_result(&mut self, v: ResultType) { + self.result = ::std::option::Option::Some(v); + } + + // repeated .ceph_disk.JiraInfo tickets = 2; + + + pub fn get_tickets(&self) -> &[JiraInfo] { + &self.tickets + } + pub fn clear_tickets(&mut self) { + self.tickets.clear(); + } + + // Param is passed by value, moved + pub fn set_tickets(&mut self, v: ::protobuf::RepeatedField) { + self.tickets = v; + } + + // Mutable pointer to the field. + pub fn mut_tickets(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.tickets + } + + // Take field + pub fn take_tickets(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.tickets, ::protobuf::RepeatedField::new()) + } + + // optional string error_msg = 3; + + + pub fn get_error_msg(&self) -> &str { + match self.error_msg.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_error_msg(&mut self) { + self.error_msg.clear(); + } + + pub fn has_error_msg(&self) -> bool { + self.error_msg.is_some() + } + + // Param is passed by value, moved + pub fn set_error_msg(&mut self, v: ::std::string::String) { + self.error_msg = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error_msg(&mut self) -> &mut ::std::string::String { + if self.error_msg.is_none() { + self.error_msg.set_default(); + } + self.error_msg.as_mut().unwrap() + } + + // Take field + pub fn take_error_msg(&mut self) -> ::std::string::String { + self.error_msg.take().unwrap_or_else(|| ::std::string::String::new()) + } +} + +impl ::protobuf::Message for OpJiraTicketsResult { + fn is_initialized(&self) -> bool { + if self.result.is_none() { + return false; + } + for v in &self.tickets { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.result, 1, &mut self.unknown_fields)? + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.tickets)?; + }, + 3 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.error_msg)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.result { + my_size += ::protobuf::rt::enum_size(1, v); + } + for value in &self.tickets { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if let Some(ref v) = self.error_msg.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.result { + os.write_enum(1, v.value())?; + } + for v in &self.tickets { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if let Some(ref v) = self.error_msg.as_ref() { + os.write_string(3, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> OpJiraTicketsResult { + OpJiraTicketsResult::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "result", + |m: &OpJiraTicketsResult| { &m.result }, + |m: &mut OpJiraTicketsResult| { &mut m.result }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "tickets", + |m: &OpJiraTicketsResult| { &m.tickets }, + |m: &mut OpJiraTicketsResult| { &mut m.tickets }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "error_msg", + |m: &OpJiraTicketsResult| { &m.error_msg }, + |m: &mut OpJiraTicketsResult| { &mut m.error_msg }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "OpJiraTicketsResult", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static OpJiraTicketsResult { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const OpJiraTicketsResult, + }; + unsafe { + instance.get(OpJiraTicketsResult::new) + } + } +} + +impl ::protobuf::Clear for OpJiraTicketsResult { + fn clear(&mut self) { + self.result = ::std::option::Option::None; + self.tickets.clear(); + self.error_msg.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for OpJiraTicketsResult { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for OpJiraTicketsResult { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct DatacenterOperation { + // message fields + Op_type: ::std::option::Option, + server_id: ::protobuf::SingularField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a DatacenterOperation { + fn default() -> &'a DatacenterOperation { + ::default_instance() + } +} + +impl DatacenterOperation { + pub fn new() -> DatacenterOperation { + ::std::default::Default::default() + } + + // required .ceph_disk.DatacenterOp Op_type = 1; + + + pub fn get_Op_type(&self) -> DatacenterOp { + self.Op_type.unwrap_or(DatacenterOp::GetDc) + } + pub fn clear_Op_type(&mut self) { + self.Op_type = ::std::option::Option::None; + } + + pub fn has_Op_type(&self) -> bool { + self.Op_type.is_some() + } + + // Param is passed by value, moved + pub fn set_Op_type(&mut self, v: DatacenterOp) { + self.Op_type = ::std::option::Option::Some(v); + } + + // required string server_id = 2; + + + pub fn get_server_id(&self) -> &str { + match self.server_id.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_server_id(&mut self) { + self.server_id.clear(); + } + + pub fn has_server_id(&self) -> bool { + self.server_id.is_some() + } + + // Param is passed by value, moved + pub fn set_server_id(&mut self, v: ::std::string::String) { + self.server_id = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_server_id(&mut self) -> &mut ::std::string::String { + if self.server_id.is_none() { + self.server_id.set_default(); + } + self.server_id.as_mut().unwrap() + } + + // Take field + pub fn take_server_id(&mut self) -> ::std::string::String { + self.server_id.take().unwrap_or_else(|| ::std::string::String::new()) + } +} + +impl ::protobuf::Message for DatacenterOperation { + fn is_initialized(&self) -> bool { + if self.Op_type.is_none() { + return false; + } + if self.server_id.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.Op_type, 1, &mut self.unknown_fields)? + }, + 2 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.server_id)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.Op_type { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(ref v) = self.server_id.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.Op_type { + os.write_enum(1, v.value())?; + } + if let Some(ref v) = self.server_id.as_ref() { + os.write_string(2, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> DatacenterOperation { + DatacenterOperation::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "Op_type", + |m: &DatacenterOperation| { &m.Op_type }, + |m: &mut DatacenterOperation| { &mut m.Op_type }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "server_id", + |m: &DatacenterOperation| { &m.server_id }, + |m: &mut DatacenterOperation| { &mut m.server_id }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "DatacenterOperation", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static DatacenterOperation { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const DatacenterOperation, + }; + unsafe { + instance.get(DatacenterOperation::new) + } + } +} + +impl ::protobuf::Clear for DatacenterOperation { + fn clear(&mut self) { + self.Op_type = ::std::option::Option::None; + self.server_id.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for DatacenterOperation { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DatacenterOperation { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Operation { + // message fields + Op_type: ::std::option::Option, + disk: ::protobuf::SingularField<::std::string::String>, + simulate: ::std::option::Option, + partition_start: ::std::option::Option, + partition_end: ::std::option::Option, + partition_name: ::protobuf::SingularField<::std::string::String>, + osd_id: ::std::option::Option, + replica_set: ::protobuf::RepeatedField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Operation { + fn default() -> &'a Operation { + ::default_instance() + } +} + +impl Operation { + pub fn new() -> Operation { + ::std::default::Default::default() + } + + // required .ceph_disk.Op Op_type = 1; + + + pub fn get_Op_type(&self) -> Op { + self.Op_type.unwrap_or(Op::Add) + } + pub fn clear_Op_type(&mut self) { + self.Op_type = ::std::option::Option::None; + } + + pub fn has_Op_type(&self) -> bool { + self.Op_type.is_some() + } + + // Param is passed by value, moved + pub fn set_Op_type(&mut self, v: Op) { + self.Op_type = ::std::option::Option::Some(v); + } + + // optional string disk = 2; + + + pub fn get_disk(&self) -> &str { + match self.disk.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_disk(&mut self) { + self.disk.clear(); + } + + pub fn has_disk(&self) -> bool { + self.disk.is_some() + } + + // Param is passed by value, moved + pub fn set_disk(&mut self, v: ::std::string::String) { + self.disk = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_disk(&mut self) -> &mut ::std::string::String { + if self.disk.is_none() { + self.disk.set_default(); + } + self.disk.as_mut().unwrap() + } + + // Take field + pub fn take_disk(&mut self) -> ::std::string::String { + self.disk.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bool simulate = 3; + + + pub fn get_simulate(&self) -> bool { + self.simulate.unwrap_or(false) + } + pub fn clear_simulate(&mut self) { + self.simulate = ::std::option::Option::None; + } + + pub fn has_simulate(&self) -> bool { + self.simulate.is_some() + } + + // Param is passed by value, moved + pub fn set_simulate(&mut self, v: bool) { + self.simulate = ::std::option::Option::Some(v); + } + + // optional uint64 partition_start = 4; + + + pub fn get_partition_start(&self) -> u64 { + self.partition_start.unwrap_or(0) + } + pub fn clear_partition_start(&mut self) { + self.partition_start = ::std::option::Option::None; + } + + pub fn has_partition_start(&self) -> bool { + self.partition_start.is_some() + } + + // Param is passed by value, moved + pub fn set_partition_start(&mut self, v: u64) { + self.partition_start = ::std::option::Option::Some(v); + } + + // optional uint64 partition_end = 5; + + + pub fn get_partition_end(&self) -> u64 { + self.partition_end.unwrap_or(0) + } + pub fn clear_partition_end(&mut self) { + self.partition_end = ::std::option::Option::None; + } + + pub fn has_partition_end(&self) -> bool { + self.partition_end.is_some() + } + + // Param is passed by value, moved + pub fn set_partition_end(&mut self, v: u64) { + self.partition_end = ::std::option::Option::Some(v); + } + + // optional string partition_name = 6; + + + pub fn get_partition_name(&self) -> &str { + match self.partition_name.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_partition_name(&mut self) { + self.partition_name.clear(); + } + + pub fn has_partition_name(&self) -> bool { + self.partition_name.is_some() + } + + // Param is passed by value, moved + pub fn set_partition_name(&mut self, v: ::std::string::String) { + self.partition_name = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_partition_name(&mut self) -> &mut ::std::string::String { + if self.partition_name.is_none() { + self.partition_name.set_default(); + } + self.partition_name.as_mut().unwrap() + } + + // Take field + pub fn take_partition_name(&mut self) -> ::std::string::String { + self.partition_name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional uint64 osd_id = 7; + + + pub fn get_osd_id(&self) -> u64 { + self.osd_id.unwrap_or(0) + } + pub fn clear_osd_id(&mut self) { + self.osd_id = ::std::option::Option::None; + } + + pub fn has_osd_id(&self) -> bool { + self.osd_id.is_some() + } + + // Param is passed by value, moved + pub fn set_osd_id(&mut self, v: u64) { + self.osd_id = ::std::option::Option::Some(v); + } + + // repeated string replica_set = 10; + + + pub fn get_replica_set(&self) -> &[::std::string::String] { + &self.replica_set + } + pub fn clear_replica_set(&mut self) { + self.replica_set.clear(); + } + + // Param is passed by value, moved + pub fn set_replica_set(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.replica_set = v; + } + + // Mutable pointer to the field. + pub fn mut_replica_set(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.replica_set + } + + // Take field + pub fn take_replica_set(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.replica_set, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for Operation { + fn is_initialized(&self) -> bool { + if self.Op_type.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.Op_type, 1, &mut self.unknown_fields)? + }, + 2 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.disk)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.simulate = ::std::option::Option::Some(tmp); + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.partition_start = ::std::option::Option::Some(tmp); + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.partition_end = ::std::option::Option::Some(tmp); + }, + 6 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.partition_name)?; + }, + 7 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.osd_id = ::std::option::Option::Some(tmp); + }, + 10 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.replica_set)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.Op_type { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(ref v) = self.disk.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.simulate { + my_size += 2; + } + if let Some(v) = self.partition_start { + my_size += ::protobuf::rt::value_size(4, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.partition_end { + my_size += ::protobuf::rt::value_size(5, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.partition_name.as_ref() { + my_size += ::protobuf::rt::string_size(6, &v); + } + if let Some(v) = self.osd_id { + my_size += ::protobuf::rt::value_size(7, v, ::protobuf::wire_format::WireTypeVarint); + } + for value in &self.replica_set { + my_size += ::protobuf::rt::string_size(10, &value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.Op_type { + os.write_enum(1, v.value())?; + } + if let Some(ref v) = self.disk.as_ref() { + os.write_string(2, &v)?; + } + if let Some(v) = self.simulate { + os.write_bool(3, v)?; + } + if let Some(v) = self.partition_start { + os.write_uint64(4, v)?; + } + if let Some(v) = self.partition_end { + os.write_uint64(5, v)?; + } + if let Some(ref v) = self.partition_name.as_ref() { + os.write_string(6, &v)?; + } + if let Some(v) = self.osd_id { + os.write_uint64(7, v)?; + } + for v in &self.replica_set { + os.write_string(10, &v)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Operation { + Operation::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "Op_type", + |m: &Operation| { &m.Op_type }, + |m: &mut Operation| { &mut m.Op_type }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "disk", + |m: &Operation| { &m.disk }, + |m: &mut Operation| { &mut m.disk }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "simulate", + |m: &Operation| { &m.simulate }, + |m: &mut Operation| { &mut m.simulate }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "partition_start", + |m: &Operation| { &m.partition_start }, + |m: &mut Operation| { &mut m.partition_start }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "partition_end", + |m: &Operation| { &m.partition_end }, + |m: &mut Operation| { &mut m.partition_end }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "partition_name", + |m: &Operation| { &m.partition_name }, + |m: &mut Operation| { &mut m.partition_name }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "osd_id", + |m: &Operation| { &m.osd_id }, + |m: &mut Operation| { &mut m.osd_id }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "replica_set", + |m: &Operation| { &m.replica_set }, + |m: &mut Operation| { &mut m.replica_set }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Operation", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Operation { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Operation, + }; + unsafe { + instance.get(Operation::new) + } + } +} + +impl ::protobuf::Clear for Operation { + fn clear(&mut self) { + self.Op_type = ::std::option::Option::None; + self.disk.clear(); + self.simulate = ::std::option::Option::None; + self.partition_start = ::std::option::Option::None; + self.partition_end = ::std::option::Option::None; + self.partition_name.clear(); + self.osd_id = ::std::option::Option::None; + self.replica_set.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Operation { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Operation { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum DiskType { + LOOPBACK = 0, + LVM = 1, + MDRAID = 2, + NVME = 3, + RAM = 4, + ROTATIONAL = 5, + SOLID_STATE = 6, + VIRTUAL = 7, + UNKNOWN = 8, +} + +impl ::protobuf::ProtobufEnum for DiskType { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(DiskType::LOOPBACK), + 1 => ::std::option::Option::Some(DiskType::LVM), + 2 => ::std::option::Option::Some(DiskType::MDRAID), + 3 => ::std::option::Option::Some(DiskType::NVME), + 4 => ::std::option::Option::Some(DiskType::RAM), + 5 => ::std::option::Option::Some(DiskType::ROTATIONAL), + 6 => ::std::option::Option::Some(DiskType::SOLID_STATE), + 7 => ::std::option::Option::Some(DiskType::VIRTUAL), + 8 => ::std::option::Option::Some(DiskType::UNKNOWN), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [DiskType] = &[ + DiskType::LOOPBACK, + DiskType::LVM, + DiskType::MDRAID, + DiskType::NVME, + DiskType::RAM, + DiskType::ROTATIONAL, + DiskType::SOLID_STATE, + DiskType::VIRTUAL, + DiskType::UNKNOWN, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("DiskType", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for DiskType { +} + +impl ::std::default::Default for DiskType { + fn default() -> Self { + DiskType::LOOPBACK + } +} + +impl ::protobuf::reflect::ProtobufValue for DiskType { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum ResultType { + OK = 0, + ERR = 1, +} + +impl ::protobuf::ProtobufEnum for ResultType { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(ResultType::OK), + 1 => ::std::option::Option::Some(ResultType::ERR), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [ResultType] = &[ + ResultType::OK, + ResultType::ERR, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("ResultType", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for ResultType { +} + +impl ::std::default::Default for ResultType { + fn default() -> Self { + ResultType::OK + } +} + +impl ::protobuf::reflect::ProtobufValue for ResultType { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum Op { + Add = 1, + AddPartition = 6, + List = 3, + Remove = 4, + SafeToRemove = 5, + GetCreatedTickets = 7, + SetMaintenance = 8, + UnsetMaintenance = 9, +} + +impl ::protobuf::ProtobufEnum for Op { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 1 => ::std::option::Option::Some(Op::Add), + 6 => ::std::option::Option::Some(Op::AddPartition), + 3 => ::std::option::Option::Some(Op::List), + 4 => ::std::option::Option::Some(Op::Remove), + 5 => ::std::option::Option::Some(Op::SafeToRemove), + 7 => ::std::option::Option::Some(Op::GetCreatedTickets), + 8 => ::std::option::Option::Some(Op::SetMaintenance), + 9 => ::std::option::Option::Some(Op::UnsetMaintenance), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [Op] = &[ + Op::Add, + Op::AddPartition, + Op::List, + Op::Remove, + Op::SafeToRemove, + Op::GetCreatedTickets, + Op::SetMaintenance, + Op::UnsetMaintenance, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("Op", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for Op { +} + +// Note, `Default` is implemented although default value is not 0 +impl ::std::default::Default for Op { + fn default() -> Self { + Op::Add + } +} + +impl ::protobuf::reflect::ProtobufValue for Op { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum DatacenterOp { + GetDc = 1, + GetRack = 2, + GetRow = 3, + GetElevation = 4, +} + +impl ::protobuf::ProtobufEnum for DatacenterOp { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 1 => ::std::option::Option::Some(DatacenterOp::GetDc), + 2 => ::std::option::Option::Some(DatacenterOp::GetRack), + 3 => ::std::option::Option::Some(DatacenterOp::GetRow), + 4 => ::std::option::Option::Some(DatacenterOp::GetElevation), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [DatacenterOp] = &[ + DatacenterOp::GetDc, + DatacenterOp::GetRack, + DatacenterOp::GetRow, + DatacenterOp::GetElevation, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("DatacenterOp", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for DatacenterOp { +} + +// Note, `Default` is implemented although default value is not 0 +impl ::std::default::Default for DatacenterOp { + fn default() -> Self { + DatacenterOp::GetDc + } +} + +impl ::protobuf::reflect::ProtobufValue for DatacenterOp { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\rservice.proto\x12\tceph_disk\"\x8f\x01\n\x03Osd\x12\x0e\n\x04fsid\ + \x18\x01\x20\x01(\tB\0\x12\x0c\n\x02id\x18\x02\x20\x02(\x04B\0\x12\x16\n\ + \x0cblock_device\x18\x03\x20\x01(\tB\0\x12\x11\n\x07journal\x18\x04\x20\ + \x01(\tB\0\x12\x10\n\x06active\x18\x05\x20\x02(\x08B\0\x12\x14\n\nused_s\ + pace\x18\x06\x20\x02(\x04B\0\x12\x15\n\x0btotal_space\x18\x07\x20\x02(\ + \x04B\0:\0\"g\n\tPartition\x12\x0e\n\x04uuid\x18\x01\x20\x02(\tB\0\x12\ + \x13\n\tfirst_lba\x18\x02\x20\x02(\x04B\0\x12\x12\n\x08last_lba\x18\x03\ + \x20\x02(\x04B\0\x12\x0f\n\x05flags\x18\x04\x20\x02(\x04B\0\x12\x0e\n\ + \x04name\x18\x05\x20\x01(\tB\0:\0\"<\n\rPartitionInfo\x12)\n\tpartition\ + \x18\x01\x20\x03(\x0b2\x14.ceph_disk.PartitionB\0:\0\"\x8a\x01\n\x04Disk\ + \x12#\n\x04type\x18\x01\x20\x02(\x0e2\x13.ceph_disk.DiskTypeB\0\x12\x12\ + \n\x08dev_path\x18\x02\x20\x02(\tB\0\x12.\n\npartitions\x18\x03\x20\x02(\ + \x0b2\x18.ceph_disk.PartitionInfoB\0\x12\x17\n\rserial_number\x18\x04\ + \x20\x01(\tB\0:\0\"*\n\x05Disks\x12\x1f\n\x04disk\x18\x01\x20\x03(\x0b2\ + \x0f.ceph_disk.DiskB\0:\0\"J\n\x08OpResult\x12'\n\x06result\x18\x01\x20\ + \x02(\x0e2\x15.ceph_disk.ResultTypeB\0\x12\x13\n\terror_msg\x18\x02\x20\ + \x01(\tB\0:\0\"_\n\x0cOpBoolResult\x12'\n\x06result\x18\x01\x20\x02(\x0e\ + 2\x15.ceph_disk.ResultTypeB\0\x12\x0f\n\x05value\x18\x02\x20\x01(\x08B\0\ + \x12\x13\n\terror_msg\x18\x03\x20\x01(\tB\0:\0\"a\n\x0eOpStringResult\ + \x12'\n\x06result\x18\x01\x20\x02(\x0e2\x15.ceph_disk.ResultTypeB\0\x12\ + \x0f\n\x05value\x18\x02\x20\x01(\tB\0\x12\x13\n\terror_msg\x18\x03\x20\ + \x01(\tB\0:\0\"8\n\x08JiraInfo\x12\x13\n\tticket_id\x18\x01\x20\x02(\tB\ + \0\x12\x15\n\x0bserver_name\x18\x02\x20\x02(\tB\0:\0\"}\n\x13OpJiraTicke\ + tsResult\x12'\n\x06result\x18\x01\x20\x02(\x0e2\x15.ceph_disk.ResultType\ + B\0\x12&\n\x07tickets\x18\x02\x20\x03(\x0b2\x13.ceph_disk.JiraInfoB\0\ + \x12\x13\n\terror_msg\x18\x03\x20\x01(\tB\0:\0\"X\n\x13DatacenterOperati\ + on\x12*\n\x07Op_type\x18\x01\x20\x02(\x0e2\x17.ceph_disk.DatacenterOpB\0\ + \x12\x13\n\tserver_id\x18\x02\x20\x02(\tB\0:\0\"\xca\x01\n\tOperation\ + \x12\x20\n\x07Op_type\x18\x01\x20\x02(\x0e2\r.ceph_disk.OpB\0\x12\x0e\n\ + \x04disk\x18\x02\x20\x01(\tB\0\x12\x12\n\x08simulate\x18\x03\x20\x01(\ + \x08B\0\x12\x19\n\x0fpartition_start\x18\x04\x20\x01(\x04B\0\x12\x17\n\r\ + partition_end\x18\x05\x20\x01(\x04B\0\x12\x18\n\x0epartition_name\x18\ + \x06\x20\x01(\tB\0\x12\x10\n\x06osd_id\x18\x07\x20\x01(\x04B\0\x12\x15\n\ + \x0breplica_set\x18\n\x20\x03(\tB\0:\0*}\n\x08DiskType\x12\x0c\n\x08LOOP\ + BACK\x10\0\x12\x07\n\x03LVM\x10\x01\x12\n\n\x06MDRAID\x10\x02\x12\x08\n\ + \x04NVME\x10\x03\x12\x07\n\x03RAM\x10\x04\x12\x0e\n\nROTATIONAL\x10\x05\ + \x12\x0f\n\x0bSOLID_STATE\x10\x06\x12\x0b\n\x07VIRTUAL\x10\x07\x12\x0b\n\ + \x07UNKNOWN\x10\x08\x1a\0*\x1f\n\nResultType\x12\x06\n\x02OK\x10\0\x12\ + \x07\n\x03ERR\x10\x01\x1a\0*\x8a\x01\n\x02Op\x12\x07\n\x03Add\x10\x01\ + \x12\x10\n\x0cAddPartition\x10\x06\x12\x08\n\x04List\x10\x03\x12\n\n\x06\ + Remove\x10\x04\x12\x10\n\x0cSafeToRemove\x10\x05\x12\x15\n\x11GetCreated\ + Tickets\x10\x07\x12\x12\n\x0eSetMaintenance\x10\x08\x12\x14\n\x10UnsetMa\ + intenance\x10\t\x1a\0*F\n\x0cDatacenterOp\x12\t\n\x05GetDc\x10\x01\x12\ + \x0b\n\x07GetRack\x10\x02\x12\n\n\x06GetRow\x10\x03\x12\x10\n\x0cGetElev\ + ation\x10\x04\x1a\0B\0b\x06proto2\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/config/bynar.json b/config/bynar.json index bfc4233..1df2511 100644 --- a/config/bynar.json +++ b/config/bynar.json @@ -18,11 +18,12 @@ "redfish_port": 443, "vault_endpoint": "https://my_vault.com", "vault_token": "token_98706420", + "lock_file": "/var/log/setMaintenance.lock", "database": { "username": "postgres", "password": "", "port": 5432, "dbname":"bynar", - "endpoint":"some.endpoint" + "endpoint":"localhost" } } diff --git a/src/client.rs b/src/client.rs index 76da219..c8598da 100644 --- a/src/client.rs +++ b/src/client.rs @@ -71,10 +71,21 @@ fn handle_jira_tickets(s: &Socket) -> BynarResult<()>{ let _tickets = helpers::get_jira_tickets(s)?; trace!("handle_jira_tickets Finished"); Ok(()) - - } +fn handle_set_maintenance(s: &mut Socket) -> BynarResult<()>{ + trace!("handle_set_maintenance called"); + helpers::set_maintenance(s)?; + trace!("handle_set_maintenance finished"); + Ok(()) +} + +fn handle_unset_maintenance(s: &mut Socket) -> BynarResult<()>{ + trace!("handle_unset_maintenance called"); + helpers::unset_maintenance(s)?; + trace!("handle_unset_maintenance finished"); + Ok(()) +} fn handle_remove_disk(s: &Socket, matches: &ArgMatches<'_>) { let p = Path::new(matches.value_of("path").unwrap()); @@ -158,6 +169,8 @@ fn get_cli_args(default_server_key: &str) -> ArgMatches<'_> { ) .subcommand(SubCommand::with_name("list").about("List all disks on a server")) .subcommand(SubCommand::with_name("get_jira_tickets").about("get all tickets created")) + .subcommand(SubCommand::with_name("set_maintenance").about("Set maintenance status")) + .subcommand(SubCommand::with_name("unset_maintenance").about("Remove maintenance status")) .subcommand( SubCommand::with_name("remove") .about("Remove a disk from the cluster") @@ -240,4 +253,10 @@ fn main() { if let Some(ref _matches) = matches.subcommand_matches("get_jira_tickets") { handle_jira_tickets(&mut s); } + if let Some(ref matches) = matches.subcommand_matches("set_maintenance") { + handle_set_maintenance(&mut s); + } + if let Some(ref matches) = matches.subcommand_matches("unset_maintenance") { + handle_unset_maintenance(&mut s); + } } diff --git a/src/disk_manager.rs b/src/disk_manager.rs index 83d0863..9fec735 100644 --- a/src/disk_manager.rs +++ b/src/disk_manager.rs @@ -6,6 +6,7 @@ use std::path::Path; use std::str::FromStr; use std::thread; use std::time::Duration; +use std::fs; use api::service::{ Disk, DiskType, Disks, JiraInfo, Op, OpBoolResult, OpJiraTicketsResult, OpResult, Partition, @@ -239,6 +240,27 @@ fn listen( } }; } + Op::SetMaintenance => { + match set_maintenance(&mut responder) { + Ok(_) => { + info!("Set maintenance operation finished"); + } + Err(e) => { + error!("Error when setting to maintenance mode: {:?}", e); + } + }; + } + Op::UnsetMaintenance => { + match unset_maintenance(&mut responder) { + Ok(_) => { + info!("Unset maintenance operation finished"); + } + Err(e) => { + error!("Error when remove the setting to maintenance mode: {:?}", e); + } + }; + + } }; thread::sleep(Duration::from_millis(10)); } @@ -468,7 +490,40 @@ fn safe_to_remove_disk( let _ = respond_to_client(&result, s); Ok(()) } - +pub fn set_maintenance(s: &mut Socket) -> BynarResult<()>{ + let mut result = OpResult::new(); + let file = match File::create("/var/log/setMaintenance.lock") { + Ok(file) => { + result.set_result(ResultType::OK); + } + Err(e) => { + error!("Failed to create lock file {}", e); + result.set_result(ResultType::ERR); + result.set_error_msg(e.to_string()); + } + }; + + let _ = respond_to_client(&result, s); + + Ok(()) +} +pub fn unset_maintenance(s: &mut Socket) -> BynarResult<()>{ + let mut result = OpResult::new(); + let file = match fs::remove_file("/var/log/setMaintenance.lock") { + Ok(file) => { + result.set_result(ResultType::OK); + } + Err(e) => { + error!("Failed to create lock file {}", e); + result.set_result(ResultType::ERR); + result.set_error_msg(e.to_string()); + } + }; + + let _ = respond_to_client(&result, s); + + Ok(()) +} fn main() { let matches = App::new("Disk Manager") .version(crate_version!()) diff --git a/src/lib/lib.rs b/src/lib/lib.rs index 9a31f0f..3834fae 100644 --- a/src/lib/lib.rs +++ b/src/lib/lib.rs @@ -16,6 +16,7 @@ use zmq::{Message, Socket}; pub mod error; pub mod host_information; + pub fn load_config(config_dir: &Path, name: &str) -> BynarResult where T: DeserializeOwned, @@ -274,3 +275,36 @@ pub fn get_jira_tickets(s: &Socket) -> BynarResult<()>{ } } + +pub fn set_maintenance(s: &mut Socket) -> BynarResult<()>{ + let mut o = Operation::new(); + debug!("Calling set_maintenance "); + o.set_Op_type(Op::SetMaintenance); + let encoded = o.write_to_bytes()?; + let msg = Message::from_slice(&encoded)?; + debug!("Sending message in set_maintenance"); + s.send_msg(msg, 0)?; + + debug!("Waiting for response: SetMaintenance"); + let response = s.recv_bytes(0)?; + + Ok(()) + +} + +pub fn unset_maintenance(s: &mut Socket) -> BynarResult<()>{ + let mut o = Operation::new(); + debug!("Calling unset_maintenance "); + o.set_Op_type(Op::UnsetMaintenance); + let encoded = o.write_to_bytes()?; + let msg = Message::from_slice(&encoded)?; + debug!("Sending message in set_maintenance"); + s.send_msg(msg, 0)?; + + debug!("Waiting for response: SetMaintenance"); + let response = s.recv_bytes(0)?; + + Ok(()) + +} + diff --git a/src/main.rs b/src/main.rs index 684b2a1..8c06f12 100644 --- a/src/main.rs +++ b/src/main.rs @@ -440,6 +440,7 @@ fn add_repaired_disks( // 5. Record the replacement in the in_progress sqlite database fn main() { + let matches = App::new("Dead Disk Detector") .version(crate_version!()) .author(crate_authors!()) @@ -519,6 +520,12 @@ fn main() { } let config: ConfigSettings = config.expect("Failed to load config"); + let f: bool = Path::new("/var/log/setMaintenance.lock").is_file(); + if f { + info!("Lock file found... quitting"); + return; + } + let db_pool = match create_db_connection_pool(&config.database) { Err(e) => { error!("Failed to create database pool {}", e);