Closed hanslammerts closed 3 years ago
Hello Hans,
First of all, sorry for that situation, that is not the way it should have been executed. Normally I would ask if you could run it with Verbose and post the, sanatized output here, but seeing how the command executed before I will not put you through that.
I'll check on my end if I can reproduce this, so for my understanding what happened was, you used a tag that didn't exist and a category that contained all VMs in the command you listed, correct?
Hi Jaap,
Sorry for the delay. Had higher priorities...
I'm a bit confused by your question. As far as I know, in VMware, you cannot have VM's residing in a Category without those VM's having a Tag. Tags and categories are entities that are present at vSphere level, not at VM level. That's why, when you move the VM to another datacenter and another vCenter environment (DR), you lose the tag assignment to that particular VM. IMHO, only when you assign a tag to a VM, the VM will be placed in the category that tag belongs to.
So when I ran the Protect-RubrikTag -Tag 'RB_NONWIN' -Category 'BACKUP' -Inherit
command, I had no VMs that had the tag RB_NONWIN. Just for testing. Not sure if the -Category parameter is mandatory, but if it isn't I could have left that out.
I was hoping that the command would do nothing, but instead it did something I wasn't prepared for... :-)
Hi,
Hans, I've pinpointed the error, what happens is that the command continues even if no tag / category is found. My apologies for the inconvenience caused by this incident, I have resolved this and in the next release of the module, 5.3
, this has been resolved.
Environment:
Rubrik 5.2.2-p4-9942 Rubrik SDK Powershell 5.0.1 Powershell 7.1 on Centos 7.9
The idea is to set the SLA to Inherit when a VM has a certain tag (in this case the tag is RB_NONWIN) using Powershell.
First try: There are NO VMs that have the tag RB_NONWIN.
When executing the command
Protect-RubrikTag -Tag 'RB_NONWIN' -Category 'BACKUP' -Inherit
(Category exists), I would have expected that this command does nothing since there are no VMs that have the specified tag.Instead, the command ran quite long, and the result was that ALL(!) VMs that had a Direct SLA relationship were stripped of that SLA. The existing SLA was removed.... This made me not very happy......😲
Question: How can it be that above command removes all existing SLAs when no VMs exist that have the tagname specified in the command ?
Second try: I noticed that from within the GUI you can assign Inherit SLA per VM. So I captured the API call that was done, and tried to use that in Powershell.
The API call looks like this:
Invoke-WebRequest -Uri "https://<rubrik-host>/api/v2/sla_domain/INHERIT/assign" ... ... -Body "{
"managedIds":[
"VirtualMachine:::128abe2a-cea4-49a6-88a6-385a1202a7fd-vm-452450"],
"shouldApplyToExistingSnapshots":true}"
Notice the v2 in the API call.
When I try to do the same in Powershell, I get the error that v2 is an unknown API when authenticating using a token I got from a call to API v1. There is no such authentication call in API v2.
Question : Is it at all possible to use an API call to set the SLA assignment to Inherit (preferrably on a per VM basis) ?
Thanks, Hans