[one-users] OpenNebula 4.4(?)

Michael Curran michael.curran at connectsolutions.com
Wed Oct 23 08:28:38 PDT 2013


Martin -- have you made any changes to the context.sh that is created? 

When I leave the default context.sh (and I modified the one-context.ps1 to only spit out variables) as default from opennebula -- it looks like this 

ETH0_DNS='10.7.6.21'
ETH0_GATEWAY='10.7.0.1'
ETH0_IP='10.7.3.243'
ETH0_MASK='255.255.248.0'
USERNAME='testing'
HOSTNAME='test1-vm'

And this is the output of the one-context.ps1 script I am putting at the bottom of this email

PS C:\cygwin\home\mcurran\context_testing> .\one-context.ps1
Windows username is
HOSTNAME is
IP address is  , NETMASK is  , GATEWAY is  , DNS is

When I modify the context.sh to use double-quotes around the variables, instead of the single quotes shown above,  this is my output

PS C:\cygwin\home\mcurran\context_testing> .\one-context.ps1
Windows username is testing
HOSTNAME is test1-vm
IP address is 10.7.3.243 , NETMASK is 255.255.248.0 , GATEWAY is 10.7.0.1 , DNS is 10.7.6.21


#################################################################
##### Windows Powershell Script to configure OpenNebula VMs #####
#####   Created by andremonteiro at ua.pt and tsbatista at ua.pt  #####
#####        DETI/IEETA Universidade de Aveiro 2011         #####
#################################################################

Set-ExecutionPolicy unrestricted -force # not needed if already done once on the VM
[string]$computerName = "$env:computername"
[string]$ConnectionString = "WinNT://$computerName"

function getContext($file) {
        $context = @{}
        switch -regex -file $file {
                '(.+)="(.+)"' {
                        $name,$value = $matches[1..2]
                        $context[$name] = $value
                }
        }
        return $context
}

function addLocalUser($context) {
    # Create new user
        $username =  $context["USERNAME"]
		write-host "Windows username is $($username)"
}


function configureNetwork($context) {
    # Print IP address data
		$dns = $context["ETH0_DNS"]
		$gateway = $context["ETH0_GATEWAY"]
		$ip = $context["ETH0_IP"]
		$netmask = $context["ETH0_MASK"]
		write-host "IP address is $($ip) , NETMASK is $($netmask) , GATEWAY is $($gateway) , DNS is $($dns)" 
}

function renameComputer($context) {
	# Print new hostname
		$hostname = $context["HOSTNAME"]
		write-host "HOSTNAME is $($hostname)"
   }

   # If folder context doesn't exist create it
if (-not (Test-Path "c:\cygwin\home\mcurran\context\")) {
    New-Item "C:\cygwin\home\mcurran\context\" -type directory
    }

# Execute script
if( -not(Test-Path "c:\cygwin\home\mcurran\context\contextualized") -and (Test-Path "C:\cygwin\home\mcurran\context_testing\context.sh")) {
    $context = @{}
    $context = getContext('C:\cygwin\home\mcurran\context_testing\context.sh')
    addLocalUser($context)
    renameComputer($context)
    configureNetwork($context)
    echo "contextualized" |Out-File ("c:\cygwin\home\mcurran\context\contextualized")
}


Michael Curran | connectsolutions | Lead Network Architect
Phone 614.568.2285 | Mobile 614.403.6320 | www.connectsolutions.com

-----Original Message-----
From: Martin Alfke [mailto:tuxmea at gmail.com] 
Sent: Tuesday, October 22, 2013 3:00 AM
To: Michael Curran
Cc: users
Subject: Re: [one-users] OpenNebula 4.4(?)

Hi Michael,

we use the same one-context.ps1 file for Win7 Professional and Win8 Professional.
Win7 has PowerShell V2, Win8 has PowerShell V3.

- Martin

On Oct 21, 2013, at 8:25 PM, Michael Curran <michael.curran at connectsolutions.com> wrote:

> That should way win2k8 R2 -- :)
> 
> Michael Curran | connectsolutions | Lead Network Architect Phone 
> 614.568.2285 | Mobile 614.403.6320 | www.connectsolutions.com
> 
> -----Original Message-----
> From: users-bounces at lists.opennebula.org 
> [mailto:users-bounces at lists.opennebula.org] On Behalf Of Michael 
> Curran
> Sent: Monday, October 21, 2013 2:02 PM
> To: Martin Alfke
> Cc: users
> Subject: Re: [one-users] OpenNebula 4.4(?)
> 
> Strange -- I updated to PS3 , and when I run their scripts in win2k7 
> r2 -- it states clearly it doenst understand the variables --
> 
> Could it be a difference between windows versions?
> 
> Michael Curran | connectsolutions | Lead Network Architect Phone 
> 614.568.2285 | Mobile 614.403.6320 | www.connectsolutions.com
> 
> -----Original Message-----
> From: Martin Alfke [mailto:tuxmea at gmail.com]
> Sent: Monday, October 21, 2013 11:59 AM
> To: Michael Curran
> Cc: Tino Vazquez; users
> Subject: Re: [one-users] OpenNebula 4.4(?)
> 
> Hi Michael,
> 
> we did no changes to context.sh
> We only enable contextualisation and use the WIn startup and 
> powershell wrapper script from ieeta.pt
> 
> This is the context.sh from a Win8 VM (I modified the HOSTNAME to make it public):
> 
> # Context variables generated by OpenNebula DISK_ID='1'
> ETH0_DNS='10.175.4.11 10.175.4.12'
> ETH0_GATEWAY='10.175.16.1'
> ETH0_IP='10.175.24.28'
> ETH0_MASK='255.255.240.0'
> ETH0_NETWORK='10.175.16.0'
> FILES_DS='/var/lib/one/datastores/2/6d59d36aaac67c69f1ceb0ce48ad9e30:'\''SetupCompleteWin8.cmd'\'' /var/lib/one/datastores/2/036c86e3eb2ba86910c5494471ff743d:'\''startupWin8.vbs'\'' /var/lib/one/datastores/2/d1abbf10eda3863726d9911df4d0868c:'\''one-contextWin8.ps1'\'' '
> HOSTNAME='win8martin.domain.com'
> NETWORK='YES'
> TARGET='hdb'
> 
> Note: our Linux systems are running in english only.
> 
> - Martin
> 
> 
> On Oct 21, 2013, at 5:46 PM, Michael Curran <michael.curran at connectsolutions.com> wrote:
> 
>> Very helpful data Martin -- but the problem I ran into was that the context.sh was created with single quotes and even PS3 couldn't read the variables unless they were in double quotes -- how did you get past that problem? 
>> 
>> Michael Curran | connectsolutions | Lead Network Architect Phone
>> 614.568.2285 | Mobile 614.403.6320 | www.connectsolutions.com
>> 
>> -----Original Message-----
>> From: users-bounces at lists.opennebula.org
>> [mailto:users-bounces at lists.opennebula.org] On Behalf Of Tino Vazquez
>> Sent: Monday, October 21, 2013 6:35 AM
>> To: Martin Alfke
>> Cc: users
>> Subject: Re: [one-users] OpenNebula 4.4(?)
>> 
>> Hi Martin,
>> 
>> Indeed, this is very helpful.
>> 
>> We've opened a feature request [1] to include windows guest contextualization support in OpenNebula.
>> 
>> Thanks a lot for your feedback,
>> 
>> -Tino
>> 
>> [1] http://dev.opennebula.org/issues/2395
>> --
>> OpenNebula - Flexible Enterprise Cloud Made Simple
>> 
>> --
>> Constantino Vázquez Blanco, PhD, MSc
>> Senior Infrastructure Architect at C12G Labs www.c12g.com | @C12G | 
>> es.linkedin.com/in/tinova
>> 
>> --
>> Confidentiality Warning: The information contained in this e-mail and any accompanying documents, unless otherwise expressly indicated, is confidential and privileged, and is intended solely for the person and/or entity to whom it is addressed (i.e. those identified in the "To" and "cc" box). They are the property of C12G Labs S.L..
>> Unauthorized distribution, review, use, disclosure, or copying of this communication, or any part thereof, is strictly prohibited and may be unlawful. If you have received this e-mail in error, please notify us immediately by e-mail at abuse at c12g.com and delete the e-mail and attachments and any copy from your system. C12G thanks you for your cooperation.
>> 
>> 
>> On Mon, Oct 21, 2013 at 8:49 AM, Martin Alfke <tuxmea at gmail.com> wrote:
>>> Hi,
>>> 
>>> we used the contextualisation from
>>> http://wiki.ieeta.pt/wiki/index.php/OpenNebula#Using_Windows_Images_
>>> f o r_new_Virtual_Machines (which is also linked at the OpenNebula
>>> Wiki) and did some minor changes.
>>> 
>>> We only assign IP address, hostname and enable RDP Hostname is set 
>>> as contextualisation variable: HOSTNAME = $name (We use the VM name 
>>> as fqdn).
>>> 
>>> We now only miss setting the DNS according to contextualisation (we need to split the variable into an array).
>>> 
>>> 
>>> This is the diff to the one_context.ps1 file:
>>> 
>>> --- one-context_orig.ps1        2013-10-21 08:43:14.000000000 +0200
>>> +++ one-contextWin8.ps1 2013-10-18 14:35:34.000000000 +0200
>>> @@ -4,14 +4,14 @@
>>> #####        DETI/IEETA Universidade de Aveiro 2011         #####
>>> #################################################################
>>> 
>>> -Set-ExecutionPolicy unrestricted -force # not needed if already 
>>> done once on the VM
>>> +Set-ExecutionPolicy Unrestricted -force # not needed if already 
>>> +done once on the VM
>>> [string]$computerName = "$env:computername"
>>> [string]$ConnectionString = "WinNT://$computerName"
>>> 
>>> function getContext($file) {
>>>    $context = @{}
>>>    switch -regex -file $file {
>>> -        '(.+)="(.+)"' {
>>> +        "(.+)='(.+)'" {
>>>            $name,$value = $matches[1..2]
>>>            $context[$name] = $value
>>>        }
>>> @@ -77,13 +77,14 @@
>>> function configureNetwork($context) {
>>>    $Nics = Get-WMIObject Win32_NetworkAdapterConfiguration | where {$_.IPEnabled -eq "TRUE" -and ($_.MACAddress)}
>>>    foreach ($nic in $Nics) {
>>> -        [String]$mac = $nic.MACAddress
>>> -        [String]$ip = getIp($mac)
>>> -        [String]$gw = getGateway($mac)
>>> +        [String]$ip = $context["ETH0_IP"]
>>> +        [String]$gw = $context["ETH0_GATEWAY"]
>>> +        [String]$mask = $context["ETH0_MASK"]
>>>        $nic.ReleaseDHCPLease()
>>> -        $nic.EnableStatic($ip , "255.255.255.0")
>>> +        $nic.EnableStatic($ip , $mask)
>>>        $nic.SetGateways($gw)
>>> -        $DNSServers = "193.136.172.20", "193.136.171.21"
>>> +        $DNSServers = "10.175.4.11", "10.175.4.12"
>>> +        # $DNSServers = $context["ETH0_DNS"]
>>>        $nic.SetDNSServerSearchOrder($DNSServers)
>>>        $nic.SetDynamicDNSRegistration("TRUE")
>>>        $nic.SetWINSServer($DNSServers[0], $DNSServers[1]) @@ -91,8
>>> +92,10 @@  }
>>> 
>>> function renameComputer($context) {
>>> -    $ComputerInfo = Get-WmiObject -Class Win32_ComputerSystem
>>> -    $ComputerInfo.rename($context["HOSTNAME"])
>>> +    $fullName = $context["HOSTNAME"]
>>> +    $computerName = $fullName.Split(".")[0]
>>> +    $computerInfo = Get-WmiObject -Class Win32_ComputerSystem
>>> +    $computerInfo.rename($computerName)
>>> }
>>> 
>>> function enableRemoteDesktop()
>>> 
>>> hth,
>>> 
>>> Martin
>>> 
>>> On Oct 18, 2013, at 4:18 PM, Tino Vazquez <cvazquez at c12g.com> wrote:
>>> 
>>>> Hi Martin,
>>>> 
>>>> That sounds great. Did you extend the ecosystem windows 
>>>> contextualization contribution, or is it something custom made from 
>>>> scratch?
>>>> 
>>>> Regards,
>>>> 
>>>> -Tino
>>>> --
>>>> OpenNebula - Flexible Enterprise Cloud Made Simple
>>>> 
>>>> --
>>>> Constantino Vázquez Blanco, PhD, MSc Senior Infrastructure 
>>>> Architect at C12G Labs www.c12g.com | @C12G | 
>>>> es.linkedin.com/in/tinova
>>>> 
>>>> --
>>>> Confidentiality Warning: The information contained in this e-mail 
>>>> and any accompanying documents, unless otherwise expressly 
>>>> indicated, is confidential and privileged, and is intended solely 
>>>> for the person and/or entity to whom it is addressed (i.e. those 
>>>> identified in the "To" and "cc" box). They are the property of C12G Labs S.L..
>>>> Unauthorized distribution, review, use, disclosure, or copying of 
>>>> this communication, or any part thereof, is strictly prohibited and 
>>>> may be unlawful. If you have received this e-mail in error, please 
>>>> notify us immediately by e-mail at abuse at c12g.com and delete the 
>>>> e-mail and attachments and any copy from your system. C12G thanks 
>>>> you for your cooperation.
>>>> 
>>>> 
>>>> On Fri, Oct 18, 2013 at 3:40 PM, Martin Alfke <tuxmea at gmail.com> wrote:
>>>>> Hi Tino,
>>>>> 
>>>>> many thanks for the update.
>>>>> 
>>>>> @Michael:
>>>>> 
>>>>> we run ONE 4.2 using Windows contextualisation without troubles (Network settings and RDP enabling) for Win7 and Win8.
>>>>> 
>>>>> Kind regards,
>>>>> 
>>>>> Martin
>>>>> 
>>>>> 
>>>>> On Oct 18, 2013, at 11:05 AM, Tino Vazquez <cvazquez at c12g.com> wrote:
>>>>> 
>>>>>> Hi Michael,
>>>>>> 
>>>>>> The beta version of OpenNebula 4.4 is due in one week. The single 
>>>>>> quote issue would be resolved (we would love to hear your 
>>>>>> feedback on this as soon as it is out), RbVmomi in place and 
>>>>>> multiple system ds support.
>>>>>> 
>>>>>> We would appreciate it if you could elaborate a bit more on your 
>>>>>> plans regarding windows contextualization.
>>>>>> 
>>>>>> Best,
>>>>>> 
>>>>>> -Tino
>>>>>> --
>>>>>> OpenNebula - Flexible Enterprise Cloud Made Simple
>>>>>> 
>>>>>> --
>>>>>> Constantino Vázquez Blanco, PhD, MSc Senior Infrastructure 
>>>>>> Architect at C12G Labs www.c12g.com | @C12G | 
>>>>>> es.linkedin.com/in/tinova
>>>>>> 
>>>>>> --
>>>>>> Confidentiality Warning: The information contained in this e-mail 
>>>>>> and any accompanying documents, unless otherwise expressly 
>>>>>> indicated, is confidential and privileged, and is intended solely 
>>>>>> for the person and/or entity to whom it is addressed (i.e. those 
>>>>>> identified in the "To" and "cc" box). They are the property of C12G Labs S.L..
>>>>>> Unauthorized distribution, review, use, disclosure, or copying of 
>>>>>> this communication, or any part thereof, is strictly prohibited 
>>>>>> and may be unlawful. If you have received this e-mail in error, 
>>>>>> please notify us immediately by e-mail at abuse at c12g.com and 
>>>>>> delete the e-mail and attachments and any copy from your system.
>>>>>> C12G thanks you for your cooperation.
>>>>>> 
>>>>>> 
>>>>>> On Thu, Oct 17, 2013 at 2:58 PM, Michael Curran 
>>>>>> <michael.curran at connectsolutions.com> wrote:
>>>>>>> Is there any expected release date for this yet? I have a fully 
>>>>>>> functional POC that handles *nix and windows, but cannot 
>>>>>>> contextualize windows because of the single quotes around 
>>>>>>> variables in the context.sh ... Which I was told would be 
>>>>>>> resolved in the next release, along with the move away from libvirt to rbvmomi for accessing the cIpher and multiple system datastores support.
>>>>>>> 
>>>>>>> Any news would help me while wee start build of an OpenStack poc 
>>>>>>> for comparison against
>>>>>>> 
>>>>>>> Sent from my Android phone using TouchDown (www.nitrodesk.com)
>>>>>>> 
>>>>>>> _______________________________________________
>>>>>>> Users mailing list
>>>>>>> Users at lists.opennebula.org
>>>>>>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>>>>>> 
>>>>>> _______________________________________________
>>>>>> Users mailing list
>>>>>> Users at lists.opennebula.org
>>>>>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>>>> 
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users at lists.opennebula.org
>>>>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>> 
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opennebula.org
>>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>> _______________________________________________
>> Users mailing list
>> Users at lists.opennebula.org
>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
> 
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org




More information about the Users mailing list