Project

General

Profile

Actions

Feature #13368

closed

libbe_py should support temporary BE activation

Added by Andy Fiddaman over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

The python libbe interface has a beActivate method which currently only accepts the BE name as a parameter.
This should be extended to support temporary activation and the removal of a temporary activation which is in place.

Actions #1

Updated by Andy Fiddaman over 1 year ago

Before this change, the library can be used to activate a new BE by providing the new BE name as a string argument.

loody% beadm list
BE           Active Mountpoint Space   Policy Created
20201206     -      -          35.49M  static 2020-12-06 16:47
objset-onu   -      -          602.55M static 2020-12-14 11:50
20201216     NR     /          122.71G static 2020-12-16 13:51

bloody% pfexec python3
Python 3.9.1 (default, Dec 16 2020, 12:02:44)
[GCC 10.2.0] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import libbe_py as be
>>> be.beActivate('objset-onu')
0
>>>
bloody% beadm list
BE           Active Mountpoint Space   Policy Created
20201206     -      -          35.49M  static 2020-12-06 16:47
objset-onu   R      -          120.51G static 2020-12-14 11:50
20201216     N      /          2.79G   static 2020-12-16 13:51

After the change, this still works as expected.

The new optional temporary parameter works too (although wrongly promoting the dataset due to #13367 )

>>> be.beActivate('objset-onu', temporary=True)

BE           Active Mountpoint Space   Policy Created
20201206     -      -          35.49M  static 2020-12-06 16:47
objset-onu   T      -          120.51G static 2020-12-14 11:50
20201216     NR     /          2.79G   static 2020-12-16 13:51

One can now also use a named parameter for bename.

Testing under python 2.7 (while checking the output of beadm list at each stage in another window).

Python 2.7.18 (default, Dec 16 2020, 11:42:29)
[GCC 10.2.0] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import libbe_py as be
>>> be.beActivate('objset-onu')
0
>>> be.beActivate(bename='20201216')
0
>>> be.beActivate('objset-onu', temporary=1)
0
>>> be.beActivate('objset-onu', temporary=0)
0
>>> be.beActivate(bename='20201216')
0
Actions #2

Updated by Andy Fiddaman over 1 year ago

  • Gerrit CR set to 1105
Actions #3

Updated by Electric Monk over 1 year ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit 4bba12ca5cd6f92aaf0d4c0d19d05528110bc095

commit  4bba12ca5cd6f92aaf0d4c0d19d05528110bc095
Author: Andy Fiddaman <omnios@citrus-it.co.uk>
Date:   2020-12-24T14:28:49.000Z

    13368 libbe_py should support temporary BE activation
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Gordon Ross <gordon.w.ross@gmail.com>

Actions

Also available in: Atom PDF