@ -427,12 +427,15 @@ ORDER BY
{
{
# If there are two or three VGs, we can create a group.
# If there are two or three VGs, we can create a group.
my $ count = keys % { $ anvil - > data - > { ungrouped_vgs } { $ scan_lvm_vg_size } { host_uuid } } ;
my $ count = keys % { $ anvil - > data - > { ungrouped_vgs } { $ scan_lvm_vg_size } { host_uuid } } ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { count = > $ count } } ) ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
scan_lvm_vg_size = > $ scan_lvm_vg_size . " (" . $ anvil - > Convert - > bytes_to_human_readable ( { 'bytes' = > $ scan_lvm_vg_size } ) . ")" ,
count = > $ count ,
} } ) ;
if ( ( $ count == 2 ) or ( $ count == 3 ) )
if ( ( $ count == 2 ) or ( $ count == 3 ) )
{
{
# Create the volume group ... group. First we need a group number
# Create the volume group ... group. First we need a group number
my $ storage_group_uuid = $ anvil - > Database - > insert_or_update_storage_groups ( {
my $ storage_group_uuid = $ anvil - > Database - > insert_or_update_storage_groups ( {
debug = > $ debug ,
debug = > 2 ,
storage_group_anvil_uuid = > $ anvil_uuid ,
storage_group_anvil_uuid = > $ anvil_uuid ,
} ) ;
} ) ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { storage_group_uuid = > $ storage_group_uuid } } ) ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { storage_group_uuid = > $ storage_group_uuid } } ) ;
@ -448,7 +451,7 @@ ORDER BY
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { storage_group_member_vg_uuid = > $ storage_group_member_vg_uuid } } ) ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { storage_group_member_vg_uuid = > $ storage_group_member_vg_uuid } } ) ;
my $ storage_group_member_uuid = $ anvil - > Database - > insert_or_update_storage_group_members ( {
my $ storage_group_member_uuid = $ anvil - > Database - > insert_or_update_storage_group_members ( {
debug = > $ debug ,
debug = > 2 ,
storage_group_member_storage_group_uuid = > $ storage_group_uuid ,
storage_group_member_storage_group_uuid = > $ storage_group_uuid ,
storage_group_member_host_uuid = > $ host_uuid ,
storage_group_member_host_uuid = > $ host_uuid ,
storage_group_member_vg_uuid = > $ storage_group_member_vg_uuid ,
storage_group_member_vg_uuid = > $ storage_group_member_vg_uuid ,
@ -461,6 +464,9 @@ ORDER BY
} } ) ;
} } ) ;
}
}
# Delete this so we don't keel creating new Storage groups.
delete $ anvil - > data - > { ungrouped_vgs } { $ scan_lvm_vg_size } ;
# Reload storage group data
# Reload storage group data
$ reload_storage_groups = 1 ;
$ reload_storage_groups = 1 ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { reload_storage_groups = > $ reload_storage_groups } } ) ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { reload_storage_groups = > $ reload_storage_groups } } ) ;