Commit c6073582 authored by Leigh Stoller's avatar Leigh Stoller

Add HasVirtInterfaces() method for call from tbswap.

parent 083db958
......@@ -3277,7 +3277,8 @@ sub RemovePhysicalState($;$)
# Interfaces table is special. Also cleaned in nfree.
DBQueryWarn("update interfaces set IP='',IPaliases=NULL,mask=NULL,".
" rtabid='0',vnode_id=NULL,current_speed='0' " .
" rtabid='0',vnode_id=NULL,current_speed='0', " .
" trunk='0',trunk_mode='equal' ".
"where ($clause) and ".
" role='" . TBDB_IFACEROLE_EXPERIMENT() . "' ")
or $errors++;
......@@ -4696,6 +4697,25 @@ sub HasVirtNodes($)
return $query_result->num_rows;
}
sub HasVirtInterfaces($)
{
my ($self) = @_;
# Must be a real reference.
return -1
if (!ref($self));
my $idx = $self->idx();
my $query_result =
DBQueryWarn("select node_id from vinterfaces ".
"where exptidx=$idx");
return -1
if (!$query_result);
return $query_result->num_rows;
}
#
# Set/Unset the lockdown bit.
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment