@ -551,7 +551,11 @@ This calls C<< drbdadm >> to collect the configuration of the local system and p
On error , C << 1 >> is returned . On success , C << 0 >> is returned .
This method takes no parameters .
Parameters ;
= head3 xml ( optional )
If set to the XML generated by C << drbdadm dump - xml >> elsewhere , this will be parsed instead of making the call .
= cut
sub gather_data
@ -562,220 +566,230 @@ sub gather_data
my $ debug = defined $ parameter - > { debug } ? $ parameter - > { debug } : 3 ;
$ anvil - > Log - > entry ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , key = > "log_0125" , variables = > { method = > "DRBD->gather_data()" } } ) ;
### NOTE: Left off here - take an XML and parse that instead of collecting it, if passed.
my $ xml = defined $ parameter - > { xml } ? $ parameter - > { xml } : "" ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
xml = > $ xml ,
} } ) ;
# Is DRBD even installed?
if ( not - e $ anvil - > data - > { path } { exe } { drbdadm } )
if ( not $ xml )
{
# This is an error, but it happens a lot because we're called by scan_drbd from Striker
# dashboards often. As such, this log level is '2'.
$ anvil - > Log - > entry ( { source = > $ THIS_FILE , line = > __LINE__ , level = > 2 , key = > "error_0251" } ) ;
return ( 1 ) ;
if ( not - e $ anvil - > data - > { path } { exe } { drbdadm } )
{
# This is an error, but it happens a lot because we're called by scan_drbd from Striker
# dashboards often. As such, this log level is '2'.
$ anvil - > Log - > entry ( { source = > $ THIS_FILE , line = > __LINE__ , level = > 2 , key = > "error_0251" } ) ;
return ( 1 ) ;
}
( $ xml , my $ return_code ) = $ anvil - > System - > call ( { shell_call = > $ anvil - > data - > { path } { exe } { drbdadm } . " dump-xml" } ) ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
xml = > $ xml ,
return_code = > $ return_code ,
} } ) ;
if ( $ return_code )
{
# Failed to dump the XML.
$ anvil - > Log - > entry ( { source = > $ THIS_FILE , line = > __LINE__ , level = > 1 , key = > "error_0252" , variables = > { return_code = > $ return_code } } ) ;
return ( 1 ) ;
}
}
my ( $ drbd_xml , $ return_code ) = $ anvil - > System - > call ( { shell_call = > $ anvil - > data - > { path } { exe } { drbdadm } . " dump-xml" } ) ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { drbd_xml = > $ drbd_xml , return_code = > $ return_code } } ) ;
if ( $ return_code )
local $@ ;
my $ dom = eval { XML::LibXML - > load_xml ( string = > $ xml ) ; } ;
if ( $@ )
{
# Failed to dump the XML.
$ anvil - > Log - > entry ( { source = > $ THIS_FILE , line = > __LINE__ , level = > 1 , key = > "error_0252" , variables = > { return_code = > $ return_code } } ) ;
$ anvil - > Log - > entry ( { source = > $ THIS_FILE , line = > __LINE__ , level = > 1 , key = > "error_0253" , variables = > {
xml = > $ xml ,
error = > $@ ,
} } ) ;
return ( 1 ) ;
}
else
{
local $@ ;
my $ dom = eval { XML::LibXML - > load_xml ( string = > $ drbd_xml ) ; } ;
if ( $@ )
{
$ anvil - > Log - > entry ( { source = > $ THIS_FILE , line = > __LINE__ , level = > 1 , key = > "error_0253" , variables = > {
xml = > $ drbd_xml ,
error = > $@ ,
} } ) ;
return ( 1 ) ;
}
else
# Successful parse!
### TODO: Might be best to config these default values by calling/parsing
### 'drbdsetup show <resource> --show-defaults'.
$ anvil - > data - > { new } { scan_drbd } { scan_drbd_common_xml } = $ xml ;
$ anvil - > data - > { new } { scan_drbd } { scan_drbd_flush_disk } = 1 ;
$ anvil - > data - > { new } { scan_drbd } { scan_drbd_flush_md } = 1 ;
$ anvil - > data - > { new } { scan_drbd } { scan_drbd_timeout } = 6 ; # Default is '60', 6 seconds
$ anvil - > data - > { new } { scan_drbd } { scan_drbd_total_sync_speed } = 0 ;
foreach my $ name ( $ dom - > findnodes ( '/config/common/section' ) )
{
# Successful parse!
### TODO: Might be best to config these default values by calling/parsing
### 'drbdsetup show <resource> --show-defaults'.
$ anvil - > data - > { new } { scan_drbd } { scan_drbd_common_xml } = $ drbd_xml ;
$ anvil - > data - > { new } { scan_drbd } { scan_drbd_flush_disk } = 1 ;
$ anvil - > data - > { new } { scan_drbd } { scan_drbd_flush_md } = 1 ;
$ anvil - > data - > { new } { scan_drbd } { scan_drbd_timeout } = 6 ; # Default is '60', 6 seconds
$ anvil - > data - > { new } { scan_drbd } { scan_drbd_total_sync_speed } = 0 ;
foreach my $ name ( $ dom - > findnodes ( '/config/common/section' ) )
my $ section = $ name - > { name } ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { section = > $ section } } ) ;
foreach my $ option_name ( $ name - > findnodes ( './option' ) )
{
my $ section = $ name - > { name } ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { section = > $ section } } ) ;
foreach my $ option_name ( $ name - > findnodes ( './option' ) )
{
my $ variable = $ option_name - > { name } ;
my $ value = $ option_name - > { value } ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
's1:variable' = > $ variable ,
's2:value' = > $ value ,
} } ) ;
my $ variable = $ option_name - > { name } ;
my $ value = $ option_name - > { value } ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
's1:variable' = > $ variable ,
's2:value' = > $ value ,
} } ) ;
if ( $ section eq "net" )
if ( $ section eq "net" )
{
if ( $ variable eq "timeout" )
{
if ( $ variable eq "timeout" )
{
$ value /= 10 ;
$ anvil - > data - > { new } { scan_drbd } { scan_drbd_timeout } = ( $ value / 10 ) ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"new::scan_drbd::scan_drbd_timeout" = > $ anvil - > data - > { new } { scan_drbd } { scan_drbd_timeout } ,
} } ) ;
}
$ value /= 10 ;
$ anvil - > data - > { new } { scan_drbd } { scan_drbd_timeout } = ( $ value / 10 ) ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"new::scan_drbd::scan_drbd_timeout" = > $ anvil - > data - > { new } { scan_drbd } { scan_drbd_timeout } ,
} } ) ;
}
if ( $ section eq "disk" )
}
if ( $ section eq "disk" )
{
if ( $ variable eq "disk-flushes" )
{
if ( $ variable eq "disk-flushes" )
{
$ anvil - > data - > { new } { scan_drbd } { scan_drbd_flush_disk } = $ value eq "no" ? 0 : 1 ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"new::scan_drbd::scan_drbd_flush_disk" = > $ anvil - > data - > { new } { scan_drbd } { scan_drbd_flush_disk } ,
} } ) ;
}
if ( $ variable eq "md-flushes" )
{
$ anvil - > data - > { new } { scan_drbd } { scan_drbd_flush_md } = $ value eq "no" ? 0 : 1 ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"new::scan_drbd::scan_drbd_flush_md" = > $ anvil - > data - > { new } { scan_drbd } { scan_drbd_flush_md } ,
} } ) ;
}
$ anvil - > data - > { new } { scan_drbd } { scan_drbd_flush_disk } = $ value eq "no" ? 0 : 1 ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"new::scan_drbd::scan_drbd_flush_disk" = > $ anvil - > data - > { new } { scan_drbd } { scan_drbd_flush_disk } ,
} } ) ;
}
if ( $ variable eq "md-flushes" )
{
$ anvil - > data - > { new } { scan_drbd } { scan_drbd_flush_md } = $ value eq "no" ? 0 : 1 ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"new::scan_drbd::scan_drbd_flush_md" = > $ anvil - > data - > { new } { scan_drbd } { scan_drbd_flush_md } ,
} } ) ;
}
}
}
}
foreach my $ name ( $ dom - > findnodes ( '/config/resource' ) )
{
my $ resource = $ name - > { name } ;
my $ conf_file = $ name - > { 'conf-file-line' } ;
$ conf_file =~ s/:\d+$// ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
's1:resource' = > $ resource ,
's2:conf_file' = > $ conf_file ,
} } ) ;
foreach my $ name ( $ dom - > findnodes ( '/config/resource' ) )
{
my $ resource = $ name - > { name } ;
my $ conf_file = $ name - > { 'conf-file-line' } ;
$ conf_file =~ s/:\d+$// ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
's1:resource' = > $ resource ,
's2:conf_file' = > $ conf_file ,
} } ) ;
$ anvil - > data - > { new } { resource } { $ resource } { up } = 0 ;
$ anvil - > data - > { new } { resource } { $ resource } { xml } = $ name - > toString ;
$ anvil - > data - > { new } { resource } { $ resource } { config_file } = $ conf_file ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"new::resource::${resource}::xml" = > $ anvil - > data - > { new } { resource } { $ resource } { xml } ,
"new::resource::${resource}::config_file" = > $ anvil - > data - > { new } { resource } { $ resource } { config_file } ,
} } ) ;
$ anvil - > data - > { new } { resource } { $ resource } { up } = 0 ;
$ anvil - > data - > { new } { resource } { $ resource } { xml } = $ name - > toString ;
$ anvil - > data - > { new } { resource } { $ resource } { config_file } = $ conf_file ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"new::resource::${resource}::xml" = > $ anvil - > data - > { new } { resource } { $ resource } { xml } ,
"new::resource::${resource}::config_file" = > $ anvil - > data - > { new } { resource } { $ resource } { config_file } ,
} } ) ;
foreach my $ host ( $ name - > findnodes ( './host' ) )
{
my $ this_host_name = $ host - > { name } ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { this_host_name = > $ this_host_name } } ) ;
foreach my $ host ( $ name - > findnodes ( './host' ) )
# Record the details under the hosts
foreach my $ volume_vnr ( $ host - > findnodes ( './volume' ) )
{
my $ this_host_name = $ host - > { name } ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { this_host_name = > $ this_host_name } } ) ;
my $ volume = $ volume_vnr - > { vnr } ;
my $ meta_disk = $ volume_vnr - > findvalue ( './meta-disk' ) ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
's1:volume' = > $ volume ,
's2:meta_disk' = > $ meta_disk ,
} } ) ;
# Record the details under the hosts
foreach my $ volume_vnr ( $ host - > findnodes ( './volume' ) )
{
my $ volume = $ volume_vnr - > { vnr } ;
my $ meta_disk = $ volume_vnr - > findvalue ( './meta-disk' ) ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
's1:volume' = > $ volume ,
's2:meta_disk' = > $ meta_disk ,
} } ) ;
$ anvil - > data - > { new } { resource } { $ resource } { host } { $ this_host_name } { volume } { $ volume } { device_path } = $ volume_vnr - > findvalue ( './device' ) ;
$ anvil - > data - > { new } { resource } { $ resource } { host } { $ this_host_name } { volume } { $ volume } { backing_disk } = $ volume_vnr - > findvalue ( './disk' ) ;
$ anvil - > data - > { new } { resource } { $ resource } { host } { $ this_host_name } { volume } { $ volume } { device_minor } = $ volume_vnr - > findvalue ( './device/@minor' ) ;
$ anvil - > data - > { new } { resource } { $ resource } { host } { $ this_host_name } { volume } { $ volume } { size } = 0 ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"s1:new::resource::${resource}::host::${this_host_name}::volume::${volume}::device_path" = > $ anvil - > data - > { new } { resource } { $ resource } { host } { $ this_host_name } { volume } { $ volume } { device_path } ,
"s2:new::resource::${resource}::host::${this_host_name}::volume::${volume}::backing_disk" = > $ anvil - > data - > { new } { resource } { $ resource } { host } { $ this_host_name } { volume } { $ volume } { backing_disk } ,
"s3:new::resource::${resource}::host::${this_host_name}::volume::${volume}::device_minor" = > $ anvil - > data - > { new } { resource } { $ resource } { host } { $ this_host_name } { volume } { $ volume } { device_minor } ,
} } ) ;
$ anvil - > data - > { new } { resource } { $ resource } { host } { $ this_host_name } { volume } { $ volume } { device_path } = $ volume_vnr - > findvalue ( './device' ) ;
$ anvil - > data - > { new } { resource } { $ resource } { host } { $ this_host_name } { volume } { $ volume } { backing_disk } = $ volume_vnr - > findvalue ( './disk' ) ;
$ anvil - > data - > { new } { resource } { $ resource } { host } { $ this_host_name } { volume } { $ volume } { device_minor } = $ volume_vnr - > findvalue ( './device/@minor' ) ;
$ anvil - > data - > { new } { resource } { $ resource } { host } { $ this_host_name } { volume } { $ volume } { size } = 0 ;
# Record the local data only.
if ( ( $ this_host_name eq $ anvil - > Get - > host_name ) or ( $ this_host_name eq $ anvil - > Get - > short_host_name ) )
{
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { device_path } = $ volume_vnr - > findvalue ( './device' ) ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { backing_disk } = $ volume_vnr - > findvalue ( './disk' ) ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { device_minor } = $ volume_vnr - > findvalue ( './device/@minor' ) ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { size } = 0 ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"s1:new::resource::${resource}::host::${this_host_name}::volume::${volume}::device_path" = > $ anvil - > data - > { new } { resource } { $ resource } { host } { $ this_host_name } { volume } { $ volume } { device_path } ,
"s2:new::resource::${resource}::host::${this_host_name}::volume::${volume}::backing_disk" = > $ anvil - > data - > { new } { resource } { $ resource } { host } { $ this_host_name } { volume } { $ volume } { backing_disk } ,
"s3:new::resource::${resource}::host::${this_host_name}:: volume::${volume}::device_minor" = > $ anvil - > data - > { new } { resource } { $ resource } { host } { $ this_host_nam e } { volume } { $ volume } { device_minor } ,
"s1:new::resource::${resource}::volume::${volume}::device_path" = > $ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { device_path } ,
"s2:new::resource::${resource}::volume::${volume}::backing_disk" = > $ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { backing_disk } ,
"s3:new::resource::${resource}::volume::${volume}::device_minor" = > $ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { device_minor } ,
} } ) ;
# Record the local data only.
if ( ( $ this_host_name eq $ anvil - > Get - > host_name ) or ( $ this_host_name eq $ anvil - > Get - > short_host_name ) )
{
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { device_path } = $ volume_vnr - > findvalue ( './device' ) ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { backing_disk } = $ volume_vnr - > findvalue ( './disk' ) ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { device_minor } = $ volume_vnr - > findvalue ( './device/@minor' ) ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { size } = 0 ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"s1:new::resource::${resource}::volume::${volume}::device_path" = > $ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { device_path } ,
"s2:new::resource::${resource}::volume::${volume}::backing_disk" = > $ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { backing_disk } ,
"s3:new::resource::${resource}::volume::${volume}::device_minor" = > $ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { device_minor } ,
} } ) ;
}
}
}
}
foreach my $ connection ( $ name - > findnodes ( './connection' ) )
foreach my $ connection ( $ name - > findnodes ( './connection' ) )
{
my $ peer = "" ;
foreach my $ host ( $ connection - > findnodes ( './host' ) )
{
my $ peer = "" ;
foreach my $ host ( $ connection - > findnodes ( './host' ) )
{
my $ this_host_name = $ host - > { name } ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { this_host_name = > $ this_host_name } } ) ;
my $ this_host_name = $ host - > { name } ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { this_host_name = > $ this_host_name } } ) ;
next if ( ( $ this_host_name eq $ anvil - > Get - > host_name ) or ( $ this_host_name eq $ anvil - > Get - > short_host_name ) ) ;
next if ( ( $ this_host_name eq $ anvil - > Get - > host_name ) or ( $ this_host_name eq $ anvil - > Get - > short_host_name ) ) ;
$ peer = $ this_host_name ;
$ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { peer_ip_address } = $ host - > findvalue ( './address' ) ;
$ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { tcp_port } = $ host - > findvalue ( './address/@port' ) ; ;
$ peer = $ this_host_name ;
$ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { peer_ip_address } = $ host - > findvalue ( './address' ) ;
$ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { tcp_port } = $ host - > findvalue ( './address/@port' ) ; ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"s1:new::resource::${resource}::peer::${peer}::peer_ip_address" = > $ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { peer_ip_address } ,
"s2:new::resource::${resource}::peer::${peer}::tcp_port" = > $ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { tcp_port } ,
} } ) ;
if ( not exists $ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { protocol } )
{
$ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { protocol } = "unknown" ;
$ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { fencing } = "unknown" ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"s1:new::resource::${resource}::peer::${peer}::peer_ip_address" = > $ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { peer_ip_address } ,
"s2:new::resource::${resource}::peer::${peer}::tcp_port" = > $ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { tcp_port } ,
"s1:new::resource::${resource}::peer::${peer}::protocol " = > $ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { protocol } ,
"s2:new::resource::${resource}::peer::${peer}::fencing" = > $ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { fencing } ,
} } ) ;
}
if ( not exists $ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { protocol } )
{
$ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { protocol } = "unknown" ;
$ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { fencing } = "unknown" ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"s1:new::resource::${resource}::peer::${peer}::protocol" = > $ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { protocol } ,
"s2:new::resource::${resource}::peer::${peer}::fencing" = > $ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { fencing } ,
} } ) ;
}
foreach my $ volume ( sort { $ a cmp $ b } keys % { $ anvil - > data - > { new } { resource } { $ resource } { volume } } )
{
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { peer } { $ peer } { connection_state } = "disconnected" ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { peer } { $ peer } { local_disk_state } = "down" ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { peer } { $ peer } { peer_disk_state } = "unknown" ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { peer } { $ peer } { local_role } = "down" ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { peer } { $ peer } { peer_role } = "unknown" ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { peer } { $ peer } { out_of_sync_size } = - 1 ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { peer } { $ peer } { replication_speed } = 0 ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { peer } { $ peer } { estimated_time_to_sync } = 0 ;
}
foreach my $ volume ( sort { $ a cmp $ b } keys % { $ anvil - > data - > { new } { resource } { $ resource } { volume } } )
{
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { peer } { $ peer } { connection_state } = "disconnected" ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { peer } { $ peer } { local_disk_state } = "down" ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { peer } { $ peer } { peer_disk_state } = "unknown" ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { peer } { $ peer } { local_role } = "down" ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { peer } { $ peer } { peer_role } = "unknown" ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { peer } { $ peer } { out_of_sync_size } = - 1 ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { peer } { $ peer } { replication_speed } = 0 ;
$ anvil - > data - > { new } { resource } { $ resource } { volume } { $ volume } { peer } { $ peer } { estimated_time_to_sync } = 0 ;
}
}
foreach my $ name ( $ connection - > findnodes ( './section' ) )
foreach my $ name ( $ connection - > findnodes ( './section' ) )
{
my $ section = $ name - > { name } ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { section = > $ section } } ) ;
foreach my $ option_name ( $ name - > findnodes ( './option' ) )
{
my $ section = $ name - > { name } ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { section = > $ section } } ) ;
my $ variable = $ option_name - > { name } ;
my $ value = $ option_name - > { value } ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
's1:variable' = > $ variable ,
's2:value' = > $ value ,
} } ) ;
foreach my $ option_name ( $ name - > findnodes ( './option' ) )
i f ( $ section eq "net" )
{
my $ variable = $ option_name - > { name } ;
my $ value = $ option_name - > { value } ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
's1:variable' = > $ variable ,
's2:value' = > $ value ,
} } ) ;
if ( $ section eq "net ")
if ( $ variable eq "protocol" )
{
$ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { protocol } = $ value ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"new::resource::${resource}::peer::${peer}::protocol" = > $ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { protocol } ,
} } ) ;
}
if ( $ variable eq "fencing ")
{
if ( $ variable eq "protocol" )
{
$ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { protocol } = $ value ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"new::resource::${resource}::peer::${peer}::protocol" = > $ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { protocol } ,
} } ) ;
}
if ( $ variable eq "fencing" )
{
$ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { fencing } = $ value ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"new::resource::${resource}::peer::${peer}::fencing" = > $ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { fencing } ,
} } ) ;
}
$ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { fencing } = $ value ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
"new::resource::${resource}::peer::${peer}::fencing" = > $ anvil - > data - > { new } { resource } { $ resource } { peer } { $ peer } { fencing } ,
} } ) ;
}
}
}