Changes between Initial Version and Version 1 of FlowVisor/UpgradingTo0.8.17


Ignore:
Timestamp:
12/27/12 19:45:20 (11 years ago)
Author:
Josh Smift
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FlowVisor/UpgradingTo0.8.17

    v1 v1  
     1[[PageOutline]]
     2
     3= Upgrading to !FlowVisor 0.8.17 =
     4
     5Upgrading to !FlowVisor 0.8.17 is slightly tricky, because the process is different depending whether your current configuration is in a database, or in a flat XML file. FV 0.8.2 and earlier used a flat XML file; 0.8.3 and later use a database.
     6
     7Before doing anything else: If you were previously storing your FV password in /etc/flowvisor/fvpasswd, move it to the new recommended location, /etc/flowvisor.passwd:
     8
     9{{{
     10sudo mv /etc/flowvisor/fvpasswd /etc/flowvisor.passwd
     11}}}
     12
     13If you were storing your FV password in a different file, you can move it or not, as you like. (But if you don't put it in /etc/flowvisor.passwd, you'll need to edit all the fvctl commands below.)
     14
     15Identifying which version of !FlowVisor you have now can be slightly tricky, because 'fvctl ping' gives incorrect results in some versions. One reliable way to tell is whether 'fvctl dumpConfig' command works: Try
     16
     17{{{
     18fvctl --passwd-file=/etc/flowvisor.passwd dumpConfig /tmp/config.json
     19}}}
     20
     21If that says "command 'dumpConfig' does not exist" (and prints a long usage message), you have an XML-based version. If it creates a JSON version of your FV configuration, you have a DB-based version. Follow the appropriate subsection in the "Upgrade the software" section below!
     22
     23= Common pre-install steps =
     24
     25First, there are some things to do regardless of which version you're upgrading from.
     26
     27== Capture state before the upgrade ==
     28
     29Get a dump of the flowspace and slice info:
     30
     31{{{
     32cd
     33rm -rf ~/tmp/flowvisor-upgrade
     34mkdir -p ~/tmp/flowvisor-upgrade/before
     35cd ~/tmp/flowvisor-upgrade/before
     36
     37fvctl --passwd-file=/etc/flowvisor.passwd dumpConfig config.json
     38fvctl --passwd-file=/etc/flowvisor.passwd listFlowSpace | sed -re 's/id=\[[0-9\-]+\]/[id number stripped]/' > flowspace
     39for slice in $(fvctl --passwd-file=/etc/flowvisor.passwd listSlices | awk '{print $3}' | sort); do echo "Info for slice: $slice" ; fvctl --passwd-file=/etc/flowvisor.passwd getSliceInfo $slice | egrep -v ^connection_[0-9]+= | sort ; done > sliceinfo
     40}}}
     41
     42You'll diff this later against similar output from after the upgrade.
     43
     44(If you're running an XML-based version, the 'fvctl dumpConfig' command won't actually do anything; that's normal and expected.)
     45
     46== Check your current version ==
     47
     48Try both of these commands:
     49
     50{{{
     51fvctl --passwd-file=/etc/flowvisor.passwd ping pong
     52dpkg -s flowvisor | grep ^Version
     53}}}
     54
     55Just keep track of the output for now, in case you end up wanting to know later.
     56
     57== Update your APT sources entry ==
     58
     59Update the FOAM apt sources entry, changing
     60
     61{{{
     62deb http://updates.flowvisor.org/openflow/downloads/GENI/DEB unstable/binary-$(ARCH)/
     63}}}
     64
     65to
     66
     67{{{
     68deb http://updates.onlab.us/debian stable contrib
     69}}}
     70
     71(This is a little vague because you might have this entry in /etc/apt/sources.list, or /etc/apt/sources.list.d/<something>, or some other place. But probably one of those two.)
     72
     73Make sure that worked and that it's available:
     74
     75{{{
     76sudo apt-get update
     77apt-cache show flowvisor | grep "^Version"
     78}}}
     79
     80The output of the second command should include a line saying "Version: 0.8.17", as well as a line for whatever version you currently have.
     81
     82Configure APT to trust the ONL signing key:
     83
     84{{{
     85cd
     86wget http://updates.onlab.us/debian/onlab-repo.gpg
     87sudo apt-key add onlab-repo.gpg
     88rm onlab-repo.gpg
     89}}}
     90
     91= Version-specific steps =
     92
     93Make sure you do only '''one''' of these subsections!
     94
     95== Upgrading from an XML-based version ==
     96
     97Do this subsection '''only''' if you're upgrading from an XML-based version!
     98
     99Upgrading from an XML version requires you to convert the flat XML configuration file into FV's new database format. (Or you can throw away your current !FlowVisor state, if you're really really sure that you don't care about any of it, but you probably don't want to do that.)
     100
     101Stop the currently running Flowvisor:
     102
     103{{{
     104sudo service flowvisor stop
     105}}}
     106
     107Check whether you currently have /etc/flowvisor, /usr/etc/flowvisor, or both, and what user owns them -- if it's '''not''' 'flowvisor', remember this fact, because there will be an additional important step later.
     108
     109{{{
     110ls -Flad /etc/flowvisor /usr/etc/flowvisor
     111}}}
     112
     113If you don't have either /etc/flowvisor or /usr/etc/flowvisor, something is probably amiss; get GPO and/or ONL involved to help figure out what's going on.
     114
     115If /etc/flowvisor is a symlink, remove it:
     116
     117{{{
     118sudo rm /etc/flowvisor
     119}}}
     120
     121If you now have a directory /usr/etc/flowvisor, and no /etc/flowvisor, rename the directory:
     122
     123{{{
     124sudo mv /usr/etc/flowvisor /etc/flowvisor
     125}}}
     126
     127At the end of all that, you should have your existing config directory in /etc/flowvisor. If it's '''not''' owned by the 'flowivsor' user, remember this -- there will be an additional important step later.
     128
     129Install the software, and remove old dependencies that aren't needed any more:
     130
     131{{{
     132sudo apt-get install flowvisor
     133sudo apt-get autoremove
     134}}}
     135
     136If your /etc/flowvisor directory, and its contents, are '''not''' owned by the 'flowvisor' user, change it:
     137
     138{{{
     139sudo chown flowvisor:flowvisor -Rh /etc/flowvisor
     140}}}
     141
     142Generate a new FV database (just hit return when prompted for a password, this will be overwritten by the next step; and ignore the "keytool error" error, it's just telling you that you already have a key pair):
     143
     144{{{
     145sudo -u flowvisor fvconfig generate /dev/null
     146}}}
     147
     148Convert your config.xml file to a config.json file
     149
     150{{{
     151sudo -u flowvisor fvconfig convert /etc/flowvisor/config.xml
     152}}}
     153
     154There are three !FlowVisor variables that are off by default in new installations, but may be on in upgraded ones, which we recommend that you turn off: run_topology_server, stats_desc_hack, and checkpointing.
     155
     156To do that, edit your new config.json file, e.g. with 'sed' like this:
     157
     158{{{
     159sudo -u flowvisor sed -i -e 's/"run_topology_server": true/"run_topology_server": false/' /etc/flowvisor/config.json
     160sudo -u flowvisor sed -i -e 's/"stats_desc_hack": true/"stats_desc_hack": false/' /etc/flowvisor/config.json
     161sudo -u flowvisor sed -i -e 's/"checkpointing": true/"checkpointing": false/' /etc/flowvisor/config.json
     162}}}
     163
     164Load it into the new database:
     165
     166{{{
     167sudo -u flowvisor fvconfig load /etc/flowvisor/config.json
     168}}}
     169
     170Now skip down to "Common post-install steps".
     171
     172== Upgrading from a DB-based version ==
     173
     174Do this subsection '''only''' if you're upgrading from an DB-based version!
     175
     176Upgrading from a DB version prior to 0.8.17 may delete your entire database, and the 'flowvisor' user. This section includes steps to back up and restore the DB; the new version will re-create the 'flowvisor' user, but if it gets a different UID than it had before, you may also have to fix up some permissions on various files and directories.
     177
     178So, just in case, get the UID of the current 'flowvisor' user:
     179
     180{{{
     181id flowvisor
     182}}}
     183
     184Keep track of this UID for a later step.
     185
     186Back up your current database:
     187
     188{{{
     189fvctl --passwd-file=/etc/flowvisor.passwd dumpConfig config-backup.json
     190}}}
     191
     192Stop the currently running Flowvisor:
     193
     194{{{
     195sudo service flowvisor stop
     196}}}
     197
     198Remove the current verson, and the old database:
     199
     200{{{
     201sudo apt-get remove flowvisor
     202sudo rm -rf /usr/share/db/flowvisor
     203}}}
     204
     205Install the software, and remove old dependencies that aren't needed any more:
     206
     207{{{
     208sudo apt-get install flowvisor
     209sudo apt-get autoremove
     210}}}
     211
     212(There may not be any old dependencies, in which case the second command won't do anything; that's fine.)
     213
     214If your /etc/flowvisor directory, and its contents, are '''not''' owned by the 'flowvisor' user, change it, and also some other places where !FlowVisor stores files, and check for any other stray files owned by the old UID:
     215
     216{{{
     217sudo chown flowvisor:flowvisor -Rh /etc/flowvisor /var/log/flowvisor /tmp/jna /tmp/config.json
     218sudo find / -user OLDUID -print
     219}}}
     220
     221where "OLDUID" is the old UID you found before.
     222
     223Generate a new FV database (just hit return when prompted for a password, this will be overwritten by the next step; and ignore the "keytool error" error, it's just telling you that you already have a key pair):
     224
     225{{{
     226sudo -u flowvisor fvconfig generate /dev/null
     227}}}
     228
     229There are three !FlowVisor variables that are off by default in new installations, but may be on in upgraded ones, which we recommend that you turn off: run_topology_server, stats_desc_hack, and checkpointing.
     230
     231To do that, edit your new config.json file, e.g. with 'sed' like this:
     232
     233{{{
     234sudo -u flowvisor sed -i -e 's/"run_topology_server": true/"run_topology_server": false/' /etc/flowvisor/config.json
     235sudo -u flowvisor sed -i -e 's/"stats_desc_hack": true/"stats_desc_hack": false/' /etc/flowvisor/config.json
     236sudo -u flowvisor sed -i -e 's/"checkpointing": true/"checkpointing": false/' /etc/flowvisor/config.json
     237}}}
     238
     239Load it into the new database:
     240
     241{{{
     242sudo -u flowvisor fvconfig load /etc/flowvisor/config.json
     243}}}
     244
     245Now skip down to "Common post-install steps".
     246
     247= Common post-install steps =
     248
     249Finally, there are some things to do regardless of which version you're upgrading from.
     250
     251== Rotate some old logs ==
     252
     253While FV is conveniently down, rotate some old logs out of the way:
     254
     255{{{
     256sudo mv /var/log/flowvisor/flowvisor-stderr.log /var/log/flowvisor/flowvisor-stderr.log.1
     257sudo mv /var/log/flowvisor/flowvisor.log /var/log/flowvisor/flowvisor.log.1
     258sudo gzip /var/log/flowvisor/*.log.1
     259}}}
     260
     261If one or the other of those don't exist, you'll get an error saying as much from the appropriate 'sudo mv' command, which you can safely ignore.
     262
     263== Fire it up ==
     264
     265Start up !FlowVisor:
     266
     267{{{
     268sudo service flowvisor start
     269}}}
     270
     271Make sure it's listening:
     272
     273{{{
     274fvctl --passwd-file=/etc/flowvisor.passwd ping pong
     275}}}
     276
     277That should print "PONG(fvadmin): FV version=flowvisor-0.8.17::pong". If you get a "connection refused" error, wait a few more seconds and try again. It shouldn't take more than 30 seconds or a minute to start up; if it's still not working after that long, something has gone wrong, and you should probably get GPO and/or ONL involved to help.
     278
     279== Compare the new "after" state to the "before" state ==
     280
     281Get a dump of the flowspace and slice info:
     282
     283{{{
     284cd
     285rm -rf ~/tmp/foam-upgrade/after
     286mkdir -p ~/tmp/flowvisor-upgrade/after
     287cd ~/tmp/flowvisor-upgrade/after
     288
     289fvctl --passwd-file=/etc/flowvisor.passwd dumpConfig config.json
     290fvctl --passwd-file=/etc/flowvisor.passwd listFlowSpace | sed -re 's/id=\[[0-9\-]+\]/[id number stripped]/' > flowspace
     291for slice in $(fvctl --passwd-file=/etc/flowvisor.passwd listSlices | awk '{print $3}' | sort); do echo "Info for slice: $slice" ; fvctl --passwd-file=/etc/flowvisor.passwd getSliceInfo $slice | egrep -v ^connection_[0-9]+= | sort ; done > sliceinfo
     292}}}
     293
     294Diff the results against the "before" results:
     295
     296{{{
     297cd ~/tmp/flowvisor-upgrade/before
     298for file in * ; do diff -u $file ../after/$file ; done
     299}}}
     300
     301You'll probably see some minor differences, including some or all of:
     302
     303 * In config.json, checkpointing, stats_desc_hack, and run_topology_server changing from true to false.
     304 * In config.json, 'version changing to "flowvisor-0.8.17".
     305 * In sliceinfo and config.json, controller_port values changing.
     306 * In sliceinfo and config.json, drop_policy settings changing.
     307
     308None of those are cause for alarm, nor is it alarming if you ''don't'' see some of those differences.
     309
     310Anything beyond those is unexpected, and worth looking into with GPO and/or ONL.
     311
     312== Clean up ==
     313
     314Once you're confident that this is all working as expected, make a backup copy of your configs just in case, and remove them from /etc/flowvisor:
     315
     316{{{
     317cp /etc/flowvisor/config.{xml,json} ~
     318sudo -u flowvisor rm /etc/flowvisor/config.{xml,json}
     319}}}
     320
     321That's it! Enjoy FV 0.8.17.