Fix import of degraded pool
Version: Freenas 11-RC3
If a volume is degraded it does't seem like the gui will allow you to import things.
Below is the repro steps I did in a vm. You can import the volume using the cli but
who wants to mess with that nonsense. ;)
Setup: all using the old gui
1. Create a raidz1 volume
2. Offline one of the disks and wipe it using the gui just to be sure
3. detach the volume using the gui
4. in the gui select import volume
5. the current volume does not populate the selection box for importing.
[root@freenas ~]# zpool import
status: One or more devices are offlined.
action: The pool can be imported despite missing or damaged devices. The
fault tolerance of the pool may be compromised if imported.
[root@freenas ~]# zpool import tank2
[root@freenas ~]# zpool status tank2
status: One or more devices has been taken offline by the administrator.
Sufficient replicas exist for the pool to continue functioning in a
action: Online the device using 'zpool online' or replace the device with
scan: none requested
NAME STATE READ WRITE CKSUM
tank2 DEGRADED 0 0 0
raidz1-0 DEGRADED 0 0 0
gptid/d8e9012e-4a32-11e7-af8f-000c29422bce ONLINE 0 0 0
gptid/da57ff3a-4a32-11e7-af8f-000c29422bce ONLINE 0 0 0
9009757885668294807 OFFLINE 0 0 0 was /dev/gptid/db87b16b-4a32-11e7-af8f-000c29422
errors: No known data errors
#2 Updated by Rickard von Essen almost 4 years ago
A quick and dirty patch that allows you to import degraded volumes:
diff --git a/gui/middleware/zfs.py b/gui/middleware/zfs.py index 1ef1f6cb1..e1250f030 100644 --- a/gui/middleware/zfs.py +++ b/gui/middleware/zfs.py @@ -398,12 +398,13 @@ class Dev(Tnode): elif self.status == 'ONLINE': log.warn("It should be a valid device: %s", self.name) self.disk = self.name - elif self.name.isdigit(): + elif self.name.isdigit() and self.status != 'OFFLINE': pool = self while getattr(pool, 'parent', None): pool = pool.parent # Lets check whether it is a guid vdev = libzfs.ZFS().get(pool.name).vdev_by_guid(int(self.name)) + if vdev: self.path = vdev.path
#6 Updated by Suraj Ravichandran over 3 years ago
- Status changed from Needs Developer Review to Reviewed by Developer
- Assignee changed from Suraj Ravichandran to William Grzybowski
- % Done changed from 0 to 100
Reviewed this and looks good, but request testing on this.
Also, @RE this is prior to new releng process so please treat as the same.