Re: Adding Ubuntu Support

2009-03-27 Thread Andy Kurth

Hi Brian,
The framework you need is there but Linux.pm hasn't been worked on yet.  The 
info at the following URL is pretty current:

http://cwiki.apache.org/confluence/display/VCL/Operating+System+Module+Interface+Specification

For the issues you mentioned, you'll need to implement 2 subroutines:
-grant_access()
-reserve()

These subs can call any other subs in the OS module or from a module it inherits 
from.  Once you implement these, the state modules (new.pm, reserve.pm, ...) 
will bypass their calls to add users, configure ext_sshd, etc. via code like this:


reserved.pm:
if ($self->os->can("grant_access")) {
  call $os->grant_access()...
}
elsif ($computer_type =~ /blade|virtualmachine/) {
  call old subs out of utils.pm...
}

Your capture_prepare() and capture_start() subs will work for now, but they 
should eventually be changed to a single sub named pre_capture().  Take a look 
at pre_capture() in Windows_mod.pm and also the section in xCAT.pm where 
pre_capture() is called.  The provisioning engine's capture() sub calls 
OS::pre_capture() and passes it the ending power state it desires.  xCAT.pm 
wants the computer to be shut down by pre_capture(), so the call is:


$self->os->pre_capture({end_state => 'off'}

Any other subs not listed on the page noted above can really be named anything 
but it would be nice to try to align the sub names with Window_mod.pm.  I think 
it's best to work these subs out in Ubuntu.pm.  Any subs which can be used by 
any flavor of Linux should eventually be moved up to Linux.pm, and Ubuntu.pm 
should inherit from Linux.pm.


I have begun describing the inheritance details here:
http://cwiki.apache.org/confluence/display/VCL/Operating+System+Module+Inheritance

Hope this helps,
Andy




Brian Bouterse wrote:
I've tried to add in an Ubuntu virtual machine into a VCL installation 
using the latest code base and the esx.pm module.  The VM gets 
provisioned properly, VCL ssh's into the box, queries the public IP 
properly, but fails to add the user and set their password.


I thought I could write an OS module to add the Ubuntu support, so I 
created a Ubuntu.pm based on the existing Linux.pm since most of that 
worked already for Ubuntu.  As a reference for others, I installed this 
Ubuntu.pm by doing the following modifications:


1) Insert a row into the module table with `perlpackage` equal to 
'VCL::Module::OS::Ubuntu'
2) Insert a row into the OS table with `moduleid` equal to the id of the 
entry from step 1 in the module table
3) Insert/Modify a row in the image table with `OSid` equal to the id of 
the entry from step 2 in the OS table


Here is the log output showing what isn't working with this Ubuntu.pm 
module as it manipulates an ubuntu VM:


2009-03-25 22:17:27|20858|113:13|reserved|reserved.pm:process(191)|user 
acknowledged, remote IP: 76.182.122.192
2009-03-25 22:17:27|20858|113:13|reserved|reserved.pm:process(210)|blade 
or virtual machine detected: virtualmachine
2009-03-25 22:17:27|20858|113:13|reserved|reserved.pm:process(264)|Linux 
image detected: ubuntu
2009-03-25 
22:17:27|20858|113:13|reserved|utils.pm:run_ssh_command(6691)|executing 
SSH command on vcl12: /usr/sbin/useradd -u 101 -d /home/admin -m admin 
-g ncsu
2009-03-25 
22:17:28|20858|113:13|reserved|utils.pm:run_ssh_command(6772)|run_ssh_command 
output: useradd: unknown group ncsu
2009-03-25 
22:17:28|20858|113:13|reserved|utils.pm:run_ssh_command(6775)|SSH 
command executed on vcl12: /usr/sbin/useradd -u 101 -d /home/admin -m 
admin -g ncsu, returning (6, output)
2009-03-25 
22:17:28|20858|113:13|reserved|utils.pm:run_ssh_command(6691)|executing 
SSH command on vcl12: cat /etc/passwd
2009-03-25 
22:17:28|20858|113:13|reserved|utils.pm:run_ssh_command(6772)|run_ssh_command 
output: root:x:0:0:root:/root:/bin/bash

|20858|113:13|reserved| daemon:x:1:1:daemon:/usr/sbin:/bin/sh
|20858|113:13|reserved| bin:x:2:2:bin:/bin:/bin/sh
|20858|113:13|reserved| sys:x:3:3:sys:/dev:/bin/sh
|20858|113:13|reserved| sync:x:4:65534:sync:/bin:/bin/sync
|20858|113:13|reserved| games:x:5:60:games:/usr/games:/bin/sh
|20858|113:13|reserved| man:x:6:12:man:/var/cache/man:/bin/sh
|20858|113:13|reserved| lp:x:7:7:lp:/var/spool/lpd:/bin/sh
|20858|113:13|reserved| mail:x:8:8:mail:/var/mail:/bin/sh
|20858|113:13|reserved| news:x:9:9:news:/var/spool/news:/bin/sh
|20858|113:13|reserved| uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
|20858|113:13|reserved| proxy:x:13:13:proxy:/bin:/bin/sh
|20858|113:13|reserved| www-data:x:33:33:www-data:/var/www:/bin/sh
|20858|113:13|reserved| backup:x:34:34:backup:/var/backups:/bin/sh
|20858|113:13|reserved| list:x:38:38:Mailing List Manager:/var/list:/bin/sh
|20858|113:13|reserved| irc:x:39:39:ircd:/var/run/ircd:/bin/sh
|20858|113:13|reserved| gnats:x:41:41:Gnats Bug-Reporting System 
(admin):/var/lib/gnats:/bin/sh

|20858|113:13|reserved| nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
|20858|113:13|reserved| libuuid:x:100:101::/var/lib/libuuid:/bin/sh
|20858|113:13|reserved| syslog:x:

Adding Ubuntu Support

2009-03-26 Thread Brian Bouterse
I've tried to add in an Ubuntu virtual machine into a VCL installation  
using the latest code base and the esx.pm module.  The VM gets  
provisioned properly, VCL ssh's into the box, queries the public IP  
properly, but fails to add the user and set their password.


I thought I could write an OS module to add the Ubuntu support, so I  
created a Ubuntu.pm based on the existing Linux.pm since most of that  
worked already for Ubuntu.  As a reference for others, I installed  
this Ubuntu.pm by doing the following modifications:


1) Insert a row into the module table with `perlpackage` equal to  
'VCL::Module::OS::Ubuntu'
2) Insert a row into the OS table with `moduleid` equal to the id of  
the entry from step 1 in the module table
3) Insert/Modify a row in the image table with `OSid` equal to the id  
of the entry from step 2 in the OS table


Here is the log output showing what isn't working with this Ubuntu.pm  
module as it manipulates an ubuntu VM:


2009-03-25 22:17:27|20858|113:13|reserved|reserved.pm:process(191)| 
user acknowledged, remote IP: 76.182.122.192
2009-03-25 22:17:27|20858|113:13|reserved|reserved.pm:process(210)| 
blade or virtual machine detected: virtualmachine
2009-03-25 22:17:27|20858|113:13|reserved|reserved.pm:process(264)| 
Linux image detected: ubuntu
2009-03-25 22:17:27|20858|113:13|reserved| 
utils.pm:run_ssh_command(6691)|executing SSH command on vcl12: /usr/ 
sbin/useradd -u 101 -d /home/admin -m admin -g ncsu
2009-03-25 22:17:28|20858|113:13|reserved| 
utils.pm:run_ssh_command(6772)|run_ssh_command output: useradd:  
unknown group ncsu
2009-03-25 22:17:28|20858|113:13|reserved| 
utils.pm:run_ssh_command(6775)|SSH command executed on vcl12: /usr/ 
sbin/useradd -u 101 -d /home/admin -m admin -g ncsu, returning (6,  
output)
2009-03-25 22:17:28|20858|113:13|reserved| 
utils.pm:run_ssh_command(6691)|executing SSH command on vcl12: cat / 
etc/passwd
2009-03-25 22:17:28|20858|113:13|reserved| 
utils.pm:run_ssh_command(6772)|run_ssh_command output: root:x: 
0:0:root:/root:/bin/bash

|20858|113:13|reserved| daemon:x:1:1:daemon:/usr/sbin:/bin/sh
|20858|113:13|reserved| bin:x:2:2:bin:/bin:/bin/sh
|20858|113:13|reserved| sys:x:3:3:sys:/dev:/bin/sh
|20858|113:13|reserved| sync:x:4:65534:sync:/bin:/bin/sync
|20858|113:13|reserved| games:x:5:60:games:/usr/games:/bin/sh
|20858|113:13|reserved| man:x:6:12:man:/var/cache/man:/bin/sh
|20858|113:13|reserved| lp:x:7:7:lp:/var/spool/lpd:/bin/sh
|20858|113:13|reserved| mail:x:8:8:mail:/var/mail:/bin/sh
|20858|113:13|reserved| news:x:9:9:news:/var/spool/news:/bin/sh
|20858|113:13|reserved| uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
|20858|113:13|reserved| proxy:x:13:13:proxy:/bin:/bin/sh
|20858|113:13|reserved| www-data:x:33:33:www-data:/var/www:/bin/sh
|20858|113:13|reserved| backup:x:34:34:backup:/var/backups:/bin/sh
|20858|113:13|reserved| list:x:38:38:Mailing List Manager:/var/list:/ 
bin/sh

|20858|113:13|reserved| irc:x:39:39:ircd:/var/run/ircd:/bin/sh
|20858|113:13|reserved| gnats:x:41:41:Gnats Bug-Reporting System  
(admin):/var/lib/gnats:/bin/sh

|20858|113:13|reserved| nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
|20858|113:13|reserved| libuuid:x:100:101::/var/lib/libuuid:/bin/sh
|20858|113:13|reserved| syslog:x:101:102::/home/syslog:/bin/false
|20858|113:13|reserved| klog:x:102:103::/home/klog:/bin/false
|20858|113:13|reserved| hplip:x:103:7:HPLIP system user,,,:/var/run/ 
hplip:/bin/false
|20858|113:13|reserved| avahi-autoipd:x:104:112:Avahi autoip  
daemon,,,:/var/lib/avahi-autoipd:/bin/false
|20858|113:13|reserved| gdm:x:105:113:Gnome Display Manager:/var/lib/ 
gdm:/bin/false
|20858|113:13|reserved| pulse:x:106:115:PulseAudio daemon,,,:/var/run/ 
pulse:/bin/false

|20858|113:13|reserved| saned:x:107:118::/home/saned:/bin/false
|20858|113:13|reserved| messagebus:x:108:119::/var/run/dbus:/bin/false
|20858|113:13|reserved| polkituser:x:109:120:PolicyKit,,,:/var/run/ 
PolicyKit:/bin/false
|20858|113:13|reserved| avahi:x:110:121:Avahi mDNS daemon,,,:/var/run/ 
avahi-daemon:/bin/false
|20858|113:13|reserved| haldaemon:x:111:122:Hardware abstraction  
layer,,,:/var/run/hald:/bin/false
|20858|113:13|reserved| tchaw:x:1000:1000:TC Ling,,,:/home/tchaw:/bin/ 
bash
|20858|113:13|reserved| sshd:x:112:65534::/var/run/sshd:/usr/sbin/ 
nologin
2009-03-25 22:17:28|20858|113:13|reserved| 
utils.pm:run_ssh_command(6775)|SSH command executed on vcl12: cat /etc/ 
passwd, returning (0, output)
2009-03-25 22:17:28|20858|113:13|reserved|utils.pm:add_user(3093)| 
added user account admin to vcl12
2009-03-25 22:17:28|20858|113:13|reserved| 
utils.pm:run_ssh_command(6691)|executing SSH command on vcl12: echo  
"AllowUsers admin" >> /etc/ssh/external_sshd_config
2009-03-25 22:17:28|20858|113:13|reserved| 
utils.pm:run_ssh_command(6772)|run_ssh_command output: none
2009-03-25 22:17:28|20858|113:13|reserved| 
utils.pm:run_ssh_command(6775)|SSH command executed on vcl12: echo  
"AllowUsers admin" >> /etc/ssh/external_sshd_config, returning (0,  
output)
200