-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extended the InventoryBaseDSC class to resolve the path to a specific Inventory Item #90
Conversation
Signed-off-by: SimeonGerginov <simeongerginov1@gmail.com>
Signed-off-by: SimeonGerginov <simeongerginov1@gmail.com>
Signed-off-by: SimeonGerginov <simeongerginov1@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure there is more effective way to resolve path. Now algorithm starts with the parent folder, gets all children on the next level from the server and filters by name client-side and this repeat to the last level in the path. Those are a lot of server requests.
One way to optimize is getting inventory item by name, and going up through it's parent names to check which on if any has the desired path. I think the API allows filtering by name and you can request only the name property which will reduce the server round-trips and the data size retrieved from the server. I think Luc was implemented something similar in his resources. You can talk to him about it.
The request here is spend a little bit more time to figure out whether ammount of data and server round trips could be optimized before going forward with the resources that will inherit this base.
Signed-off-by: SimeonGerginov <simeongerginov1@gmail.com>
Tested with the following values: DatacenterPath = Datacenter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Rename "InventoryItemName" property to "Name"
- Rename "InventoryItemPath" property to "InventoryPath"
- Rename "DatacenterPath" property to "Datacenter"
- InventoryPath shouldn't include the root folder. Define hidden property that will be set by inheritors to determine the root folder.
Here is an example configuration for reference
MyDatacenterFolder
-MyDatacenter
--MyCluster
---MyHost1
---MyDVS
---MyVM
?Datacenter MyDatacetner {
Name =
Path =
}
Cluster MyCluster {
[Key]Name = "MyCluster"
[Key]InventoryPath = ""
[Key]Datacenter = "MyDatacenterFolder/MyDatacenter"
DependsOn = [Datacenter]
Ensure = Present
}
DVS MyDVS {
Name = "MyDVS"
InvtoryPath = "MyNetworkFolder"
DatacenterPath = "MyDatacenterFolder/MyDatacenter"
Ensure = Present
}
VM MyVM {
Name = "MyVM"
InvtoryPath = "Discovered Virtual Machines"
DatacenterPath = "MyDatacenterFolder/MyDatacenter"
?Datastore = MyDatastore1
?Compute = MyHost1
Ensure = Present
DependsOn = [MyDatastore1]
DependsOn = [MyHost1]
}
Signed-off-by: SimeonGerginov <simeongerginov1@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the documentation comments per my review comments. Everything else looks good.
Signed-off-by: SimeonGerginov <simeongerginov1@gmail.com>
Signed-off-by: SimeonGerginov simeongerginov1@gmail.com