11
WP3 Status Report & Plan 1 Blueprint of Roll-back workflow Nice Meeting, January 7th/8th [email protected] [email protected]

WP3 Status Report & Plan1 Blueprint of Roll-back workflow Nice Meeting, January 7th/8th [email protected] [email protected]

Embed Size (px)

Citation preview

Page 1: WP3 Status Report & Plan1 Blueprint of Roll-back workflow Nice Meeting, January 7th/8th Paulo.Trezentos@caixamagica.pt John.Thomson@caixamagica.pt

WP3 Status Report & Plan 1

Blueprint of Roll-back workflow

Nice Meeting, January 7th/8th

[email protected]@caixamagica.pt

Page 2: WP3 Status Report & Plan1 Blueprint of Roll-back workflow Nice Meeting, January 7th/8th Paulo.Trezentos@caixamagica.pt John.Thomson@caixamagica.pt

WP3 Status Report & Plan 2

% pre-install DSL% post-install DSL#!/bin/shif [ condition ]; then

dslstart UpdateMimeTypeCache if [ -x "`which update-mime-database 2>/dev/null`" ]; then

update-mime-database /usr/share/mimefidslend UpdateMimeTypeCache

fidslstart PostinstUdevif [ "$1" = configure ]; then

if [ -e "#OLD#" ]; thenecho "Preserving user changes to #RULE# ..."if [ -e "#RULE#" ]; then

mv -f "#RULE#" "#RULE#.dpkg-new"fimv -f "#OLD#" "#RULE#"

fifidslstop PostinstUdevdslstart UnknownTemplateif [ "$1" = purge ]; then if [ -d $OLD_DIR ]; then rm -f $OLD_DIR/$SCHEMA fifidslstop UnknownTemplate

Usecase 1 :Non-invertibleMaint. Script *

Unclassified chunk of code. Will not be logged.

Template detected by UdA engine but without inverse DSL.

* assuming in this case the template is non-invertible.

Page 3: WP3 Status Report & Plan1 Blueprint of Roll-back workflow Nice Meeting, January 7th/8th Paulo.Trezentos@caixamagica.pt John.Thomson@caixamagica.pt

WP3 Status Report & Plan 3

% pre-install DSL. /var/lib/mancoosi/libdsl/libdsl.sh% post-install DSL#!/bin/shif [ condition ]; then

dslstart UpdateMimeTypeCache if [ -x "`which update-mime-database 2>/dev/null`" ]; then

update-mime-database /usr/share/mimefidslend UpdateMimeTypeCache

elsedslstart PostinstUdevif [ "$1" = configure ]; then

echo "Preserving user changes to #RULE# ..."mv -f "#RULE#" "#RULE#.dpkg-new"

fidslstop PostinstUdev

fi

sub Rollback_UpdateMimeTypeCache {dslend Reverse_UpdateMimeTypeCache if [ "$1" = "configure" ]; then

update-mime-database /usr/share/mimefidslstart Reverse_UpdateMimeTypeCache

}sub Rollback_PostinstUdev {

dslstart PostinstUdev rm -rf /* mv -f "#RULE#" "#RULE#.dpkg-new"

dslstop PostinstUdev}

Inverse functions for templates.

(Debian style) Template definition

Usecase 2 :Invertible *

Maint. Script

Non functional – syntactical sugar

* In this case assuming that the fn is invertible

Page 4: WP3 Status Report & Plan1 Blueprint of Roll-back workflow Nice Meeting, January 7th/8th Paulo.Trezentos@caixamagica.pt John.Thomson@caixamagica.pt

WP3 Status Report & Plan 4

% pre-install DSL. /var/lib/mancoosi/libdsl/libdsl.sh% post-install DSL#!/bin/sh

dslstart PostinstUdevif [ "$1" = configure ]; then

echo "Preserving user changes to #RULE# ..."mv -f "#RULE#" "#RULE#.dpkg-new"

fidslstop PostinstUdev

1.- Possible; this is an empty « on purpose » rollback. The rollback is doing nothingsub Rollback_PostinstUdev { }

2.- Not possible/Not defined.# No roll-back is defined by the absense of a function

3.- Doing somethingsub Rollback_PostinstUdev {

rn -f "#RULE#" "#RULE#.dpkg-new"

}

Special case of 3 above.4.- self inverting function – running the function is the logical inverse of itselfsub Rollback_PostinstUdev {

if [ "$1" = configure ]; thenecho "Preserving user changes to #RULE# ..."mv -f "#RULE#" "#RULE#.dpkg-new"

fi}

Different implementations of Rollback functions

Page 5: WP3 Status Report & Plan1 Blueprint of Roll-back workflow Nice Meeting, January 7th/8th Paulo.Trezentos@caixamagica.pt John.Thomson@caixamagica.pt

WP3 Status Report & Plan 5

foo.rpm

Maint. Scripts .sh

foo.rpm

DSLMaint. Scripts Processed .sh

foo.rpm

DSLMaint. Scripts DSL compliant.sh

LinuxEditor (Distribution)

Linux Systemapt-get install

foo

UdA engine

Maintainer Editing for adding roll-back functions

DSL'isationof existing

scripts:usecase1->usecase2

Page 6: WP3 Status Report & Plan1 Blueprint of Roll-back workflow Nice Meeting, January 7th/8th Paulo.Trezentos@caixamagica.pt John.Thomson@caixamagica.pt

WP3 Status Report & Plan 6

DSL approachapt-get install foo (final scenario)

model_simulator ( )model_simulator ( )

DSL_dispatcher_pre ( )DSL_dispatcher_pre ( )

run_transaction ()run_transaction ()

DSL_dispatcher_post ( )DSL_dispatcher_post ( )

Input: DSL+Model

Output: success | failure

bash_trap (pre_inst.sh,TID)bash_trap (pre_inst.sh,TID)

executePreInstScript(); -> actions performed over system using bash_trap(); -> DSL_log_written

executePostInstScript(); -> actions performed over system -> DSL_log_written if ( checkDSL_log() != invertible) && bashTrapReturn != fail { -> Associate SysCall changes to TID in DSL_Log_DB. } else -> No_rollback_possible()

Input: script + TID

Output: tarball with file changes

bash_trap (post_inst.sh,TID)bash_trap (post_inst.sh,TID)

Program

flow

Page 7: WP3 Status Report & Plan1 Blueprint of Roll-back workflow Nice Meeting, January 7th/8th Paulo.Trezentos@caixamagica.pt John.Thomson@caixamagica.pt

WP3 Status Report & Plan 7

DSL approachapt-get rollback TID_foo

model_simulator ( )model_simulator ( ) Input: DSL+Model

Output: success | failure

foreach (STID)

ExecuteInverseFunction()

Where STID = sub-transaction ID

RestoreFileChanges() [using VCS]

DSL_dispatcher_rollback_post ( )DSL_dispatcher_rollback_post ( )

run_transaction ()run_transaction ()

→check_if_TID_invertible() → If (invertible == DSL)

-> If (inversible == SysCall)

restoring_FS_changes ()restoring_FS_changes ()

DSL_dispatcher_rollback_pre ( )DSL_dispatcher_rollback_pre ( )

Program

flow

Page 8: WP3 Status Report & Plan1 Blueprint of Roll-back workflow Nice Meeting, January 7th/8th Paulo.Trezentos@caixamagica.pt John.Thomson@caixamagica.pt

WP3 Status Report & Plan 8

DSL Log DB

Usecase 2 :Invertible

Maint. Script

Usecase 1 :Non-invertibleMaint. Script

Transaction Table | TID | Pkg | Status || 1 | foo | Invertible || 2 | foo2 | Non-Invertible |

DSL_Statements Table | TID | DSL_ID | DSL_Statement || 1 | 1 | UpdateMimeTypeCache | Invertible ?| | 1 | 2 | UnknownTemplate | Non-Invertible |

SysCall_Changes Table | TID | SysCall_ID | FS storage|| 1 | 1 | UnknownTemplate |

Transaction Table | TID | Pkg | Status || 1 | foo | Invertible || 1 | foo2 | Non-Invertible |

DSL_Statements Table | TID | DSL_ID | DSL_Statement || 1 | 1 | UpdateMimeTypeCache |

SysCall_Changes Table | TID | SysCall_ID | FS storage |

Page 9: WP3 Status Report & Plan1 Blueprint of Roll-back workflow Nice Meeting, January 7th/8th Paulo.Trezentos@caixamagica.pt John.Thomson@caixamagica.pt

WP3 Status Report & Plan 9

- DSL Demonstration + UdA : providing demonstration of the workflow: maintainer_scripts -> DSL -> maintainer_scripts_preprocessed + CxM : implementing: - hooks in Apt + DSL_dispatcher()

+ run_transaction (no-scripts) - dslstart() and dslend() bash implementation (log to Sqlite,...)

- apt rollback: + retrieving from DSL_log_db invocations to rollback + invocate the rollback functions Storyboard: 1.- for package foo.rpm, show the original maintainer script, the DSL, the generated maintainer scripts. 2.- Install package foo. Show the DB. 3.- rollback package foo instalation. (Purpose: show a functional approach to rollback with a affordable migration path).

- SysCall Demonstration + Mdv: provide a RPM / librpm proof-of-concept in which a installation generates a set of the file changes in the disk - Others: + RPM ACID-safe engine (RPM5?)

Timeline - March review

Page 10: WP3 Status Report & Plan1 Blueprint of Roll-back workflow Nice Meeting, January 7th/8th Paulo.Trezentos@caixamagica.pt John.Thomson@caixamagica.pt

WP3 Status Report & Plan 10

+ CxM : implementing:

- By FOSDEM 2010

Hooks into apt-rpm 4.6.0, Specifically:DSL_dispatcher()run_transaction [already there but need the logic code around it]

Show original .spec file or .dsl file on user selection.

dslstart/dslend BASH script. Avoid using anything that requires dependencies so avoid using an implementation that depends on just SQLite3 used as a library from BASH.

First version of an implementation that launches from hooks DSL, logging utilities.

- By March Review, 25th/26th March

Apt-rollback using logs to roll-back an inorder/ out of order transaction.

SysCall() Integration with Mandriva code. If DSL, STID non-invertible see whether a corresponding invertible SysCall() method works. If not report error condition.

Log and Transactional DB management with selectable policies.Perform a roll-back from a live-system device that can access only the logs/initial

model.

Timeline - Break-down

Page 11: WP3 Status Report & Plan1 Blueprint of Roll-back workflow Nice Meeting, January 7th/8th Paulo.Trezentos@caixamagica.pt John.Thomson@caixamagica.pt

WP3 Status Report & Plan 11

- Rollback integration of: + DSL_rollback () + Syscall_rollback () + rpm_ACID_engine ()

Storyboard of the demonstration: - show a toll with the 3 above subsystems integrated and that works for different types of rollback - highlight differences against the existing tools as identified in D3.1/2

Final outcomes