205 if (!convertPyArgsToNvlist(&beProps, 2,
206 PyString_AsString(pkey),
207 PyString_AsString(pvalue))) {
208 nvlist_free(beProps);
209 nvlist_free(beAttrs);
210 return (Py_BuildValue("[iss]", BE_PY_ERR_NVLIST,
211 NULL, NULL));
212 }
213 }
214 }
215
216 if (beProps != NULL && beAttrs != NULL &&
217 nvlist_add_nvlist(beAttrs, BE_ATTR_ZFS_PROPERTIES,
218 beProps) != 0) {
219 nvlist_free(beProps);
220 nvlist_free(beAttrs);
221 return (Py_BuildValue("[iss]", BE_PY_ERR_NVLIST,
222 NULL, NULL));
223 }
224
225 if (beProps != NULL) nvlist_free(beProps);
226
227 if (trgtBeName == NULL) {
228 /*
229 * Caller wants to get back the BE_ATTR_NEW_BE_NAME and
230 * BE_ATTR_SNAP_NAME
231 */
232 if ((ret = be_copy(beAttrs)) != BE_SUCCESS) {
233 nvlist_free(beAttrs);
234 return (Py_BuildValue("[iss]", ret, NULL, NULL));
235 }
236
237 /*
238 * When no trgtBeName is passed to be_copy, be_copy
239 * returns an auto generated beName and snapshot name.
240 */
241 if (nvlist_lookup_string(beAttrs, BE_ATTR_NEW_BE_NAME,
242 &trgtBeName) != 0) {
243 nvlist_free(beAttrs);
244 return (Py_BuildValue("[iss]", BE_PY_ERR_NVLIST,
245 NULL, NULL));
|
205 if (!convertPyArgsToNvlist(&beProps, 2,
206 PyString_AsString(pkey),
207 PyString_AsString(pvalue))) {
208 nvlist_free(beProps);
209 nvlist_free(beAttrs);
210 return (Py_BuildValue("[iss]", BE_PY_ERR_NVLIST,
211 NULL, NULL));
212 }
213 }
214 }
215
216 if (beProps != NULL && beAttrs != NULL &&
217 nvlist_add_nvlist(beAttrs, BE_ATTR_ZFS_PROPERTIES,
218 beProps) != 0) {
219 nvlist_free(beProps);
220 nvlist_free(beAttrs);
221 return (Py_BuildValue("[iss]", BE_PY_ERR_NVLIST,
222 NULL, NULL));
223 }
224
225 nvlist_free(beProps);
226
227 if (trgtBeName == NULL) {
228 /*
229 * Caller wants to get back the BE_ATTR_NEW_BE_NAME and
230 * BE_ATTR_SNAP_NAME
231 */
232 if ((ret = be_copy(beAttrs)) != BE_SUCCESS) {
233 nvlist_free(beAttrs);
234 return (Py_BuildValue("[iss]", ret, NULL, NULL));
235 }
236
237 /*
238 * When no trgtBeName is passed to be_copy, be_copy
239 * returns an auto generated beName and snapshot name.
240 */
241 if (nvlist_lookup_string(beAttrs, BE_ATTR_NEW_BE_NAME,
242 &trgtBeName) != 0) {
243 nvlist_free(beAttrs);
244 return (Py_BuildValue("[iss]", BE_PY_ERR_NVLIST,
245 NULL, NULL));
|