Project

General

Profile

Bug #3845

beadm doesn't work in non-global zones

Added by Alexander Eremin over 7 years ago. Updated about 7 years ago.

Status:
Resolved
Priority:
Normal
Category:
-
Start date:
2013-06-24
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

beadm doesn't work in non-global zone:
ngz:~# beadm list -v
be_find_current_be: failed to find current BE name
be_list: No BE's found
No boot environments found on this system.

It has some initial zone support, which was not finished.


Files

beadm-zones-support.patch (19.3 KB) beadm-zones-support.patch Andrew Stormont, 2013-07-11 09:53 PM
#1

Updated by Alexander Eremin over 7 years ago

  • Tracker changed from Feature to Bug
  • Subject changed from beadm must include support for non-global zones to beadm doesn't work in non-global zones
#2

Updated by Alexander Eremin over 7 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 20
#3

Updated by Alexander Eremin over 7 years ago

  • % Done changed from 20 to 80
#4

Updated by Alexander Eremin over 7 years ago

Provided fix (webrev is available at http://cr.illumos.org/~webrev/alhazred/3845) changes libbe to allow
view, create, activate, destroy, rename BE in non-global zone. New BE is a copy of existing zone root dataset, created with same parentbe uuid.

root@indy:~# zlogin test2
[Connected to zone 'test2' pts/2]
Last login: Tue Jul  9 09:03:52 on console
The Illumos Project    SunOS 5.11    illumos-gate    Jun. 11, 2013
SunOS Internal Development: alex 2013-Jun-11 [illumos-gate]
root@test2:~# beadm list
BE    Active Mountpoint Space Policy Created
zbe   NR     /          687M  static 2013-07-09 08:55
root@test2:~# zfs list    
NAME                         USED  AVAIL  REFER  MOUNTPOINT
rpool                        326G   115G    49K  /rpool
rpool/zones                 5.79G   115G   891M  /zones
rpool/zones/test2            680M   115G    33K  /zones/test2
rpool/zones/test2/ROOT       680M   115G    31K  legacy
rpool/zones/test2/ROOT/zbe   680M   115G   680M  legacy
root@test2:~# beadm list
BE  Active Mountpoint Space Policy Created
zbe NR     /          680M  static 2013-07-09 08:55
root@test2:~# beadm create illumos
Created successfully
root@test2:~# beadm list
BE      Active Mountpoint Space Policy Created
illumos -      -          35.0K static 2013-07-09 15:44
zbe     NR     /          680M  static 2013-07-09 08:55
root@test2:~# beadm activate illumos
Activated successfully
root@test2:~# beadm list
BE      Active Mountpoint Space Policy Created
illumos R      -          680M  static 2013-07-09 15:44
zbe     N      /          293K  static 2013-07-09 08:55
root@test2:~# reboot
....
root@test2:~# beadm list
BE      Active Mountpoint Space Policy Created
illumos NR     /          687M  static 2013-07-09 15:44
zbe     -      -          1.10M static 2013-07-09 08:55
root@test2:~# zfs list
NAME                             USED  AVAIL  REFER  MOUNTPOINT
rpool                            326G   115G    49K  /rpool
rpool/zones                     5.80G   115G   891M  /zones
rpool/zones/test2                685M   115G    33K  /zones/test2
rpool/zones/test2/ROOT           685M   115G    31K  legacy
rpool/zones/test2/ROOT/illumos   684M   115G   680M  legacy
rpool/zones/test2/ROOT/zbe      1.10M   115G   680M  legacy
root@test2:~# 

#5

Updated by Andrew Stormont over 7 years ago

The patch causes beadm to segfault in my build zone, caused by a call to abort in make_dataset_handle_common. Not sure why this is happening. zfs list returns nothing.

Maybe I don't have this setup properly?

#6

Updated by Andrew Stormont over 7 years ago

OK, so the problem was with something else in my environment (I was running a new libzfs on an old kernel). After fixing that beadm seems to work. I can create, delete, mount, unmount and list boot environments but I can't activate them:

root@gentoo:~# beadm activate zbe-3
Unable to activate zbe-3.
No active zone root

#7

Updated by Alexander Eremin over 7 years ago

Andrew Stormont wrote:

OK, so the problem was with something else in my environment (I was running a new libzfs on an old kernel). After fixing that beadm seems to work. I can create, delete, mount, unmount and list boot environments but I can't activate them:

root@gentoo:~# beadm activate zbe-3
Unable to activate zbe-3.
No active zone root

Looks like you start testing with multiple root datasets. Try to create new zone, put to it patched libbe and then test (or remove all zbe's from existing zone but keep one, which must have "on" for org.opensolaris.libbe:active.

#8

Updated by Andrew Stormont over 7 years ago

There is a bug. If you run activate on the same boot environment twice it will set the org.opensolaris.libbe:active value to "off" for all boot environments.

#9

Updated by Andrew Stormont over 7 years ago

I've attached your patch with a couple of changes. It doesn't unset the boot environment if it's already set, and it does not error out if no boot environment is set at all.

#10

Updated by Alexander Eremin over 7 years ago

Andrew Stormont wrote:

I've attached your patch with a couple of changes. It doesn't unset the boot environment if it's already set, and it does not error out if no boot environment is set at all.

This is good point, thanks Andrew.

#11

Updated by Andrew Stormont over 7 years ago

I've also discovered another problem. After activating the new boot environment the zone cannot be started. It gives this error:

zone 'gentoo': ERROR: Unable to mount the zones's ZFS dataset.
zone 'gentoo':
zoneadm: zone 'gentoo': call to zoneadmd failed

Running this solved the problem.

zfs set mountpoint=legacy rpool/zones/gentoo/ROOT/zbe-3

#12

Updated by Alexander Eremin over 7 years ago

webrev is updated

#13

Updated by Alexander Eremin over 7 years ago

  • Status changed from In Progress to Pending RTI
  • % Done changed from 80 to 100
#14

Updated by Alexander Eremin about 7 years ago

  • Status changed from Pending RTI to In Progress
  • % Done changed from 100 to 90

webrev's updated, now zone root datasets from non-active global BE are marked with 'x' (if they are active on boot, they are marked also with 'b') and activate, snapshot, and rollback with such datasets aren't allowed, destroy allowed only if they non-active on boot.

~# beadm list
BE      Active Mountpoint Space Policy Created
foo     xb      -          4.72M static 2013-07-18 11:36
illumos -      -          4.74M static 2013-07-09 15:44
zbe     x      -          710M  static 2013-07-09 08:55
zbe-1   NR     /          323M  static 2013-07-26 07:58
zbe-3   x      -          64.5K static 2013-07-28 20:52
~# beadm activate foo
Unable to activate foo.
Operation not supported.
~# beadm activate illumos
Activated successfully
~# beadm list
BE      Active Mountpoint Space Policy Created
foo     xb      -          4.72M static 2013-07-18 11:36
illumos R      -          4.74M static 2013-07-09 15:44
zbe     x      -          710M  static 2013-07-09 08:55
zbe-1   N     /          323M  static 2013-07-26 07:58
zbe-3   x      -          64.5K static 2013-07-28 20:52
~# 

#15

Updated by Andrew Stormont about 7 years ago

I'm testing the patch in a non-global zone, and the output doesn't look quite right to me. Should zbe and zbe-1 have the x next to them?

root@gentoo:~# beadm list
BE     Active Mountpoint Space Policy Created
zbe    x      -          1.84M static 2013-06-02 13:30
zbe-1  x      -          36.5M static 2013-06-21 08:02
zbe-10 -      -          41.6M static 2013-07-17 16:25
zbe-11 -      -          47.1M static 2013-07-17 22:10
zbe-12 -      -          96.2M static 2013-07-19 04:51
zbe-13 -      -          30.3M static 2013-07-19 07:59
zbe-14 -      -          15.8M static 2013-08-07 10:05
zbe-15 NR     /          18.2G static 2013-08-09 01:05
zbe-2  -      -          72.4M static 2013-07-07 07:47
zbe-3  -      -          1.10M static 2013-07-10 11:05
zbe-4  -      -          7.64M static 2013-07-12 05:07
zbe-5  -      -          38.0K static 2013-07-12 05:10
zbe-6  -      -          1.74M static 2013-07-12 05:14
zbe-7  -      -          107M  static 2013-07-12 05:21
zbe-8  -      -          37.6M static 2013-07-13 15:31
zbe-9  -      -          13.2M static 2013-07-15 00:14
#16

Updated by Dan McDonald about 7 years ago

  • Status changed from In Progress to Pending RTI
  • % Done changed from 90 to 100

commit 7e0e2549bfaa531aff576083ab0c07f84fa8fb27
Author: Alexander Eremin <>
Date: Mon Aug 26 13:52:20 2013 -0400

3845 beadm doesn't work in non-global zones
Reviewed by: Hans Rosenfeld &lt;&gt;
Reviewed by: Andrew Stormont &lt;&gt;
Reviewed by: Richard Lowe &lt;&gt;
Approved by: Dan McDonald &lt;&gt;
#17

Updated by Dan McDonald about 7 years ago

  • Status changed from Pending RTI to Resolved

Also available in: Atom PDF