1 2 Previous Next 16 Replies Latest reply on Jun 10, 2011 3:27 PM by Bill Robinson

    Create Virtual Guest Job through BLCLI (8.1)

      Hello,

       

      I'm trying to deploy a new virtual machine (VMware vCenter) and want to create a new Virtual Guest Job through BLCLI ("Virtualization createVirtualGuestFromPackage"). The vCenter already contains a template with an operation system, which I'm trying to use. This is my XML Input:

       

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

      <VirtualGuestJobConfiguration>

          <VirtualGuestPackage>

              <VGPackageID>2000005</VGPackageID>

              <VirtualGuestPackageType>1</VirtualGuestPackageType>

              <VGName>vm15020</VGName>

              <PlatformInfo>

                  <VMwareInfo>

                      <IsCustomConfig>true</IsCustomConfig>

                      <VMXDatastore>datastore4</VMXDatastore>

                      <GuestOSId>1</GuestOSId>

                      <GuestOSVersionId>13</GuestOSVersionId>

                      <NumOfProcessors>2</NumOfProcessors>

                      <MemoryInMB>1024</MemoryInMB>

                      <VMwareDiskSettings>

                          <DiskInfo>

                              <DiskSize>4096</DiskSize>

                              <DiskSizeUnit>MB</DiskSizeUnit>

                              <Datastore>datastore4</Datastore>

                              </DiskInfo>

                          <DiskInfo>

                              <DiskSize>1</DiskSize>

                              <DiskSizeUnit>GB</DiskSizeUnit>

                              <Datastore>datastore4</Datastore>

                          </DiskInfo>

                      </VMwareDiskSettings>

                      <VMwareNetworkSettings>

                          <NetworkConnection>

                              <Network>VM Network</Network>

                              <Adapter>E1000</Adapter>

                              <ConnectAtPowerOn>true</ConnectAtPowerOn>

                              <GuestNetworkConfiguration>

                                  <IPAddress>192.168.1.100</IPAddress>

                                  <SubnetMask>255.255.255.0</SubnetMask>

                                  <DefaultGateway>192.168.1.1</DefaultGateway>

                                  <PrimaryDNS>192.168.1.230</PrimaryDNS>

                                  <SecondaryDNS>192.168.1.231</SecondaryDNS>

                              </GuestNetworkConfiguration>

                          </NetworkConnection>

                      </VMwareNetworkSettings>

                      <OSCustomizationInfo>

                          <WindowsCustomizationInfo>

                              <ComputerName>vm15020</ComputerName>

                              <AdminPassword>BLencrypt:VVVLQXXWXQLWBMXWNOAEKMNVUPNTZBLPPLTVPTQTNXZBQMUWAXAQXLBOTTBEVLMN</AdminPassword>

                              <Workgroup>bmc</Workgroup>

                              <UserName>bmc</UserName>

                              <Organization>bmc</Organization>

                              <LicenseKey>ABCDE-12345-67890-DEFGH-IJKLMN</LicenseKey>

                              <LicenseType>perSeat</LicenseType>

                              <TimezoneId>1</TimezoneId>

                              <LocaleId>1</LocaleId>

                          </WindowsCustomizationInfo>

                      </OSCustomizationInfo>

                  </VMwareInfo>

              </PlatformInfo>

          </VirtualGuestPackage>

          <VirtualGuestJob>

              <JobName>NewTestVMWareJOB2</JobName>

              <JobFolderID>2000101</JobFolderID>

              <VirtualGuestDestination>2000100,VMwareESXServer,host-28</VirtualGuestDestination>

              <ExecuteNow>true</ExecuteNow>

          </VirtualGuestJob>

          <LifeCycle>

              <SkipApproval>true</SkipApproval>

              <ServiceRquestID>SRID1</ServiceRquestID>

              <ChangeID>CID1</ChangeID>

              <TaskID>TID1</TaskID>

              <Owner>Ranga Satteli</Owner>

              <ExpiryDate>2009-07-27 04:54:44</ExpiryDate>

              <GroupName>myGroup</GroupName>

              <ServiceLevel>gold</ServiceLevel>

          </LifeCycle>

      </VirtualGuestJobConfiguration>

       

      The template contains one network adapter and I want to configure it. Because of this, I set the "IsCustomConfig" parameter to true. But unfortunately, this flag ("Customize OS") won't be set to true in the created Job and no custom settings are set (including RAM, CPU). Does anyone know what I'm doing wrong?

        • 1. Create Virtual Guest Job through BLCLI (8.1)

          You need to set the customize flag on the VGP in the depot that this job is based on. Then you should be able to customize in your job.

          • 2. Create Virtual Guest Job through BLCLI (8.1)

            Hello Adam,

             

            thanks for your reply. Unfortunately this doesn't work. If I set the customize flag in the depot, I need to provide all required information. I typed in some testdata, but when I create the job through BLCLI, the provided ip address, computer name & co in my XML file is not been set at the created job.

            • 3. Create Virtual Guest Job through BLCLI (8.1)

              Yes, you set the option in the VGP and then put in dummy or place holder data. After you saved the template, keep in mind that your VGPackageID has changed so, if your VGPackageID is still 2000005, then that is incorrect. Also, are you using a template? If so, then your VirtualGuestPackageType should be 2, and not 1.

              • 4. Create Virtual Guest Job through BLCLI (8.1)

                Here is an XML that worked for me last week to to do a custom provision of a VGP template:

                 

                <?xml version="1.0" encoding="UTF-8"standalone="yes"?>

                <VirtualGuestJobConfiguration>

                <VirtualGuestPackage>

                <VGPackageID>2000023</VGPackageID>

                <VirtualGuestName>test-1</VirtualGuestName>

                <PlatformInfo>

                <VMwareInfo>

                <IsCustomConfig>false</IsCustomConfig>

                <VMXDatastore>VMWARE SHARED DATASTORE</VMXDatastore>

                <GuestOSId>2</GuestOSId>

                <GuestOSVersionId>39</GuestOSVersionId>

                <NumOfProcessors>2</NumOfProcessors>

                <MemoryInMB>2048</MemoryInMB>

                <VMwareDiskSettings>

                <DiskInfo>

                <DiskSize>51200</DiskSize>

                <DiskSizeUnit>MB</DiskSizeUnit>

                <Datastore>VMWARE SHARED DATASTORE</Datastore>

                </DiskInfo>

                </VMwareDiskSettings>

                <VMwareNetworkSettings>

                <NetworkConnection>

                <Network>VM Network 2 - Internet</Network>

                <Adapter>E1000</Adapter>

                <ConnectAtPowerOn>true</ConnectAtPowerOn>

                <GuestNetworkConfiguration>

                <IPAddress>192.168.2.64</IPAddress>

                <SubnetMask>255.255.255.0</SubnetMask>

                <DefaultGateway>192.168.2.1</DefaultGateway>

                <PrimaryDNS>192.168.3.4</PrimaryDNS>

                <SecondaryDNS>192.168.3.5</SecondaryDNS></GuestNetworkConfiguration>

                </NetworkConnection>

                </VMwareNetworkSettings>

                <OSCustomizationInfo>

                <LinuxCustomizationInfo>

                <HostName>tbdtest-1</HostName>

                <Domain>privatecloud</Domain>

                </LinuxCustomizationInfo>

                </OSCustomizationInfo>

                </VMwareInfo>

                </PlatformInfo>

                </VirtualGuestPackage>

                <VirtualGuestJob>

                <JobName>test-1</JobName>

                <JobFolderID>2000300</JobFolderID>

                <VirtualGuestDestination>2000000,VMwareCluster,domain-c83</VirtualGuestDestination>

                <ExecuteNow>true</ExecuteNow>

                </VirtualGuestJob>

                </VirtualGuestJobConfiguration>

                • 5. Re: Create Virtual Guest Job through BLCLI (8.1)

                  I've tried your example. The following errors occur:

                   

                  blcli Virtualization createVirtualGuestFromPackage /D/temp/bladelogic/vmware_linux2.xml

                  Command execution failed.  Missing VirtualGuest name in input file: <VGName>

                   

                  I've replaced the VirtualGuestName tag with VGName and the next error occured:

                   

                  blcli Virtualization createVirtualGuestFromPackage /D/temp/bladelogic/vmware_linux2.xml

                  Command execution failed.  invalid value in input file: <ServiceRquestID>

                   

                  I'm using BladeLogic 8.1 Patch 1. I've also tried your other hints, none of them worked. :-(

                   

                  By the way: why is in your example IsCustomConfig set to false? Shouldn't it be true?

                  • 6. Re: Create Virtual Guest Job through BLCLI (8.1)

                    You should use the 'createVirtualGuest' BLCLI instead. I'm sure that's the one Adam is using.

                    The one you're using is deprecated is guess. Moving forward the 'createVirtualGuest' BLCLI would be used.

                     

                    The best way of doing this for once is to set it all up in the VGP itself. You can then run a 'getVirtualGuestPackage' blcli which would spit out the correct XML for the VGP. Copy the entire PlatformInfo tag and paste it in your VGJ xml. Let me know if that works.

                     

                    Once this works, post that you can just create a VGP from a template and then do all modifications in the VGJ.

                    • 7. Re: Create Virtual Guest Job through BLCLI (8.1)

                      Great! Umar, thanks for your help. I didn't know that this method was depracated (it's not even noted in the API), but it's good to know. I used this method for version 8.0 and it worked fine there. Anyway, thanks alot!!

                      • 8. Re: Create Virtual Guest Job through BLCLI (8.1)

                        on a similar topic, how are you guys getting rid of these virtualguestjobs runs ??? on a regular basis?? some sort of maintenance job ? ..since they will have individual names, the results_retention_time property will not be applicable.. any ideas ??

                        • 9. Re: Create Virtual Guest Job through BLCLI (8.1)

                          I'm not sure why you would like to use the RESULTS_RETENTATION_TIME property, because as far as I know it just deletes the job runs.

                           

                          If you create a specific job folder where only those created deploy jobs are residing, you could create a NSH Script Job with BLCLI commands to delete all containing jobs and schedule it.

                           

                          And you can also specify the exact name of the created job:

                           

                          <VirtualGuestJob>

                          <JobName>test-1</JobName>

                          <JobFolderID>2000300</JobFolderID>

                          <VirtualGuestDestination>2000000,VMwareCluster,domain-c83</VirtualGuestDestination>

                          <ExecuteNow>true</ExecuteNow>

                          </VirtualGuestJob>

                           

                          Since you now know the created DeployJob name, you could delete the job right after it completed.

                          • 10. Re: Create Virtual Guest Job through BLCLI (8.1)
                            Bill Robinson

                            or set AUTO_GENERATED to true on the job object and run cleanup.

                            • 11. Re: Create Virtual Guest Job through BLCLI (8.1)

                              Marceld, Bill --- thanks for the tips..

                               

                              I must be getting confused here... the issue is that we dont want to delete the VGJ unless they are older ( existed within BL ) then 7days...any possible non fancy way to achieve this ?

                               

                              thx

                              • 12. Re: Create Virtual Guest Job through BLCLI (8.1)
                                Bill Robinson

                                Set AUTO_GENERATED=true on the job.

                                In blasadmin set the auto_generated time to 7 days

                                Run the blcli Delete executeRetentionPolicy

                                 

                                That should do it.

                                • 13. Re: Create Virtual Guest Job through BLCLI (8.1)

                                  thanks Bill.... just so I get a more complete picture:

                                   

                                  if I set AUTO_GENERATED  to "True"  on the  Job Run Properties, under the Job Run Property Class / Property Dictionary, then it would be a set it and forget it.... even for the jobs of type Virtual Guest Job Run... there would be no need to modify the xml .. right track ?

                                  • 14. Re: Create Virtual Guest Job through BLCLI (8.1)
                                    Bill Robinson

                                    AUTO_GENERATED is for Job and Depot objects, not Job Run. 

                                     

                                    You are trying to delete Job here, not the Job Run right?

                                    1 2 Previous Next