SDKs back up
Added by Bill Roth about 1 year ago
The SDK files are back up after the nexenta.com respin. You can get them here: http://info.nexenta.com/SDKDownloads_FormPage.html
Reply to this post if you have issues.
Bill Roth
Replies
RE: SDKs back up - Added by Carl Brunning about 1 year ago
i may be silly but i do not see anything in the sdk that tell how to create AUTOSNAP or any of the AUTO job
can anyone tell me how you can create a new AUTOSNAP or any of the AUTO if you have none to start with
thanks
RE: SDKs back up - Added by Linda Kateley about 1 year ago
Are you looking to develop a new kind of auto service? or just run an existing autoservice?
RE: SDKs back up - Added by Carl Brunning about 1 year ago
trying to make a new autosnap but there nothing in the api explaining how to create any new auto it show how to destroy or seem them
this is the only show stopper i got at the moment on making a windows gui
thanks
RE: SDKs back up - Added by Vladimir Markelov 11 months ago
In short, to create auto-* service you should do the following (I use examples in C):
1. connect to Nexenta (struct nms_connection nms; nms_client_init(&nms, <host_address>);)
2. get remote auto-service manager (struct nms_object *proxy = nms_remote_obj (nms, NZA_AUTOSVC);)
3. Fill hash with auto-* service properties that are required. In C it is an char* array, even items are keys, and odd ones are values. All properties you can read in SA-API (f.e, auto-snap is section 32: http://www.nexenta.com/static/NexentaStor-API.html#com.nexenta.nms.SmfAutoSnap)
4. call auto-service manager to create new auto-* service:
char *svc = AUTO_TIER; // type of auto-service you want to create. List of allowed types in nza_consts.h (lines : # define AUTO_* ..
char *desc = "service description"; // maybe empty
dbus_bool_t override_tier = 0; // should we overrride existing while creating
struct nms_message *msg = nms_execute (proxy, "fmri_create",
DBUS_TYPE_STRING, &svc,
DBUS_TYPE_STRING, &desc,
DBUS_TYPE_STRING, &local_fs, // char * to the local path
DBUS_TYPE_BOOLEAN, &override_tier,
DBUS_TYPE_CHAR_DICT, dict, sz, // hash char** that have been filled at step 3, sz - number of key+value pairs
DBUS_TYPE_INVALID); // must be the last item in argument list that means that there are no more arguments
Then you should check if msg is valid, and it should contain name of the newly created auto-* service in case of success.
I do not mention all checks and cleanups.
RE: SDKs back up - Added by Pavel Rýdl 10 months ago
Hello,
I tested you code, it's working, i successfully added a autosnapping service. I have last problem with autosnapping service and it's instance name.
Service has default name "some_name-000", how can u change that name ? I tried to pass "name" => "myname" or "instance" => "myname", nothing works.
This is my current code snippet: ( It's my wrapper for WPF.NET )
nmsmsg = nms.NMS_prepareCall("autosvc", "fmri_create");
nms.NMS_addBasicValue(nmsmsg, "auto-snap");
nms.NMS_addBasicValue(nmsmsg, "0");
nms.NMS_addBasicValue(nmsmsg, "my_volume_by_code/my_folder_by_code");
nms.NMS_addBasicValue(nmsmsg, "1");
nms.NMS_addDictArray(nmsmsg, "type", "minute", "period", "1", "keep_days", "7", "day" , "0", "name", "my_name");
nms.NMS_execute(nmsmsg);
No error. Name is still "myvolumebycode-myfolderbycode-000" in my case .. pretty long name ,huh ? :)
Also, function "fmri_create" is not documented. That's why my friend Carl asked, how to add new service. Thank you very much for help.
RE: SDKs back up - Added by Vladimir Markelov 10 months ago
Hello,
I do not think that this name is long. It is built from full auto-* path by default. So, you can get much longer :)
Using 'custom_name' hash item might help. Try to add it to the last argument like this:
nms.NMS_addDictArray(nmsmsg, "type", "minute",
"period", "1", "keep_days", "7",
"day" , "0", "name", "my_name",
"custom_name", your-name);
RE: SDKs back up - Added by Pavel Rýdl 10 months ago
It's working :) thank you
It's interesting, becuase i can't see any object called "custom_name" in documentation and even when i recieve all parameters from nexenta server. It has variables like "instancename", "fsname", "name" etc :) but no custom name. I am very happy, i can get all information on this forum, very helpful.
RE: SDKs back up - Added by Pavel Rýdl 10 months ago
Hello again :)
I have another question.
What is a best way to get free unassigned disks ? I am using not good method, where i get list of all disks and list of used disks and i can get unassigned disks by few for loops and conditions.
Another problem with my method is i get disks, which are exported too ( and i should not get them ).
thank you for answers :)
RE: SDKs back up - Added by Vladimir Markelov 9 months ago
Sorry for late answer.
Unfortunately, there is no single call to get free LUNs. NMC uses several calls to determine what LUNs are used and what of them are used for services (f.e, auto-cdp) to mark them in 'show lun'.
What IPC calls did you use? There several useful methods. I guess you know how to get all LUN list. Then you can use two additional IPC: resolveluntovolumes(string) - its argument is LUN name and it returns the list of volumes which the LUN attached to, and resolveluntoservices(string) - it takes LUN name and returns list of services that uses the LUN(f.e, any auto-cdp shared LUN)
Hope it helps.
RE: SDKs back up - Added by Pavel Rýdl 9 months ago
Hello again :)
I have a little bit a different problem .. and the problem is with dBus. I am working on exporting/importing volumes and i have strange problems with recieving dictionary, which contains dictionary with array of strings :)
It's a result of calling getimportvolumes.
I have tried lots of combinations and when it looks like it returns what i am waiting for .. it crashes.
This is first function, i get right argtype ( ARRAY ) and right elemtype ( DICT ):
ArrayList^ StorAgeLibrary::StorAgeManager::NMSgetResults( NMSmessage^ msg ) { ArrayList^ list = gcnew ArrayList(); struct nms_message* message = msg->msg;
if (message)
{
int arg_type, elem_type;
arg_type = dbus_message_iter_get_arg_type (message->reply);
if( arg_type == DBUS_TYPE_STRING ) list->Add( NMS_GetString( message->reply ) ); // 115
if (arg_type == DBUS_TYPE_ARRAY ) // 97
{
elem_type = dbus_message_iter_get_element_type(message->reply);
if( elem_type == DBUS_TYPE_STRING ) list->Add( NMS_GetStringArray( message ) ); // 115
if( elem_type == DBUS_TYPE_DICT_ENTRY) list->Add( NMS_GetDictionaryArray( message ) ); // 101
}
nms_call_free (&message);
}
return list;
}
Then, i jump into message.
ArrayList^ NMSGetDictionaryArray( struct nmsmessage* message ) { ArrayList^ list = gcnew ArrayList(); DBusMessageIter dict;
dbus_message_iter_recurse (message->reply, &dict);
NMS_GetDictionaryArrayIter( message, &dict, list);
return list;
}
And last part, here, i tried lots of combinations of how to get message. Perhaps, it's just a silly problem. if i ask, what argtype is iter, i got 0, i should get STRING here, ok, i jumped into iter to get item, argtype is STRING now, when i would like to get that string => crash.
void NMSGetDictionaryArrayIter( struct nmsmessage* message, DBusMessageIter * iter, ArrayList^ list )
{
DBusMessageIter item, subitem;
int argtype, elemtype;
while (1)
{
elem_type = dbus_message_iter_get_arg_type (iter); // returns 0 ???
dbus_message_iter_recurse (iter, &item);
elem_type = dbus_message_iter_get_arg_type (&item); // returns 115
if (elem_type == DBUS_TYPE_STRING) list->Add( NMS_GetString(&item) ); // 115 - crash
while (dbus_message_iter_has_next (&item))
{
dbus_message_iter_next (&item);
elem_type = dbus_message_iter_get_arg_type(&item);
if (elem_type == DBUS_TYPE_STRING) list->Add( NMS_GetString(&item) ); // 115
if (elem_type == DBUS_TYPE_ARRAY) // 97
{
elem_type = dbus_message_iter_get_element_type(&item);
if( elem_type == DBUS_TYPE_DICT_ENTRY)
{
NMS_GetDictionaryArrayIter(message, &item, list); // 101
}
if( elem_type == DBUS_TYPE_STRING )
{
list->Add( NMS_GetStringArray( message ) );
}
}
};
if(dbus_message_iter_has_next(iter)) dbus_message_iter_next (iter); else break;
};
}
This is code for getting String, for simplier structures, it works fine.
String^ NMS_GetString( DBusMessageIter* iter )
{
char * simplestring;
dbusmessageitergetbasic(iter, &simplestring );
return gcnew String(simplestring);
}
Perhaps someone had similar problem or know a solution , how to do it right, thank you very much for helping me.
PS: sorry for bad code formating, seems code display is not working correctly