Hi All,
I was trying to automate importing an existing host profile saved on my local path into the vCenter using Perl SDK but could not find a way. The reference guide only mentions how to create a host profile but not how to import an existing one. Does anyone have a clue of how to proceed with this? Thanks in advance
Abhinav.
You'd call CreateProfile from the HostProfileManager object. You'd subclass the createSpec with ProfileSerializedCreateSpec. Set the enabled, name and annotation. The profileConfigString is the XML export of the HostProfile. You can also CreateProfiles by filling out the various sections manually (it's tedious though).
I actually did write up some Perl test scripts before working on a project around HostProfile management with Orchestrator. I think I have them archived and I'll try to find them. It was pretty easy to import and export XML, however. The harder part was doing Apply* operations and answering user input fields.
Hi stumpr,
Thanks!!That does explain a lot. I will definitely try what you suggested and come back to you with issues if I face any. In case you can provide me with the scripts that you mentioned about, that would be of great help.
I looked through my backup, I didn't save the Perl snippets. The Orchestrator project work was for a customer, so that was retained by VMware when I left.
If you hit any snags, definitely post back. I'll be happy to share. I really don't remember having too many problems importing and exporting profiles. Most of the issues were with the bugs/quirks in the host profiles in general
Hi Stumpr,
I am back with a problem again regarding creating host profiles.
I am creating the host profile by following piece of code
open FH, $profilefilename || $logger->logconfess("Unable to open Host Profile file");
my $pcstr = <FH> ;
my $pcs = ProfileSerializedCreateSpec->new(enabled => 'true', name => $pname, profileConfigString => $pcstr );
my $profile = $hostProfileManager->CreateProfile(createSpec => $pcs );
But the call is failing with error
Could not create the profile due to the following error
SOAP Fault:
-----------
Fault string: There is no valid reference host associated with the profile .
Fault detail: InvalidProfileReferenceHostFault
I tried to find this error but could not get hold of anything substantial. Could you point out where I might be going wrong?
Thanks,
Abhinav
I think you'll need to use HostProfileSerializedHostProfileCreateSpec and include the validatorHost property, which points to an existing Host you want to use as the reference host. Currently HostProfiles require a reference host during import, though I do recall there is some plans in the future to remove that requirement (but I don't have any official timeline on when that might happen).
So for now, you'll probably have to import the host profile against a reference host.
Hi Stumpr,
Thanks for the help man! It really did work Thanks a tonne for your prompt replies, you always help me out of difficult situations. Hats off!
Thanks,
Abhinav
No worries. Always glad to help. Thanks for the update!