text stringlengths 0 14.1k |
|---|
if (islog) |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, |
""cannot replace a log with a spare"")); |
else |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, |
""cannot replace a replacing device"")); |
} else { |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, |
""can only attach to mirrors and top-level "" |
""disks"")); |
} |
(void) zfs_error(hdl, EZFS_BADTARGET, msg); |
break; |
case EINVAL: |
/* |
* The new device must be a single disk. |
*/ |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, |
""new device must be a single disk"")); |
(void) zfs_error(hdl, EZFS_INVALCONFIG, msg); |
break; |
case EBUSY: |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, ""%s is busy""), |
new_disk); |
(void) zfs_error(hdl, EZFS_BADDEV, msg); |
break; |
case EOVERFLOW: |
/* |
* The new device is too small. |
*/ |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, |
""device is too small"")); |
(void) zfs_error(hdl, EZFS_BADDEV, msg); |
break; |
case EDOM: |
/* |
* The new device has a different alignment requirement. |
*/ |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, |
""devices have different sector alignment"")); |
(void) zfs_error(hdl, EZFS_BADDEV, msg); |
break; |
case ENAMETOOLONG: |
/* |
* The resulting top-level vdev spec won't fit in the label. |
*/ |
(void) zfs_error(hdl, EZFS_DEVOVERFLOW, msg); |
break; |
default: |
(void) zpool_standard_error(hdl, errno, msg); |
} |
return (-1); |
} |
/* |
* Detach the specified device. |
*/ |
int |
zpool_vdev_detach(zpool_handle_t *zhp, const char *path) |
{ |
zfs_cmd_t zc = { 0 }; |
char msg[1024]; |
nvlist_t *tgt; |
boolean_t avail_spare, l2cache; |
libzfs_handle_t *hdl = zhp->zpool_hdl; |
(void) snprintf(msg, sizeof (msg), |
dgettext(TEXT_DOMAIN, ""cannot detach %s""), path); |
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); |
if ((tgt = zpool_find_vdev(zhp, path, &avail_spare, &l2cache, |
NULL)) == 0) |
return (zfs_error(hdl, EZFS_NODEVICE, msg)); |
if (avail_spare) |
return (zfs_error(hdl, EZFS_ISSPARE, msg)); |
if (l2cache) |
return (zfs_error(hdl, EZFS_ISL2CACHE, msg)); |
verify(nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID, &zc.zc_guid) == 0); |
if (zfs_ioctl(hdl, ZFS_IOC_VDEV_DETACH, &zc) == 0) |
return (0); |
switch (errno) { |
case ENOTSUP: |
/* |
* Can't detach from this type of vdev. |
*/ |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, ""only "" |
""applicable to mirror and replacing vdevs"")); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.