StarWind iSCSI SAN
StarWind Native SAN for Hyper-V
 

Powershell cmdlets: how to get a list of free slots?

Pure software-based VM-centric and flash-friendly VM storage (iSCSI, SMB3, NFS, iSER and NVMe over Fabrics) including free version. Same software embedded on StarWind ready nodes.

Moderators: art (staff), anton (staff), Anatoly (staff), Max (staff)

Powershell cmdlets: how to get a list of free slots?

Postby cforest » Fri Dec 14, 2018 10:58 am

Morning,

I am trying to leverage the InsertVirtualTape.ps1 script available in the StarWindX folder. Generally, it works, but I fail to understand if there is any method/property for a given slot to get to know if it is empty or not. Is it possible?

Just to make it more clear - here is the code:

Code: Select all
foreach($slot in $device.Slots)    {
      write-host "Slot:"
      $slot
}
      
$tapeBarcode = "SW88V001";
$slotName = "Slot_1096";

$device.InsertTape($tapeBarcode, $slotName);
write-host "Completed!" -foreground yellow

In this code, is it possible to get free slots for $device, or verify if a given $slot is free or not?

Thanks,
Forest
cforest
 
Posts: 15
Joined: Fri Dec 14, 2018 10:48 am

Re: Powershell cmdlets: how to get a list of free slots?

Postby Boris (staff) » Fri Dec 14, 2018 3:31 pm

In the sample script there is a comment as follows:
Code: Select all
#
# print all slots. if barcode is empty it means that slot is empty.
#

It makes me think this it is exactly what you are looking for. So, in your script you simply need to check whether the Barcode property is empty or not, and based on this you will be able to define whether some certain slot is free.
Last edited by Boris (staff) on Fri Dec 14, 2018 6:02 pm, edited 1 time in total.
Boris (staff)
Staff
 
Posts: 806
Joined: Fri Jul 28, 2017 8:18 am

Re: Powershell cmdlets: how to get a list of free slots?

Postby cforest » Fri Dec 14, 2018 5:25 pm

Boris (staff) wrote:In the sample script there is a comment as follows:
Code: Select all
#
# print all slots. if barcode is empty it means that slot is empty.
#

It makes me this it is exactly what you are looking for. So, in your script you simply need to check whether the Barcode property is empty or not, and based on this you will be able to define whether some certain slot is free.


Thank you! I missed it. You are right. Actually, it is a bit strange for me. In my VTL device, I seem to have the following configuration:

Transport Slots 1
Drive Slots 4
import/Export Slots 3
Storage Slots 96

Tapes 9
Offline Shelf 1

So I am trying to insert a tape from Offline Shelf, but all Slots have their Barcodes not empty. How is it possible taking into account the number of slots and tapes? Is it possible to somehow free some slots with a cmdlet? What is interesting is that I am able to insert this tape in UI (StarWind Management Console) despite the fact that there are not slots with empty Barcode. What do I miss? Thank you!
cforest
 
Posts: 15
Joined: Fri Dec 14, 2018 10:48 am

Re: Powershell cmdlets: how to get a list of free slots?

Postby cforest » Sun Dec 16, 2018 2:52 pm

Hi there,

Just in case, here is the StarWind version: 8.0.0.11818

To be more specific, attached are some details:

1. Screenshot.png - here is my VTL configuration (10 tapes, one of them being offline)
2. getTapesAndSlots.ps1 - a script to get a list of all tapes and slots for my VTL
3. TapesAndSlots.txt - the output of the script above (getTapesAndSlots.ps1) - a list of all tapes and slots
4. insertTape.ps1 - a script to insert a tape.

When running insertTape.ps1 with $slotName equal Slot_1, Slot_1001 or Slot_1011, I am getting the following error:

Inserting tape...Error:
Specified slot doesn't empty.


Why am I getting this error? Is there anything I am doing wrong here?

Thank you!
Attachments
TapesAndSlots.zip
(25.93 KiB) Downloaded 139 times
cforest
 
Posts: 15
Joined: Fri Dec 14, 2018 10:48 am

Re: Powershell cmdlets: how to get a list of free slots?

Postby Boris (staff) » Sun Dec 16, 2018 7:37 pm

As you use an outdated build, I would suggest you updating to the latest one in the first row, and check whether you encounter any similar issues. There have been improvements and you will most likely be able to achieve what you aim at.
Boris (staff)
Staff
 
Posts: 806
Joined: Fri Jul 28, 2017 8:18 am

Re: Powershell cmdlets: how to get a list of free slots?

Postby cforest » Mon Dec 17, 2018 9:11 am

Hi Boris,

Thanks for the answer!

If this issue is to be resolved with the latest build, is it possible to get StarWindX.dll from the latest build for x64 platform just to verify if it works in our environment? The reason we ask for it is to be sure it is a panacea. At the moment, we are quite satisfied with the current version. To go through the upgrade procedure just to see if the issue is resolved and possibly get some new issues in the new version doesn't look encouraging. As we can see in the current build, the tape inserting functionality does work in UI, so it looks like it is a StarWindX issue, not core functionality, so this issue might be just resolved with a newer StarWindX.dll. Does it make sense? Hopefully so. If it does not, could you please at least confirm that you really had this issue in 8.0.0.11818, and it was really fixed?

Yuri
cforest
 
Posts: 15
Joined: Fri Dec 14, 2018 10:48 am

Re: Powershell cmdlets: how to get a list of free slots?

Postby cforest » Mon Dec 17, 2018 1:26 pm

Update: I tried to use StarWindX.dll from v.12658 with v. 11818 and got an error:

Inserting tape...Cannot convert argument "1", with value: "Slot_1", for "InsertTape" to type "System.Int32": "Cannot convert value "Slot_1" to type "System.Int32". Error: "Input string was not in a correct format.""


That's a bit strange since the dll is x64, and StarWind is installed on win 2016. Looks like old core and new StarWindX.dll are not compatible. Okay, no problem with that. We will try to install v.12658 to see if the issue with tape inserting is resolved.

Thanks,
Yuri
cforest
 
Posts: 15
Joined: Fri Dec 14, 2018 10:48 am

Re: Powershell cmdlets: how to get a list of free slots?

Postby Boris (staff) » Mon Dec 17, 2018 3:30 pm

Slot address is an integer (explicitly shown in the sample script), while you are passing it a string instead. Use 1 instead of "Slot_1".
Just be sure to update not only StarWindX to this newest build, but also the StarWind VSAN service.
Boris (staff)
Staff
 
Posts: 806
Joined: Fri Jul 28, 2017 8:18 am

Re: Powershell cmdlets: how to get a list of free slots?

Postby cforest » Mon Dec 17, 2018 3:59 pm

Actually, in a sample for 11818, it looks like that:

$slotName = "Slot_4096";

But thank you so much for pointing out, anyway! It seems to have been changed in the latest version. I could miss it after an upgrade. So I will try with integer.

Yuri
cforest
 
Posts: 15
Joined: Fri Dec 14, 2018 10:48 am

Re: Powershell cmdlets: how to get a list of free slots?

Postby Boris (staff) » Mon Dec 17, 2018 5:00 pm

Let me know whether this solves your issue.
Boris (staff)
Staff
 
Posts: 806
Joined: Fri Jul 28, 2017 8:18 am

Re: Powershell cmdlets: how to get a list of free slots?

Postby cforest » Mon Dec 17, 2018 5:17 pm

Update: installed 12658 from scratch with no upgrade. Inserting a tape seems to work. Thanks for your help!

Yuri
cforest
 
Posts: 15
Joined: Fri Dec 14, 2018 10:48 am

Re: Powershell cmdlets: how to get a list of free slots?

Postby Oleg(staff) » Tue Dec 18, 2018 9:58 am

You are welcome!
Oleg(staff)
Staff
 
Posts: 564
Joined: Fri Nov 24, 2017 7:52 am


Return to StarWind Virtual SAN / StarWind Virtual SAN Free / StarWind HyperConverged Appliance / StarWind Storage Appliance

Who is online

Users browsing this forum: No registered users and 6 guests