text stringlengths 0 14.1k |
|---|
if (l2cache) { |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, |
""cannot expand cache devices"")); |
return (zfs_error(hdl, EZFS_VDEVNOTSUP, msg)); |
} |
if (wholedisk) { |
pathname += strlen(DISK_ROOT) + 1; |
(void) zpool_relabel_disk(zhp->zpool_hdl, pathname); |
} |
} |
zc.zc_cookie = VDEV_STATE_ONLINE; |
zc.zc_obj = flags; |
if (zfs_ioctl(zhp->zpool_hdl, ZFS_IOC_VDEV_SET_STATE, &zc) != 0) { |
if (errno == EINVAL) { |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, ""was split "" |
""from this pool into a new one. Use '%s' "" |
""instead""), ""zpool detach""); |
return (zfs_error(hdl, EZFS_POSTSPLIT_ONLINE, msg)); |
} |
return (zpool_standard_error(hdl, errno, msg)); |
} |
*newstate = zc.zc_cookie; |
return (0); |
} |
/* |
* Take the specified vdev offline |
*/ |
int |
zpool_vdev_offline(zpool_handle_t *zhp, const char *path, boolean_t istmp) |
{ |
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 offline %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)) == NULL) |
return (zfs_error(hdl, EZFS_NODEVICE, msg)); |
verify(nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID, &zc.zc_guid) == 0); |
if (avail_spare) |
return (zfs_error(hdl, EZFS_ISSPARE, msg)); |
zc.zc_cookie = VDEV_STATE_OFFLINE; |
zc.zc_obj = istmp ? ZFS_OFFLINE_TEMPORARY : 0; |
if (zfs_ioctl(zhp->zpool_hdl, ZFS_IOC_VDEV_SET_STATE, &zc) == 0) |
return (0); |
switch (errno) { |
case EBUSY: |
/* |
* There are no other replicas of this device. |
*/ |
return (zfs_error(hdl, EZFS_NOREPLICAS, msg)); |
case EEXIST: |
/* |
* The log device has unplayed logs |
*/ |
return (zfs_error(hdl, EZFS_UNPLAYED_LOGS, msg)); |
default: |
return (zpool_standard_error(hdl, errno, msg)); |
} |
} |
/* |
* Mark the given vdev faulted. |
*/ |
int |
zpool_vdev_fault(zpool_handle_t *zhp, uint64_t guid, vdev_aux_t aux) |
{ |
zfs_cmd_t zc = { 0 }; |
char msg[1024]; |
libzfs_handle_t *hdl = zhp->zpool_hdl; |
(void) snprintf(msg, sizeof (msg), |
dgettext(TEXT_DOMAIN, ""cannot fault %llu""), (u_longlong_t) guid); |
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); |
zc.zc_guid = guid; |
zc.zc_cookie = VDEV_STATE_FAULTED; |
zc.zc_obj = aux; |
if (ioctl(zhp->zpool_hdl->libzfs_fd, ZFS_IOC_VDEV_SET_STATE, &zc) == 0) |
return (0); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.