provisioning & migration with p2: case study - the good, the bad and the ugly

17
Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly Christian Bourgeois @bourgeois_c

Upload: bluma

Post on 20-Mar-2016

71 views

Category:

Documents


0 download

DESCRIPTION

Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly. Christian Bourgeois @bourgeois_c. Some Context on Previous Product Version. Based on Eclipse 3.4 Too much time to deliver a simple update Migration would leave system in inconsistent state. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly

Provisioning & Migration with p2: Case study - The Good, the Bad and the UglyChristian Bourgeois@bourgeois_c

Page 2: Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly

Some Context on Previous Product Version

2

• Based on Eclipse 3.4• Too much time to deliver a simple update• Migration would leave system in

inconsistent state

Page 3: Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly

3

How can we update a software component and migrate it’s configuration data while having a stable system in case of failure?

Page 4: Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly

Demonstration

4

Page 5: Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly

Provisioning UI

5

import org.eclipse.equinox.internal.p2.ui.ProvUI;import org.eclipse.equinox.internal.p2.ui.ProvUIProvisioningListener;import org.eclipse.equinox.internal.p2.ui.dialogs.AddRepositoryDialog;import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;

Page 6: Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly

• client.feature• info.feature• client.bundle• common.bundle• client.bundle.nls

• server.feature• info.feature• server.bundle• common.bundle• config.feature

6

Business ModelArtifacts Layout

Page 7: Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly

properties.1.name = bsm.adaptorproperties.1.value = trueproperties.2.name = adaptor.nameproperties.2.value = ZExampleAdaptorproperties.3.name = client.feature.nameproperties.3.value = zzz.compuware.example.adaptor.client.featureproperties.4.name = server.feature.nameproperties.4.value = zzz.compuware.example.adaptor.server.featureproperties.5.name = adaptor.idproperties.5.value = ZExampleAdaptorproperties.6.name = adaptor.versionproperties.6.value = 1.0.0properties.7.name = company.idproperties.7.value = CPWRproperties.8.name = domains.idsproperties.8.value = APM

7

Business Modelinfo.feature – p2.inf

Page 8: Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly

8

Migrations… How to integrate them with p2?

public abstract class org.eclipse.equinox.p2.engine.spi.ProvisioningAction { …

public abstract IStatus execute(Map<String, Object> parameters);

public abstract IStatus undo(Map<String, Object> parameters);

…}

Page 9: Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly

Remote Provisioning

9

Client ServerCreate Plan

Create Plan

Execute Plan

Create Plan

Execute Plan

Execute Plan

Migrate

Save

Uninstall

timestamp

Install

timestamp

Page 10: Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly

10

p2 Touchpoint Actions

instructions.configure=markStarted(started:true);

instructions.configure=copy(source:a, target:b,overwrite:true);

instructions.configure=setProgramProperty(propName:key, propValue:value);

instructions.configure=addJvmArg(jvmArg:-XX:+UnlockDiagnosticVMOptions);

They are executed in the “builder”!

Page 11: Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly

Custom p2 Touchpoint Actions

11

instructions.configure=…adaptors.p2.engine.touchpoint.migrate();

instructions.unconfigure=…adaptors.p2.engine.touchpoint.saveConfigurations();

• Executes business logic• Must have knowledge of their runtime

Page 12: Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly

12

public IStatus execute(Map<String, Object> parameters) { boolean isServer = RuntimeInfo.isServer(); if (!isServer) { return Status.OK_STATUS; } … IInstallableUnit infoInstallableUnit = this.getInfoInstallableUnit(iu, repositoryManager, progressMonitor); String adaptorID = this.getAdaptorID(infoInstallableUnit); Version adaptorVersion = this.getAdaptorVersion(infoInstallableUnit); MigrationManager manager = this.getMigrationManager(); MigrationStatus migrationStatus = manager.migrate(adaptorID, adaptorVersion); IStatus status = EclipseStatusFactory.createStatus(migrationStatus); return status;}

public IStatus undo(Map<String, Object> parameters) { … MigrationManager manager = this.getMigrationManager(); manager.revert(adaptorID, adaptorVersion);}

Page 13: Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly

13

Ok… But now I get a “No action found” message?

Page 14: Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly

p2 Meta-Requirements

14

• Provisions the meta-requirements in the builder

provides.0.namespace=com.compuware.vantage.vsm.adaptors.p2

provides.0.name=touchpoints

provides.0.version=1.1

com.compuware.vantage.vsm.adaptors.p2.engine.touchpoint.feature

com.compuware.vantage.vsm.adaptors.p2.prerequisite.feature

metaRequirements.0.namespace=com.compuware.vantage.vsm.adaptors.p2

metaRequirements.0.name=touchpoints

metaRequirements.0.range=1.1

Page 15: Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly

p2 Meta-RequirementsBeware!

15

• Tycho Bugzilla 351487• tycho-p2-director-plugin ignores meta-

requirements

• *.target in IDE

Page 16: Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly

Conclusion

16

• p2 is easy to use (when you know the basics)

• p2 API is becoming more high level• Must be aware of the “tricks” and pitfalls

Page 17: Provisioning & Migration with p2: Case study - The Good, the Bad and the Ugly

Christian Bourgeois@bourgeois_c

Feedback is always appreciated