Skip to contentSkip to conversation

Which UPS simulator?

uml-devel Dan Shearer 2 participants 5 messages Feb 12, 2004 – Feb 13, 2004 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

I propose using a standard UPS interface as a way for mconsole to trigger a full system shutdown. I don't know the UPS market well and am hoping someone can point me a to a more open protocol that what I've found so far. This doesn't solve the bigger problem of UML control from mconsole, but it addresses one immediate need.

The key thing is that this doesn't require the user of the uml to use any special software or configurations, which in turn means I don't have to give anyone any more training than a URL for standard Linux UPS software.

http://quasar.mathstat.uottawa.ca/~selinger/ups/simulator.c is easy to find. It mostly implements an informally documented protocol
(http://quasar.mathstat.uottawa.ca/~selinger/ups/belkin-universal-ups.html)
and is GPLd. Some slight mods in how the communications happen and this could be how mconsole talks to a ups daemon listening on one of the virtual serial ports. Not sure if this includes upsd that comes with many distros however this UPS is listed as supported at
http://eu1.networkupstools.org.

Anyone know of a simulator for a more open/more appropriate UPS protocol that is understood by more than one of the open source UPS daemons?

Signature · 13 lines
Dan Shearer
[email protected]


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#1 lore raw

Moin Dan Shearer,

why UPS simulation ? I'm using normal mconsole cad feature to power down my UMLs. I only have to ensure that the inittab will trigger a halt with "ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -h now" instead of rebooting. I then have some helpfull scripts.

/opt/uml/bin/uml is using screen :

#------------------------------------------------------------------------------
#!/bin/sh

[ $# = 1 ] || {
echo usage: uml machine
exit 0
}
[ -f /opt/uml/$1/$1.config ] || {
echo machine $1 not defined
}

if [ -f /opt/uml/$1/$1.running ]
then

    screen -d -r $1
else
    screen -S $1 /opt/uml/bin/uml-start $1

fi
exit 0
#------------------------------------------------------------------------------

/opt/uml/bin/uml-start does a filesystemcheck :

#------------------------------------------------------------------------------
#!/bin/sh

cd /opt/uml/

[ whoami != "root" ] && {
echo "only root can use $0"
exit 1
}
[ $# != 1 ] && {
echo "usage: $0 name"
exit 0
}

[ ! -f $1/$1.root.img ] && {
        echo "$1/$1.root.img not found"
        exit 0
        }
[ ! -f $1/$1.swap.img ] && {
        echo "$1/$1.swap.img not found"
        exit 0
        }
[ ! -f $1/$1.options ] && {
        echo "$1/$1.options not found"
        exit 0
        }
[ ! -f /opt/uml/$1/$1.linux ] && {
        echo "/opt/uml/$1/$1.linux not found"
        exit 0
        }

[ -f $1/$1.running ] && {
echo "$1 already running"
exit 0
}

touch $1/$1.running

[ -d $1/$1.root.fs/lost+found ] && umount $1/$1.root.fs [ -d $1/$1.work.fs/lost+found ] && umount $1/$1.work.fs

echo checking file systems :
[ -f $1/$1.root.img ] && e2fsck -y -f -v $1/$1.root.img [ -f $1/$1.work.img ] && e2fsck -y -f -v $1/$1.work.img echo done.

/opt/uml/$1/$1.linux cat $1/$1.options

# [ -d $1/$1.root.fs ] && mount -o loop $1/$1.root.img $1/$1.root.fs # [ -d $1/$1.work.fs ] && mount -o loop $1/$1.work.img $1/$1.work.fs

rm -f $1/$1.running

exit 0
#------------------------------------------------------------------------------

/opt/uml/bin/uml-stop will halt systems

#------------------------------------------------------------------------------
#!/bin/sh

cd /opt/uml

echo -n UML shutdown systems :

for s
do

    x=$s/$s.running
    if [ ! -f "$x" ] 
    then
        echo " no systems up."
        exit 0
    else
        echo -n " $s "
        echo cad | uml_mconsole $s 2>/dev/null >/dev/null
        echo -n ".";sleep 1
        echo -n ".";sleep 1
        echo -n ".";sleep 1
    fi

done

echo done.

echo -n UML waiting for systems :
while true
do

    for s
    do
	x=$s/$s.running
        if [ ! -f "$x" ] 
        then
            echo all systems down.
            exit 0
        else
            echo -n " $s "
        fi
    done
    echo -n ".";sleep 1
    echo -n ".";sleep 1
    echo -n ".";sleep 1

done
#------------------------------------------------------------------------------

ask me for a complete shar.gz or tar.gz of my current UML environment :

  uml          uml-copydef      uml-gen      uml-start     uml-tunctl
  uml-bkup     uml-createfs     uml-mount    uml-startall  uml-umount
  uml-bkupall  uml-forward      uml-net      uml-stop      uml_switch
  uml-config   uml-forward-old  uml-running  uml-stopall
  uml-copyall  uml-fsck         uml-screen   uml-tap1

each UML is defined by a small text config file, so a lot of UMLs can be managed in a simple way. Backups for virtual UML machines and migration to other hosts is semiautomatic. e.g. noam is the site hosting www.copyleft.de and other domains :

#------------------------------------------------------------------------------
HOST="noam"
DOMAIN="copyleft.de"
MODULES=""

#ETH0OPT="tuntap,,,193.101.47.67"
ETH0BASE="193.101.47"
ETH0WORK="193.101.47.64"
ETH0GATE="193.101.47.65"
ETH0ADDR="193.101.47.67"
ETH0CAST="193.101.47.95"
ETH0MASK="255.255.255.224"

NAMESERVER="193.101.47.33"
PROXY="193.101.47.33:3128"

ROOT="/dev/ubd0"
SWAP="/dev/ubd1"
WORK="/dev/ubd2"

STORSIZE=64
SWAPSIZE=128
ROOTSIZE=256
WORKSIZE=2048
#------------------------------------------------------------------------------

I recently reinstalled my Libretto laptop :

      Linux makhno 2.6.1-l5skas1 #1 Wed Feb 4 02:25:54 UTC 2004 i686 GNU/Linux

All i had to do to to run noam on this machine was :

ssh makhno mkdir -p /opt/uml/bin
scp /opt/uml/bin/* makhno:/opt/uml/bin
uml-copydef skel makhno
uml-copydef noam makhno
uml-bkup noam makhno
ssh makhno
export PATH=/opt/uml/bin:$PATH
uml-net
uml noam

Bye Michael

Signature · 13 lines
  mailto:[email protected]             UNA:+.? 'CED+2+:::Linux:2.4.22'UNZ+1'
  http://www.xml-edifact.org/           CETERUM CENSEO WINDOWS ESSE DELENDAM


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#2 lore raw
Quoted 6 lines · Michael Koehne

Moin Dan Shearer,

why UPS simulation ? I'm using normal mconsole cad feature to power down my UMLs. I only have to ensure that the inittab will trigger a halt with "ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -h now" instead of rebooting. I then have some helpfull scripts.

That is exactly what I want to avoid. I want a more accurate UML where no UML-specific logic is needed for communication -- from one point of view that is what communication is all about. There are plenty of ways of introducing new communications methods (such as you have done, or a special listening port, etc) into the UML.

Signature · 13 lines
Dan Shearer
[email protected]


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#3 lore raw

Moin Dan Shearer,

Quoted 5 lines

That is exactly what I want to avoid. I want a more accurate UML where no UML-specific logic is needed for communication -- from one point of view that is what communication is all about. There are plenty of ways of introducing new communications methods (such as you have done, or a special listening port, etc) into the UML.

implementing an UPS would also only require existing uml technics, as APC and Berkin UPS are talking to a serial line. But it would require some special program running inside and outside your UML, while my simple script only require to cad line to be right.

see http://quasar.mathstat.uottawa.ca/~selinger/ups/simulator.c
for Berkin simulator and demons, or reference apcupsd for APC and reverse enginier a simulator.

Bye Michael

Signature · 13 lines
  mailto:[email protected]             UNA:+.? 'CED+2+:::Linux:2.4.22'UNZ+1'
  http://www.xml-edifact.org/           CETERUM CENSEO WINDOWS ESSE DELENDAM


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#4 lore raw
Quoted 8 lines · Michael Koehne

Moin Dan Shearer,

Quoted 5 lines

That is exactly what I want to avoid. I want a more accurate UML where no UML-specific logic is needed for communication -- from one point of view that is what communication is all about. There are plenty of ways of introducing new communications methods (such as you have done, or a special listening port, etc) into the UML.

Quoted 4 lines

implementing an UPS would also only require existing uml technics, as APC and Berkin UPS are talking to a serial line. But it would require some special program running inside and outside your UML, while my simple script only require to cad line to be right.

Just depends on what you want to achive. You are correct, but your way requires something different to real life. My point remains that a UML user with root has only to run "some special program" that is a standard UPS tool that he can read about in any Linux reference.

Quoted 3 lines

see http://quasar.mathstat.uottawa.ca/~selinger/ups/simulator.c
for Berkin simulator and demons, or reference apcupsd for APC and reverse enginier a simulator.

Read my original message, where I quoted exactly this URL (and Cc'd the author.)

Signature · 13 lines
Dan Shearer
[email protected]


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel