Commit 92cecdca authored by Leigh B Stoller's avatar Leigh B Stoller

Add disksize attribute to virt disks, per Yathi's request.

parent 0886d353
......@@ -4452,6 +4452,7 @@ CREATE TABLE `virt_node_disks` (
`vname` varchar(32) NOT NULL default '',
`diskname` varchar(32) NOT NULL default '',
`disktype` varchar(32) NOT NULL default '',
`disksize` int(11) unsigned NOT NULL default '0',
`mountpoint` tinytext,
`parameters` tinytext,
`command` tinytext,
......
......@@ -867,6 +867,7 @@ REPLACE INTO table_regex VALUES ('virt_node_disks','eid','text','redirect','expe
REPLACE INTO table_regex VALUES ('virt_node_disks','vname','text','redirect','virt_nodes:vname',0,0,NULL);
REPLACE INTO table_regex VALUES ('virt_node_disks','diskname','text','regex','^[-\\w]+$',2,32,NULL);
REPLACE INTO table_regex VALUES ('virt_node_disks','disktype','text','regex','^[-\\w]+$',2,32,NULL);
REPLACE INTO table_regex VALUES ('virt_node_disks','disksize','int','redirect','default:int',0,0,NULL);
REPLACE INTO table_regex VALUES ('virt_node_disks','mountpoint','text','redirect','default:tinytext',1,255,NULL);
REPLACE INTO table_regex VALUES ('virt_node_disks','parameters','text','redirect','default:tinytext',1,255,NULL);
REPLACE INTO table_regex VALUES ('virt_node_disks','command','text','redirect','default:tinytext',1,255,NULL);
......
#
# Minor mods to the virt_node_disks table.
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (!DBSlotExists("virt_node_disks", "disksize")) {
DBQueryFatal("alter table virt_node_disks add ".
" `disksize` int(11) unsigned NOT NULL default '0' ".
"after disktype");
}
DBQueryFatal("REPLACE INTO table_regex VALUES ".
" ('virt_node_disks','disksize','int','redirect', ".
" 'default:int',0,0,NULL)");
return 0;
}
1;
# Local Variables:
# mode:perl
# End:
# -*- tcl -*-
#
# EMULAB-COPYRIGHT
......@@ -24,6 +25,7 @@ Disk instproc init {s} {
$self set sim $s
$self set node {}
$self set type {}
$self set size 0
$self set mountpoint {}
$self set parameters {}
$self set command {}
......@@ -48,6 +50,7 @@ Disk instproc updatedb {DB} {
var_import ::TBCOMPAT::objtypes
$self instvar node
$self instvar type
$self instvar size
$self instvar mountpoint
$self instvar parameters
$self instvar sim
......@@ -58,8 +61,8 @@ Disk instproc updatedb {DB} {
return
}
set fields [list "vname" "diskname" "disktype" "mountpoint"]
set values [list $node $self $type $mountpoint]
set fields [list "vname" "diskname" "disktype" "disksize" "mountpoint"]
set values [list $node $self $type $size $mountpoint]
if { $parameters != "" } {
lappend fields "parameters"
......
......@@ -709,12 +709,13 @@ Node instproc program-agent {args} {
Node instproc disk-agent {args} {
::GLOBALS::named-args $args {
-type {} -mountpoint {} -parameters {} -command {}
-type {} -size 0 -mountpoint {} -parameters {} -command {}
}
set curdisk [new Disk [$self set sim]]
$curdisk set node $self
$curdisk set type $(-type)
$curdisk set size $(-size)
$curdisk set mountpoint $(-mountpoint)
$curdisk set parameters $(-parameters)
$curdisk set command $(-command)
......
......@@ -1786,6 +1786,7 @@ Simulator instproc make_event {outer event} {
set default_name $obj
set default_type [$obj set type]
set default_size [$obj set size]
set default_mountpoint [$obj set mountpoint]
set default_params [$obj set parameters]
......@@ -1793,6 +1794,7 @@ Simulator instproc make_event {outer event} {
::GLOBALS::named-args $evargs [list \
-name $default_name \
-type $default_type \
-size $default_size \
-mountpoint $default_mountpoint \
-parameters $default_params \
]
......@@ -1803,6 +1805,9 @@ Simulator instproc make_event {outer event} {
if {$(-type) != {}} {
set args "${args}DISKTYPE=$(-type) "
}
if {$(-size) != {}} {
set args "${args}DISKSIZE=$(-size) "
}
if {$(-mountpoint) != {}} {
set args "${args}MOUNTPOINT=$(-mountpoint) "
}
......@@ -1821,6 +1826,7 @@ Simulator instproc make_event {outer event} {
set args "DISKNAME=$default_name "
set args "${args}DISKTYPE= "
set args "${args}DISKSIZE= "
set args "${args}MOUNTPOINT= "
set args "${args}PARAMETERS= "
set default_cmd [$obj set command]
......@@ -1843,6 +1849,7 @@ Simulator instproc make_event {outer event} {
set args "DISKNAME=$default_name "
set args "${args}DISKTYPE= "
set args "${args}DISKSIZE= "
set args "${args}MOUNTPOINT= "
set args "${args}PARAMETERS= "
set default_cmd [$obj set command]
......
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