From dpierce at redhat.com Tue Sep 1 14:04:26 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Tue, 1 Sep 2009 10:04:26 -0400 Subject: [Ovirt-devel] [PATCH node] Introduces the node-admin toolset. In-Reply-To: <4A9C3729.8060200@redhat.com> References: <1251733820-22719-1-git-send-email-dpierce@redhat.com> <1251733820-22719-2-git-send-email-dpierce@redhat.com> <4A9C3729.8060200@redhat.com> Message-ID: <20090901140426.GB3361@mcpierce-laptop.rdu.redhat.com> On Mon, Aug 31, 2009 at 04:48:41PM -0400, Joey Boggs wrote: > So I've got the tool set installed, but not fully tested just yet, > here's some things that need to be changed > > python -m compileall /usr/lib/python2.6/site-packages/nodeadmin in > common-post.ks of ovirt-node-image otherwise they get removed during > blacklisting > # common-blacklist.ks:find / -name '*.py' -exec rm -f {} \; That should be okay, though, right? As long as the *.pyc files remain we should be okay. > __init__.py is commented out, cant get this to copy to buildroot for > some reason, still working on it any ideas? > # %{__install} -p -m0644 admin/__init__.py > %{buildroot}%{python_sitelib}/nodeadmin Yeah, I've got no idea why that doesn't work. > missing dependencies, whether via rpm/python failures > > +python-setuptools - (needed for load_entry_point in nodeadmin) > +dbus-python +newt > +newt-python > +pkgconfig > +python-devel > +slang > +slang-devel kk, adding them in. > The egg creation in ovirt-node package for nodeadmin is failing > somewhere and the install doesnt complete during the build process, > which requires it to be run again on boot. I don't see any obvious > failures, what can I look for? I'm not sure. This python stuff is mostly new to me. I can ask some guys here ITO, such as ashcrow, to give me some advice on this. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Virtual Machine Management - http://www.ovirt.org/ Is fearr Gaeilge bhriste n? B?arla cliste. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: From jboggs at redhat.com Tue Sep 1 14:17:06 2009 From: jboggs at redhat.com (Joey Boggs) Date: Tue, 01 Sep 2009 10:17:06 -0400 Subject: [Ovirt-devel] [PATCH node] Introduces the node-admin toolset. In-Reply-To: <20090901140426.GB3361@mcpierce-laptop.rdu.redhat.com> References: <1251733820-22719-1-git-send-email-dpierce@redhat.com> <1251733820-22719-2-git-send-email-dpierce@redhat.com> <4A9C3729.8060200@redhat.com> <20090901140426.GB3361@mcpierce-laptop.rdu.redhat.com> Message-ID: <4A9D2CE2.4060807@redhat.com> Darryl L. Pierce wrote: > On Mon, Aug 31, 2009 at 04:48:41PM -0400, Joey Boggs wrote: > >> So I've got the tool set installed, but not fully tested just yet, >> here's some things that need to be changed >> >> python -m compileall /usr/lib/python2.6/site-packages/nodeadmin in >> common-post.ks of ovirt-node-image otherwise they get removed during >> blacklisting >> # common-blacklist.ks:find / -name '*.py' -exec rm -f {} \; >> > > That should be okay, though, right? As long as the *.pyc files remain we > should be okay. > > Yeah we just need to compile them before the blacklisting parts of o-n-i so they hang around >> __init__.py is commented out, cant get this to copy to buildroot for >> some reason, still working on it any ideas? >> # %{__install} -p -m0644 admin/__init__.py >> %{buildroot}%{python_sitelib}/nodeadmin >> > > Yeah, I've got no idea why that doesn't work. > > >> missing dependencies, whether via rpm/python failures >> >> +python-setuptools - (needed for load_entry_point in nodeadmin) >> +dbus-python +newt >> +newt-python >> +pkgconfig >> +python-devel >> +slang >> +slang-devel >> > > kk, adding them in. > > >> The egg creation in ovirt-node package for nodeadmin is failing >> somewhere and the install doesnt complete during the build process, >> which requires it to be run again on boot. I don't see any obvious >> failures, what can I look for? >> > > I'm not sure. This python stuff is mostly new to me. I can ask some guys > here ITO, such as ashcrow, to give me some advice on this. > > From pmyers at redhat.com Tue Sep 1 14:29:07 2009 From: pmyers at redhat.com (Perry Myers) Date: Tue, 01 Sep 2009 10:29:07 -0400 Subject: [Ovirt-devel] [PATCH node] Introduces the node-admin toolset. In-Reply-To: <4A9D2CE2.4060807@redhat.com> References: <1251733820-22719-1-git-send-email-dpierce@redhat.com> <1251733820-22719-2-git-send-email-dpierce@redhat.com> <4A9C3729.8060200@redhat.com> <20090901140426.GB3361@mcpierce-laptop.rdu.redhat.com> <4A9D2CE2.4060807@redhat.com> Message-ID: <4A9D2FB3.5040909@redhat.com> On 09/01/2009 10:17 AM, Joey Boggs wrote: > Darryl L. Pierce wrote: >> On Mon, Aug 31, 2009 at 04:48:41PM -0400, Joey Boggs wrote: >>> So I've got the tool set installed, but not fully tested just yet, >>> here's some things that need to be changed >>> >>> python -m compileall /usr/lib/python2.6/site-packages/nodeadmin in >>> common-post.ks of ovirt-node-image otherwise they get removed during >>> blacklisting >>> # common-blacklist.ks:find / -name '*.py' -exec rm -f {} \; >> >> That should be okay, though, right? As long as the *.pyc files remain we >> should be okay. >> > Yeah we just need to compile them before the blacklisting parts of o-n-i > so they hang around The compiled pyc files should be included as part of the RPM, so it shouldn't be necessary to compile them manually during ovirt-node-image creation. Perry From jboggs at redhat.com Tue Sep 1 17:16:54 2009 From: jboggs at redhat.com (Joey Boggs) Date: Tue, 1 Sep 2009 13:16:54 -0400 Subject: [Ovirt-devel] [PATCH node-image] readonly rootfs setup Message-ID: <1251825414-2229-1-git-send-email-jboggs@redhat.com> This completes the read only rootfs, all needed writable directories are in the tmpfs. Signed-off-by: Joey Boggs --- common-post.ks | 12 ++++++++++++ ovirt-node-image.ks | 1 + 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/common-post.ks b/common-post.ks index 0c0a3f4..44a0270 100644 --- a/common-post.ks +++ b/common-post.ks @@ -146,3 +146,15 @@ EOF # Remove the default logrotate daily cron job # since we run it every 10 minutes instead. rm -f /etc/cron.daily/logrotate + +# comment out /etc/* entries in rwtab to prevent overlapping mounts +sed -i '/^files \/etc*/ s/^/#/' /etc/rwtab +cat > /etc/rwtab.d/ovirt < rootpw= sets a temporary root password, change is forced on first login password is crypted, same as Kickstart option rootpw --iscrypted WARNING: use for debugging only, this is not secure! Signed-off-by: Alan Pevec --- scripts/ovirt-early | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-early b/scripts/ovirt-early index cdd4afd..d31f3ed 100755 --- a/scripts/ovirt-early +++ b/scripts/ovirt-early @@ -203,6 +203,12 @@ start() { # enter emergency shell for fixing configuration issues rescue= + # rootpw= + # sets a temporary root password, change is forced on first login + # password is crypted, same as Kickstart option rootpw --iscrypted + # WARNING: use for debugging only, this is not secure! + rootpw= + # pxelinux format: ip=::: # anaconda format: ip= netmask= gateway= # ipv6=dhcp|auto @@ -321,6 +327,9 @@ start() { rescue) rescue=1 ;; + rootpw=*) + rootpw=${i#rootpw=} + ;; ovirt_overcommit*) i=${i#ovirt_overcommit=} @@ -404,6 +413,19 @@ start() { fi fi + if [ -n "$rootpw" ]; then + log "Setting temporary root password: $rootpw" + unmount_config /etc/passwd /etc/shadow + /usr/sbin/usermod -p $rootpw root + chage -d 0 root + # PAM will force password change at first login + # so make sure we persist it after a successful login + cat >> /root/.bash_profile << EOF +# added by ovirt-early +persist /etc/passwd /etc/shadow +EOF + fi + if [ "$rescue" = 1 ]; then log "Rescue mode requested, starting emergency shell" stop_log -- 1.6.0.6 From ignazio.cassano at provincia.torino.it Thu Sep 3 11:17:08 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Thu, 03 Sep 2009 13:17:08 +0200 Subject: [Ovirt-devel] ovirt documentation Message-ID: <20090903131708.k04mmuy64b74o8k8@webmail.provincia.torino.it> Good morning, I am following instruction on http://ovirt.org/install-instructions.html to install ovirt. I read I must run: yum install --enablerepo=rawhide ovirt-server ovirt-server-installer ovirt-node-image ovirt-node-image-pxe but ovirt-node-image and ovirt-node-image-pxe are not on rawhide repo. Where can I find them ? Thanks From dpierce at redhat.com Thu Sep 3 14:06:25 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 3 Sep 2009 10:06:25 -0400 Subject: [Ovirt-devel] ovirt documentation In-Reply-To: <20090903131708.k04mmuy64b74o8k8@webmail.provincia.torino.it> References: <20090903131708.k04mmuy64b74o8k8@webmail.provincia.torino.it> Message-ID: <20090903140625.GE3568@mcpierce-laptop.rdu.redhat.com> On Thu, Sep 03, 2009 at 01:17:08PM +0200, ignazio.cassano at provincia.torino.it wrote: > Good morning, > I am following instruction on http://ovirt.org/install-instructions.html to > install ovirt. > I read I must run: > yum install --enablerepo=rawhide ovirt-server ovirt-server-installer > ovirt-node-image ovirt-node-image-pxe > > but ovirt-node-image and ovirt-node-image-pxe are not on rawhide repo. > Where can I find them ? Sorry about that. The instructions on that page were updated in anticipation of the ovirt-node-image and ovirt-node-image-pxe RPMs being available in Fedora. But that's changing behind the scenes, and so the instructions above are incorrect. We'll fix that straight away on the website, thanks for point that out. In the meantime, if you would like to, you can build the RPMs by following the instructions here: http://ovirt.org/build-instructions.html You can also down the ISO directly from: http://ovirt.org/download.html Or you can point to the ovirt yum repo: http://ovirt.org/repos/ovirt/ and pull our development RPMs directly. We're also in the process of updating the RPMs there for the node image. I think an updated version will be available in the next day or so, but you can work with what's out there now as well. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Virtual Machine Management - http://www.ovirt.org/ Is fearr Gaeilge bhriste n? B?arla cliste. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: From ignazio.cassano at provincia.torino.it Thu Sep 3 14:56:02 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Thu, 03 Sep 2009 16:56:02 +0200 Subject: [Ovirt-devel] ovirt documentation In-Reply-To: <20090903140625.GE3568@mcpierce-laptop.rdu.redhat.com> References: <20090903131708.k04mmuy64b74o8k8@webmail.provincia.torino.it> <20090903140625.GE3568@mcpierce-laptop.rdu.redhat.com> Message-ID: <20090903165602.nfy6qill9zpc0cwg@webmail.provincia.torino.it> Hi, following building instructions on fedora 10 I am able to build. Following building instructions on fedora 11 , make build reports the folowing error: Error creating Live CD: Failed to find package "kvm-tools": non packages(s) available to install. Can anyone help me ? ----- Messaggio da dpierce at redhat.com --------- Data: Thu, 03 Sep 2009 10:06:25 -0400 Da: "Darryl L. Pierce" Rispondi-A:"Darryl L. Pierce" Oggetto: Re: [Ovirt-devel] ovirt documentation A: ignazio.cassano at provincia.torino.it Cc: ovirt-devel at redhat.com > On Thu, Sep 03, 2009 at 01:17:08PM +0200, > ignazio.cassano at provincia.torino.it wrote: >> Good morning, >> I am following instruction on http://ovirt.org/install-instructions.html to >> install ovirt. >> I read I must run: >> yum install --enablerepo=rawhide ovirt-server ovirt-server-installer >> ovirt-node-image ovirt-node-image-pxe >> >> but ovirt-node-image and ovirt-node-image-pxe are not on rawhide repo. >> Where can I find them ? > > Sorry about that. The instructions on that page were updated in > anticipation of the ovirt-node-image and ovirt-node-image-pxe RPMs being > available in Fedora. But that's changing behind the scenes, and so the > instructions above are incorrect. We'll fix that straight away on the > website, thanks for point that out. > > In the meantime, if you would like to, you can build the RPMs by > following the instructions here: > > http://ovirt.org/build-instructions.html > > You can also down the ISO directly from: > > http://ovirt.org/download.html > > Or you can point to the ovirt yum repo: > > http://ovirt.org/repos/ovirt/ > > and pull our development RPMs directly. > > We're also in the process of updating the RPMs there for the node image. > I think an updated version will be available in the next day or so, but > you can work with what's out there now as well. > > -- > Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. > Virtual Machine Management - http://www.ovirt.org/ > Is fearr Gaeilge bhriste n? B?arla cliste. > ----- Fine del messaggio da dpierce at redhat.com ----- From dpierce at redhat.com Thu Sep 3 15:12:24 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 3 Sep 2009 11:12:24 -0400 Subject: [Ovirt-devel] ovirt documentation In-Reply-To: <20090903165602.nfy6qill9zpc0cwg@webmail.provincia.torino.it> References: <20090903131708.k04mmuy64b74o8k8@webmail.provincia.torino.it> <20090903140625.GE3568@mcpierce-laptop.rdu.redhat.com> <20090903165602.nfy6qill9zpc0cwg@webmail.provincia.torino.it> Message-ID: <20090903151224.GF3568@mcpierce-laptop.rdu.redhat.com> On Thu, Sep 03, 2009 at 04:56:02PM +0200, ignazio.cassano at provincia.torino.it wrote: > Hi, following building instructions on fedora 10 I am able to build. > Following building instructions on fedora 11 , make build reports the > folowing error: > > Error creating Live CD: Failed to find package "kvm-tools": non > packages(s) available to install. > > Can anyone help me ? kvm-tools is now qemu-kvm-tools in F11. We've updated common-pkgs.ks in the ovirt-node-image repo. Are you building against the "next" branch in git or the "master" branch? I'm guessing "master". If so, you should switch the repos over to "next", which has the more updated code in it for F11. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Virtual Machine Management - http://www.ovirt.org/ Is fearr Gaeilge bhriste n? B?arla cliste. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: From ignazio.cassano at provincia.torino.it Fri Sep 4 06:36:56 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Fri, 04 Sep 2009 08:36:56 +0200 Subject: [Ovirt-devel] ovirt documentation In-Reply-To: <20090903151224.GF3568@mcpierce-laptop.rdu.redhat.com> References: <20090903131708.k04mmuy64b74o8k8@webmail.provincia.torino.it> <20090903140625.GE3568@mcpierce-laptop.rdu.redhat.com> <20090903165602.nfy6qill9zpc0cwg@webmail.provincia.torino.it> <20090903151224.GF3568@mcpierce-laptop.rdu.redhat.com> Message-ID: <20090904083656.6z4yullw48owkgwo@webmail.provincia.torino.it> Great ! This works fine ! Many thanks ----- Messaggio da dpierce at redhat.com --------- Data: Thu, 03 Sep 2009 11:12:24 -0400 Da: "Darryl L. Pierce" Rispondi-A:"Darryl L. Pierce" Oggetto: Re: [Ovirt-devel] ovirt documentation A: ignazio.cassano at provincia.torino.it Cc: ovirt-devel at redhat.com > On Thu, Sep 03, 2009 at 04:56:02PM +0200, > ignazio.cassano at provincia.torino.it wrote: >> Hi, following building instructions on fedora 10 I am able to build. >> Following building instructions on fedora 11 , make build reports the >> folowing error: >> >> Error creating Live CD: Failed to find package "kvm-tools": non >> packages(s) available to install. >> >> Can anyone help me ? > > kvm-tools is now qemu-kvm-tools in F11. We've updated common-pkgs.ks in > the ovirt-node-image repo. Are you building against the "next" branch in > git or the "master" branch? I'm guessing "master". If so, you should > switch the repos over to "next", which has the more updated code in it > for F11. > > -- > Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. > Virtual Machine Management - http://www.ovirt.org/ > Is fearr Gaeilge bhriste n? B?arla cliste. > ----- Fine del messaggio da dpierce at redhat.com ----- From apevec at redhat.com Sat Sep 5 17:09:40 2009 From: apevec at redhat.com (Alan Pevec) Date: Sat, 5 Sep 2009 19:09:40 +0200 Subject: [Ovirt-devel] [PATCH node] adjust init script patching for local boot on F11 Message-ID: <1252170580-14016-1-git-send-email-apevec@redhat.com> mkliveinitrd dropped udev trigger, and it already appends || : --- scripts/ovirt-config-boot | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot index a40c03a..2961f76 100755 --- a/scripts/ovirt-config-boot +++ b/scripts/ovirt-config-boot @@ -107,7 +107,7 @@ ovirt_boot_setup() { # Fedora 10 mkliveinitrd init_script=sbin/real-init fi - sed -i '/^\/sbin\/udev.*settle/ a \ + sed -i '/^\/sbin\/udev.*trigger/ a \ echo SCSI wait for scans\ /sbin/modprobe scsi_wait_scan\ /sbin/modprobe -r scsi_wait_scan\ @@ -125,8 +125,6 @@ set -e\ ' $init_script # fix emergency shell sed -i 's/^ bash$/ bash < \/dev\/console/' $init_script - # do not fail if device node already exists - sed -i 's/mknod.*$/& || :/' $init_script mkdir -p bin bit= if [ -e /lib64 ]; then -- 1.6.0.6 From apevec at redhat.com Sat Sep 5 17:16:21 2009 From: apevec at redhat.com (Alan Pevec) Date: Sat, 5 Sep 2009 19:16:21 +0200 Subject: [Ovirt-devel] [PATCH node] adjust init script patching for local boot on F11 In-Reply-To: <1252170580-14016-1-git-send-email-apevec@redhat.com> References: <1252170580-14016-1-git-send-email-apevec@redhat.com> Message-ID: <1252170981-14123-1-git-send-email-apevec@redhat.com> mkliveinitrd dropped udev settle and it already appends || : to avoid non-fatal errors Signed-off-by: Alan Pevec --- scripts/ovirt-config-boot | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot index a40c03a..2961f76 100755 --- a/scripts/ovirt-config-boot +++ b/scripts/ovirt-config-boot @@ -107,7 +107,7 @@ ovirt_boot_setup() { # Fedora 10 mkliveinitrd init_script=sbin/real-init fi - sed -i '/^\/sbin\/udev.*settle/ a \ + sed -i '/^\/sbin\/udev.*trigger/ a \ echo SCSI wait for scans\ /sbin/modprobe scsi_wait_scan\ /sbin/modprobe -r scsi_wait_scan\ @@ -125,8 +125,6 @@ set -e\ ' $init_script # fix emergency shell sed -i 's/^ bash$/ bash < \/dev\/console/' $init_script - # do not fail if device node already exists - sed -i 's/mknod.*$/& || :/' $init_script mkdir -p bin bit= if [ -e /lib64 ]; then -- 1.6.0.6 From pmialon at linagora.com Mon Sep 7 10:13:47 2009 From: pmialon at linagora.com (pmialon at linagora.com) Date: Mon, 7 Sep 2009 10:13:47 +0000 Subject: [Ovirt-devel] [PATCH node] Fix SRV_SERVER for SRV_HOST to work with /etc/init.d/ovirt-functions Message-ID: <1252318427-13740-1-git-send-email-pmialon@linagora.com> From: root --- scripts/ovirt-config-collectd | 6 +++--- scripts/ovirt-config-logging | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/ovirt-config-collectd b/scripts/ovirt-config-collectd index 4ad877e..1474bf5 100755 --- a/scripts/ovirt-config-collectd +++ b/scripts/ovirt-config-collectd @@ -98,9 +98,9 @@ if [ "$1" = "AUTO" ]; then if [ -z "$OVIRT_COLLECTD_SERVER" -o -z "$OVIRT_COLLECTD_PORT" ]; then printf "\nAttempting to locate remote collectd server..." find_srv collectd udp - if [ -n "$SRV_SERVER" -a -n "$SRV_PORT" ]; then - printf "found! Using collectd server '$SRV_SERVER:$SRV_PORT'.\n" - ovirt_collectd $SRV_SERVER $SRV_PORT + if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then + printf "found! Using collectd server '$SRV_HOST:$SRV_PORT'.\n" + ovirt_collectd $SRV_HOST $SRV_PORT else printf "not found!\n" fi diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging index 464dfcb..d8e5c95 100755 --- a/scripts/ovirt-config-logging +++ b/scripts/ovirt-config-logging @@ -179,9 +179,9 @@ if [ "$1" = "AUTO" ]; then if [ -z "$OVIRT_SYSLOG_SERVER" -o -z "$OVIRT_SYSLOG_PORT" ]; then printf "\nAttempting to locate remote syslog server..." find_srv syslog udp - if [ -n "$SRV_SERVER" -a -n "$SRV_PORT" ]; then - printf "found! Using syslog server '$SRV_SERVER:$SRV_PORT'.\n" - ovirt_rsyslog $SRV_SERVER $SRV_PORT udp + if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then + printf "found! Using syslog server '$SRV_HOST:$SRV_PORT'.\n" + ovirt_rsyslog $SRV_HOST $SRV_PORT udp else printf "not found!\n" fi -- 1.6.2.5 From apevec at redhat.com Mon Sep 7 11:23:25 2009 From: apevec at redhat.com (Alan Pevec) Date: Mon, 07 Sep 2009 13:23:25 +0200 Subject: [Ovirt-devel] Re: [PATCH node] Fix SRV_SERVER for SRV_HOST to work with /etc/init.d/ovirt-functions In-Reply-To: <1252318427-13740-1-git-send-email-pmialon@linagora.com> References: <1252318427-13740-1-git-send-email-pmialon@linagora.com> Message-ID: <4AA4ED2D.9000704@redhat.com> ACK and pushed to next Thanks for spotting this mistake! Obviously, oVirt Node stand-alone mode is not much used at the moment, but new functionally like node-admin by Darryl should make this mode more useful and hopefully more tested. Thanks, Alan From ignazio.cassano at provincia.torino.it Mon Sep 7 12:05:02 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Mon, 07 Sep 2009 14:05:02 +0200 Subject: [Ovirt-devel] ovirt documentation In-Reply-To: <20090904083656.6z4yullw48owkgwo@webmail.provincia.torino.it> References: <20090903131708.k04mmuy64b74o8k8@webmail.provincia.torino.it> <20090903140625.GE3568@mcpierce-laptop.rdu.redhat.com> <20090903165602.nfy6qill9zpc0cwg@webmail.provincia.torino.it> <20090903151224.GF3568@mcpierce-laptop.rdu.redhat.com> <20090904083656.6z4yullw48owkgwo@webmail.provincia.torino.it> Message-ID: <20090907140502.4f62suk7594c8ggw@webmail.provincia.torino.it> Hello, I am able to build ovirt following instruction on ovirt.org, but when I run "ace install ovirt" it reports the following error: Could not find package ovirt-node-image-pxe . I thing ace checks for the package on a web site , any case the package is not generated by "make build". Please, could you tell me where is the error ? Thanks ----- Messaggio da ignazio.cassano at provincia.torino.it --------- Data: Fri, 04 Sep 2009 08:36:56 +0200 Da: ignazio.cassano at provincia.torino.it Rispondi-A:ignazio.cassano at provincia.torino.it Oggetto: Re: [Ovirt-devel] ovirt documentation A: "Darryl L. Pierce" Cc: ovirt-devel at redhat.com > Great ! > This works fine ! > > Many thanks > > ----- Messaggio da dpierce at redhat.com --------- > Data: Thu, 03 Sep 2009 11:12:24 -0400 > Da: "Darryl L. Pierce" > Rispondi-A:"Darryl L. Pierce" > Oggetto: Re: [Ovirt-devel] ovirt documentation > A: ignazio.cassano at provincia.torino.it > Cc: ovirt-devel at redhat.com > > >> On Thu, Sep 03, 2009 at 04:56:02PM +0200, >> ignazio.cassano at provincia.torino.it wrote: >>> Hi, following building instructions on fedora 10 I am able to build. >>> Following building instructions on fedora 11 , make build reports the >>> folowing error: >>> >>> Error creating Live CD: Failed to find package "kvm-tools": non >>> packages(s) available to install. >>> >>> Can anyone help me ? >> >> kvm-tools is now qemu-kvm-tools in F11. We've updated common-pkgs.ks in >> the ovirt-node-image repo. Are you building against the "next" branch in >> git or the "master" branch? I'm guessing "master". If so, you should >> switch the repos over to "next", which has the more updated code in it >> for F11. >> >> -- >> Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. >> Virtual Machine Management - http://www.ovirt.org/ >> Is fearr Gaeilge bhriste n? B?arla cliste. >> > > > ----- Fine del messaggio da dpierce at redhat.com ----- > > > > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- From pmialon at linagora.com Mon Sep 7 12:19:02 2009 From: pmialon at linagora.com (Pierre-Gilles Mialon) Date: Mon, 7 Sep 2009 14:19:02 +0200 Subject: [Ovirt-devel] Re: [PATCH node] Fix SRV_SERVER for SRV_HOST to work with /etc/init.d/ovirt-functions In-Reply-To: <4AA4ED2D.9000704@redhat.com> References: <1252318427-13740-1-git-send-email-pmialon@linagora.com> <4AA4ED2D.9000704@redhat.com> Message-ID: <200909071419.02561.pmialon@linagora.com> Le lundi 7 septembre 2009 13:23:25 Alan Pevec, vous avez ?crit : > ACK and pushed to next > > Thanks for spotting this mistake! Obviously, oVirt Node stand-alone mode is > not much used at the moment, but new functionally like node-admin by Darryl > should make this mode more useful and hopefully more tested. Thanks, > Alan Is this possible to add ovirt-config-logging AUTO to /etc/init.d/ovirt ? I need it to add remote-logging on a pxe-booted diskless ovirt-node. Thanks -- Pierre-Gilles Mialon Responsable h?bergement :: Head of Hosting services pmialon at linagora.com :: +33.1 58 18 65 46 Linagora :: http://www.linagora.com 27 rue de Berri :: 75008 PARIS -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part. URL: From pmialon at linagora.com Mon Sep 7 15:57:21 2009 From: pmialon at linagora.com (Pierre-Gilles Mialon) Date: Mon, 7 Sep 2009 17:57:21 +0200 Subject: [Ovirt-devel] ssh access on the ovirt-node Message-ID: <200909071757.21471.pmialon@linagora.com> < node-image/common-post.ks > [...] if rpm -q --qf '%{release}' ovirt-node | grep -q "^0\." ; then echo "Building in developer mode, leaving root account unlocked" augtool <<\EOF set /files/etc/ssh/sshd_config/PermitEmptyPasswords yes save EOF else echo "Building in production mode, locking root account" passwd -l root fi [...] What is the best way to disable the EmptyPasswords on the ovirt-node ? I didn't understand where I can redifined the %{release}. I try to put _ovirt_devel= 1 in the Makefile.am but it does nothing. Is it really wanted to add a ssh root access with an empty password ? Some weeks ago, the authenticated keys were the only way to log in via ssh, and that was fiting my needs... Perhaps we can change this behaviour by touching a file yes_i_really_want_ssh_root_access_with_empty_pass and make the test on it at the place of the minor of revision ? Thanks -- Pierre-Gilles Mialon Responsable h?bergement :: Head of Hosting services pmialon at linagora.com :: +33.1 58 18 65 46 Linagora :: http://www.linagora.com 27 rue de Berri :: 75008 PARIS -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part. URL: From ignazio.cassano at provincia.torino.it Tue Sep 8 12:04:50 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Tue, 08 Sep 2009 14:04:50 +0200 Subject: [Ovirt-devel] ovirt web interface Message-ID: <20090908140450.rj75ndl315hs0w80@webmail.provincia.torino.it> Good morning, I build ovirt following instruction o ovirt.org but when I try to connect to the web interface the following error is reported: Redirect Loop I think the problem is first lines in ovirt-server.conf under /etc/httd/conf.d: NameVirtualHost 172.25.0.52:80 RewriteEngine on RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L] I tried to delete the above lines and it seems to work but with some errors (for example I cannot logout from the web interface). Please, could anyone help me ? Thanks Igna From mloiseleur at linagora.com Tue Sep 8 13:17:52 2009 From: mloiseleur at linagora.com (mloiseleur at linagora.com) Date: Tue, 8 Sep 2009 13:17:52 +0000 Subject: [Ovirt-devel] [PATCH server] fix live migration Message-ID: <1252415872-24215-1-git-send-email-mloiseleur@linagora.com> From: root --- src/app/views/host/_grid.rhtml | 2 +- src/app/views/vm/migrate.rhtml | 1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/app/views/host/_grid.rhtml b/src/app/views/host/_grid.rhtml index 663a55d..698dc95 100644 --- a/src/app/views/host/_grid.rhtml +++ b/src/app/views/host/_grid.rhtml @@ -1,7 +1,7 @@ <%= render :partial => 'graph/load_graph.rhtml' %> <% pool_controller = 'hardware' unless (defined? pool_controller) and !(pool_controller.nil?) %> -<% hosts_per_page.nil? ? hosts_per_page = 40: hosts_per_page = hosts_per_page %> +<% hosts_per_page = 40 if !defined?(hosts_per_page) or hosts_per_page.nil? %> <% if (hwpool.nil? or ((hwpool.is_a? HardwarePool) and (hwpool.hosts.size > hosts_per_page)) or ((hwpool.is_a? SmartPool) and (hwpool.tagged_hosts.size > hosts_per_page))) diff --git a/src/app/views/vm/migrate.rhtml b/src/app/views/vm/migrate.rhtml index f94723a..9165425 100644 --- a/src/app/views/vm/migrate.rhtml +++ b/src/app/views/vm/migrate.rhtml @@ -44,6 +44,7 @@ :hwpool => @vm.get_hardware_pool, :exclude_pool => nil, :exclude_host => @vm.host_id, + :is_popup => true, :checkboxes => false, :on_select => "migrate_vm_select", :on_deselect => "migrate_vm_deselect", -- 1.6.2.5 From pmialon at linagora.com Tue Sep 8 15:12:15 2009 From: pmialon at linagora.com (pmialon at linagora.com) Date: Tue, 8 Sep 2009 15:12:15 +0000 Subject: [Ovirt-devel] [PATCH node] Add support for automatic remote logging on PXE ovirt-node Message-ID: <1252422735-24943-1-git-send-email-pmialon@linagora.com> From: root Use ovirt-config-logging in /etc/init.d/ovirt --- scripts/ovirt | 19 ++++--------------- scripts/ovirt-config-logging | 2 +- scripts/ovirt-functions | 4 ++++ 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/scripts/ovirt b/scripts/ovirt index 4ff03f2..0c5e3be 100755 --- a/scripts/ovirt +++ b/scripts/ovirt @@ -14,6 +14,9 @@ start() { if is_standalone; then return 0 fi + + ovirt-config-logging AUTO + find_srv ipa tcp if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then krb5_conf=/etc/krb5.conf @@ -43,21 +46,7 @@ start() { log "skipping ovirt-awake, oVirt identify service not available" fi - find_srv collectd udp - if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then - collectd_conf=/etc/collectd.conf - if [ -f $collectd_conf.in ]; then - sed -e "s/@COLLECTD_SERVER@/$SRV_HOST/" \ - -e "s/@COLLECTD_PORT@/$SRV_PORT/" \ - -e "//,/<\/Plugin>/d" $collectd_conf.in \ - > $collectd_conf - if [ $? -ne 0 ]; then - log "Failed to write $collectd_conf"; return 1 - fi - fi - else - log "skipping collectd configuration, collectd service not available" - fi + ovirt-config-collectd AUTO find_srv qpidd tcp if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging index d8e5c95..598b7cb 100755 --- a/scripts/ovirt-config-logging +++ b/scripts/ovirt-config-logging @@ -8,7 +8,7 @@ trap '__st=$?; stop_log; exit $__st' 0 trap 'exit $?' 1 2 13 15 -if ! is_local_storage_configured; then +if ! is_local_storage_configured && ! is_diskless ; then printf "Local storage must be configured prior to configuring the logging system.\n" exit 99 fi diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions index 98e88e7..f86543e 100644 --- a/scripts/ovirt-functions +++ b/scripts/ovirt-functions @@ -88,6 +88,10 @@ is_local_storage_configured () { return 1 } +is_diskless() { + grep -q '/dev/mapper/live-rw /' /proc/mounts +} + # perform automatic local disk installation # when at least following boot parameters are present: # for networking - OVIRT_BOOTIF, management NIC -- 1.6.2.5 From pmialon at linagora.com Tue Sep 8 15:34:56 2009 From: pmialon at linagora.com (pmialon at linagora.com) Date: Tue, 8 Sep 2009 15:34:56 +0000 Subject: [Ovirt-devel] [PATCH node-image] Add ability to set persistent ssh_host_keys on the node, usefull if you run diskless instance of ovirt-node Message-ID: <1252424096-25113-1-git-send-email-pmialon@linagora.com> From: root --- ovirt-node-image.ks | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/ovirt-node-image.ks b/ovirt-node-image.ks index 802b6a5..d698497 100644 --- a/ovirt-node-image.ks +++ b/ovirt-node-image.ks @@ -55,6 +55,22 @@ if [ -f "ovirt-authorized_keys" ]; then chmod 644 $INSTALL_ROOT/root/.ssh/authorized_keys fi +if [ -f ovirt-ssh_host_dsa_key -f ovirt-ssh_host_dsa_key.pub \ + -f ovirt-ssh_host_key -f ovirt-ssh_host_key.pub \ + -f ovirt-ssh_host_rsa_key -f ovirt-ssh_host_rsa_key.pub ]; then + echo "Adding persistent ssh_keys for host to Image" + mkdir -p $INSTALL_ROOT/etc/ssh + cp -v ovirt-ssh_host_dsa_key $INSTALL_ROOT/etc/ssh/ssh_host_dsa_key + cp -v ovirt-ssh_host_key $INSTALL_ROOT/etc/ssh/ssh_host_key + cp -v ovirt-ssh_host_rsa_key $INSTALL_ROOT/etc/ssh/ssh_host_rsa_key + cp -v ovirt-ssh_host_key.pub $INSTALL_ROOT/etc/ssh/ssh_host_key.pub + cp -v ovirt-ssh_host_dsa_key.pub $INSTALL_ROOT/etc/ssh/ssh_host_dsa_key.pub + cp -v ovirt-ssh_host_rsa_key.pub $INSTALL_ROOT/etc/ssh/ssh_host_rsa_key.pub + chown root:root $INSTALL_ROOT/etc/ssh/*key* + chmod 600 $INSTALL_ROOT/etc/ssh/*key + chmod 644 $INSTALL_ROOT/etc/ssh/*key.pub +fi + echo "Fixing boot menu" # remove quiet from Node bootparams, added by livecd-creator sed -i -e 's/ quiet//' $LIVE_ROOT/isolinux/isolinux.cfg -- 1.6.2.5 From pmialon at linagora.com Tue Sep 8 16:10:47 2009 From: pmialon at linagora.com (Pierre-Gilles Mialon) Date: Tue, 8 Sep 2009 18:10:47 +0200 Subject: [Ovirt-devel] [PATCH node-image] Add ability to set persistent ssh_host_keys on the node, usefull if you run diskless instance of ovirt-node Message-ID: <200909081810.47300.pmialon@linagora.com> Sorry for that I didn't send the good patch. Please forget this mail and the precedent Sincerely, Le mardi 8 septembre 2009 17:34:56 pmialon at linagora.com, vous avez ?crit : > From: root > > --- > ovirt-node-image.ks | 16 ++++++++++++++++ > 1 files changed, 16 insertions(+), 0 deletions(-) > > diff --git a/ovirt-node-image.ks b/ovirt-node-image.ks > index 802b6a5..d698497 100644 > --- a/ovirt-node-image.ks > +++ b/ovirt-node-image.ks > @@ -55,6 +55,22 @@ if [ -f "ovirt-authorized_keys" ]; then > chmod 644 $INSTALL_ROOT/root/.ssh/authorized_keys > fi > > +if [ -f ovirt-ssh_host_dsa_key -f ovirt-ssh_host_dsa_key.pub \ > + -f ovirt-ssh_host_key -f ovirt-ssh_host_key.pub \ > + -f ovirt-ssh_host_rsa_key -f ovirt-ssh_host_rsa_key.pub ]; then > + echo "Adding persistent ssh_keys for host to Image" > + mkdir -p $INSTALL_ROOT/etc/ssh > + cp -v ovirt-ssh_host_dsa_key $INSTALL_ROOT/etc/ssh/ssh_host_dsa_key > + cp -v ovirt-ssh_host_key $INSTALL_ROOT/etc/ssh/ssh_host_key > + cp -v ovirt-ssh_host_rsa_key $INSTALL_ROOT/etc/ssh/ssh_host_rsa_key > + cp -v ovirt-ssh_host_key.pub $INSTALL_ROOT/etc/ssh/ssh_host_key.pub > + cp -v ovirt-ssh_host_dsa_key.pub > $INSTALL_ROOT/etc/ssh/ssh_host_dsa_key.pub + cp -v > ovirt-ssh_host_rsa_key.pub $INSTALL_ROOT/etc/ssh/ssh_host_rsa_key.pub > + chown root:root $INSTALL_ROOT/etc/ssh/*key* > + chmod 600 $INSTALL_ROOT/etc/ssh/*key > + chmod 644 $INSTALL_ROOT/etc/ssh/*key.pub > +fi > + > echo "Fixing boot menu" > # remove quiet from Node bootparams, added by livecd-creator > sed -i -e 's/ quiet//' $LIVE_ROOT/isolinux/isolinux.cfg Pierre-Gilles Mialon Responsable h?bergement :: Head of Hosting services pmialon at linagora.com :: +33.1 58 18 65 46 Linagora :: http://www.linagora.com 27 rue de Berri :: 75008 PARIS -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part. URL: From pmialon at linagora.com Tue Sep 8 16:15:06 2009 From: pmialon at linagora.com (pmialon at linagora.com) Date: Tue, 8 Sep 2009 16:15:06 +0000 Subject: [Ovirt-devel] [PATCH node-image] Working version of Add the ability to use persistent ssh_host_keys on the ovirt-node Message-ID: <1252426506-25493-1-git-send-email-pmialon@linagora.com> From: root --- ovirt-node-image.ks | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/ovirt-node-image.ks b/ovirt-node-image.ks index 802b6a5..9a7d617 100644 --- a/ovirt-node-image.ks +++ b/ovirt-node-image.ks @@ -55,6 +55,22 @@ if [ -f "ovirt-authorized_keys" ]; then chmod 644 $INSTALL_ROOT/root/.ssh/authorized_keys fi +if [ -f ovirt-ssh_host_dsa_key -a -f ovirt-ssh_host_dsa_key.pub -a\ + -f ovirt-ssh_host_key -a -f ovirt-ssh_host_key.pub -a \ + -f ovirt-ssh_host_rsa_key -a -f ovirt-ssh_host_rsa_key.pub ]; then + echo "Adding persistent ssh_keys for host to Image" + mkdir -p $INSTALL_ROOT/etc/ssh + cp -v ovirt-ssh_host_dsa_key $INSTALL_ROOT/etc/ssh/ssh_host_dsa_key + cp -v ovirt-ssh_host_key $INSTALL_ROOT/etc/ssh/ssh_host_key + cp -v ovirt-ssh_host_rsa_key $INSTALL_ROOT/etc/ssh/ssh_host_rsa_key + cp -v ovirt-ssh_host_key.pub $INSTALL_ROOT/etc/ssh/ssh_host_key.pub + cp -v ovirt-ssh_host_dsa_key.pub $INSTALL_ROOT/etc/ssh/ssh_host_dsa_key.pub + cp -v ovirt-ssh_host_rsa_key.pub $INSTALL_ROOT/etc/ssh/ssh_host_rsa_key.pub + chown root:root $INSTALL_ROOT/etc/ssh/*key* + chmod 600 $INSTALL_ROOT/etc/ssh/*key + chmod 644 $INSTALL_ROOT/etc/ssh/*key.pub +fi + echo "Fixing boot menu" # remove quiet from Node bootparams, added by livecd-creator sed -i -e 's/ quiet//' $LIVE_ROOT/isolinux/isolinux.cfg -- 1.6.2.5 From jguiditt at redhat.com Wed Sep 9 15:54:02 2009 From: jguiditt at redhat.com (Jason Guiditta) Date: Wed, 09 Sep 2009 11:54:02 -0400 Subject: [Ovirt-devel] ovirt web interface In-Reply-To: <20090908140450.rj75ndl315hs0w80@webmail.provincia.torino.it> References: <20090908140450.rj75ndl315hs0w80@webmail.provincia.torino.it> Message-ID: <1252511642.7781.7.camel@lenovo> On Tue, 2009-09-08 at 14:04 +0200, ignazio.cassano at provincia.torino.it wrote: > Good morning, > I build ovirt following instruction o ovirt.org but when I try to connect > to the web interface the following error is reported: > > Redirect Loop > > I think the problem is first lines in ovirt-server.conf under > /etc/httd/conf.d: > > NameVirtualHost 172.25.0.52:80 > > > RewriteEngine on > RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L] > > > > I tried to delete the above lines and it seems to work but with some > errors (for example I cannot logout from the web interface). > > Please, could anyone help me ? > Thanks > Igna This sounds like the error that you get if you have only one network rather than 2 (one for admin, one for guest). Someone (Mo I believe) was looking into getting a one network setup working, but it is currently not supported in oVirt. As for the not logging out - we use http auth headers, so the only way to really log out is to install (for firefox) something like the web developer toolbar, which allows you to tell your browser to remove currently auth'ed session. This must be used in conjunction with the logout button in the UI, which kills the session on the server side. -j From mmorsi at redhat.com Wed Sep 9 18:51:11 2009 From: mmorsi at redhat.com (Mohammed Morsi) Date: Wed, 9 Sep 2009 14:51:11 -0400 Subject: [Ovirt-devel] oVirt Appliance / Single Machine Install Message-ID: <1252522273-16638-1-git-send-email-mmorsi@redhat.com> The following two patches fixes / reimplements the oVirt appliance project, installing the entire oVirt stack including all server and node components on one machine. These patches are intended to be checked out and used to build the appliance rpm, after which it is installed provides the /usr/sbin/ovirt-appliance-ctrl script to install/uninstall the appliance. The first patch merely removes the current broken implementation, while the second adds the new one. Currently rebooting a working appliance doesn't work 100%, though there are post-reboot steps noted in the code to get things working again until a fix is sent. From mmorsi at redhat.com Wed Sep 9 18:51:12 2009 From: mmorsi at redhat.com (Mohammed Morsi) Date: Wed, 9 Sep 2009 14:51:12 -0400 Subject: [Ovirt-devel] [PATCH appliance] removed old / broken appliance implementation In-Reply-To: <1252522273-16638-1-git-send-email-mmorsi@redhat.com> References: <1252522273-16638-1-git-send-email-mmorsi@redhat.com> Message-ID: <1252522273-16638-2-git-send-email-mmorsi@redhat.com> --- Makefile.am | 208 ------------------------------------------ autobuild.sh | 117 ------------------------ autogen.sh | 66 -------------- configure.ac | 5 - create-ovirt-appliance | 87 ------------------ create-ovirt-network | 161 --------------------------------- create-ovirt-nodes | 51 ----------- get-ovirt-appliance | 115 ------------------------ gettree.sh | 77 ---------------- ovirt-appliance-functions | 219 --------------------------------------------- ovirt-appliance.ks | 119 ------------------------ ovirt-appliance.spec.in | 69 -------------- 12 files changed, 0 insertions(+), 1294 deletions(-) delete mode 100644 Makefile.am delete mode 100755 autobuild.sh delete mode 100755 autogen.sh delete mode 100644 configure.ac delete mode 100755 create-ovirt-appliance delete mode 100755 create-ovirt-network delete mode 100755 create-ovirt-nodes delete mode 100755 get-ovirt-appliance delete mode 100755 gettree.sh delete mode 100644 ovirt-appliance-functions delete mode 100644 ovirt-appliance.ks delete mode 100644 ovirt-appliance.spec.in diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index bd40ef8..0000000 --- a/Makefile.am +++ /dev/null @@ -1,208 +0,0 @@ -# Copyright (C) 2008 Red Hat, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -# MA 02110-1301, USA. A copy of the GNU General Public License is -# also available at http://www.gnu.org/copyleft/gpl.html. - -OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache -OVIRT_LOCAL_REPO ?= file://$(OVIRT_CACHE_DIR)/ovirt -OVIRT_URL ?= http://ovirt.org/repos/ovirt -PKG_FMT ?= tar -SRC_FMT ?= tar -DISK_FMT ?= qcow2 -SUM ?= sha1sum -APP_RAM ?= 1024 -AUTH_KEYS ?= ~/.ssh/authorized_keys - -FEDORA_MIRROR = http://mirrors.fedoraproject.org/mirrorlist -FEDORA_URL_DEF = http://download.fedoraproject.org/pub/fedora/linux -CUR_RAWHIDE = 11 - -FEDORA = $(shell rpm --eval '%{fedora}') -ARCH = $(shell rpm --eval '%{_arch}') - -NVR = $(PACKAGE)-$(VERSION)-$(ARCH) - -EXTRA_DIST = \ - .gitignore \ - create-$(PACKAGE) \ - create-ovirt-network \ - create-ovirt-nodes \ - get-$(PACKAGE) \ - $(PACKAGE)-functions \ - gettree.sh \ - $(PACKAGE).ks \ - $(PACKAGE).spec \ - $(PACKAGE).spec.in - -DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz \ - $(NVR).* \ - $(NVR).*.$(SUM) \ - repos.ks ovirt-authorized_keys - -# For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT- -# annotated rpm version strings. -_ovirt_dev = \ - $(shell grep -q '^[[:space:]]*Release:[[:space:]]*0' \ - $(srcdir)/*.spec.in && echo 1 || :) - -git_head = $$(git log -1 --pretty=format:%h) -GIT_RELEASE = $$(date --utc +%Y%m%d%H%M%S)git$(git_head) -RPMDIR = $$(rpm --eval '%{_rpmdir}') -RPM_FLAGS = --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)" -RPM_FLAGS += $(if $(_ovirt_dev),--define "extra_release .$(GIT_RELEASE)") -APP_TMP = $(OVIRT_CACHE_DIR)/$(PACKAGE)-$(ARCH)-tmp -SRC_KS = $(APP_TMP)/src.ks - -repos.ks: - ( \ - if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \ - FEDORA_REPO=rawhide ;\ - FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/development/$(ARCH)/os,--mirrorlist=$(FEDORA_MIRROR)?repo=rawhide&arch=$(ARCH))" ;\ - OVIRT_DISTRO=development ;\ - else \ - FEDORA_REPO=f$(FEDORA) ;\ - FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/$(ARCH)/os,--mirrorlist=$(FEDORA_MIRROR)?repo=fedora-$(FEDORA)&arch=$(ARCH))" ;\ - OVIRT_DISTRO=$(FEDORA) ;\ - UPDATE_REPO_LINE="repo --name=$${FEDORA_REPO}-updates $(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/updates/$(FEDORA)/$(ARCH),--mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-f$(FEDORA)&arch=$(ARCH))" ;\ - fi ;\ - echo "repo --name=$${FEDORA_REPO} $${FEDORA_REPO_LOC}" > $@ ;\ - echo "repo --name=ovirt-org --baseurl=$(OVIRT_URL)/$${OVIRT_DISTRO}/$(ARCH)" >> $@ ;\ - echo "$${UPDATE_REPO_LINE}" >> $@ ;\ - echo "repo --name=ovirt-local --baseurl=$(OVIRT_LOCAL_REPO)" >> $@ \ - ) - -src.ks: repos.ks - mkdir -p $(APP_TMP) - ( \ - cat repos.ks ;\ - if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \ - FEDORA_REPO=rawhide ;\ - FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/development/source/SRPMS,--mirrorlist=$(FEDORA_MIRROR)?repo=rawhide-source&arch=source)" ;\ - OVIRT_DISTRO=development ;\ - else \ - FEDORA_REPO=f$(FEDORA) ;\ - FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/source/SRPMS,--mirrorlist=$(FEDORA_MIRROR)?repo=fedora-source-$(FEDORA)&arch=source)" ;\ - OVIRT_DISTRO=$(FEDORA) ;\ - UPDATE_REPO_LINE="repo --name=$${FEDORA_REPO}-updates-source $(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/updates/$(FEDORA)/SRPMS,--mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-source-f$(FEDORA)&arch=source)" ;\ - fi ;\ - echo "repo --name=$${FEDORA_REPO}-source $${FEDORA_REPO_LOC}" ;\ - echo "repo --name=ovirt-org-source --baseurl=$(OVIRT_URL)/$${OVIRT_DISTRO}/src" ;\ - echo "$${UPDATE_REPO_LINE}" ;\ - echo "%packages --nobase" ;\ - grep -v '^-' /usr/share/appliance-os/includes/base-pkgs.ks ;\ - echo "ovirt-recipe" ;\ - echo "lokkit" ;\ - echo "%end" ;\ - ) > $(SRC_KS) - -keys: - if [ "$(_ovirt_dev)" = 1 -a -f $(AUTH_KEYS) ]; then \ - cp -va $(AUTH_KEYS) ovirt-authorized_keys ;\ - fi - -SELINUX_ENFORCING=$(shell /usr/sbin/getenforce) -$(NVR).$(PKG_FMT): repos.ks keys - mkdir -p $(APP_TMP)/tree - mkdir -p $(OVIRT_CACHE_DIR)/yum-$(ARCH) - ( \ - case $(SELINUX_ENFORCING) in \ - Enforcing) sudo /usr/sbin/setenforce Permissive ;; \ - Permissive) ;; \ - *) if ksflatten $(PACKAGE).ks 2>/dev/null \ - | grep -q '^selinux --disabled'; then \ - echo WARNING: SELinux disabled in kickstart ;\ - else \ - echo ERROR: SELinux enabled in kickstart, \ - but disabled on the build machine ;\ - exit 1 ;\ - fi ;; \ - esac ;\ - if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \ - FEDORA_TREE_URL="$(if $(FEDORA_URL),$(FEDORA_URL)/development/$(ARCH)/os,$(FEDORA_URL_DEF)/development/$(ARCH)/os)" ;\ - else \ - FEDORA_TREE_URL="$(if $(FEDORA_URL),$(FEDORA_URL)/releases/$(FEDORA)/Fedora/$(ARCH)/os,$(FEDORA_URL_DEF)/releases/$(FEDORA)/Fedora/$(ARCH)/os)" ;\ - fi ;\ - ./gettree.sh $${FEDORA_TREE_URL} $(APP_TMP)/tree ;\ - ) - - mkdir -p scripts - cp -a create-$(PACKAGE) create-ovirt-network create-ovirt-nodes \ - get-$(PACKAGE) $(PACKAGE)-functions scripts - - ln -snf $(APP_TMP) tmp - sudo su -c "export PATH=$(PATH):/sbin:/usr/sbin && \ - appliance-creator --config $(PACKAGE).ks \ - --name $(PACKAGE) -f $(DISK_FMT) -p $(PKG_FMT) -d -v \ - --tmpdir='$(APP_TMP)' \ - --cache='$(OVIRT_CACHE_DIR)/yum-$(ARCH)' \ - --vmem=$(APP_RAM) \ - -i scripts" - sudo chown $${USER} $(PACKAGE).$(PKG_FMT) - ( \ - if [ $(SELINUX_ENFORCING) = Enforcing ]; then \ - sudo /usr/sbin/setenforce Enforcing || exit 1 ;\ - fi \ - ) - - mv $(PACKAGE).$(PKG_FMT) $(NVR).$(PKG_FMT) - rm -Rf scripts - -$(NVR).$(PKG_FMT).$(SUM): $(NVR).$(PKG_FMT) - $(SUM) $(NVR).$(PKG_FMT) > $(NVR).$(PKG_FMT).$(SUM) - -appliance: $(NVR).$(PKG_FMT).$(SUM) - -PUNGI = $(APP_TMP)/tree/pungi -source: src.ks - @sudo rm -Rf $(PUNGI) - @mkdir -p $(PUNGI) - - cd $(PUNGI) && \ - sudo pungi -G --ver=$(PACKAGE) -c $(SRC_KS) \ - --cachedir=$(OVIRT_CACHE_DIR)/yum-$(ARCH) - if [ "$(SRC_FMT)" == "iso" ]; then \ - cd $(PUNGI) && \ - sudo pungi --sourceiso --ver=$(PACKAGE) -c $(SRC_KS) \ - --cachedir=$(OVIRT_CACHE_DIR)/yum-$(ARCH) ;\ - sudo mv $(PUNGI)/$(PACKAGE)/source/iso/Fedora-$(PACKAGE)-source.iso \ - $(PWD)/$(PACKAGE)-source-$(VERSION).iso ;\ - elif [ "$(SRC_FMT)" == "tar" ]; then \ - cd $(PUNGI)/$(PACKAGE)/source && \ - sudo tar cf ovirt-source.tar SRPMS ;\ - sudo mv $(PUNGI)/$(PACKAGE)/source/ovirt-source.tar \ - $(PWD)/$(PACKAGE)-source-$(VERSION).tar ;\ - else \ - echo "Invalid src format: $(SRC_FMT)" ;\ - exit 1 ;\ - fi - sudo sudo chown -R $(USER) $(PWD)/$(PACKAGE)-source-$(VERSION).$(SRC_FMT) - sudo sudo chown -R $(USER) $(PUNGI) - $(SUM) $(PWD)/$(PACKAGE)-source-$(VERSION).$(SRC_FMT) \ - > $(PACKAGE)-source-$(VERSION).$(SRC_FMT).$(SUM) - -rpms: dist appliance - rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz - -srpms: dist - rpmbuild $(RPM_FLAGS) -ts $(distdir).tar.gz - -publish: rpms - mkdir -p $(OVIRT_CACHE_DIR) - rsync -aq $(shell rpm --eval '%{_rpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/ - rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src/ - createrepo $(OVIRT_CACHE_DIR)/ovirt - -.PHONY: rpms publish srpms $(NVR).$(PKG_FMT).$(SUM) $(NVR).$(PKG_FMT) keys \ - repos.ks src.ks source diff --git a/autobuild.sh b/autobuild.sh deleted file mode 100755 index cdb8d62..0000000 --- a/autobuild.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/sh -#oVirt node image autobuild script -# -# Copyright (C) 2008 Red Hat, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -# MA 02110-1301, USA. A copy of the GNU General Public License is -# also available at http://www.gnu.org/copyleft/gpl.html. - -echo "Running oVirt Appliance Autobuild" - -set -e -set -v - -test -f Makefile && make -k distclean || : - -# setup parameters to ssh to appliance -SSHKEY=~/.ssh/id_autobuild -remote_target="root at 192.168.50.2" -ssh_cmd="ssh -i $SSHKEY -o StrictHostKeyChecking=no \ - -o UserKnownHostsFile=/dev/null $remote_target" -scp_cmd="scp -i $SSHKEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" - -# generate new ssh key if not found -if [ ! -r $SSHKEY ]; then - mkdir -p $(dirname "$SSHKEY") - ssh-keygen -q -t rsa -N "" -f $SSHKEY -fi - -# implant ssh key in appliance -cat >> ovirt-appliance.ks << KS -%post -mkdir -p /root/.ssh -chmod 700 /root/.ssh -cat > /root/.ssh/authorized_keys << \EOF -$(ssh-keygen -y -f $SSHKEY) -EOF -chmod 600 /root/.ssh/authorized_keys -%end -KS - -# move sshd to start last (after ovirt*first-run scripts) -cat >> ovirt-appliance.ks << \KS -%post -rm -f /etc/rc3.d/S55sshd -ln -s /etc/init.d/sshd /etc/rc3.d/S99sshd -%end -KS - -export OVIRT_LOCAL_REPO=file://$AUTOBUILD_PACKAGE_ROOT/rpm/RPMS - -./autogen.sh --prefix=$AUTOBUILD_INSTALL_ROOT -make dist -make appliance - -if [ -f /usr/bin/rpmbuild ]; then - if [ -n "$AUTOBUILD_COUNTER" ]; then - EXTRA_RELEASE=".auto$AUTOBUILD_COUNTER" - else - NOW=`date +"%s"` - EXTRA_RELEASE=".$USER$NOW" - fi - - rm -f $AUTOBUILD_PACKAGE_ROOT/rpm/RPMS/noarch/ovirt-appliance* - - rpmbuild --nodeps --define "extra_release $EXTRA_RELEASE" \ - --define "ovirt_local_repo $OVIRT_LOCAL_REPO" \ - -ta --clean *.tar.gz -fi - -# if ovirt-appliance rpm is already installed, remove it -(rpm -q ovirt-appliance && sudo rpm -e ovirt-appliance) || : - -# install ovirt-appliance, create appliance -sudo rpm -ivh $AUTOBUILD_PACKAGE_ROOT/rpm/RPMS/noarch/ovirt-appliance*rpm -sudo /usr/sbin/get-ovirt-appliance -l `pwd` -p tar -sudo /usr/sbin/create-ovirt-network -f -sudo /usr/sbin/create-ovirt-nodes -sudo /usr/sbin/create-ovirt-appliance -sudo virsh start ovirt-appliance -sudo virsh start node3 - -# wait till ovirt-appliance is started -for i in $(seq 1 60); do - $ssh_cmd exit && break - sleep 10 -done - -# implant selenium test module (apache licensed) -# into running appliance -SELENIUM_RB=/var/selenium/selenium.rb -if [ -f $SELENIUM_RB ]; then - $scp_cmd $SELENIUM_RB $remote_target:/usr/share/ovirt-server/test/ -else - echo "$SELENIUM_RB not found, will not run interface tests" -fi - -# run server tests -echo "Running the server tests" -for i in $(seq 1 10); do - $ssh_cmd "curl -i http://management.priv.ovirt.org/ovirt/ | \ - grep 'HTTP/1.1 200 OK'" && break - sleep 10 -done - -$ssh_cmd "cd /usr/share/ovirt-server && rake test" diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 6b0970f..0000000 --- a/autogen.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -# Run this to generate configure and Makefile - -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -THEDIR=`pwd` -( - cd $srcdir - die=0 - - (autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have autoconf installed." - echo "Download the appropriate package for your distribution," - echo "or see http://www.gnu.org/software/autoconf" - die=1 - } - - # Require libtool only if one of of LT_INIT, - # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac. - grep -E '^[[:blank:]]*(LT_INIT|A[CM]_PROG_LIBTOOL)' configure.ac >/dev/null \ - && { - (libtool --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have libtool installed." - echo "Download the appropriate package for your distribution," - echo "or see http://www.gnu.org/software/libtool" - die=1 - } - } - - (automake --version) < /dev/null > /dev/null 2>&1 || { - echo - die=1 - echo "You must have automake installed." - echo "Download the appropriate package for your distribution," - echo "or see http://www.gnu.org/software/automake" - } - - test $die = 1 && exit 1 - - test -f ovirt-appliance.spec.in || { - echo "You must run this script in the top-level directory" - exit 1 - } - - if test -z "$*"; then - echo "I am going to run ./configure with no arguments - if you wish " - echo "to pass any to it, please specify them on the $0 command line." - fi - - aclocal - - # Run autoheader only if needed - grep '^[[:blank:]]*AC_CONFIG_HEADERS' configure.ac >/dev/null && autoheader - - automake --add-missing - autoconf - ./configure "$@" -) - -if test "x$OBJ_DIR" != x; then - mkdir -p "$OBJ_DIR" - cd "$OBJ_DIR" -fi diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 001ece9..0000000 --- a/configure.ac +++ /dev/null @@ -1,5 +0,0 @@ -AC_INIT([ovirt-appliance], [0.99], [ovirt-devel at redhat.com]) -AM_INIT_AUTOMAKE([-Wall -Werror foreign tar-pax]) - -AC_CONFIG_FILES([Makefile ovirt-appliance.spec]) -AC_OUTPUT diff --git a/create-ovirt-appliance b/create-ovirt-appliance deleted file mode 100755 index 1a1529f..0000000 --- a/create-ovirt-appliance +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash -# -# Create oVirt Appliance -# Copyright 2008 Red Hat, Inc. -# Written by Perry Myers -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Library General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -. $(dirname $0)/ovirt-appliance-functions - -usage() { - case $# in 1) warn "$1"; try_h; exit 1;; esac - cat < /dev/null 2>&1 ; then - # If the appliance is already defined, abort since rewriting the appliance - # will change network settings that break the appliance. - echo "$name is already a defined virtual machine." - die -fi - -mkdir -p $imgdir - -appdisk=$name/$name-sda.$DISK_FMT -datadisk=$name/$name-sdb.$DISK_FMT - -test ! -r $imgdir/$appdisk && die "Disk image not found at $imgdir/$appdisk" -test ! -r $imgdir/$datadisk && die "Disk image not found at $imgdir/$datadisk" -virsh destroy $name > /dev/null 2>&1 -virsh undefine $name > /dev/null 2>&1 - -virt-image -b $BRIDGENAME $imgdir/$name/$name.xml -# FIXME: virt-image doesn't do virtio so we have to kill the appliance, edit -# the libvirt xml and restart -virsh destroy $name > /dev/null 2>&1 -TMPXML=$(mktemp) || exit 1 -BR_XML="" -VNIC_XML="" -# FIXME: virtio disks won't boot presently, need to look into this -# -e "s/bus='ide'/bus='virtio'/" \ -# -e "s/dev='hd\(.\)'/dev='vd\1'/" \ -virsh dumpxml $name | sed -e "s^\($BR_XML\)^\1\n$VNIC_XML^" \ - > $TMPXML && \ - virsh define $TMPXML && \ - rm -f $TMPXML - -if [ $console = 1 ]; then - virsh start $name && virsh console $name -fi diff --git a/create-ovirt-network b/create-ovirt-network deleted file mode 100755 index 8fd3b88..0000000 --- a/create-ovirt-network +++ /dev/null @@ -1,161 +0,0 @@ -#!/bin/bash - -. $(dirname $0)/ovirt-appliance-functions - -usage() { - case $# in 1) warn "$1"; try_h; exit 1;; esac - cat < /dev/null 2>&1 ; bridge_dev_present=$? - test $bridge_dev_present != 0 \ - && die "$bridge device not present, aborting!" - - # Check to see if the eth device is already tied to a non oVirt bridge - attached_bridge=$(brctl show \ - | awk -v BRIDGE=$bridge '$4~BRIDGE {print $1}') - test -n "$attached_bridge" -a "$attached_bridge" != "$BRIDGENAME" \ - && die "$bridge already attached to other bridge $attached_bridge" - - # Check to make sure that the system is not already using the interface - if [[ $force != 1 && -f $NET_SCRIPTS/ifcfg-$bridge ]]; then - echo "$NET_SCRIPTS/ifcfg-$bridge is present, are you sure you wish to" - echo "overwrite this file? [y/N]? " - read yesno - - if [ "$yesno" != "y" -a "$yesno" != "Y" ]; then - exit 2 - fi - fi -fi - -# Remove old bridge device if it exists -sed -i "/# $BRIDGENAME/d" /etc/rc.d/rc.local -old_bridge=$(brctl show \ - | awk -v BRIDGENAME=$BRIDGENAME '$1==BRIDGENAME {print $4}') -if [ -n "$old_bridge" ]; then - echo "Removing old bridge $old_bridge" - ifconfig $old_bridge down - brctl delif $BRIDGENAME $old_bridge - rm -f $NET_SCRIPTS/ifcfg-$old_bridge -fi - -{ -echo "Removing $BRIDGENAME" -virsh net-destroy $BRIDGENAME -virsh net-undefine $BRIDGENAME -ifconfig $BRIDGENAME down -brctl delbr $BRIDGENAME -rm -fv $NET_SCRIPTS/ifcfg-$BRIDGENAME -rm -fv /etc/sysconfig/iptables-$BRIDGENAME-filter -rm -fv /etc/sysconfig/iptables-$BRIDGENAME-nat -sed -i "/iptables-$BRIDGENAME/d" /etc/sysconfig/system-config-firewall -lokkit --update -echo "Done Removing $BRIDGENAME" -} 2> /dev/null - -lokkit -s dns - -if [ -n "$bridge" ]; then - # real external bridge, use distro networking scripts - ifconfig $bridge down 2> /dev/null - TMPAUG=$(mktemp) || exit 1 - cat > $TMPAUG < /etc/sysconfig/iptables-$BRIDGENAME-filter < /etc/sysconfig/iptables-$BRIDGENAME-nat < $TMPXML - virsh net-define $TMPXML - rm $TMPXML - virsh net-start $BRIDGENAME - virsh net-autostart $BRIDGENAME -fi - -# Set up ip-forwarding -sysctl -w net.ipv4.ip_forward=1 -TMPAUG=$(mktemp) || exit 1 -cat > $TMPAUG < /etc/dnsmasq.d/$BRIDGENAME.conf -bind-interfaces -interface=$BRIDGENAME -except-interface=lo -EOF -if ! grep "^conf-dir=/etc/dnsmasq.d" /etc/dnsmasq.conf > /dev/null 2>&1 ; then - echo "conf-dir=/etc/dnsmasq.d" >> /etc/dnsmasq.conf -fi -chkconfig dnsmasq on -service dnsmasq restart - -service libvirtd restart -wait_for_service 'virsh connect' 10 2 || exit 1 - -net_debug diff --git a/create-ovirt-nodes b/create-ovirt-nodes deleted file mode 100755 index 0ac5fd0..0000000 --- a/create-ovirt-nodes +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# -# Create fake oVirt Nodes that PXE boot to the Appliance Server -# Copyright 2008 Red Hat, Inc. -# Written by Perry Myers -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Library General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -. $(dirname $0)/ovirt-appliance-functions - -usage() { - case $# in 1) warn "$1"; try_h; exit 1;; esac - cat < -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Library General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -. $(dirname $0)/ovirt-appliance-functions - -usage() { - case $# in 1) warn "$1"; try_h; exit 1;; esac - cat < /dev/null 2>&1 ; then - echo "Using http at $app_loc to retrieve appliance" - - if verify_sum $pkgfile $sumfile ; then - app_loc=$(pwd) - else - wget -c $app_loc/$sumfile || die "error downloading $app_loc/$sumfile" - wget -c $app_loc/$pkgfile || die "error downloading $app_loc/$pkgfile" - if verify_sum $pkgfile $sumfile ; then - app_loc=$(pwd) - else - die "appliance files not available, aborting" - fi - fi -else - echo "Using local files in $app_loc for appliance" - - if [ -d $app_loc ]; then - if ! verify_sum $app_loc/$pkgfile $app_loc/$sumfile ; then - die "appliance files not available, aborting" - fi - elif [ -f $app_loc -a -f $app_loc.$SUM ]; then - if ! verify_sum $app_loc $app_loc.$SUM ; then - die "appliance files not available, aborting" - fi - fi -fi - -mkdir -p $imgdir - -appdisk=$name/$name-sda.$DISK_FMT -datadisk=$name/$name-sdb.$DISK_FMT - -case $PKG_FMT in - tar.bz2) - tar -jSxvf $app_loc/$pkgfile -C $imgdir - ;; - tar.gz) - tar -zSxvf $app_loc/$pkgfile -C $imgdir - ;; - tar) - tar -xSvf $app_loc/$pkgfile -C $imgdir - ;; - *) - die "$PKG_FMT is unsupported" - ;; -esac - -test ! -r $imgdir/$appdisk && die "Disk image not found at $imgdir/$appdisk" -test ! -r $imgdir/$datadisk && die "Disk image not found at $imgdir/$datadisk" - -virsh destroy $name > /dev/null 2>&1 -virsh undefine $name > /dev/null 2>&1 - -echo "Appliance Disks installed to $imgdir" -echo "Run create-ovirt-appliance to define and start the appliance" diff --git a/gettree.sh b/gettree.sh deleted file mode 100755 index 477b4bf..0000000 --- a/gettree.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash - -# gettree.sh -# Fedora release URL - Fedora base URL -# e.g. http://download.fedoraproject.org/pub/fedora/linux/releases/9/Fedora/x86_64/os -# download minimal Fedora tree: .treeinfo stage2 initrd and kernel - -# Requires: wget -# Requires: python-iniparse -# Requires: createrepo - -# download $destination $URL [$alternative1 ...] -# attempt to download from a list of URLs until it succeeds -download() { - local destination=$1 - shift - local files="$@" - set +e - rc=0 - for f in $files; do - case $f in - file://*) cp "${f#file://}" "$destination" ;; - *) wget --directory-prefix="$destination" \ - --progress=dot:mega --continue "$f" ;; - esac - rc=$? - if [ $rc == 0 ]; then - printf "." - break - fi - done - set -e - return $rc -} - -if [[ $# < 2 ]]; then - cat >&2 << EOF -Usage: $(basename "$0") -EOF - exit 1 -fi - -url=$1 -dest=$2 - -printf "Downloading minimal Fedora install tree from $url" -set -e -download "$dest" $url/.treeinfo -python -c 'from iniparse import INIConfig -ini = INIConfig(open("'"$dest/"'.treeinfo")) -family = ini.general.family -version = ini.general.version -arch = ini.general.arch -kernel = ini["images-"+arch].kernel -initrd = ini["images-"+arch].initrd -stage2 = ini.stage2.mainimage -print "%s %s %s %s %s %s" % (family, version, arch, kernel, initrd, stage2)' | \ -( -read os ver arch kernel initrd stage2 -echo $os $ver $arch > "$dest/.treeinfo.ova" -mkdir -p "$dest/Packages" -download "$dest/Packages" "$url/Packages/basesystem-8.1-1.noarch.rpm" \ - "$url/Packages/basesystem-10.0-1.noarch.rpm" -download "$dest/Packages" "$url/Packages/kernel-headers-2.6.27.5-117.fc10.$arch.rpm" \ - "$url/Packages/kernel-headers-2.6.28-3.fc11.$arch.rpm" -createrepo "$dest" -dir="$dest/$(dirname $stage2)" -mkdir -p "$dir" -download "$dir" "$url/$stage2" -dir="$dest/$(dirname $kernel)" -mkdir -p "$dir" -download "$dir" "$url/$kernel" -dir="$dest/$(dirname $initrd)" -mkdir -p "$dir" -download "$dir" "$url/$initrd" -) -echo "done" diff --git a/ovirt-appliance-functions b/ovirt-appliance-functions deleted file mode 100644 index c1d9a15..0000000 --- a/ovirt-appliance-functions +++ /dev/null @@ -1,219 +0,0 @@ -# -*-Shell-script-*- -# -# Common functions for the oVirt Appliance scripts -# Copyright 2008 Red Hat, Inc. -# Written by Perry Myers -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Library General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -PATH=$PATH:/sbin:/usr/sbin - -ME=$(basename "$0") -warn() { printf '%s: %s\n' "$ME" "$*" >&2; } -try_h() { printf "Try \`$ME -h' for more information.\n" >&2; } -die() { warn "$@"; try_h; exit 1; } - -IMGDIR_DEFAULT=/var/lib/libvirt/images -NAME_DEFAULT=ovirt-appliance -NET_SCRIPTS=/etc/sysconfig/network-scripts - -BRIDGENAME=ovirtbr0 -NETWORK=192.168.50.0 -NETMASK=255.255.255.0 - -PKG_FMT_DEFAULT=tar.bz2 -PKG_FMT=$PKG_FMT_DEFAULT -SUM=sha1sum - -DISK_FMT_DEFAULT=qcow2 -DISK_FMT=$DISK_FMT_DEFAULT -OVIRT_URL=http://ovirt.org/download - -NODE_DISK_FMT=qcow2 -NODE_DISK_SIZE=6144M - -imgdir=$IMGDIR_DEFAULT -name=$NAME_DEFAULT - -force=0 - -do_checks() { - # first, check to see we are root - if [ $( id -u ) -ne 0 ]; then - die "Must run as root" - fi - - test "$PKG_FMT" = "tar" -o "$PKG_FMT" = "tar.gz" \ - -o "$PKG_FMT" = "tar.bz2" \ - || die "$PKG_FMT is not a supported package format" - - test "$DISK_FMT" = "qcow2" -o "$DISK_FMT" = "raw" \ - || die "$DISK_FMT is not a supported disk format" - - # now make sure the packages we need are installed - if [ -e /etc/redhat-release ]; then - # We rely on RPM deps for this in Red Hat/Fedora systems - CHECK=0 - KVM_BINARY=/usr/bin/qemu-kvm - version=$(rpm -q --qf '%{version}' ovirt-appliance) - elif [ -e /etc/debian_version ]; then - # Works in Ubuntu 8.04. Still needs testing in Debian - PACKAGES="libvirt0 libvirt-bin kvm qemu" - CHECK=$(dpkg -l $PACKAGES &> /dev/null; echo $?) - KVM_BINARY=/usr/bin/kvm - version=LATEST - else - die "Not a supported system" - fi - - if [ $CHECK -ne 0 ]; then - # one of the previous packages wasn't installed; bail out - die "Must have the $PACKAGES packages installed" - fi - - service iptables status > /dev/null 2>&1 \ - || service iptables start > /dev/null 2>&1 - chkconfig iptables on - - service libvirtd status > /dev/null 2>&1 \ - || service libvirtd start > /dev/null 2>&1 - chkconfig libvirtd on -} - -check_net() { - service NetworkManager status > /dev/null 2>&1 ; netman_status=$? - if [ $netman_status -eq 0 ]; then - if [ $force -ne 1 ]; then - die "NetworkManager is running, disable and use standard network scripts before proceeding" - elif [ -n "$bridge" ]; then - echo "WARNING! NetworkManager running and bridge ($bridge) specified" - echo "WARNING! This combination will most likely not work." - fi - fi -} - -gen_bridge() { - cat << EOF - - $BRIDGENAME - - - - -EOF -} - -gen_fake_managed_node() { - local num=$1 - local last_mac=$(( 54 + $num )) - - echo "Creating fake node$num..." - virsh destroy node$num > /dev/null 2>&1 - virsh undefine node$num > /dev/null 2>&1 - rm -f $imgdir/node${i}-sda.$NODE_DISK_FMT - qemu-img create -f $NODE_DISK_FMT $imgdir/node${i}-sda.$NODE_DISK_FMT \ - $NODE_DISK_SIZE - # FIXME: virt-install should be changed to have a --nostart parameter - # that just defines the VM w/o starting it. - virt-install --name=node$num --ram=512 --vcpus=1 \ - --disk path=$imgdir/node${i}-sda.$NODE_DISK_FMT \ - --network=bridge:$BRIDGENAME --mac=00:16:3e:12:34:$last_mac \ - --vnc --accelerate --hvm --noautoconsole \ - --os-type=linux --os-variant=fedora10 \ - --force --noreboot --pxe - virsh destroy node$num > /dev/null 2>&1 - # FIXME: virt-install should be changed to allow network boot - # to be a permanent selection - TMPXML=$(mktemp) || exit 1 - virsh dumpxml node$num | sed "s/boot dev='.*'/boot dev='network'/" > $TMPXML - virsh define $TMPXML - rm -f $TMPXML - echo "node$num created" -} - -net_debug() { - # Some output for debugging problems - echo "Currently active bridges:" - echo "-------------------------" - brctl show - echo - echo "Currently defined libvirt networks:" - echo "-----------------------------------" - virsh net-list --all - echo -} - -cleanup_old_apps() { - # Cleanup to handle older version of script that used these domain names - virsh destroy developer - virsh undefine developer - virsh destroy bundled - virsh undefine bundled -} > /dev/null 2>&1 - -cleanup_old_nets() { - # Cleanup to handle older version of script that used these bridge names - virsh net-destroy dummybridge - virsh net-undefine dummybridge - brctl delif eth1bridge eth1 - virsh net-destroy eth1bridge - virsh net-undefine eth1bridge - old_bridge=$(brctl show \ - | awk -v BRIDGENAME=ovirtbr '$1==BRIDGENAME {print $4}') - if [ -n "$old_bridge" ]; then - ifconfig $old_bridge down - fi - brctl delif ovirtbr $old_bridge - virsh net-destroy ovirtbr - virsh net-undefine ovirtbr - sed -i "/# ovirtbr$/d" /etc/rc.d/rc.local -} > /dev/null 2>&1 - -verify_sum() { - local pkgfile=$1 - local sumfile=$2 - - test ! -f $sumfile && { echo "$sumfile not found" ; return 1 ; } - test ! -f $pkgfile && { echo "$pkgfile not found" ; return 1 ; } - - echo "performing checksum of $pkgfile" - local actual_sum=$($SUM $pkgfile | awk '{print $1}') - local expect_sum=$(awk '{print $1}' $sumfile) - - if [ "$actual_sum" = "$expect_sum" ]; then - echo "checksum verified" - return 0 - else - echo "checksum failed" - return 1 - fi -} - -# wait_for_service 'test command' max_retries seconds_to_sleep_between_retries -wait_for_service() { - local testcmd=$1; shift - local n_retries=$1; shift - local sleep_seconds=$1; shift - local total=$((n_retries*sleep_seconds)) - - while [ $n_retries -gt 0 ] - do - eval "$testcmd" > /dev/null 2>&1 && return 0 - echo service not ready yet, retrying... - n_retries=$((n_retries-1)) - sleep $sleep_seconds - done - printf 'service not ready after %d seconds, giving up\n' $total 1>&2 - return 1 -} diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks deleted file mode 100644 index 202babc..0000000 --- a/ovirt-appliance.ks +++ /dev/null @@ -1,119 +0,0 @@ -install - -lang en_US.UTF-8 -keyboard us -network --device=eth0 --bootproto=static --ip=192.168.50.2 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.50.1 --gateway=192.168.50.1 -# Root password is 'ovirt' -rootpw --iscrypted Xa8QeYfWrtscM -firewall --disabled -authconfig --enableshadow --enablemd5 -selinux --disabled -# NOTE: ntp/ntpdate need to stay in this list to ensure that time on the -# appliance is correct prior to the ovirt-server-installer being run. Otherwise you -# get Kerberos errors -services --disabled=libvirtd,postgresql --enabled=network,tgtd,nfs,iptables,ntpdate,ntpd,ace,acpid -timezone --utc UTC -text - -bootloader --location=mbr --driveorder=sda,sdb --append="console=tty0 console=ttyS0,115200" -zerombr -clearpart --all --drives=sda,sdb -part /boot --ondisk=sda --fstype=ext3 --size=100 -part / --ondisk=sda --fstype=ext3 --size=5000 -part swap --ondisk=sda --fstype=swap --size=512 -part /mnt/data --ondisk=sdb --fstype=ext3 --size=20000 -reboot - -%include repos.ks - -%packages --excludedocs --nobase -%include /usr/share/appliance-os/includes/base-pkgs.ks -openssh-clients -openssh-server -nfs-utils -collectd -collectd-rrdtool -ipa-server -ipa-admintools -scsi-target-utils -iscsi-initiator-utils -augeas -syslinux -curl -bind-utils -libvirt-python -rhpl -cobbler -# Stupid yum dep solver pulls in older 'qemu' to resolve -# /usr/bin/qemu-img dep. This forces it to pick the new -# qemu-img RPM. -qemu-img -ovirt-release -ovirt-node-image -ovirt-server -ovirt-server-installer -lokkit - -%post - # cleanup rpmdb to allow non-matching host and chroot RPM versions - rm -f /var/lib/rpm/__db* - - # set up serial console - sed -i 's/hiddenmenu/hiddenmenu\nserial --unit=0 --speed=115200\nterminal --timeout=5 serial console/' /boot/grub/grub.conf - - # The ace stuff. - mkdir /etc/sysconfig/ace - echo ovirt-appliance >> /etc/sysconfig/ace/appliancename -%end - -%post - # Create initial manifests - manifests=/tmp/manifests - mkdir -p $manifests - rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' | sort \ - > $manifests/rpm-manifest.txt - rpm -qa --qf '%{sourcerpm}\n' | sort -u > $manifests/srpm-manifest.txt - du -akx --exclude=/var/cache/yum / > $manifests/file-manifest.txt - du -x --exclude=/var/cache/yum / > $manifests/dir-manifest.txt -%end - -%post --nochroot - if [ -f "ovirt-authorized_keys" ]; then - echo "Adding authorized_keys to Image" - mkdir -p $INSTALL_ROOT/root/.ssh - cp -v ovirt-authorized_keys $INSTALL_ROOT/root/.ssh/authorized_keys - chown -R root:root $INSTALL_ROOT/root/.ssh - chmod 755 $INSTALL_ROOT/root/.ssh - chmod 644 $INSTALL_ROOT/root/.ssh/authorized_keys - fi - - set -e - cat tmp/tree/.treeinfo.ova | ( read os ver arch - dest=$INSTALL_ROOT/var/www/cobbler/ks_mirror/$os-$ver-$arch - printf "Importing $os-$ver-$arch ..." - cp -a tmp/tree "$dest" - ) -%end - -%post - # Create post-image processing manifests - manifests=/tmp/manifests - mkdir -p $manifests - rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' | sort \ - > $manifests/rpm-manifest-post.txt - rpm -qa --qf '%{sourcerpm}\n' | sort -u > $manifests/srpm-manifest-post.txt - du -akx --exclude=/var/cache/yum / > $manifests/file-manifest-post.txt - du -x --exclude=/var/cache/yum / > $manifests/dir-manifest-post.txt - - ver=$(rpm -q --qf '%{version}' ovirt-server-installer) - rel=$(rpm -q --qf '%{release}' ovirt-server-installer) - arch=$(rpm -q --qf '%{arch}' ovirt-server-installer) - echo "oVirt Appliance release $ver-$rel-$arch" > $manifests/ovirt-release - tar -cvf ovirt-appliance-manifests-$ver-$rel.$arch.tar -C /tmp manifests - rm -Rf $manifests -%end - -%post --nochroot - # Move manifest tar to build directory - mv $INSTALL_ROOT/ovirt-appliance-manifests-*.tar . -%end diff --git a/ovirt-appliance.spec.in b/ovirt-appliance.spec.in deleted file mode 100644 index 8bb32f2..0000000 --- a/ovirt-appliance.spec.in +++ /dev/null @@ -1,69 +0,0 @@ -Summary: oVirt Appliance -Name: ovirt-appliance -Version: @VERSION@ -Release: 0%{?dist}%{?extra_release} -Source0: %{name}-%{version}.tar.gz -License: GPLv2+ -Group: Applications/System -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot -BuildArch: noarch -URL: http://ovirt.org/ -# FIXME: libvirt and kvm require ovirt specific patches presently due to -# the fact that migration has not been fixed upstream. Once upstream migration -# is fixed, these Requires should be fixed. -Requires: libvirt >= 0.4.6-2 -Requires: kvm >= 78-4 -Requires: qemu-img -Requires: augeas -Requires: virt-viewer-plugin -Requires: python-virtinst >= 0.400 -Requires: wget - -%define app_root %{_datadir}/%{name} - -# disable debuginfo, makes no sense for appliance and it is created empty anyway -%define debug_package %{nil} - -%description -The oVirt Appliance scripts to install on a Fedora Host - -%prep -%setup -q - -%build - -%install -%{__rm} -rf %{buildroot} -mkdir %{buildroot} - -%{__install} -d -m0755 %{buildroot}%{app_root} -%{__install} -p -m0644 COPYING %{buildroot}%{app_root} -%{__install} -d -m0755 %{buildroot}%{_sbindir} -%{__install} -p -m0755 create-%{name} %{buildroot}%{_sbindir} -%{__install} -p -m0755 create-ovirt-network %{buildroot}%{_sbindir} -%{__install} -p -m0755 create-ovirt-nodes %{buildroot}%{_sbindir} -%{__install} -p -m0755 get-%{name} %{buildroot}%{_sbindir} -%{__install} -p -m0644 %{name}-functions %{buildroot}%{_sbindir} - -%clean -%{__rm} -rf %{buildroot} - -%files -%defattr(-,root,root,0644) -%{app_root}/COPYING -%defattr(-,root,root,0755) -%{_sbindir}/create-%{name} -%{_sbindir}/create-ovirt-network -%{_sbindir}/create-ovirt-nodes -%{_sbindir}/get-%{name} -%defattr(-,root,root,0644) -%{_sbindir}/%{name}-functions - -%changelog -* Wed Nov 05 2008 Perry Myers 0.96 -- Removed appliance building from rpm. RPM now just contains tools to - download image and install it -* Sun Sep 14 2008 Perry Myers 0.92-1 -- Added Requires on libvirt/kvm -* Fri Sep 05 2008 Perry Myers 0.92-1 -- Initial build. -- 1.6.0.6 From mmorsi at redhat.com Wed Sep 9 18:51:13 2009 From: mmorsi at redhat.com (Mohammed Morsi) Date: Wed, 9 Sep 2009 14:51:13 -0400 Subject: [Ovirt-devel] [PATCH appliance] new ovirt appliance implementation using oVirt server installer In-Reply-To: <1252522273-16638-2-git-send-email-mmorsi@redhat.com> References: <1252522273-16638-1-git-send-email-mmorsi@redhat.com> <1252522273-16638-2-git-send-email-mmorsi@redhat.com> Message-ID: <1252522273-16638-3-git-send-email-mmorsi@redhat.com> - checkout appliance - make rpms - rpm -ivh ovirt-appliance.rpm - /usr/sbin/ovirt-appliance-ctrl install The install process will take a while, after which you can access the server by going to http://192.168.50.2/ovirt at which you can boot and manage vms on your host. --- .gitignore | 17 +-- Makefile.am | 56 +++++++ autogen.sh | 66 ++++++++ configure.ac | 11 ++ data/appliance.ks | 82 ++++++++++ data/ifcfg-breth0 | 4 + data/network.xml | 9 + ovirt-appliance.spec.in | 52 +++++++ scripts/ovirt-appliance-ctrl | 56 +++++++ scripts/ovirt-appliance-functions | 297 +++++++++++++++++++++++++++++++++++++ 10 files changed, 639 insertions(+), 11 deletions(-) create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 data/appliance.ks create mode 100644 data/ifcfg-breth0 create mode 100644 data/network.xml create mode 100644 ovirt-appliance.spec.in create mode 100755 scripts/ovirt-appliance-ctrl create mode 100644 scripts/ovirt-appliance-functions diff --git a/.gitignore b/.gitignore index 1221087..5b4f7d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,22 +1,17 @@ -*~ -INSTALL Makefile Makefile.in aclocal.m4 -autom4te.cache/ +autom4te.cache config.h config.h.in config.log config.status configure +depcomp install-sh missing -ovirt-appliance-manifests*.tar -ovirt-appliance-*-*.tar* -ovirt-appliance-*-*.tar.sha1sum -ovirt-appliance-*.tar.gz -ovirt-appliance.spec -ovirt-authorized_keys -repos.ks stamp-h1 -tmp +ovirt-appliance*.gz +ovirt-appliance.spec +schema.rb +log/ diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..7a104ce --- /dev/null +++ b/Makefile.am @@ -0,0 +1,56 @@ +# Copyright (C) 2008 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache + +EXTRA_DIST = \ + .gitignore \ + ovirt-appliance.spec \ + ovirt-appliance.spec.in \ + scripts \ + data + +DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz + +# For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT- +# annotated rpm version strings. +_ovirt_dev = \ + $(shell grep -q '^[[:space:]]*Release:[[:space:]]*0' \ + $(srcdir)/*.spec.in && echo 1 || :) + +git_head = $$(git log -1 --pretty=format:%h) +GIT_RELEASE = $$(date --utc +%Y%m%d%H%M%S)git$(git_head) +RPMDIR = $$(rpm --eval '%{_rpmdir}') +RPM_FLAGS = --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)" +RPM_FLAGS += $(if $(_ovirt_dev),--define "extra_release .$(GIT_RELEASE)") + +rpms: dist + rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz + +srpms: dist + rpmbuild $(RPM_FLAGS) -ts $(distdir).tar.gz + +publish: rpms + mkdir -p $(OVIRT_CACHE_DIR) + rsync -aq $(shell rpm --eval '%{_rpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/ + rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src + createrepo $(OVIRT_CACHE_DIR)/ovirt + +genlangs: + cd src && rake updatepo && rake makemo + +.PHONY: rpms publish srpms genlangs diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..6b0970f --- /dev/null +++ b/autogen.sh @@ -0,0 +1,66 @@ +#!/bin/sh +# Run this to generate configure and Makefile + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +THEDIR=`pwd` +( + cd $srcdir + die=0 + + (autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have autoconf installed." + echo "Download the appropriate package for your distribution," + echo "or see http://www.gnu.org/software/autoconf" + die=1 + } + + # Require libtool only if one of of LT_INIT, + # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac. + grep -E '^[[:blank:]]*(LT_INIT|A[CM]_PROG_LIBTOOL)' configure.ac >/dev/null \ + && { + (libtool --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have libtool installed." + echo "Download the appropriate package for your distribution," + echo "or see http://www.gnu.org/software/libtool" + die=1 + } + } + + (automake --version) < /dev/null > /dev/null 2>&1 || { + echo + die=1 + echo "You must have automake installed." + echo "Download the appropriate package for your distribution," + echo "or see http://www.gnu.org/software/automake" + } + + test $die = 1 && exit 1 + + test -f ovirt-appliance.spec.in || { + echo "You must run this script in the top-level directory" + exit 1 + } + + if test -z "$*"; then + echo "I am going to run ./configure with no arguments - if you wish " + echo "to pass any to it, please specify them on the $0 command line." + fi + + aclocal + + # Run autoheader only if needed + grep '^[[:blank:]]*AC_CONFIG_HEADERS' configure.ac >/dev/null && autoheader + + automake --add-missing + autoconf + ./configure "$@" +) + +if test "x$OBJ_DIR" != x; then + mkdir -p "$OBJ_DIR" + cd "$OBJ_DIR" +fi diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..db3bc30 --- /dev/null +++ b/configure.ac @@ -0,0 +1,11 @@ +AC_INIT([ovirt-appliance], [0.101], [ovirt-devel at redhat.com]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability tar-pax]) +AC_PROG_CC +AC_CONFIG_HEADERS([config.h]) + +# If using gcc and default CFLAGS, enable some warnings. +test x"$ac_ct_CC:$CFLAGS" = 'xgcc:-g -O2' \ + && CFLAGS="$CFLAGS -Wshadow -Wall -Werror" + +AC_CONFIG_FILES([Makefile ovirt-appliance.spec]) +AC_OUTPUT diff --git a/data/appliance.ks b/data/appliance.ks new file mode 100644 index 0000000..39a821c --- /dev/null +++ b/data/appliance.ks @@ -0,0 +1,82 @@ +install + +lang en_US.UTF-8 +keyboard us + +# setup two nics, one public, one on the private libvirt network we setup +network --device=eth0 --bootproto=static --ip=192.168.50.2 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.50.1 +network --device=eth1 --onboot=on + +# Root password is 'ovirt' +rootpw --iscrypted Xa8QeYfWrtscM + +firewall --disabled +authconfig --enableshadow --enablemd5 +selinux --disabled + +# NOTE: ntp/ntpdate need to stay in this list to ensure that time on the +# appliance is correct prior to the ovirt-server-installer being run. Otherwise you +# get Kerberos errors +services --disabled=libvirtd,postgresql --enabled=network,iptables,ntpdate,acpid,sshd +timezone --utc UTC +text + +bootloader --location=mbr +clearpart --all --drives=sda +part /boot --ondisk=sda --fstype=ext3 --size=100 +part / --ondisk=sda --fstype=ext3 --size=10000 +part swap --ondisk=sda --fstype=swap --size=512 +reboot + +repo --name=f11 --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-11&arch=x86_64 +repo --name=f11-updates --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f11&arch=x86_64 +#repo --name=f11-rawhide --mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=rawhide&arch=x86_64 +repo --name=ovirtorg --baseurl=http://ovirt.org/repos/ovirt/11/x86_64/ +repo --name=ovirt --baseurl=file://OVIRT_REPO + +%packages --excludedocs --nobase +%include /usr/share/appliance-os/includes/base-pkgs.ks +ntpdate +openssh-server +openssh-clients +ovirt-server +ovirt-server-installer +ovirt-node-image +ovirt-node-image-pxe +%end + +%post +# setup automatic ssh login +mkdir -p /root/.ssh +chmod 700 /root/.ssh +cat > /root/.ssh/authorized_keys << \EOF +OVIRT_SSH_KEY +EOF +chmod 600 /root/.ssh/authorized_keys + +# setup the ovirt installer answers +cat > /root/ovirt-installer-answers << \EOF +y +eth1 +eth0 +server.ovirt-appliance.com +n +n +192.168.50 +3 +50 +ovirt-appliance.com + +y +n +cobbler +cobbler +cobbler +v23zj59an +v23zj59an +ovirt-appliance.com +ovirt +ovirt +EOF + +%end diff --git a/data/ifcfg-breth0 b/data/ifcfg-breth0 new file mode 100644 index 0000000..02955b2 --- /dev/null +++ b/data/ifcfg-breth0 @@ -0,0 +1,4 @@ +DEVICE=breth0 +ONBOOT=yes +TYPE=Bridge +PEERNTP=yes diff --git a/data/network.xml b/data/network.xml new file mode 100644 index 0000000..8bce0db --- /dev/null +++ b/data/network.xml @@ -0,0 +1,9 @@ + + ovirt-appliance + OVIRT_NETWORK_UUID + + + + + + diff --git a/ovirt-appliance.spec.in b/ovirt-appliance.spec.in new file mode 100644 index 0000000..61bdc8d --- /dev/null +++ b/ovirt-appliance.spec.in @@ -0,0 +1,52 @@ +%define app_root %{_datadir}/%{name} + +Summary: oVirt Appliance +Name: ovirt-appliance +Version: @VERSION@ +Release: 1%{?dist}%{?extra_release} +Source0: %{name}-%{version}.tar.gz +License: GPLv2+ +Group: Applications/System +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot +BuildArch: noarch +URL: http://ovirt.org/ +#Requires: + +%description +The oVirt Appliance scripts to install on a Fedora Host + +%prep +%setup -q + +%build + +%install +%{__rm} -rf %{buildroot} +mkdir %{buildroot} + +%{__install} -d -m0755 %{buildroot}%{_sbindir} +%{__install} -d -m0755 %{buildroot}%{app_root} +%{__install} -d -m0755 %{buildroot}%{app_root}/backup +%{__cp} -a scripts/* %{buildroot}%{app_root} +%{__cp} -a data/* %{buildroot}%{app_root} +%{__ln_s} %{app_root}/ovirt-appliance-ctrl %{buildroot}%{_sbindir}/ + +%clean +%{__rm} -rf %{buildroot} + +%files +%defattr(-,root,root,0755) +%{app_root} +%{_sbindir}/ovirt-appliance-ctrl + +%changelog +* Wed Sep 02 2009 Mohammed Morsi 0.100-1 +- Revamped entire appliance project to fix it bring it up + to speed with the current implementation of oVirt +* Wed Nov 05 2008 Perry Myers 0.96 +- Removed appliance building from rpm. RPM now just contains tools to + download image and install it +* Sun Sep 14 2008 Perry Myers 0.92-1 +- Added Requires on libvirt/kvm +* Fri Sep 05 2008 Perry Myers 0.92-1 +- Initial build. diff --git a/scripts/ovirt-appliance-ctrl b/scripts/ovirt-appliance-ctrl new file mode 100755 index 0000000..2ac86c6 --- /dev/null +++ b/scripts/ovirt-appliance-ctrl @@ -0,0 +1,56 @@ +#!/bin/bash +# Control script for the oVirt appliance. +# +# Use this to setup / install a server appliance running in a vm +# and a node configuration on the baremetal host. +# +# This must be run as a super-user to be successful. +# +# Copyright (C) 2008 Red Hat, Inc. +# Written by Mohammed Morsi +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +. /etc/init.d/functions +. /usr/share/ovirt-appliance/ovirt-appliance-functions + +case "$1" in + install) + bootstrap_setup + build_rpms # would like to make this step optional + setup_network + setup_server_ssh_access + create_server_vm + run_server_installer + setup_server_env + backup_node_env + setup_node_env + ;; + uninstall) + bootstrap_teardown + destroy_server_vm + destroy_network + restore_node_env + echo "reboot to complete the uninstall process" + ;; + *) + echo "Usage: ovirt-appliance-ctrl {install|uninstall}" + exit 1 + ;; +esac + +exit $RETVAL + diff --git a/scripts/ovirt-appliance-functions b/scripts/ovirt-appliance-functions new file mode 100644 index 0000000..3ed77fb --- /dev/null +++ b/scripts/ovirt-appliance-functions @@ -0,0 +1,297 @@ +#!/bin/bash +# Function definitions part of the oVirt appliance setup utility +# +# Copyright (C) 2008 Red Hat, Inc. +# Written by Mohammed Morsi +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +OVIRT_APPLIANCE_DIR="/usr/share/ovirt-appliance" +OVIRT_APPLIANCE_BACKUP_DIR="$OVIRT_APPLIANCE_DIR/backup" +OVIRT_APPLIANCE_WORKING_DIR="`mktemp -d`" + +# perform any common setup initialization routines +bootstrap_setup() { + unalias cp + + # set selinux to permissive mode + /usr/sbin/setenforce 0 + + # make sure we aren't localhost so the server can lookup our hostname + hostname="`hostname`" + if [ "$hostname" == "localhost" -o "$hostname" == "localhost.localdomain" -o "$hostname" == "" ]; then + echo "hostname cannot be localhost (server needs to be able to resolve it)" + hostname host.ovirt-appliance.com + cp -f /etc/sysconfig/network $OVIRT_APPLIANCE_BACKUP_DIR + sed -i s/HOSTNAME.*$/HOSTNAME\=host\.ovirt-appliance\.com/g /etc/sysconfig/network + hostname host.ovirt-appliance.com + fi + + # install the oVirt release rpm if not present + rpm -q ovirt-release || rpm -ivh http://ovirt.org/repos/ovirt/ovirt-release-LATEST.noarch.rpm + + # update our system to have the latest packages, install base packages + yum install -y yum-fastestmirror libvirt + yum update -y --enablerepo=ovirt + + # copy the files we will be modifying into the working dir + cp -f $OVIRT_APPLIANCE_DIR/appliance.ks $OVIRT_APPLIANCE_WORKING_DIR/ + cp -f $OVIRT_APPLIANCE_DIR/network.xml $OVIRT_APPLIANCE_WORKING_DIR/ + cp -f $OVIRT_APPLIANCE_DIR/ifcfg-breth0 $OVIRT_APPLIANCE_WORKING_DIR/ + + # start up libvirt + service libvirtd start +} + +# perform any common teardown initialization routines +bootstrap_teardown() { + unalias cp + + # restore /etc/sysconfig/network if modified + test -f $OVIRT_APPLIANCE_BACKUP_DIR/network && cp -f $OVIRT_APPLIANCE_BACKUP_DIR/network /etc/sysconfig/ +} + +# build the neccessary oVirt rpms to install the appliance +build_rpms() { + # install dependencies + yum install -y --enablerepo=ovirt \ + git automake autoconf gcc rpm-build \ + ruby ruby-devel rubygem-gettext rubygem-rake \ + libvirt-devel dbus-devel hal-devel hardlink \ + livecd-tools appliance-tools \ + publican publican-ovirt + + ### checkout / build oVirt + + # create a build directory, and cd into it + saved_dir=`pwd` + OVIRT_CHECKOUT_DIR=`mktemp -d` + cd $OVIRT_CHECKOUT_DIR + + # clone the release project + git clone git://ovirt.org/ovirt-release release + + # setup the cache dir and make update and publish + export OVIRT_CACHE_DIR=$(pwd)/cache + OVIRT_REPO=$OVIRT_CACHE_DIR/ovirt + make -f release/ovirt.mk update publish + + # restore working directory + cd $saved_dir + + # swap in the correct local repo in the kickstart + sed -i s~OVIRT_REPO~$OVIRT_REPO~g $OVIRT_APPLIANCE_WORKING_DIR/appliance.ks +} + +# setup a libvirt network to act as the oVirt admin network +setup_network() { + # generate a network id and swap it into the network config + sed -i s/OVIRT_NETWORK_UUID/`uuidgen`/g $OVIRT_APPLIANCE_WORKING_DIR/network.xml + + # write the network config to the appropriate place + cp -f $OVIRT_APPLIANCE_WORKING_DIR/network.xml /etc/libvirt/qemu/networks/ovirt-appliance.xml + + # define and start the network via libvirt, set to autostart + virsh net-define /etc/libvirt/qemu/networks/ovirt-appliance.xml + virsh net-start ovirt-appliance + virsh net-autostart ovirt-appliance + + # setup breth0 as its needed to start vms with a network + # (backing the old config up first) + test -f /etc/sysconfig/network-scripts/ifcfg-breth0 && \ + cp -f /etc/sysconfig/network-scripts/ifcfg-breth0 $OVIRT_APPLIANCE_BACKUP_DIR/ifcfg-breth0.bak + cp -f $OVIRT_APPLIANCE_WORKING_DIR/ifcfg-breth0 /etc/sysconfig/network-scripts/ + ifup breth0 +} + +# destroy / remove the network that was setup +destroy_network() { + # destroy, undefine, and un-autostart the network + virsh net-destroy ovirt-appliance + virsh net-undefine ovirt-appliance + rm -f /etc/libvirt/qemu/networks/ovirt-appliance.xml + + # restore ifcfg-breth0 backup if neccessary + test -f $OVIRT_APPLIANCE_BACKUP_DIR/ifcfg-breth0.bak && \ + cp -f $OVIRT_APPLIANCE_BACKUP_DIR/ifcfg-breth0.bak /etc/sysconfig/network-scripts/ +} + +# setup no-password ssh login for the server +setup_server_ssh_access() { + # create convenience env variables for the ssh params/cmds + SSHKEY=~/.ssh/id_ovirt_appliance + remote_target="root at 192.168.50.2" + ssh_cmd="ssh -i $SSHKEY -o StrictHostKeyChecking=no \ + -o UserKnownHostsFile=/dev/null $remote_target" + scp_cmd="scp -i $SSHKEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" + + # generate new ssh key if not found + if [ ! -r $SSHKEY ]; then + mkdir -p $(dirname "$SSHKEY") + ssh-keygen -q -t rsa -N "" -f $SSHKEY + fi + + # implant ssh key into the server kickstart + sed -i "s~OVIRT_SSH_KEY~`ssh-keygen -y -f $SSHKEY`~g" $OVIRT_APPLIANCE_WORKING_DIR/appliance.ks +} + +# create and start the server vm +create_server_vm() { + # install dependencies + yum install -y --enablerepo=ovirt \ + appliance-os python-virtinst kvm + + + # save the current dir, and enter the working dir + saved_dir=`pwd` + cd $OVIRT_APPLIANCE_WORKING_DIR + + # remove the appliance image if it exists + test -d ovirt-appliance && rm -rf ovirt-appliance + + # create the appliance image + appliance-creator --config appliance.ks --name ovirt-appliance \ + -f raw --vmem=2048 -d -v + + # define / start the vm via libvirt, set to autostart + virt-image --network=network:ovirt-appliance ovirt-appliance/ovirt-appliance.xml + virsh define /etc/libvirt/qemu/ovirt-appliance.xml + virsh autostart ovirt-appliance + + # restore the saved dir + cd $saved_dir + + for i in $(seq 1 60); do + $ssh_cmd exit && break + sleep 10 + done +} + +# destroy the server vm that was setup +destroy_server_vm() { + # at some point, find a way to destroy the oVirt + # managed vms as well + virsh destroy ovirt-appliance + virsh undefine ovirt-appliance +} + +# run the oVirt server installation process on the server vm +run_server_installer() { + # run the actual installer w/ pre-specified answers (see kickstart) + $ssh_cmd "ovirt-installer < /root/ovirt-installer-answers" + + # XXX for whatever reason ovirt-node-image-pxe isn't setting + # up the pxe correctly for the node-image iso, just put this + # here until we figure out why + $ssh_cmd "cd /usr/share/ovirt-node-image/ && \ + rm -rf tftpboot && \ + livecd-iso-to-pxeboot ovirt-node-image.iso" + + # XXX another hack needed here to install the old fedora-ds-base + # instead of the currently broken 389-ds-base + # https://bugzilla.redhat.com/show_bug.cgi?id=518544 + # http://ovirt.org/install-instructions.html#free-ipa-warning + $ssh_cmd "yum install perl-Mozilla-LDAP nss-tools mozldap-tools lm_sensors-devel net-snmp-devel openssl-devel -y" + $ssh_cmd "rpm -ivh http://kojipkgs.fedoraproject.org/packages/fedora-ds-base/1.2.0/4.fc11/x86_64/fedora-ds-base-1.2.0-4.fc11.x86_64.rpm" + + # run the ace portion of the installer, actuall performing the oVirt installation + $ssh_cmd "ace -d install ovirt > /root/install.log" +} + +# perform everything else needed to get the oVirt server +# to work on a single machine install +setup_server_env() { + # set server resolv.conf to avoid an infinite loop. + # set it to the server nameserver, followed by the + # nameservers as defined in the host's resolv.conf + nameservers=`grep nameserver /etc/resolv.conf` + nameservers="nameserver 192.168.50.2 +$nameservers" + $ssh_cmd "echo '$nameservers' > /etc/resolv.conf" + + # prepend this hostname onto server's hosts and restart the dns service, + # required for kerberos and other components that need to lookup the host + $ssh_cmd "echo '192.168.50.1 `hostname`'|cat - /etc/hosts > /tmp/out && mv -f /tmp/out /etc/hosts" + $ssh_cmd "service dnsmasq restart" + + # add priciples to the kerberos server allowing node access + #$ssh_cmd /usr/bin/ovirt-add-host `hostname` /usr/share/ovirt-server/ovirt.keytab + $ssh_cmd "echo 'addprinc -randkey libvirt/`hostname`@OVIRT-APPLIANCE.COM' | kadmin.local" + $ssh_cmd "echo 'addprinc -randkey qpidd/`hostname`@OVIRT-APPLIANCE.COM' | kadmin.local" + $ssh_cmd "echo 'ktadd -k /usr/share/ipa/html/`hostname`-libvirt.tab libvirt/`hostname`@OVIRT-APPLIANCE.COM' | kadmin.local" + $ssh_cmd "echo 'ktadd -k /usr/share/ipa/html/`hostname`-libvirt.tab qpidd/`hostname`@OVIRT-APPLIANCE.COM' | kadmin.local" +} + +# backup all config files modified by setup_node_env +backup_node_env() { + test -f /etc/resolv.conf && cp -f /etc/resolv.conf $OVIRT_APPLIANCE_BACKUP_DIR + test -f /etc/krb5.conf && cp -f /etc/krb5.conf $OVIRT_APPLIANCE_BACKUP_DIR + test -f /etc/libvirt/krb5.tab/ && cp -f /etc/libvirt/krb5.tab $OVIRT_APPLIANCE_BACKUP_DIR + test -f /etc/sysconfig/libvirt-qpid && cp -f /etc/sysconfig/libvirt-qpid $OVIRT_APPLIANCE_BACKUP_DIR + test -f /etc/sysconfig/matahari && cp -f /etc/sysconfig/matahari $OVIRT_APPLIANCE_BACKUP_DIR +} + +# perform everything else needed to get the oVirt node/host +# to work on a single machine install +setup_node_env() { + # install dependencies + yum install -y --enablerepo=ovirt \ + wget libvirt-qpid cyrus-sasl-gssapi + # selinux-policy-doc \ + + # sync up our system time w/ the server's ntp server + ntpdate 192.168.50.2 + + # prepend the ovirt server's dns nameserver onto the local resolv.conf, + # so that we can perform the appliance domain lookups + echo "nameserver 192.168.50.2"|cat - /etc/resolv.conf > /tmp/out && mv -f /tmp/out /etc/resolv.conf + + # grab the kerberos config + wget -q --no-check-certificate http://192.168.50.2:80/ipa/config/krb5.ini -O /etc/krb5.conf + + # grab key/ticket off the server, and initialize kerberos w/ it + $scp_cmd $remote_target:/usr/share/ipa/html/`hostname`-libvirt.tab /etc/libvirt/krb5.tab + /usr/kerberos/bin/kinit -k -t /etc/libvirt/krb5.tab qpidd/`hostname` + + # setup the libvirt-qpid / matahari sysconfig + echo "LIBVIRT_QPID_ARGS=\"--broker 192.168.50.2 --port 5672\"" >> /etc/sysconfig/libvirt-qpid + echo "/usr/kerberos/bin/kinit -k -t /etc/libvirt/krb5.tab qpidd/`hostname`" >> /etc/sysconfig/libvirt-qpid + echo "MATAHARI_ARGS=\"--broker 192.168.50.2 --port 5672\"" >> /etc/sysconfig/matahari + echo "/usr/kerberos/bin/kinit -k -t /etc/libvirt/krb5.tab qpidd/`hostname`" >> /etc/sysconfig/matahari + + # restart libvirt and start libvirt-qpid + service libvirtd restart + service libvirt-qpid start + + # install matahari (XXX yum install it when it is availabe in the repos) + rpm -q matahari || rpm -ivh http://kojipkgs.fedoraproject.org/packages/matahari/0.0.4/4.fc11/x86_64/matahari-0.0.4-4.fc11.x86_64.rpm + + # and start it + sudo service matahari start + + # run ovirt awake to register us w/ the server + #bash checkout/node/scripts/ovirt-awake start 192.168.50.2 12120 /etc/libvirt/krb5.tab + + # FIXME on reboot we need to setenforce 0, ifup breth0, resetup resolv.conf (on both server/node), start libvirt-qpid / matahari +} + +restore_node_env(){ + test -f $OVIRT_APPLIANCE_BACKUP_DIR/resolv.conf && cp -f $OVIRT_APPLIANCE_BACKUP_DIR/resolv.conf /etc + test -f $OVIRT_APPLIANCE_BACKUP_DIR/krb5.conf && cp -f $OVIRT_APPLIANCE_BACKUP_DIR/krb5.conf /etc + test -f $OVIRT_APPLIANCE_BACKUP_DIR/libvirt/krb5.tab/ && cp -f $OVIRT_APPLIANCE_BACKUP_DIR/krb5.tab /etc + test -f $OVIRT_APPLIANCE_BACKUP_DIR/libvirt-qpid && cp -f $OVIRT_APPLIANCE_BACKUP_DIR/libvirt-qpid /etc/sysconfig + test -f $OVIRT_APPLIANCE_BACKUP_DIR/matahari && cp -f $OVIRT_APPLIANCE_BACKUP_DIR/matahari /etc/sysconfig +} -- 1.6.0.6 From doron at redhat.com Thu Sep 10 06:16:33 2009 From: doron at redhat.com (Doron Fediuck) Date: Thu, 10 Sep 2009 09:16:33 +0300 Subject: [Ovirt-devel] Re: persistent ssh_host_keys In-Reply-To: <20090909160106.3F235619B80@hormel.redhat.com> References: <20090909160106.3F235619B80@hormel.redhat.com> Message-ID: <200909100916.33590.doron@redhat.com> I believe you should support authorized_keys as well. On Wednesday 09 September 2009 19:01:06 ovirt-devel-request at redhat.com wrote: > Send Ovirt-devel mailing list submissions to > ovirt-devel at redhat.com > > To subscribe or unsubscribe via the World Wide Web, visit > https://www.redhat.com/mailman/listinfo/ovirt-devel > or, via email, send a message with subject or body 'help' to > ovirt-devel-request at redhat.com > > You can reach the person managing the list at > ovirt-devel-owner at redhat.com > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Ovirt-devel digest..." > > > Today's Topics: > > 1. Re: [PATCH node-image] Add ability to set persistent > ssh_host_keys on the node, usefull if you run diskless instance > of ovirt-node (Pierre-Gilles Mialon) > 2. [PATCH node-image] Working version of Add the ability to use > persistent ssh_host_keys on the ovirt-node (pmialon at linagora.com) > 3. Re: ovirt web interface (Jason Guiditta) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 8 Sep 2009 18:10:47 +0200 > From: "Pierre-Gilles Mialon" > Subject: Re: [Ovirt-devel] [PATCH node-image] Add ability to set > persistent ssh_host_keys on the node, usefull if you run diskless > instance of ovirt-node > To: ovirt-devel at redhat.com > Message-ID: <200909081810.47300.pmialon at linagora.com> > Content-Type: text/plain; charset="iso-8859-15" > > Sorry for that I didn't send the good patch. > > Please forget this mail and the precedent > > Sincerely, > > > Le mardi 8 septembre 2009 17:34:56 pmialon at linagora.com, vous avez ?crit : > > From: root > > > > --- > > ovirt-node-image.ks | 16 ++++++++++++++++ > > 1 files changed, 16 insertions(+), 0 deletions(-) > > > > diff --git a/ovirt-node-image.ks b/ovirt-node-image.ks > > index 802b6a5..d698497 100644 > > --- a/ovirt-node-image.ks > > +++ b/ovirt-node-image.ks > > @@ -55,6 +55,22 @@ if [ -f "ovirt-authorized_keys" ]; then > > chmod 644 $INSTALL_ROOT/root/.ssh/authorized_keys > > fi > > > > +if [ -f ovirt-ssh_host_dsa_key -f ovirt-ssh_host_dsa_key.pub \ > > + -f ovirt-ssh_host_key -f ovirt-ssh_host_key.pub \ > > + -f ovirt-ssh_host_rsa_key -f ovirt-ssh_host_rsa_key.pub ]; then > > + echo "Adding persistent ssh_keys for host to Image" > > + mkdir -p $INSTALL_ROOT/etc/ssh > > + cp -v ovirt-ssh_host_dsa_key $INSTALL_ROOT/etc/ssh/ssh_host_dsa_key > > + cp -v ovirt-ssh_host_key $INSTALL_ROOT/etc/ssh/ssh_host_key > > + cp -v ovirt-ssh_host_rsa_key $INSTALL_ROOT/etc/ssh/ssh_host_rsa_key > > + cp -v ovirt-ssh_host_key.pub $INSTALL_ROOT/etc/ssh/ssh_host_key.pub > > + cp -v ovirt-ssh_host_dsa_key.pub > > $INSTALL_ROOT/etc/ssh/ssh_host_dsa_key.pub + cp -v > > ovirt-ssh_host_rsa_key.pub $INSTALL_ROOT/etc/ssh/ssh_host_rsa_key.pub > > + chown root:root $INSTALL_ROOT/etc/ssh/*key* > > + chmod 600 $INSTALL_ROOT/etc/ssh/*key > > + chmod 644 $INSTALL_ROOT/etc/ssh/*key.pub > > +fi > > + > > echo "Fixing boot menu" > > # remove quiet from Node bootparams, added by livecd-creator > > sed -i -e 's/ quiet//' $LIVE_ROOT/isolinux/isolinux.cfg > > Pierre-Gilles Mialon > Responsable h?bergement :: Head of Hosting services > pmialon at linagora.com :: +33.1 58 18 65 46 > Linagora :: http://www.linagora.com > 27 rue de Berri :: 75008 PARIS > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: not available > Type: application/pgp-signature > Size: 198 bytes > Desc: This is a digitally signed message part. > Url : https://www.redhat.com/archives/ovirt-devel/attachments/20090908/11a7ddd1/attachment.bin > > ------------------------------ > > Message: 2 > Date: Tue, 8 Sep 2009 16:15:06 +0000 > From: pmialon at linagora.com > Subject: [Ovirt-devel] [PATCH node-image] Working version of Add the > ability to use persistent ssh_host_keys on the ovirt-node > To: ovirt-devel at redhat.com > Cc: root > Message-ID: <1252426506-25493-1-git-send-email-pmialon at linagora.com> > > From: root > > --- > ovirt-node-image.ks | 16 ++++++++++++++++ > 1 files changed, 16 insertions(+), 0 deletions(-) > > diff --git a/ovirt-node-image.ks b/ovirt-node-image.ks > index 802b6a5..9a7d617 100644 > --- a/ovirt-node-image.ks > +++ b/ovirt-node-image.ks > @@ -55,6 +55,22 @@ if [ -f "ovirt-authorized_keys" ]; then > chmod 644 $INSTALL_ROOT/root/.ssh/authorized_keys > fi > > +if [ -f ovirt-ssh_host_dsa_key -a -f ovirt-ssh_host_dsa_key.pub -a\ > + -f ovirt-ssh_host_key -a -f ovirt-ssh_host_key.pub -a \ > + -f ovirt-ssh_host_rsa_key -a -f ovirt-ssh_host_rsa_key.pub ]; then > + echo "Adding persistent ssh_keys for host to Image" > + mkdir -p $INSTALL_ROOT/etc/ssh > + cp -v ovirt-ssh_host_dsa_key $INSTALL_ROOT/etc/ssh/ssh_host_dsa_key > + cp -v ovirt-ssh_host_key $INSTALL_ROOT/etc/ssh/ssh_host_key > + cp -v ovirt-ssh_host_rsa_key $INSTALL_ROOT/etc/ssh/ssh_host_rsa_key > + cp -v ovirt-ssh_host_key.pub $INSTALL_ROOT/etc/ssh/ssh_host_key.pub > + cp -v ovirt-ssh_host_dsa_key.pub $INSTALL_ROOT/etc/ssh/ssh_host_dsa_key.pub > + cp -v ovirt-ssh_host_rsa_key.pub $INSTALL_ROOT/etc/ssh/ssh_host_rsa_key.pub > + chown root:root $INSTALL_ROOT/etc/ssh/*key* > + chmod 600 $INSTALL_ROOT/etc/ssh/*key > + chmod 644 $INSTALL_ROOT/etc/ssh/*key.pub > +fi > + > echo "Fixing boot menu" > # remove quiet from Node bootparams, added by livecd-creator > sed -i -e 's/ quiet//' $LIVE_ROOT/isolinux/isolinux.cfg > > Good morning, > > I build ovirt following instruction o ovirt.org but when I try to connect > > to the web interface the following error is reported: > > > > Redirect Loop > > > > I think the problem is first lines in ovirt-server.conf under > > /etc/httd/conf.d: > > > > NameVirtualHost 172.25.0.52:80 > > > > > > RewriteEngine on > > RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L] > > > > > > > > I tried to delete the above lines and it seems to work but with some > > errors (for example I cannot logout from the web interface). > > > > Please, could anyone help me ? > > Thanks > > Igna > > This sounds like the error that you get if you have only one network > rather than 2 (one for admin, one for guest). Someone (Mo I believe) > was looking into getting a one network setup working, but it is > currently not supported in oVirt. As for the not logging out - we use > http auth headers, so the only way to really log out is to install (for > firefox) something like the web developer toolbar, which allows you to > tell your browser to remove currently auth'ed session. This must be > used in conjunction with the logout button in the UI, which kills the > session on the server side. > > -j > > > > ------------------------------ > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel > > > End of Ovirt-devel Digest, Vol 20, Issue 8 > ****************************************** > From ignazio.cassano at provincia.torino.it Thu Sep 10 09:49:07 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Thu, 10 Sep 2009 11:49:07 +0200 Subject: [Ovirt-devel] f11 ovirt build fails Message-ID: <20090910114907.bctgq7v2jdw0c0c8@webmail.provincia.torino.it> Good morning, I read on ovirt.org to send information about installation procedure issues to this mailing list. I followed ovirt building instructions but "make build" reports the following error on fedora 11: Error creating Live CD : Unable to download from repo : Cannot retrieve repository metadata (repomd.xml) for repository: f11. Please verify its path and try again Could not retrieve mirrorlist http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-11&arch=x86_64 error was [Errno 4] IOError: make[2]: *** [ovirt-node-image-1.0.3-x86_64.iso] Error 1 make[2]: Leaving directory `/root/ovirt/node-image' make[1]: *** [publish] Error 1 Thanks From dpierce at redhat.com Thu Sep 10 13:14:02 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 10 Sep 2009 09:14:02 -0400 Subject: [Ovirt-devel] [PATCH node-image] Add ability to set persistent ssh_host_keys on the node, usefull if you run diskless instance of ovirt-node In-Reply-To: <1252424096-25113-1-git-send-email-pmialon@linagora.com> References: <1252424096-25113-1-git-send-email-pmialon@linagora.com> Message-ID: <20090910131402.GC3288@mcpierce-laptop.rdu.redhat.com> On Tue, Sep 08, 2009 at 03:34:56PM +0000, pmialon at linagora.com wrote: > From: root > > --- > ovirt-node-image.ks | 16 ++++++++++++++++ > 1 files changed, 16 insertions(+), 0 deletions(-) > > diff --git a/ovirt-node-image.ks b/ovirt-node-image.ks > index 802b6a5..d698497 100644 > --- a/ovirt-node-image.ks > +++ b/ovirt-node-image.ks > @@ -55,6 +55,22 @@ if [ -f "ovirt-authorized_keys" ]; then > chmod 644 $INSTALL_ROOT/root/.ssh/authorized_keys > fi > > +if [ -f ovirt-ssh_host_dsa_key -f ovirt-ssh_host_dsa_key.pub \ > + -f ovirt-ssh_host_key -f ovirt-ssh_host_key.pub \ > + -f ovirt-ssh_host_rsa_key -f ovirt-ssh_host_rsa_key.pub ]; then > + echo "Adding persistent ssh_keys for host to Image" > + mkdir -p $INSTALL_ROOT/etc/ssh > + cp -v ovirt-ssh_host_dsa_key $INSTALL_ROOT/etc/ssh/ssh_host_dsa_key > + cp -v ovirt-ssh_host_key $INSTALL_ROOT/etc/ssh/ssh_host_key > + cp -v ovirt-ssh_host_rsa_key $INSTALL_ROOT/etc/ssh/ssh_host_rsa_key > + cp -v ovirt-ssh_host_key.pub $INSTALL_ROOT/etc/ssh/ssh_host_key.pub > + cp -v ovirt-ssh_host_dsa_key.pub $INSTALL_ROOT/etc/ssh/ssh_host_dsa_key.pub > + cp -v ovirt-ssh_host_rsa_key.pub $INSTALL_ROOT/etc/ssh/ssh_host_rsa_key.pub > + chown root:root $INSTALL_ROOT/etc/ssh/*key* > + chmod 600 $INSTALL_ROOT/etc/ssh/*key > + chmod 644 $INSTALL_ROOT/etc/ssh/*key.pub > +fi > + > echo "Fixing boot menu" > # remove quiet from Node bootparams, added by livecd-creator > sed -i -e 's/ quiet//' $LIVE_ROOT/isolinux/isolinux.cfg > -- > 1.6.2.5 ACK. This works as expected. I copied the SSH keys for my laptop into my build environment, then built and installed a managed node. I was able to SSH into the node without a password prompt. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Virtual Machine Management - http://www.ovirt.org/ Is fearr Gaeilge bhriste n? B?arla cliste. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: From dpierce at redhat.com Thu Sep 10 13:25:54 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 10 Sep 2009 09:25:54 -0400 Subject: [Ovirt-devel] [PATCH node-image] Add ability to set persistent ssh_host_keys on the node, usefull if you run diskless instance of ovirt-node In-Reply-To: <20090910131402.GC3288@mcpierce-laptop.rdu.redhat.com> References: <1252424096-25113-1-git-send-email-pmialon@linagora.com> <20090910131402.GC3288@mcpierce-laptop.rdu.redhat.com> Message-ID: <20090910132554.GD3288@mcpierce-laptop.rdu.redhat.com> On Thu, Sep 10, 2009 at 09:14:02AM -0400, Darryl L. Pierce wrote: > ACK. This works as expected. > > I copied the SSH keys for my laptop into my build environment, then > built and installed a managed node. I was able to SSH into the node > without a password prompt. (I responded too early before) NAK, based on security review. While technically this works, from a security standpoint it is not a good idea to have all managed nodes use the same SSH keys, since it makes it far too easy to compromise an entire environment by hacking one machine. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Virtual Machine Management - http://www.ovirt.org/ Is fearr Gaeilge bhriste n? B?arla cliste. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: From pmyers at redhat.com Thu Sep 10 13:38:12 2009 From: pmyers at redhat.com (Perry Myers) Date: Thu, 10 Sep 2009 09:38:12 -0400 Subject: [Ovirt-devel] [PATCH node-image] Add ability to set persistent ssh_host_keys on the node, usefull if you run diskless instance of ovirt-node In-Reply-To: <20090910132554.GD3288@mcpierce-laptop.rdu.redhat.com> References: <1252424096-25113-1-git-send-email-pmialon@linagora.com> <20090910131402.GC3288@mcpierce-laptop.rdu.redhat.com> <20090910132554.GD3288@mcpierce-laptop.rdu.redhat.com> Message-ID: <4AA90144.7090805@redhat.com> On 09/10/2009 09:25 AM, Darryl L. Pierce wrote: > On Thu, Sep 10, 2009 at 09:14:02AM -0400, Darryl L. Pierce wrote: >> ACK. This works as expected. >> >> I copied the SSH keys for my laptop into my build environment, then >> built and installed a managed node. I was able to SSH into the node >> without a password prompt. > > (I responded too early before) > > NAK, based on security review. > > While technically this works, from a security standpoint it is not > a good idea to have all managed nodes use the same SSH keys, since it > makes it far too easy to compromise an entire environment by hacking one > machine. Also, if the issue is just annoyance at constantly changing host keys in a development environment, you can tell the ssh client to ignore host keys with the following syntax: ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null That will quash the error messages you would normally otherwise get from sshing to the same ip address (i.e. same Node) as it changes ssh host keys from one build to the next. Certainly this is not recommended in a production environment, but for development (where you do lots of builds and the node host keys change frequently) this is fine. Perry From ignazio.cassano at provincia.torino.it Fri Sep 11 16:06:36 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Fri, 11 Sep 2009 18:06:36 +0200 Subject: [Ovirt-devel] ovirt ace error Message-ID: <20090911180636.87h1g03oevj4gw8w@webmail.provincia.torino.it> Good morning, I have succesfully buil ovirt on fedora 11 but running ace -d l /tmp/ace.log install ovirt I got en error (I think it is krb5 issue). My server was not a kerberos server before installing ovirt, so I think ace procedure has installed it. Attacchede here there is the ace.log file. Could anyone help me ? Thanks & Regards Ignazio -------------- next part -------------- A non-text attachment was scrubbed... Name: ace.log Type: text/x-log Size: 190359 bytes Desc: not available URL: From ignazio.cassano at provincia.torino.it Fri Sep 11 16:14:21 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Fri, 11 Sep 2009 18:14:21 +0200 Subject: [Ovirt-devel] ovirt ace error In-Reply-To: <20090911180636.87h1g03oevj4gw8w@webmail.provincia.torino.it> References: <20090911180636.87h1g03oevj4gw8w@webmail.provincia.torino.it> Message-ID: <20090911181421.0w0idny67a8kwwk8@webmail.provincia.torino.it> Good morning, I'd like to add some information to my previous email. Reading ace.log I saw kinit fails. Escaping to shell, I tried to execute: kinit admin kinit: Looping detected inside krb5_get_in_tkt while getting initial credentials After entering password, the following error is displayed: ----- Messaggio da ignazio.cassano at provincia.torino.it --------- Data: Fri, 11 Sep 2009 18:06:36 +0200 Da: ignazio.cassano at provincia.torino.it Rispondi-A:ignazio.cassano at provincia.torino.it Oggetto: [Ovirt-devel] ovirt ace error A: ovirt-devel at redhat.com > Good morning, > I have succesfully buil ovirt on fedora 11 but running > ace -d l /tmp/ace.log install ovirt I got en error (I think it is > krb5 issue). > > My server was not a kerberos server before installing ovirt, so I think ace > procedure has installed it. > Attacchede here there is the ace.log file. > Could anyone help me ? > Thanks & Regards > Ignazio ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- From jboggs at redhat.com Fri Sep 11 16:15:52 2009 From: jboggs at redhat.com (Joey Boggs) Date: Fri, 11 Sep 2009 12:15:52 -0400 Subject: [Ovirt-devel] ovirt ace error In-Reply-To: <20090911180636.87h1g03oevj4gw8w@webmail.provincia.torino.it> References: <20090911180636.87h1g03oevj4gw8w@webmail.provincia.torino.it> Message-ID: <4AAA77B8.6020104@redhat.com> ignazio.cassano at provincia.torino.it wrote: > Good morning, > I have succesfully buil ovirt on fedora 11 but running > ace -d l /tmp/ace.log install ovirt I got en error (I think it is krb5 > issue). > > My server was not a kerberos server before installing ovirt, so I > think ace > procedure has installed it. > Attacchede here there is the ace.log file. > Could anyone help me ? > Thanks & Regards > Ignazio > Looks like the log is cut off after: Fri Sep 11 17:54:58 +0200 2009 //ovirt::setup/Service[ovirt-host-browser]/require (debug): requires Single_exec[db_migrate] Fri Sep 11 17:54:58 +0200 2009 /File[/etc/cobbler/modules.conf]/require (debug): requires Package[cobbler] Fri Sep 11 17:54:58 +0200 2009 /File[/etc/cobbler/modules.conf]/notify (debug): subscribes to Service[cobblerd] Fri Sep 11 17:54:58 +0200 2009 //ovirt::setup/Single_exec[set_ldap_dn]/requi= Can you send the remainder? From ignazio.cassano at provincia.torino.it Fri Sep 11 16:32:39 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Fri, 11 Sep 2009 18:32:39 +0200 Subject: [Ovirt-devel] ovirt ace error In-Reply-To: <4AAA77B8.6020104@redhat.com> References: <20090911180636.87h1g03oevj4gw8w@webmail.provincia.torino.it> <4AAA77B8.6020104@redhat.com> Message-ID: <20090911183239.e8dcwc5aojs408cs@webmail.provincia.torino.it> I am sorry. Attacched here there is the gzipped lo. ----- Messaggio da jboggs at redhat.com --------- Data: Fri, 11 Sep 2009 12:15:52 -0400 Da: Joey Boggs Rispondi-A:Joey Boggs Oggetto: Re: [Ovirt-devel] ovirt ace error A: ignazio.cassano at provincia.torino.it Cc: ovirt-devel at redhat.com > ignazio.cassano at provincia.torino.it wrote: >> Good morning, >> I have succesfully buil ovirt on fedora 11 but running >> ace -d l /tmp/ace.log install ovirt I got en error (I think it is >> krb5 issue). >> >> My server was not a kerberos server before installing ovirt, so I think ace >> procedure has installed it. >> Attacchede here there is the ace.log file. >> Could anyone help me ? >> Thanks & Regards >> Ignazio >> > Looks like the log is cut off after: > > Fri Sep 11 17:54:58 +0200 2009 > //ovirt::setup/Service[ovirt-host-browser]/require (debug): requires > Single_exec[db_migrate] > Fri Sep 11 17:54:58 +0200 2009 /File[/etc/cobbler/modules.conf]/require > (debug): requires Package[cobbler] > Fri Sep 11 17:54:58 +0200 2009 /File[/etc/cobbler/modules.conf]/notify > (debug): subscribes to Service[cobblerd] > Fri Sep 11 17:54:58 +0200 2009 //ovirt::setup/Single_exec[set_ldap_dn]/requi= > > > Can you send the remainder? ----- Fine del messaggio da jboggs at redhat.com ----- -------------- next part -------------- A non-text attachment was scrubbed... Name: ace.log.gz Type: application/x-gzip Size: 14345 bytes Desc: not available URL: From jguiditt at redhat.com Fri Sep 11 17:39:50 2009 From: jguiditt at redhat.com (Jason Guiditta) Date: Fri, 11 Sep 2009 13:39:50 -0400 Subject: [Ovirt-devel] [PATCH server] fix live migration In-Reply-To: <1252415872-24215-1-git-send-email-mloiseleur@linagora.com> References: <1252415872-24215-1-git-send-email-mloiseleur@linagora.com> Message-ID: <1252690790.3201.0.camel@lenovo> On Tue, 2009-09-08 at 13:17 +0000, mloiseleur at linagora.com wrote: > From: root > > --- > src/app/views/host/_grid.rhtml | 2 +- > src/app/views/vm/migrate.rhtml | 1 + > 2 files changed, 2 insertions(+), 1 deletions(-) > ACK and pushed, not sure how that ever worked from looking at it. From jboggs at redhat.com Fri Sep 11 18:17:14 2009 From: jboggs at redhat.com (Joey Boggs) Date: Fri, 11 Sep 2009 14:17:14 -0400 Subject: [Ovirt-devel] ovirt ace error In-Reply-To: <20090911181421.0w0idny67a8kwwk8@webmail.provincia.torino.it> References: <20090911180636.87h1g03oevj4gw8w@webmail.provincia.torino.it> <20090911181421.0w0idny67a8kwwk8@webmail.provincia.torino.it> Message-ID: <4AAA942A.6080709@redhat.com> ignazio.cassano at provincia.torino.it wrote: > Good morning, > I'd like to add some information to my previous email. > Reading ace.log I saw kinit fails. > Escaping to shell, I tried to execute: > kinit admin > kinit: Looping detected inside krb5_get_in_tkt while getting initial > credentials > > > After entering password, the following error is displayed: > > > > > ----- Messaggio da ignazio.cassano at provincia.torino.it --------- > Data: Fri, 11 Sep 2009 18:06:36 +0200 > Da: ignazio.cassano at provincia.torino.it > Rispondi-A:ignazio.cassano at provincia.torino.it > Oggetto: [Ovirt-devel] ovirt ace error > A: ovirt-devel at redhat.com > > >> Good morning, >> I have succesfully buil ovirt on fedora 11 but running >> ace -d l /tmp/ace.log install ovirt I got en error (I think it is >> krb5 issue). >> >> My server was not a kerberos server before installing ovirt, so I >> think ace >> procedure has installed it. >> Attacchede here there is the ace.log file. >> Could anyone help me ? >> Thanks & Regards >> Ignazio > > > ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- > > > > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel Hmm, looks like the error message from this email, the install log looks good other than the kinit failing so 101/108 items were completed, can you send the error message from kinit admin again? From dpierce at redhat.com Fri Sep 11 18:41:25 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 11 Sep 2009 14:41:25 -0400 Subject: [Ovirt-devel] Text-based node administration tool Message-ID: <1252694486-11597-1-git-send-email-dpierce@redhat.com> This patch obsoletes any previous ones. This is an upstream candidate, so I'm looking for feedback so we can push this and start using it. From dpierce at redhat.com Fri Sep 11 18:41:26 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 11 Sep 2009 14:41:26 -0400 Subject: [Ovirt-devel] [PATCH node] Introduces the node-admin toolset. In-Reply-To: <1252694486-11597-1-git-send-email-dpierce@redhat.com> References: <1252694486-11597-1-git-send-email-dpierce@redhat.com> Message-ID: <1252694486-11597-2-git-send-email-dpierce@redhat.com> Defines a primary entry point that displays a menu of options that user can use to administer the managed node. It leverages the code from virtinst-python to do the heavy lifting and just provides a front end for collecting user data. Created a new configuration class to be used for all configuration screens. The user can select to create a node. They are then walked through the steps to create a domain similar to virt-manager. The user can create a defined domain. The user can destroy a created domain. The user can undefine a defined domain. The user can list all domains on the system. The user can create a new user account. When the RPM is created, a separate entry point is created for each node admin command. This allows the commands to be invoked individually as well as from the main menu. Signed-off-by: Darryl L. Pierce --- .gitignore | 1 + Makefile.am | 15 ++ configure.ac | 1 + nodeadmin/__init__.py | 20 ++ nodeadmin/configscreen.py | 150 ++++++++++++++ nodeadmin/createdomain.py | 68 +++++++ nodeadmin/createuser.py | 106 ++++++++++ nodeadmin/definedomain.py | 470 +++++++++++++++++++++++++++++++++++++++++++ nodeadmin/destroydomain.py | 66 ++++++ nodeadmin/domainconfig.py | 217 ++++++++++++++++++++ nodeadmin/halworker.py | 37 ++++ nodeadmin/libvirtworker.py | 271 +++++++++++++++++++++++++ nodeadmin/listdomains.py | 68 +++++++ nodeadmin/mainmenu.py | 71 +++++++ nodeadmin/nodeadmin.py | 29 +++ nodeadmin/setup.py.in | 34 +++ nodeadmin/undefinedomain.py | 83 ++++++++ nodeadmin/userworker.py | 38 ++++ ovirt-node.spec.in | 37 ++++ 19 files changed, 1782 insertions(+), 0 deletions(-) create mode 100644 nodeadmin/__init__.py create mode 100644 nodeadmin/configscreen.py create mode 100755 nodeadmin/createdomain.py create mode 100755 nodeadmin/createuser.py create mode 100755 nodeadmin/definedomain.py create mode 100755 nodeadmin/destroydomain.py create mode 100644 nodeadmin/domainconfig.py create mode 100644 nodeadmin/halworker.py create mode 100644 nodeadmin/libvirtworker.py create mode 100755 nodeadmin/listdomains.py create mode 100755 nodeadmin/mainmenu.py create mode 100755 nodeadmin/nodeadmin.py create mode 100644 nodeadmin/setup.py.in create mode 100755 nodeadmin/undefinedomain.py create mode 100644 nodeadmin/userworker.py diff --git a/.gitignore b/.gitignore index 26a0210..19b15d1 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ missing stamp-h1 ovirt-node*.gz ovirt-node.spec +*.pyc diff --git a/Makefile.am b/Makefile.am index 419cdf1..5192d9d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,6 +26,21 @@ EXTRA_DIST = \ ovirt-node-selinux.fc \ images/grub-splash.xpm.gz \ images/syslinux-vesa-splash.jpg \ + nodeadmin/__init__.py \ + nodeadmin/configscreen.py \ + nodeadmin/createuser.py \ + nodeadmin/destroydomain.py \ + nodeadmin/halworker.py \ + nodeadmin/libvirtworker.py \ + nodeadmin/userworker.py \ + nodeadmin/mainmenu.py \ + nodeadmin/undefinedomain.py \ + nodeadmin/createdomain.py \ + nodeadmin/definedomain.py \ + nodeadmin/domainconfig.py \ + nodeadmin/listdomains.py \ + nodeadmin/nodeadmin.py \ + nodeadmin/setup.py \ scripts/collectd.conf.in \ scripts/ovirt \ scripts/ovirt-awake \ diff --git a/configure.ac b/configure.ac index b60afeb..780b757 100644 --- a/configure.ac +++ b/configure.ac @@ -8,6 +8,7 @@ test x"$ac_ct_CC:$CFLAGS" = 'xgcc:-g -O2' \ && CFLAGS="$CFLAGS -Wshadow -Wall -Werror" AC_CONFIG_FILES([Makefile + nodeadmin/setup.py gptsync/Makefile ovirt-node.spec ]) diff --git a/nodeadmin/__init__.py b/nodeadmin/__init__.py new file mode 100644 index 0000000..1f3c72c --- /dev/null +++ b/nodeadmin/__init__.py @@ -0,0 +1,20 @@ +# __init__.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from nodeadmin import NodeAdmin + diff --git a/nodeadmin/configscreen.py b/nodeadmin/configscreen.py new file mode 100644 index 0000000..0282eee --- /dev/null +++ b/nodeadmin/configscreen.py @@ -0,0 +1,150 @@ +# configscreen.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from halworker import HALWorker +from libvirtworker import LibvirtWorker +import traceback + +BACK_BUTTON = "back" +NEXT_BUTTON = "next" +CANCEL_BUTTON = "cancel" +FINISH_BUTTON = "finish" + +class ConfigScreen: + '''Enables the creation of navigable, multi-paged configuration screens.''' + + def __init__(self, title): + self.__title = title + self.__current_page = 1 + self.__finished = False + self.__hal = HALWorker() + self.__libvirt = LibvirtWorker() + + def get_hal(self): + return self.__hal + + def get_libvirt(self): + return self.__libvirt + + def set_finished(self): + self.__finished = True + + def get_elements_for_page(self, screen, page): + return [] + + def page_has_next(self, page): + return False + + def page_has_finish(self, page): + return False + + def get_back_page(self, page): + if page > 1: return page - 1 + return page + + def go_back(self): + self.__current_page = self.get_back_page(self.__current_page) + + def get_next_page(self, page): + return page + 1 + + def go_next(self): + self.__current_page = self.get_next_page(self.__current_page) + + def validate_input(self, page, errors): + return True + + def process_input(self, page): + return + + def start(self): + active = True + while active and (self.__finished == False): + screen = SnackScreen() + gridform = GridForm(screen, self.__title, 1, 4) + elements = self.get_elements_for_page(screen, self.__current_page) + current_element = 0 + for element in elements: + gridform.add(element, 0, current_element) + current_element += 1 + # create the navigation buttons + buttons = [] + if self.__current_page > 1: buttons.append(["Back", BACK_BUTTON, "F11"]) + if self.page_has_next(self.__current_page): buttons.append(["Next", NEXT_BUTTON, "F12"]) + if self.page_has_finish(self.__current_page): buttons.append(["Finish", FINISH_BUTTON, "F10"]) + buttons.append(["Cancel", CANCEL_BUTTON, "ESC"]) + buttonbar = ButtonBar(screen, buttons) + gridform.add(buttonbar, 0, current_element, growx = 1) + current_element += 1 + try: + result = gridform.runOnce() + pressed = buttonbar.buttonPressed(result) + if pressed == BACK_BUTTON: + self.go_back() + elif pressed == NEXT_BUTTON or pressed == FINISH_BUTTON: + errors = [] + if self.validate_input(self.__current_page, errors): + self.process_input(self.__current_page) + self.go_next() + else: + error_text = "" + for error in errors: + error_text += "%s\n" % error + ButtonChoiceWindow(screen, + "There Were Errors", + error_text, + buttons = ["OK"]) + elif pressed == CANCEL_BUTTON: + active = False + except Exception, error: + ButtonChoiceWindow(screen, + "An Exception Has Occurred", + str(error) + "\n" + traceback.format_exc(), + buttons = ["OK"]) + screen.popWindow() + screen.finish() + +class DomainListConfigScreen(ConfigScreen): + '''Provides a base class for all config screens that require a domain list.''' + + def __init__(self, title): + ConfigScreen.__init__(self, title) + + def get_domain_list_page(self, screen, defined=True, created=True): + domains = self.get_libvirt().list_domains(defined, created) + result = None + + if len(domains) > 0: + self.__has_domains = True + self.__domain_list = Listbox(0) + for name in self.get_libvirt().list_domains(defined, created): + self.__domain_list.append(name, name) + result = [self.__domain_list] + else: + self.__has_domains = False + grid = Grid(1, 1) + grid.setField(Label("There are no domains available."), 0, 0) + result = [grid] + return result + + def get_selected_domain(self): + return self.__domain_list.current() + + def has_selectable_domains(self): + return self.__has_domains diff --git a/nodeadmin/createdomain.py b/nodeadmin/createdomain.py new file mode 100755 index 0000000..b73a09e --- /dev/null +++ b/nodeadmin/createdomain.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# +# createdomain.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from configscreen import * + +class CreateDomainConfigScreen(DomainListConfigScreen): + LIST_PAGE = 1 + CREATE_PAGE = 2 + + def __init__(self): + DomainListConfigScreen.__init__(self, "Create A Domain") + + def get_elements_for_page(self, screen, page): + if page is self.LIST_PAGE: + return self.get_domain_list_page(screen, created = False) + elif page is self.CREATE_PAGE: + return self.get_create_domain_page(screen) + + def page_has_next(self, page): + if page is self.LIST_PAGE: return self.has_selectable_domains() + return False + + def page_has_back(self, page): + if page is self.CREATE_PAGE: return True + return False + + def validate_input(self, page, errors): + if page is self.LIST_PAGE: + if self.get_selected_domain() is not None: + domain = self.get_selected_domain() + try: + self.get_libvirt().create_domain(domain) + return True + except Exception, error: + errors.append("There was an error creating the domain: %s" % domain) + errors.append(str(error)) + else: + errors.append("You must first select a domain to create.") + + def process_input(self, page): + print "foo" + + def get_create_domain_page(self, screen): + grid = Grid(1, 1) + grid.setField(Label("%s was successfully created." % self.get_selected_domain()), 0, 0) + return [grid] + +def CreateDomain(): + screen = CreateDomainConfigScreen() + screen.start() diff --git a/nodeadmin/createuser.py b/nodeadmin/createuser.py new file mode 100755 index 0000000..dbc4626 --- /dev/null +++ b/nodeadmin/createuser.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python +# +# createuser.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from configscreen import ConfigScreen +from userworker import UserWorker + +import libuser + +DETAILS_PAGE = 1 +CONFIRM_PAGE = 2 + +class CreateUserConfigScreen(ConfigScreen): + def __init__(self): + ConfigScreen.__init__(self, "Create A User Account") + self.__username = None + self.__useradmin = libuser.admin() + self.__user_worker = UserWorker() + + def get_elements_for_page(self, screen, page): + if page is DETAILS_PAGE: return self.get_details_page(screen) + elif page is CONFIRM_PAGE: return self.get_confirm_page(screen) + + def validate_input(self, page, errors): + if page is DETAILS_PAGE: + if len(self.__username.value()) > 0: + name = self.__username.value() + if self.__useradmin.lookupUserByName(name) is None: + if len(self.__password.value()) > 0: + if self.__password.value() == self.__confirm.value(): + return True + else: + errors.append("Passwords do not match.") + else: + errors.append("You must enter a password.") + else: + errors.append("User %s already exists." % name) + else: + errors.append("You must enter a username.") + self.__confirm.value() + return False + + def process_input(self, page): + if page is CONFIRM_PAGE: + self.__user_worker.create_user(self.__username.value(), + self.__password.value(), + "wheel" if self.__adminuser.value() else None) + self.set_finished() + + def page_has_next(self, page): + return (page is DETAILS_PAGE) + + def page_has_back(self, page): + return (page is CONFIRM_PAGE) + + def page_has_finish(self, page): + return (page is CONFIRM_PAGE) + + def get_details_page(self, screen): + if self.__username is None: + self.__username = Entry(50, "") + self.__password = Entry(50, "", password = 1) + self.__confirm = Entry(50, "", password = 1) + self.__adminuser = Checkbox("This user is an administrator", False) + grid = Grid(2, 4) + grid.setField(Label("Username:"), 0, 0, anchorRight = 1) + grid.setField(self.__username, 1, 0, anchorLeft = 1) + grid.setField(Label("Password:"), 0, 1, anchorRight = 1) + grid.setField(self.__password, 1, 1, anchorLeft = 1) + grid.setField(Label("Confirm password:"), 0, 2, anchorRight = 1) + grid.setField(self.__confirm, 1, 2, anchorLeft = 1) + grid.setField(Label(" "), 0, 3) + grid.setField(self.__adminuser, 1, 3, anchorLeft = 1) + return [Label("Enter The User Details"), + grid] + + def get_confirm_page(self, screen): + grid = Grid(1, 2) + grid.setField(Label("Username: %s" % self.__username.value()), 0, 0) + admin_label = "is not" + if self.__adminuser.value(): + admin_label = "is" + grid.setField(Label("This user %s an administrator." % admin_label), 0, 1) + return [Label("Create this user account?"), + grid] + +def CreateUser(): + screen = CreateUserConfigScreen() + screen.start() diff --git a/nodeadmin/definedomain.py b/nodeadmin/definedomain.py new file mode 100755 index 0000000..ea4c986 --- /dev/null +++ b/nodeadmin/definedomain.py @@ -0,0 +1,470 @@ +#!/usr/bin/env python +# +# definedomain.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +import os +from domainconfig import DomainConfig +from configscreen import ConfigScreen +import urlgrabber.progress as progress + +from virtinst import * + +VM_DETAILS_PAGE = 1 +LOCAL_INSTALL_PAGE = 2 +SELECT_CDROM_PAGE = 3 +SELECT_ISO_PAGE = 4 +NETWORK_INSTALL_PAGE = 10 +OS_TYPE_PAGE = 11 +OS_VARIANT_PAGE = 12 +RAM_CPU_PAGE = 13 +ENABLE_STORAGE_PAGE = 14 +LOCAL_STORAGE_PAGE = 15 +MANAGED_STORAGE_PAGE = 16 +BRIDGE_PAGE = 17 +VIRT_DETAILS_PAGE = 18 +CONFIRM_PAGE = 19 + +LOCATION="location" +KICKSTART="kickstart" +KERNELOPTS="kernel.options" +OS_TYPE="os.type" +OS_VARIANT="os.variant" +MEMORY="memory" +CPUS="cpus" + +class DummyMeter(progress.BaseMeter): + + def _do_start(self, now = None): + print "Starting..." + + def _do_end(self, amount_read, now = None): + print "Ending: read=%d" % amount_read + + def _do_update(self, amount_read, now = None): + print "Update: read=%d" % amount_read + +class DomainConfigScreen(ConfigScreen): + + def __init__(self): + ConfigScreen.__init__(self, "Create A New Virtual Machine") + self.__config = DomainConfig() + self.__config.set_architecture(self.get_libvirt().get_default_architecture()) + self.__config.set_virt_type(self.get_libvirt().get_default_virt_type()) + + def get_elements_for_page(self, screen, page): + if page == VM_DETAILS_PAGE: return self.get_vm_details_page(screen) + elif page == LOCAL_INSTALL_PAGE: return self.get_local_install_page(screen) + elif page == SELECT_CDROM_PAGE: return self.get_select_cdrom_page(screen) + elif page == SELECT_ISO_PAGE: return self.get_select_iso_page(screen) + elif page == NETWORK_INSTALL_PAGE: return self.get_network_install_page(screen) + elif page == OS_TYPE_PAGE: return self.get_os_type_page(screen) + elif page == OS_VARIANT_PAGE: return self.get_os_variant_page(screen) + elif page == RAM_CPU_PAGE: return self.get_ram_and_cpu_page(screen) + elif page == ENABLE_STORAGE_PAGE: return self.get_enable_storage_page(screen) + elif page == LOCAL_STORAGE_PAGE: return self.get_local_storage_page(screen) + elif page == MANAGED_STORAGE_PAGE: return self.get_managed_storage_page(screen) + elif page == BRIDGE_PAGE: return self.get_bridge_page(screen) + elif page == VIRT_DETAILS_PAGE: return self.get_virt_details_page(screen) + elif page == CONFIRM_PAGE: return self.get_confirm_page(screen) + return [] + + def validate_input(self, page, errors): + if page == VM_DETAILS_PAGE: + if len(self.__guest_name.value()) > 0: + if self.get_libvirt().domain_exists(self.__guest_name.value()): + errors.append("Guest name '%s' is already in use." % self.__guest_name.value()) + else: + return True + else: + errors.append("Guest name must be a string between 0 and 50 characters.") + elif page == LOCAL_INSTALL_PAGE: + if self.__install_source.getSelection() == DomainConfig.INSTALL_SOURCE_CDROM: + return True + elif self.__install_source.getSelection() == DomainConfig.INSTALL_SOURCE_ISO: + return True + elif page == SELECT_CDROM_PAGE: + if self.__install_media.getSelection() != None: + if len(self.get_hal().list_installable_volumes()) == 0: + errors.append("No installable media is available.") + else: + return True + else: + errors.append("You must select an install media.") + elif page == SELECT_ISO_PAGE: + if len(self.__iso_path.value()) > 0: + if os.path.exists(self.__iso_path.value()): + if os.path.isfile(self.__iso_path.value()): + return True + else: + errors.append("%s is not a file." % self.__iso_path.value()) + else: + errors.append("No such install media exists:") + errors.append(self.__iso_path.value()) + else: + errors.append("An install media selection is required.") + elif page == NETWORK_INSTALL_PAGE: + if len(self.__install_url.value()) > 0: + return True + else: + errors.append("An install tree is required.") + elif page == OS_TYPE_PAGE: return True + elif page == OS_VARIANT_PAGE: return True + elif page == RAM_CPU_PAGE: + if (len(self.__memory.value()) > 0 and len(self.__cpus.value()) > 0) \ + and (int(self.__memory.value()) > 0 and int(self.__cpus.value()) > 0): + return True + else: + if len(self.__memory.value()) == 0: + errors.append("A value must be entered for memory.") + elif int(self.__memory.value()) <= 0: + errors.append("A positive integer value must be entered for memory.") + if len(self.__cpus.value()) == 0: + errors.append("A value must be entered for CPUs.") + elif int(self.__cpus.value()) <= 0: + errors.append("A positive integer value must be entered for memory.") + elif page == ENABLE_STORAGE_PAGE: return True + elif page == LOCAL_STORAGE_PAGE: + if len(self.__storage_size.value()) > 0: + if float(self.__storage_size.value()) > 0: + return True + else: + errors.append("A positive value must be entered for the storage size.") + else: + errors.append("A value must be entered for the storage size.") + elif page == MANAGED_STORAGE_PAGE: + if self.__existing_storage.getSelection() is not None: + return True + else: + errors.append("Please select a storage volume.") + elif page == BRIDGE_PAGE: + if self.__network_bridges.getSelection() != None: + if len(self.__mac_address.value()) > 0: + # TODO: regex check the format + return True + else: + errors.append("MAC address must be supplied.") + else: + errors.append("A network bridge must be selected.") + elif page == VIRT_DETAILS_PAGE: + if self.__virt_types.getSelection() != None and self.__architectures.getSelection() != None: + return True + if self.__virt_types.getSelection() is None: + errors.append("Please select a virtualization type.") + if self.__architectures.getSelection() is None: + errors.append("Please selection an architecture.") + elif page == CONFIRM_PAGE: return True + return False + + def process_input(self, page): + if page == VM_DETAILS_PAGE: + self.__config.set_guest_name(self.__guest_name.value()) + self.__config.set_install_type(self.__install_type.getSelection()) + elif page == LOCAL_INSTALL_PAGE: + self.__config.set_use_cdrom_source(self.__install_source.getSelection() == DomainConfig.INSTALL_SOURCE_CDROM) + elif page == SELECT_CDROM_PAGE: + self.__config.set_install_media(self.__install_media.getSelection()) + elif page == SELECT_ISO_PAGE: + self.__config.set_iso_path(self.__iso_path.value()) + elif page == NETWORK_INSTALL_PAGE: + self.__config.set_install_url(self.__install_url.value()) + self.__config.set_kickstart_url(self.__kickstart_url.value()) + self.__config.set_kernel_options(self.__kernel_options.value()) + elif page == OS_TYPE_PAGE: + self.__config.set_os_type(self.__os_types.getSelection()) + elif page == OS_VARIANT_PAGE: + self.__config.set_os_variant(self.__os_variants.getSelection()) + elif page == RAM_CPU_PAGE: + self.__config.set_memory(int(self.__memory.value())) + self.__config.set_cpus(int(self.__cpus.value())) + elif page == ENABLE_STORAGE_PAGE: + self.__config.set_enable_storage(self.__enable_storage.value()) + if self.__storage_type.getSelection() == DomainConfig.NEW_STORAGE: + self.__config.set_use_local_storage(True) + elif self.__storage_type.getSelection() == Node.STORAGE_TYPE_EXISTING: + self.__config.set_use_local_storage(False) + elif page == LOCAL_STORAGE_PAGE: + self.__config.set_storage_size(float(self.__storage_size.value())) + self.__config.set_allocate_storage(self.__allocate_storage.value()) + elif page == MANAGED_STORAGE_PAGE: + self.__config.set_use_local_storage(False) + self.__config.set_existing_storage(self.__existing_storage.getSelection()) + self.__config.set_storage_size(self.get_libvirt().get_storage_size(self.__existing_storage.getSelection())) + elif page == BRIDGE_PAGE: + self.__config.set_network_bridge(self.__network_bridges.getSelection()) + elif page == VIRT_DETAILS_PAGE: + self.__config.set_virt_type(self.__virt_types.getSelection()) + self.__config.set_architecture(self.__architectures.getSelection()) + elif page == CONFIRM_PAGE: + self.get_libvirt().define_domain(self.__config, DummyMeter()) + self.set_finished() + + def get_back_page(self, page): + result = page + if page == OS_TYPE_PAGE: + install_type = self.__config.get_install_type() + if install_type == DomainConfig.LOCAL_INSTALL: + if self.__config.get_use_cdrom_source(): + result = SELECT_CDROM_PAGE + else: + result = SELECT_ISO_PAGE + elif install_type == DomainConfig.NETWORK_INSTALL: + result = NETWORK_INSTALL_PAGE + elif install_type == DomainConfig.PXE_INSTALL: + result = VM_DETAILS_PAGE + elif page == LOCAL_STORAGE_PAGE or page == MANAGED_STORAGE_PAGE: + result = ENABLE_STORAGE_PAGE + elif page == NETWORK_INSTALL_PAGE: + result = VM_DETAILS_PAGE + elif page == SELECT_CDROM_PAGE or page == SELECT_ISO_PAGE: + result = LOCAL_INSTALL_PAGE + elif page == BRIDGE_PAGE: + if self.__config.get_use_local_storage(): + result = LOCAL_STORAGE_PAGE + else: + result = MANAGED_STORAGE_PAGE + else: + if page > 1: result = page - 1 + return result + + def get_next_page(self, page): + result = page + if page == VM_DETAILS_PAGE: + install_type = self.__config.get_install_type() + if install_type == DomainConfig.LOCAL_INSTALL: + result = LOCAL_INSTALL_PAGE + elif install_type == DomainConfig.NETWORK_INSTALL: + result = NETWORK_INSTALL_PAGE + elif install_type == DomainConfig.PXE_INSTALL: + result = OS_TYPE_PAGE + elif page == LOCAL_INSTALL_PAGE: + if self.__config.get_use_cdrom_source(): + result = SELECT_CDROM_PAGE + else: + result = SELECT_ISO_PAGE + elif page == SELECT_CDROM_PAGE or page == SELECT_ISO_PAGE: + result = OS_TYPE_PAGE + elif page == NETWORK_INSTALL_PAGE: + result = OS_TYPE_PAGE + elif page == ENABLE_STORAGE_PAGE: + result = BRIDGE_PAGE + if self.__config.get_enable_storage(): + if self.__config.get_use_local_storage(): + result = LOCAL_STORAGE_PAGE + else: + result = MANAGED_STORAGE_PAGE + elif page == LOCAL_STORAGE_PAGE or page == MANAGED_STORAGE_PAGE: + result = BRIDGE_PAGE + else: + result = page + 1 + return result + + def page_has_finish(self, page): + if page == CONFIRM_PAGE: return True + return False + + def page_has_next(self, page): + if page < CONFIRM_PAGE: + return True + + def get_vm_details_page(self, screen): + self.__guest_name = Entry(50, self.__config.get_guest_name()) + self.__install_type = RadioBar(screen, (("Local install media (ISO image or CDROM)", + DomainConfig.LOCAL_INSTALL, + self.__config.is_install_type(DomainConfig.LOCAL_INSTALL)), + ("Network Install (HTTP, FTP, or NFS)", + DomainConfig.NETWORK_INSTALL, + self.__config.is_install_type(DomainConfig.NETWORK_INSTALL)), + ("Network Boot (PXE)", + DomainConfig.PXE_INSTALL, + self.__config.is_install_type(DomainConfig.PXE_INSTALL)))) + grid = Grid(2,3) + grid.setField(Label("Name:"), 0, 0, anchorRight = 1) + grid.setField(self.__guest_name, 1, 0, anchorLeft = 1) + grid.setField(Label("Choose how you would like to install the operating system"), 1, 1, + anchorLeft = 1, anchorTop = 1) + grid.setField(self.__install_type, 1, 2, anchorLeft = 1) + return [Label("Enter your machine details"), + grid] + + def get_local_install_page(self, screen): + self.__install_source = RadioBar(screen, (("Use CDROM or DVD", + DomainConfig.INSTALL_SOURCE_CDROM, + self.__config.get_use_cdrom_source()), + ("Use ISO image", + DomainConfig.INSTALL_SOURCE_ISO, + self.__config.get_use_cdrom_source() is False))) + grid = Grid(1,1) + grid.setField(self.__install_source, 0, 0, anchorLeft = 1) + return [Label("Locate your install media"), + grid] + + def get_select_cdrom_page(self, screen): + drives = [] + media = self.get_hal().list_installable_volumes() + for drive in media.keys(): + drives.append([media[drive], drive, self.__config.is_install_media(drive)]) + self.__install_media = RadioBar(screen, (drives)) + grid = Grid(1, 1) + grid.setField(self.__install_media, 0, 0) + return [Label("Select the install media"), + grid] + + def get_select_iso_page(self, screen): + self.__iso_path = Entry(50, self.__config.get_iso_path()) + grid = Grid(1, 2) + grid.setField(Label("Enter ISO path:"), 0, 0, anchorLeft = 1) + grid.setField(self.__iso_path, 0, 1, anchorLeft = 1) + return [Label("Enter the full path to an install ISO"), + grid] + + def get_network_install_page(self, screen): + self.__install_url = Entry(50, self.__config.get_install_url()) + self.__kickstart_url = Entry(50, self.__config.get_kickstart_url()) + self.__kernel_options = Entry(50, self.__config.get_kernel_options()) + grid = Grid(2,3) + grid.setField(Label("URL:"), 0, 0, anchorRight = 1) + grid.setField(self.__install_url, 1, 0, anchorLeft = 1) + grid.setField(Label("Kickstart URL:"), 0, 1, anchorRight = 1) + grid.setField(self.__kickstart_url, 1, 1, anchorLeft = 1) + grid.setField(Label("Kernel Options:"), 0, 2, anchorRight = 1) + grid.setField(self.__kernel_options, 1, 2, anchorLeft = 1) + return [Label("Provide the operating system URL"), + grid] + + def get_os_type_page(self, screen): + types = [] + for type in Guest.list_os_types(): + types.append([Guest.get_os_type_label(type), type, self.__config.is_os_type(type)]) + self.__os_types = RadioBar(screen, types) + grid = Grid(1, 1) + grid.setField(self.__os_types, 0, 0, anchorLeft = 1) + return [Label("Choose the operating system type"), + grid] + + def get_os_variant_page(self, screen): + variants = [] + type = self.__config.get_os_type() + for variant in Guest.list_os_variants(type): + variants.append([Guest.get_os_variant_label(type, variant), variant, self.__config.is_os_variant(variant)]) + self.__os_variants = RadioBar(screen, variants) + grid = Grid(1, 1) + grid.setField(self.__os_variants, 0, 0, anchorLeft = 1) + return [Label("Choose the operating system version"), + grid] + + def get_ram_and_cpu_page(self, screen): + self.__memory = Entry(10, str(self.__config.get_memory())) + self.__cpus = Entry(10, str(self.__config.get_cpus())) + grid = Grid(2,2) + grid.setField(Label("Memory (RAM):"), 0, 0, anchorRight = 1) + grid.setField(self.__memory, 1, 0, anchorLeft = 1) + grid.setField(Label("CPUs:"), 0, 1, anchorRight = 1) + grid.setField(self.__cpus, 1, 1, anchorLeft = 1) + return [Label("Choose memory and CPU settings"), + grid] + + def get_enable_storage_page(self, screen): + self.__enable_storage = Checkbox("Enable storage for this virtual machine", self.__config.get_enable_storage()) + self.__storage_type = RadioBar(screen,((["Create a disk image on the computer's hard disk", + DomainConfig.NEW_STORAGE, + self.__config.get_use_local_storage()]), + (["Select managed or other existing storage", + DomainConfig.EXISTING_STORAGE, + self.__config.get_use_local_storage() is False]))) + grid = Grid(1,2) + grid.setField(self.__enable_storage, 0, 0, anchorLeft = 1) + grid.setField(self.__storage_type, 0, 1, anchorLeft = 1) + return [Label("Configure storage"), + grid] + + def get_local_storage_page(self, screen): + self.__storage_size = Entry(6, str(self.__config.get_storage_size())) + self.__allocate_storage = Checkbox("Allocate entire disk now", self.__config.get_allocate_storage()) + grid = Grid(2, 2) + grid.setField(self.__allocate_storage, 0, 0, growx = 1, anchorLeft = 1) + grid.setField(Label("Storage size (GB):"), 0, 1, anchorLeft = 1) + grid.setField(self.__storage_size, 1, 1) + return [Label("Configure local storage"), + grid] + + def get_managed_storage_page(self, screen): + volumes = [] + for volume in self.get_libvirt().list_storage_volumes(): + volumes.append(["%s (%d GB)" % (volume.name(), volume.info()[1] / (1024 ** 3)), + volume.name(), + self.__config.is_existing_storage(volume.name())]) + self.__existing_storage = RadioBar(screen, (volumes)) + grid = Grid(2, 1) + grid.setField(Label("Existing storage:"), 0, 0) + grid.setField(self.__existing_storage, 1, 0) + return [Label("Configure managed storage"), + grid] + + def get_bridge_page(self, screen): + bridges = [] + for bridge in self.get_libvirt().list_bridges(): + bridges.append(["Virtual network '%s'" % bridge.name(), bridge.name(), self.__config.get_network_bridge() == bridge.name()]) + self.__network_bridges = RadioBar(screen, (bridges)) + if self.__config.get_mac_address() == None: + self.__config.set_mac_address(self.get_libvirt().generate_mac_address()) + self.__mac_address = Entry(20, self.__config.get_mac_address()) + grid = Grid(1, 1) + grid.setField(self.__network_bridges, 0, 0) + return [Label("Select an existing bridge"), + grid] + + def get_virt_details_page(self, screen): + virt_types = [] + for type in self.get_libvirt().list_virt_types(): + virt_types.append([type, type, self.__config.is_virt_type(type)]) + self.__virt_types = RadioBar(screen, (virt_types)) + archs = [] + for arch in self.get_libvirt().list_architectures(): + archs.append([arch, arch, self.__config.is_architecture(arch)]) + self.__architectures = RadioBar(screen, (archs)) + grid = Grid(2, 2) + grid.setField(Label("Virt Type:"), 0, 0, anchorRight = 1, anchorTop = 1) + grid.setField(self.__virt_types, 1, 0, anchorLeft = 1) + grid.setField(Label("Architecture:"), 0, 1, anchorRight = 1, anchorTop = 1) + grid.setField(self.__architectures, 1, 1, anchorLeft = 1) + return [Label("Configure virtualization details"), + grid] + + def get_confirm_page(self, screen): + grid = Grid(2, 6) + grid.setField(Label("OS:"), 0, 0, anchorRight = 1) + grid.setField(Label(Guest.get_os_variant_label(self.__config.get_os_type(), + self.__config.get_os_variant())), 1, 0, anchorLeft = 1) + grid.setField(Label("Install:"), 0, 1, anchorRight = 1) + grid.setField(Label(self.__config.get_install_type_text()), 1, 1, anchorLeft = 1) + grid.setField(Label("Memory:"), 0, 2, anchorRight = 1) + grid.setField(Label("%s MB" % self.__config.get_memory()), 1, 2, anchorLeft = 1) + grid.setField(Label("CPUs:"), 0, 3, anchorRight = 1) + grid.setField(Label("%d" % self.__config.get_cpus()), 1, 3, anchorLeft = 1) + grid.setField(Label("Storage:"), 0, 4, anchorRight = 1) + grid.setField(Label(self.__config.get_existing_storage()), 1, 4, anchorLeft = 1) + grid.setField(Label("Network:"), 0, 5, anchorRight = 1) + grid.setField(Label(self.__config.get_network_bridge()), 1, 5, anchorLeft = 1) + return [Label("Ready to begin installation of %s" % self.__config.get_guest_name()), + grid] + +def DefineDomain(): + screen = DomainConfigScreen() + screen.start() diff --git a/nodeadmin/destroydomain.py b/nodeadmin/destroydomain.py new file mode 100755 index 0000000..350c32e --- /dev/null +++ b/nodeadmin/destroydomain.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# +# destroydomain.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from configscreen import * + +class DestroyDomainConfigScreen(DomainListConfigScreen): + LIST_PAGE = 1 + DESTROY_PAGE = 2 + + def __init__(self): + DomainListConfigScreen.__init__(self, "Destroy A Domain") + + def get_elements_for_page(self, screen, page): + if page is self.LIST_PAGE: + return self.get_domain_list_page(screen, defined = False) + elif page is self.DESTROY_PAGE: + return self.get_destroy_page(screen) + + def page_has_next(self, page): + if page is self.LIST_PAGE: return self.has_selectable_domains() + return False + + def page_has_back(self, page): + if page is self.DESTROY_PAGE: return True + return False + + def validate_input(self, page, errors): + if page is self.LIST_PAGE: + if self.get_selected_domain() is not None: + domain = self.get_selected_domain() + try: + self.get_libvirt().destroy_domain(domain) + return True + except Exception, error: + errors.append("There was an error destroy the domain: %s" % domain) + errors.append(str(error)) + else: + errors.append("You must first select a domain to destroy.") + return False + + def get_destroy_page(self, screen): + grid = Grid(1, 1) + grid.setField(Label("%s was successfully destroyed." % self.get_selected_domain()), 0, 0) + return [grid] + +def DestroyDomain(): + screen = DestroyDomainConfigScreen() + screen.start() diff --git a/nodeadmin/domainconfig.py b/nodeadmin/domainconfig.py new file mode 100644 index 0000000..ef39fe0 --- /dev/null +++ b/nodeadmin/domainconfig.py @@ -0,0 +1,217 @@ +# domainconfig.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from virtinst import Guest + +class DomainConfig: + LOCAL_INSTALL = "local" + NETWORK_INSTALL = "network" + PXE_INSTALL = "pxe" + INSTALL_TYPE_TEXT = {LOCAL_INSTALL : "Local CDROM/ISO", + NETWORK_INSTALL : "URL INstall Tree", + PXE_INSTALL : "PXE Install"} + + INSTALL_SOURCE_CDROM = "cdrom" + INSTALL_SOURCE_ISO = "iso" + + NEW_STORAGE = "new" + EXISTING_STORAGE = "existing" + + def __init__(self): + self.__guest_name = "" + self.__install_type = DomainConfig.LOCAL_INSTALL + self.__use_cdrom_source = True + self.__install_location = "" + self.__install_media = "" + self.__iso_path = "" + self.__install_url = "" + self.__kickstart_url = "" + self.__kernel_options = "" + self.__os_type = "other" + self.__os_variant = None + self.__memory = 512 + self.__cpus = 1 + self.__enable_storage = True + self.__use_local_storage = True + self.__storage_size = 8.0 + self.__allocate_storage = True + self.__existing_storage = "" + self.__network_bridge = None + self.__mac_address = None + self.__virt_type = None + self.__architecture = None + + def set_guest_name(self, name): + self.__guest_name = name + + def get_guest_name(self): + return self.__guest_name + + def set_install_type(self, type): + self.__install_type = type + + def get_install_type(self): + return self.__install_type + + def get_install_type_text(self): + return DomainConfig.INSTALL_TYPE_TEXT[self.get_install_type()] + + def is_install_type(self, type): + return self.__install_type == type + + def set_install_location(self, location): + self.__install_location = location + + def set_use_cdrom_source(self, use): + self.__use_cdrom_source = use + + def get_use_cdrom_source(self): + return self.__use_cdrom_source + + def get_install_location(self): + return self.__install_location + + def is_install_location(self, location): + return self.__install_location == location + + def set_install_media(self, media): + self.__install_media = media + + def get_install_media(self): + return self.__install_media + + def is_install_media(self, media): + return self.__install_media == media + + def set_iso_path(self, path): + self.__iso_path = path + + def get_iso_path(self): + return self.__iso_path + + def set_install_url(self, url): + self.__install_url = url + + def get_install_url(self): + return self.__install_url + + def set_kickstart_url(self, url): + self.__kickstart_url = url + + def get_kickstart_url(self): + return self.__kickstart_url + + def set_kernel_options(self, options): + self.__kernel_options = options + + def get_kernel_options(self): + return self.__kernel_options + + def set_os_type(self, type): + self.__os_type = type + self.__os_variant = Guest.list_os_variants(type)[0] + + def get_os_type(self): + return self.__os_type + + def is_os_type(self, type): + return self.__os_type == type + + def set_os_variant(self, variant): + self.__os_variant = variant + + def get_os_variant(self): + return self.__os_variant + + def is_os_variant(self, variant): + return self.__os_variant == variant + + def set_memory(self, memory): + self.__memory = int(memory) + + def get_memory(self): + return self.__memory + + def set_cpus(self, cpus): + self.__cpus = cpus + + def get_cpus(self): + return self.__cpus + + def set_enable_storage(self, enable): + self.__enable_storage = enable + + def get_enable_storage(self): + return self.__enable_storage + + def set_use_local_storage(self, use): + self.__use_local_storage = use + + def get_use_local_storage(self): + return self.__use_local_storage + + def set_storage_size(self, size): + self.__storage_size = size + + def get_storage_size(self): + return self.__storage_size + + def set_allocate_storage(self, allocate): + self.__allocate_storage = allocate + + def get_allocate_storage(self): + return self.__allocate_storage + + def set_existing_storage(self, storage): + self.__existing_storage = storage + + def get_existing_storage(self): + return self.__existing_storage + + def is_existing_storage(self, storage): + return self.__existing_storage == storage + + def set_network_bridge(self, bridge): + self.__network_bridge = bridge + + def get_network_bridge(self): + return self.__network_bridge + + def set_mac_address(self, address): + self.__mac_address = address + + def get_mac_address(self): + return self.__mac_address + + def set_virt_type(self, type): + self.__virt_type = type + + def get_virt_type(self): + return self.__virt_type + + def is_virt_type(self, type): + return self.__virt_type == type + + def set_architecture(self, architecture): + self.__architecture = architecture + + def get_architecture(self): + return self.__architecture + + def is_architecture(self, architecture): + return self.__architecture == architecture diff --git a/nodeadmin/halworker.py b/nodeadmin/halworker.py new file mode 100644 index 0000000..448c22d --- /dev/null +++ b/nodeadmin/halworker.py @@ -0,0 +1,37 @@ +# halworker.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +import dbus +import virtinst + +class HALWorker: + '''Provides utilities for working with HAL to get hardware information.''' + def __init__(self): + self.__bus = dbus.SystemBus() + hobj = self.__bus.get_object("org.freedesktop.Hal", "/org/freedesktop/Hal/Manager") + self.__conn = dbus.Interface(hobj, "org.freedesktop.Hal.Manager") + + def list_installable_volumes(self): + result = {} + for udi in self.__conn.FindDeviceByCapability("volume"): + device = self.__bus.get_object("org.freedesktop.Hal", udi) + info = dbus.Interface(device, "org.freedesktop.Hal.Device") + if info.GetProperty("volume.is_disc"): + if info.GetProperty("volume.disc.has_data"): + result[str(info.GetProperty("block.device"))] = info.GetProperty("volume.label") + return result diff --git a/nodeadmin/libvirtworker.py b/nodeadmin/libvirtworker.py new file mode 100644 index 0000000..d10595c --- /dev/null +++ b/nodeadmin/libvirtworker.py @@ -0,0 +1,271 @@ +# libvirtworker.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +import dbus +import libvirt +import os +import virtinst + +from domainconfig import DomainConfig + +DEFAULT_POOL_TARGET_PATH="/var/lib/libvirt/images" + +class LibvirtWorker: + '''Provides utilities for interfacing with libvirt.''' + def __init__(self, url = "qemu:///system"): + self.__conn = libvirt.open(url) + self.__capabilities = virtinst.CapabilitiesParser.parse(self.__conn.getCapabilities()) + self.__net = virtinst.VirtualNetworkInterface(conn = self.__conn) + self.__net.setup(self.__conn) + (self.__new_guest, self.__new_domain) = virtinst.CapabilitiesParser.guest_lookup(conn = self.__conn) + + def list_domains(self, defined = True, started = True): + '''Lists all domains.''' + result = [] + if defined: + result.extend(self.__conn.listDefinedDomains()) + if started: + for id in self.__conn.listDomainsID(): + result.append(self.__conn.lookupByID(id).name()) + return result + + def get_domain(self, name): + '''Returns the specified domain.''' + result = self.__conn.lookupByName(name) + if result is None: raise Exception("No such domain exists: %s" % name) + + return result + + def domain_exists(self, name): + '''Returns whether a domain with the specified node exists.''' + domains = self.list_domains() + if name in domains: return True + return False + + def create_domain(self, name): + '''Creates the specified domain.''' + domain = self.get_domain(name) + domain.create() + + def destroy_domain(self, name): + '''Destroys the specified domain.''' + domain = self.get_domain(name) + domain.destroy() + + def undefine_domain(self, name): + '''Undefines the specified domain.''' + domain = self.get_domain(name) + domain.undefine() + + def list_storage_pools(self): + '''Returns the list of all defined storage pools.''' + return self.__conn.listStoragePools() + + def storage_pool_exists(self, name): + '''Returns whether a storage pool exists.''' + pools = self.list_storage_pools() + if name in pools: return True + return False + + def define_storage_pool(self, name): + '''Defines a storage pool with the given name.''' + try: + pool = virtinst.Storage.DirectoryPool(conn=self.__conn, + name=name, + target_path=DEFAULT_POOL_TARGET_PATH) + newpool = pool.install(build=True, create=True) + newpool.setAutostart(True) + except Exception, error: + raise RuntimeError("Could not create pool: %s - %s", str(error)) + + def list_bridges(self): + '''Lists all defined and active bridges.''' + bridges = self.__conn.listNetworks() + bridges.extend(self.__conn.listDefinedNetworks()) + result = [] + for name in bridges: + bridge = self.__conn.networkLookupByName(name) + result.append(bridge) + return result + + def generate_mac_address(self): + return self.__net.macaddr + + def list_storage_volumes(self): + '''Lists all defined storage volumes.''' + pools = self.__conn.listStoragePools() + pools.extend(self.__conn.listDefinedStoragePools()) + result = [] + for name in pools: + pool = self.__conn.storagePoolLookupByName(name) + for volname in pool.listVolumes(): + volume = self.__conn.storageVolLookupByPath("/var/lib/libvirt/images/%s" % volname) + result.append(volume) + return result + + def get_storage_size(self, name): + '''Returns the size of the specified storage volume.''' + volume = self.__conn.storageVolLookupByPath("/var/lib/libvirt/images/%s" % name) + return volume.info()[1] / (1024.0 ** 3) + + def get_virt_types(self): + result = [] + for guest in self.__capabilities.guests: + guest_type = guest.os_type + for domain in guest.domains: + domain_type = domain.hypervisor_type + label = domain_type + + if domain_type is "kvm" and guest_type is "xen": label = "xenner" + elif domain_type is "xen": + if guest_type is "xen": + label = "xen (paravirt)" + elif guest_type is "kvm": + label = "xen (fullvirt)" + elif domain_type is "test": + if guest_type is "xen": + label = "test (xen)" + elif guest_type is "hvm": + label = "test (hvm)" + + for row in result: + if row[0] == label: + label = None + break + if label is None: continue + + result.append([label, domain_type, guest_type]) + return result + + def list_virt_types(self): + virt_types = self.get_virt_types() + result = [] + for type in virt_types: + result.append(type[0]) + return result + + def get_default_architecture(self): + '''Returns a default hypervisor type for new domains.''' + return self.__new_guest.arch + + def get_hypervisor(self, virt_type): + virt_types = self.get_virt_types() + for type in virt_types: + if type[0] is virt_type: return type[1] + return None + + def get_default_virt_type(self): + '''Returns the default virtualization type for new domains.''' + return self.__new_domain.hypervisor_type + + def get_os_type(self, virt_type): + virt_types = self.get_virt_types() + for type in virt_types: + if type[0] is virt_type: return type[2] + return None + + def list_architectures(self): + result = [] + for guest in self.__capabilities.guests: + for domain in guest.domains: + label = guest.arch + for row in result: + if row == label: + label = None + break + if label is None: continue + + result.append(label) + return result + + def define_domain(self, config, meter): + location = extra = kickstart = None + + if config.get_install_type() == DomainConfig.LOCAL_INSTALL: + if config.get_use_cdrom_source(): + iclass = virtinst.DistroInstaller + location = config.get_install_media() + else: + iclass = virtinst.LiveCDInstaller + location = config.get_is_path() + elif config.get_install_type() == DomainConfig.NETWORK_INSTALL: + iclass = virtinst.DistroInstaller + location = config.get_install_url() + extra = config.get_kernel_options() + kickstart = config.get_kickstart_url() + elif config.get_install_type() == DomainConfig.PXE_INSTALL: + iclass = virtinst.PXEInstaller + + installer = iclass(conn = self.__conn, + type = self.get_hypervisor(config.get_virt_type()), + os_type = self.get_os_type(config.get_virt_type())) + self.__guest = installer.guest_from_installer() + self.__guest.name = config.get_guest_name() + self.__guest.vcpus = config.get_cpus() + self.__guest.memory = config.get_memory() + self.__guest.maxmemory = config.get_memory() + + self.__guest.installer.location = location + if config.get_use_cdrom_source(): self.__guest.installer.cdrom = True + extraargs = "" + if extra: extraargs += extra + if kickstart: extraargs += " ks=%s" % kickstart + if extraargs: self.__guest.installer.extraarags = extraargs + + self.__guest.uuid = virtinst.util.uuidToString(virtinst.util.randomUUID()) + + if config.get_os_type() != "generic": self.__guest.os_type = config.get_os_type() + if config.get_os_variant() != "generic": self.__guest.os_variant = config.get_os_variant() + + self.__guest._graphics_dev = virtinst.VirtualGraphics(type = virtinst.VirtualGraphics.TYPE_VNC) + self.__guest.sound_devs = [] + self.__guest.sound_devs.append(virtinst.VirtualAudio(model = "es1370")) + + self._setup_nics(config) + self._setup_disks(config) + + self.__guest.conn = self.__conn + self.__domain = self.__guest.start_install(False, meter = meter) + + def _setup_nics(self, config): + self.__guest.nics = [] + nic = virtinst.VirtualNetworkInterface(type = virtinst.VirtualNetworkInterface.TYPE_VIRTUAL, + bridge = config.get_network_bridge(), + network = config.get_network_bridge(), + macaddr = config.get_mac_address()) + self.__guest.nics.append(nic) + + def _setup_disks(self, config): + self.__guest.disks = [] + if config.get_enable_storage(): + path = None + if config.get_use_local_storage(): + if self.storage_pool_exists("default") is False: + self.define_storage_pool("default") + pool = self.__conn.storagePoolLookupByName("default") + path = virtinst.Storage.StorageVolume.find_free_name(config.get_guest_name(), + pool_object = pool, + suffix = ".img") + path = os.path.join(DEFAULT_POOL_TARGET_PATH, path) + + if path is not None: + storage= virtinst.VirtualDisk(conn = self.__conn, + path = path, + size = config.get_storage_size()) + self.__guest.disks.append(storage) + self.__guest.conn = self.__conn diff --git a/nodeadmin/listdomains.py b/nodeadmin/listdomains.py new file mode 100755 index 0000000..1b51ee2 --- /dev/null +++ b/nodeadmin/listdomains.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# +# listdomains.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from libvirtworker import LibvirtWorker +from configscreen import * + +class ListDomainsConfigScreen(DomainListConfigScreen): + LIST_PAGE = 1 + DETAIL_PAGE = 2 + + def __init__(self): + DomainListConfigScreen.__init__(self, 'List Domains') + + def page_has_next(self, page): + return (page == self.LIST_PAGE) + + def page_has_back(self, page): + return (page == self.DETAIL_PAGE) + + def validate_input(self, page, errors): + if page == self.LIST_PAGE: + if self.get_selected_domain() is None: + errors.append("Please select a domain to view.") + else: + return True + + def get_elements_for_page(self, screen, page): + if page == self.LIST_PAGE: + return self.get_domain_list_page(screen) + elif page == self.DETAIL_PAGE: + return self.get_detail_page_elements(screen) + + def get_detail_page_elements(self, screen): + domain = self.get_libvirt().get_domain(self.get_selected_domain()) + grid = Grid(2, 5) + grid.setField(Label("Name: "), 0, 0, anchorRight = 1) + grid.setField(Label(domain.name()), 1, 0, anchorLeft = 1) + grid.setField(Label("UUID: "), 0, 1, anchorRight = 1) + grid.setField(Label(domain.UUIDString()), 1, 1, anchorLeft = 1) + grid.setField(Label("OS Type: "), 0, 2, anchorRight = 1) + grid.setField(Label(domain.OSType()), 1, 2, anchorLeft = 1) + grid.setField(Label("Max. Memory: "), 0, 3, anchorRight = 1) + grid.setField(Label(str(domain.maxMemory())), 1, 3, anchorLeft = 1) + grid.setField(Label("Max. VCPUs: "), 0, 4, anchorRight = 1) + grid.setField(Label(str(domain.maxVcpus())), 1, 4, anchorLeft = 1) + return [grid] + +def ListDomains(): + screen = ListDomainsConfigScreen() + screen.start() diff --git a/nodeadmin/mainmenu.py b/nodeadmin/mainmenu.py new file mode 100755 index 0000000..2808dad --- /dev/null +++ b/nodeadmin/mainmenu.py @@ -0,0 +1,71 @@ +# mainmenu.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +import traceback +from configscreen import ConfigScreen +from definedomain import DefineDomain +from createdomain import CreateDomain +from destroydomain import DestroyDomain +from undefinedomain import UndefineDomain +from listdomains import ListDomains +from createuser import CreateUser + +DEFINE_DOMAIN = 1 +CREATE_DOMAIN = 2 +DESTROY_DOMAIN = 3 +UNDEFINE_DOMAIN = 4 +LIST_DOMAINS = 5 +CREATE_USER = 6 +EXIT_CONSOLE = 99 + +def MainMenu(): + finished = False + while finished == False: + screen = SnackScreen() + menu = Listbox(height = 0, width = 0, returnExit = 1) + menu.append("Define A Domain", DEFINE_DOMAIN) + menu.append("Create A Domain", CREATE_DOMAIN) + menu.append("Destroy A Domain", DESTROY_DOMAIN) + menu.append("Undefine A Domain", UNDEFINE_DOMAIN) + menu.append("List All Domains", LIST_DOMAINS) + menu.append("Create A User", CREATE_USER) + menu.append("Exit Administration", EXIT_CONSOLE) + gridform = GridForm(screen, "Node Administration Console", 1, 4) + gridform.add(menu, 0, 0) + result = gridform.run(); + screen.popWindow() + screen.finish() + + try: + if result.current() == DEFINE_DOMAIN: DefineDomain() + elif result.current() == CREATE_DOMAIN: CreateDomain() + elif result.current() == DESTROY_DOMAIN: DestroyDomain() + elif result.current() == UNDEFINE_DOMAIN: UndefineDomain() + elif result.current() == LIST_DOMAINS: ListDomains() + elif result.current() == CREATE_USER: CreateUser() + elif result.current() == EXIT_CONSOLE: finished = True + except Exception, error: + screen = SnackScreen() + ButtonChoiceWindow(screen, + "An Exception Has Occurred", + str(error) + "\n" + traceback.format_exc(), + buttons = ["OK"]) + screen.popWindow() + screen.finish() + finished = True diff --git a/nodeadmin/nodeadmin.py b/nodeadmin/nodeadmin.py new file mode 100755 index 0000000..864a4c0 --- /dev/null +++ b/nodeadmin/nodeadmin.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# +# node-admin - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +import sys + +from mainmenu import MainMenu + +def NodeAdmin(): + MainMenu() + +if __name__ == "__main__": + sys.exit(NodeAdmin()) diff --git a/nodeadmin/setup.py.in b/nodeadmin/setup.py.in new file mode 100644 index 0000000..f51a34c --- /dev/null +++ b/nodeadmin/setup.py.in @@ -0,0 +1,34 @@ +# setup.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from setuptools import setup, find_packages + +setup(name = "nodeadmin", + version = "@VERSION@", + package_dir = {'nodeadmin': 'nodeadmin'}, + packages = find_packages('.'), + entry_points = { + 'console_scripts': [ + 'nodeadmin = nodeadmin.nodeadmin:NodeAdmin', + 'definedom = nodeadmin.definedomain:DefineDomain', + 'createdom = nodeadmin.createdomain:CreateDomain', + 'destroydom = nodeadmin.destroydomain:DestroyDomain', + 'undefinedom = nodeadmin.undefinedomain:UndefineDomain', + 'createuser = nodeadmin.createuser:CreateUser', + 'listdoms = nodeadmin.listdomains:ListDomains'] + }) diff --git a/nodeadmin/undefinedomain.py b/nodeadmin/undefinedomain.py new file mode 100755 index 0000000..2620540 --- /dev/null +++ b/nodeadmin/undefinedomain.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python +# +# undefinedomain.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from configscreen import * + +class UndefineDomainConfigScreen(DomainListConfigScreen): + LIST_PAGE = 1 + CONFIRM_PAGE = 2 + UNDEFINE_PAGE = 3 + + def __init__(self): + DomainListConfigScreen.__init__(self, "Undefine A Domain") + + def get_elements_for_page(self, screen, page): + if page is self.LIST_PAGE: return self.get_domain_list_page(screen) + elif page is self.CONFIRM_PAGE: return self.get_confirm_page(screen) + elif page is self.UNDEFINE_PAGE: return self.get_undefine_page(screen) + + def page_has_next(self, page): + if page is self.LIST_PAGE: return self.has_selectable_domains() + elif page is self.CONFIRM_PAGE: return True + return False + + def page_has_back(self, page): + if page is self.CONFIRM_PAGE: return True + elif page is self.UNDEFINE_PAGE: return True + return False + + def get_back_page(self, page): + if page is self.CONFIRM_PAGE: return self.LIST_PAGE + elif page is self.UNDEFINE_PAGE: return self.LIST_PAGE + + def validate_input(self, page, errors): + if page is self.LIST_PAGE: + if self.get_selected_domain() is not None: + return True + else: + errors.append("You must first select a domain.") + elif page is self.CONFIRM_PAGE: + if self.__confirm_undefine.value(): + domain = self.get_selected_domain() + try: + self.get_libvirt().undefine_domain(domain) + return True + except Exception, error: + errors.append("Failed to undefine %s." % domain) + errors.append(str(error)) + else: + errors.append("You must confirm undefining the domain to proceed.") + return False + + def get_confirm_page(self, screen): + self.__confirm_undefine = Checkbox("Check here to confirm undefining %s." % self.get_selected_domain(), 0) + grid = Grid(1, 1) + grid.setField(self.__confirm_undefine, 0, 0) + return [grid] + + def get_undefine_page(self, screen): + grid = Grid(1, 1) + grid.setField(Label("%s has been undefined." % self.get_selected_domain()), 0, 0) + return [grid] + +def UndefineDomain(): + screen = UndefineDomainConfigScreen() + screen.start() diff --git a/nodeadmin/userworker.py b/nodeadmin/userworker.py new file mode 100644 index 0000000..167197b --- /dev/null +++ b/nodeadmin/userworker.py @@ -0,0 +1,38 @@ +# userworker.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +import libuser + +class UserWorker: + '''Provides APIs for creating, modifying and deleting user accounts.''' + def __init__(self): + self.__admin = libuser.admin() + + def create_user(self, username, password, other_group): + '''Creates a new user account with the provides username, + password. The user is also added to the optional group + if one is specified.''' + user = self.__admin.initUser(username) + user.set('pw_passwd', password) + self.__admin.addUser(user) + if other_group is not None: + group = self.__admin.lookupGroupByName(other_group) + if group is None: raise Exception("Invalid group specified: %s" % other_group) + user.add('pw_gid', group.get('pw_gid')[0]) + self.__admin.modifyUser(user) + diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index 12815c9..9091f4f 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -1,5 +1,7 @@ %define product_family oVirt Node %define beta Beta +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} + Summary: The oVirt Node daemons/scripts Name: ovirt-node @@ -21,6 +23,8 @@ Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig BuildRequires: libvirt-devel >= 0.5.1 BuildRequires: dbus-devel hal-devel +BuildRequires: python-devel +BuildRequires: python-setuptools Requires: libvirt >= 0.6.3 Requires: augeas >= 0.3.5 Requires: libvirt-qpid >= 0.2.14-3 @@ -44,6 +48,10 @@ Requires: nc Requires: grub Requires: /usr/sbin/crond Requires: anyterm +Requires: newt-python +Requires: libuser-python +Requires: dbus-python + ExclusiveArch: %{ix86} x86_64 %define app_root %{_datadir}/%{name} @@ -144,6 +152,7 @@ cd - %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/cron.d %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/cron.hourly %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/logrotate.d +%{__install} -d -m0755 %{buildroot}%{python_sitelib}/nodeadmin %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-config-boot %{buildroot}%{_sbindir} @@ -164,6 +173,21 @@ cd - %{__install} -p -m0755 scripts/persist %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/unpersist %{buildroot}%{_sbindir} +%{__install} -p -m0644 nodeadmin/__init__.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/configscreen.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/createdomain.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/createuser.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/definedomain.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/destroydomain.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/domainconfig.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/halworker.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/libvirtworker.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/userworker.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/listdomains.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/mainmenu.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/nodeadmin.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/undefinedomain.py %{buildroot}%{python_sitelib}/nodeadmin + # gptsync %{__install} -p -m0755 gptsync/gptsync %{buildroot}%{_sbindir} %{__install} -p -m0755 gptsync/showpart %{buildroot}%{_sbindir} @@ -182,6 +206,10 @@ cd - %{__install} -p -m0644 logrotate/ovirt-logrotate %{buildroot}%{_sysconfdir}/cron.d %{__install} -p -m0644 logrotate/ovirt-logrotate.conf %{buildroot}%{_sysconfdir}/logrotate.d +# install the admin tools +python nodeadmin/setup.py install --root %{buildroot} +# rm -rf %{buildroot}%{python_sitelib}/nodeadmin- at VERSION@* + echo "oVirt Node release %{version}-%{release}" > %{buildroot}%{_sysconfdir}/ovirt-release mkdir -p %{buildroot}/%{_sysconfdir}/default touch %{buildroot}/%{_sysconfdir}/default/ovirt @@ -325,7 +353,16 @@ fi %{_sbindir}/ovirt-awake %{_initrddir}/ovirt-functions %defattr(-,root,root,0644) +%{_bindir}/nodeadmin +%{_bindir}/definedom +%{_bindir}/createdom +%{_bindir}/destroydom +%{_bindir}/undefinedom +%{_bindir}/listdoms +%{_bindir}/createuser %{_sysconfdir}/collectd.conf.in +%{python_sitelib}/nodeadmin +%{python_sitelib}/nodeadmin- at VERSION@-py2.6.egg-info %config %attr(0644,root,root) %{_sysconfdir}/ovirt-release %config %attr(0644,root,root) %{_sysconfdir}/default/ovirt -- 1.6.2.5 From dpierce at redhat.com Fri Sep 11 18:44:51 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 11 Sep 2009 14:44:51 -0400 Subject: [Ovirt-devel] Accompanies the node patch... Message-ID: <1252694692-12082-1-git-send-email-dpierce@redhat.com> This patch obsoletes any previous patches... From dpierce at redhat.com Fri Sep 11 18:44:52 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 11 Sep 2009 14:44:52 -0400 Subject: [Ovirt-devel] [PATCH node-image] Changed packages and dependencies so virt-manager-tui runs properly. In-Reply-To: <1252694692-12082-1-git-send-email-dpierce@redhat.com> References: <1252694692-12082-1-git-send-email-dpierce@redhat.com> Message-ID: <1252694692-12082-2-git-send-email-dpierce@redhat.com> Signed-off-by: Darryl L. Pierce --- common-blacklist.ks | 4 ++-- common-install.ks | 2 +- common-pkgs.ks | 7 +++++-- common-post.ks | 7 +++++++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/common-blacklist.ks b/common-blacklist.ks index 2f8842f..4c196e5 100644 --- a/common-blacklist.ks +++ b/common-blacklist.ks @@ -8,14 +8,14 @@ echo "Removing excess RPMs" # However, this is just an install-time dependency; we can remove # it afterwards, which we do here RPMS="system-config-firewall-tui system-config-network-tui rhpl \ - rpm-python dbus-python kudzu newt-python newt libsemanage-python" + rpm-python kudzu libsemanage-python" RPMS="$RPMS kpartx mkinitrd isomd5sum dmraid checkpolicy" # Remove additional RPMs forcefully RPMS="$RPMS gamin pm-utils kbd usermode vbetool ConsoleKit hdparm \ efibootmgr linux-atm-libs fedora-release-notes \ - slang psmisc cryptsetup-luks pciutils mtools syslinux \ + psmisc cryptsetup-luks pciutils mtools syslinux \ wireless-tools radeontool libicu gnupg2 \ fedora-logos" diff --git a/common-install.ks b/common-install.ks index 2a7fbb7..9bcdaa3 100644 --- a/common-install.ks +++ b/common-install.ks @@ -4,7 +4,7 @@ timezone --utc UTC auth --useshadow --enablemd5 selinux --enforcing firewall --disabled -part / --size 600 --fstype ext2 +part / --size 650 --fstype ext2 services --enabled=auditd,ntpd,ntpdate,collectd,iptables,network,rsyslog,libvirt-qpid # This requires a new fixed version of livecd-creator to honor the --append settings. bootloader --timeout=30 --append="console=tty0 console=ttyS0,115200n8" diff --git a/common-pkgs.ks b/common-pkgs.ks index 6f0af6e..99af269 100644 --- a/common-pkgs.ks +++ b/common-pkgs.ks @@ -8,18 +8,20 @@ rootfiles dhclient openssh-clients openssh-server -kvm +qemu +qemu-kvm libmlx4 ovirt-node-stateless ovirt-node-selinux ovirt-node-logos ovirt-node-release --selinux-policy-targeted +selinux-policy-targeted selinux-policy-minimum vim-minimal sudo python python-libs +python-setuptools db4 vconfig python-virtinst @@ -37,6 +39,7 @@ pciutils numactl file lsof +newt-python /usr/bin/kvmtrace #remove -audit-libs-python diff --git a/common-post.ks b/common-post.ks index 0c0a3f4..d0a52e9 100644 --- a/common-post.ks +++ b/common-post.ks @@ -146,3 +146,10 @@ EOF # Remove the default logrotate daily cron job # since we run it every 10 minutes instead. rm -f /etc/cron.daily/logrotate + +# add nodeadmin as a valid shell +cat >> /etc/shells < References: <20090911180636.87h1g03oevj4gw8w@webmail.provincia.torino.it> <20090911181421.0w0idny67a8kwwk8@webmail.provincia.torino.it> <4AAA942A.6080709@redhat.com> Message-ID: <20090914100045.23oo7nnjz6hwskoc@webmail.provincia.torino.it> Hello, the following is what iy requested: [root at mgmt ~]# kinit admin Password for admin at OVIRT.LOCAL: kinit: Looping detected inside krb5_get_in_tkt while getting initial credentials [root at mgmt ~]# Thanks ----- Messaggio da jboggs at redhat.com --------- Data: Fri, 11 Sep 2009 14:17:14 -0400 Da: Joey Boggs Rispondi-A:Joey Boggs Oggetto: Re: [Ovirt-devel] ovirt ace error A: ignazio.cassano at provincia.torino.it Cc: ovirt-devel at redhat.com > ignazio.cassano at provincia.torino.it wrote: >> Good morning, >> I'd like to add some information to my previous email. >> Reading ace.log I saw kinit fails. >> Escaping to shell, I tried to execute: >> kinit admin >> kinit: Looping detected inside krb5_get_in_tkt while getting >> initial credentials >> >> >> After entering password, the following error is displayed: >> >> >> >> >> ----- Messaggio da ignazio.cassano at provincia.torino.it --------- >> Data: Fri, 11 Sep 2009 18:06:36 +0200 >> Da: ignazio.cassano at provincia.torino.it >> Rispondi-A:ignazio.cassano at provincia.torino.it >> Oggetto: [Ovirt-devel] ovirt ace error >> A: ovirt-devel at redhat.com >> >> >>> Good morning, >>> I have succesfully buil ovirt on fedora 11 but running >>> ace -d l /tmp/ace.log install ovirt I got en error (I think it is >>> krb5 issue). >>> >>> My server was not a kerberos server before installing ovirt, so I think ace >>> procedure has installed it. >>> Attacchede here there is the ace.log file. >>> Could anyone help me ? >>> Thanks & Regards >>> Ignazio >> >> >> ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- >> >> >> >> >> _______________________________________________ >> Ovirt-devel mailing list >> Ovirt-devel at redhat.com >> https://www.redhat.com/mailman/listinfo/ovirt-devel > Hmm, looks like the error message from this email, the install log > looks good other than the kinit failing so 101/108 items were > completed, can you send the error message from kinit admin again? ----- Fine del messaggio da jboggs at redhat.com ----- From ignazio.cassano at provincia.torino.it Mon Sep 14 10:05:13 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Mon, 14 Sep 2009 12:05:13 +0200 Subject: [Ovirt-devel] ovirt ace error In-Reply-To: <4AAA942A.6080709@redhat.com> References: <20090911180636.87h1g03oevj4gw8w@webmail.provincia.torino.it> <20090911181421.0w0idny67a8kwwk8@webmail.provincia.torino.it> <4AAA942A.6080709@redhat.com> Message-ID: <20090914120513.1ke4mwizfcgsk8sc@webmail.provincia.torino.it> Hello, probably the ace installation procedure fails something to add admin principal. If I launch the command kadmin.local and then "get_principal admin at OVIRT.PRIV" it displays: get_principal: Database record is incomplete or corrupted while retrieving "admin at OVIRT.PRIV" ----- Messaggio da jboggs at redhat.com --------- Data: Fri, 11 Sep 2009 14:17:14 -0400 Da: Joey Boggs Rispondi-A:Joey Boggs Oggetto: Re: [Ovirt-devel] ovirt ace error A: ignazio.cassano at provincia.torino.it Cc: ovirt-devel at redhat.com > ignazio.cassano at provincia.torino.it wrote: >> Good morning, >> I'd like to add some information to my previous email. >> Reading ace.log I saw kinit fails. >> Escaping to shell, I tried to execute: >> kinit admin >> kinit: Looping detected inside krb5_get_in_tkt while getting >> initial credentials >> >> >> After entering password, the following error is displayed: >> >> >> >> >> ----- Messaggio da ignazio.cassano at provincia.torino.it --------- >> Data: Fri, 11 Sep 2009 18:06:36 +0200 >> Da: ignazio.cassano at provincia.torino.it >> Rispondi-A:ignazio.cassano at provincia.torino.it >> Oggetto: [Ovirt-devel] ovirt ace error >> A: ovirt-devel at redhat.com >> >> >>> Good morning, >>> I have succesfully buil ovirt on fedora 11 but running >>> ace -d l /tmp/ace.log install ovirt I got en error (I think it is >>> krb5 issue). >>> >>> My server was not a kerberos server before installing ovirt, so I think ace >>> procedure has installed it. >>> Attacchede here there is the ace.log file. >>> Could anyone help me ? >>> Thanks & Regards >>> Ignazio >> >> >> ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- >> >> >> >> >> _______________________________________________ >> Ovirt-devel mailing list >> Ovirt-devel at redhat.com >> https://www.redhat.com/mailman/listinfo/ovirt-devel > Hmm, looks like the error message from this email, the install log > looks good other than the kinit failing so 101/108 items were > completed, can you send the error message from kinit admin again? ----- Fine del messaggio da jboggs at redhat.com ----- From ignazio.cassano at provincia.torino.it Mon Sep 14 11:06:47 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Mon, 14 Sep 2009 13:06:47 +0200 Subject: [Ovirt-devel] ovirt ace error In-Reply-To: <20090914120513.1ke4mwizfcgsk8sc@webmail.provincia.torino.it> References: <20090911180636.87h1g03oevj4gw8w@webmail.provincia.torino.it> <20090911181421.0w0idny67a8kwwk8@webmail.provincia.torino.it> <4AAA942A.6080709@redhat.com> <20090914120513.1ke4mwizfcgsk8sc@webmail.provincia.torino.it> Message-ID: <20090914130647.4dnnkfp0k8cogckk@webmail.provincia.torino.it> Hello, I have seen ace installs ipa-server. I launched another clean installation and viewing ipa server install log I read it fails launching ldappasswd . I am going to launch another clean installation to send you ipa server install log. Thanks Ignazio ----- Messaggio da ignazio.cassano at provincia.torino.it --------- Data: Mon, 14 Sep 2009 12:05:13 +0200 Da: ignazio.cassano at provincia.torino.it Rispondi-A:ignazio.cassano at provincia.torino.it Oggetto: Re: [Ovirt-devel] ovirt ace error A: Joey Boggs Cc: ovirt-devel at redhat.com > Hello, probably the ace installation procedure fails something to add > admin principal. > If I launch the command kadmin.local and then "get_principal > admin at OVIRT.PRIV" > it displays: > > get_principal: Database record is incomplete or corrupted while > retrieving "admin at OVIRT.PRIV" > > > > ----- Messaggio da jboggs at redhat.com --------- > Data: Fri, 11 Sep 2009 14:17:14 -0400 > Da: Joey Boggs > Rispondi-A:Joey Boggs > Oggetto: Re: [Ovirt-devel] ovirt ace error > A: ignazio.cassano at provincia.torino.it > Cc: ovirt-devel at redhat.com > > >> ignazio.cassano at provincia.torino.it wrote: >>> Good morning, >>> I'd like to add some information to my previous email. >>> Reading ace.log I saw kinit fails. >>> Escaping to shell, I tried to execute: >>> kinit admin >>> kinit: Looping detected inside krb5_get_in_tkt while getting >>> initial credentials >>> >>> >>> After entering password, the following error is displayed: >>> >>> >>> >>> >>> ----- Messaggio da ignazio.cassano at provincia.torino.it --------- >>> Data: Fri, 11 Sep 2009 18:06:36 +0200 >>> Da: ignazio.cassano at provincia.torino.it >>> Rispondi-A:ignazio.cassano at provincia.torino.it >>> Oggetto: [Ovirt-devel] ovirt ace error >>> A: ovirt-devel at redhat.com >>> >>> >>>> Good morning, >>>> I have succesfully buil ovirt on fedora 11 but running >>>> ace -d l /tmp/ace.log install ovirt I got en error (I think it is >>>> krb5 issue). >>>> >>>> My server was not a kerberos server before installing ovirt, so I >>>> think ace >>>> procedure has installed it. >>>> Attacchede here there is the ace.log file. >>>> Could anyone help me ? >>>> Thanks & Regards >>>> Ignazio >>> >>> >>> ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- >>> >>> >>> >>> >>> _______________________________________________ >>> Ovirt-devel mailing list >>> Ovirt-devel at redhat.com >>> https://www.redhat.com/mailman/listinfo/ovirt-devel >> Hmm, looks like the error message from this email, the install log >> looks good other than the kinit failing so 101/108 items were >> completed, can you send the error message from kinit admin again? > > > ----- Fine del messaggio da jboggs at redhat.com ----- > > > > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- From ignazio.cassano at provincia.torino.it Mon Sep 14 11:07:30 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Mon, 14 Sep 2009 13:07:30 +0200 Subject: [Ovirt-devel] ovirt ace error In-Reply-To: <4AAA942A.6080709@redhat.com> References: <20090911180636.87h1g03oevj4gw8w@webmail.provincia.torino.it> <20090911181421.0w0idny67a8kwwk8@webmail.provincia.torino.it> <4AAA942A.6080709@redhat.com> Message-ID: <20090914130730.65iogz5na5es4o80@webmail.provincia.torino.it> Hello, I have seen ace installs ipa-server. I launched another clean installation and viewing ipa server install log I read it fails launching ldappasswd . I am going to launch another clean installation to send you ipa server install log. Thanks Ignazio ----- Messaggio da jboggs at redhat.com --------- Data: Fri, 11 Sep 2009 14:17:14 -0400 Da: Joey Boggs Rispondi-A:Joey Boggs Oggetto: Re: [Ovirt-devel] ovirt ace error A: ignazio.cassano at provincia.torino.it Cc: ovirt-devel at redhat.com > ignazio.cassano at provincia.torino.it wrote: >> Good morning, >> I'd like to add some information to my previous email. >> Reading ace.log I saw kinit fails. >> Escaping to shell, I tried to execute: >> kinit admin >> kinit: Looping detected inside krb5_get_in_tkt while getting >> initial credentials >> >> >> After entering password, the following error is displayed: >> >> >> >> >> ----- Messaggio da ignazio.cassano at provincia.torino.it --------- >> Data: Fri, 11 Sep 2009 18:06:36 +0200 >> Da: ignazio.cassano at provincia.torino.it >> Rispondi-A:ignazio.cassano at provincia.torino.it >> Oggetto: [Ovirt-devel] ovirt ace error >> A: ovirt-devel at redhat.com >> >> >>> Good morning, >>> I have succesfully buil ovirt on fedora 11 but running >>> ace -d l /tmp/ace.log install ovirt I got en error (I think it is >>> krb5 issue). >>> >>> My server was not a kerberos server before installing ovirt, so I think ace >>> procedure has installed it. >>> Attacchede here there is the ace.log file. >>> Could anyone help me ? >>> Thanks & Regards >>> Ignazio >> >> >> ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- >> >> >> >> >> _______________________________________________ >> Ovirt-devel mailing list >> Ovirt-devel at redhat.com >> https://www.redhat.com/mailman/listinfo/ovirt-devel > Hmm, looks like the error message from this email, the install log > looks good other than the kinit failing so 101/108 items were > completed, can you send the error message from kinit admin again? ----- Fine del messaggio da jboggs at redhat.com ----- From ignazio.cassano at provincia.torino.it Mon Sep 14 11:37:23 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Mon, 14 Sep 2009 13:37:23 +0200 Subject: [Ovirt-devel] ovirt ace error In-Reply-To: <4AAA942A.6080709@redhat.com> References: <20090911180636.87h1g03oevj4gw8w@webmail.provincia.torino.it> <20090911181421.0w0idny67a8kwwk8@webmail.provincia.torino.it> <4AAA942A.6080709@redhat.com> Message-ID: <20090914133723.z5rptz0ewawo0ksc@webmail.provincia.torino.it> Hello, I found the uid admin object is found in ldap. The probleb is when ldappasswd is executed , the slapd error log reports the following: [14/Sep/2009:13:34:28 +0200] ipa_pwd_extop - krb5_c_string_to_key failed [Bad encryption type] [14/Sep/2009:13:34:28 +0200] ipa_pwd_extop - key encryption/encoding failed ----- Messaggio da jboggs at redhat.com --------- Data: Fri, 11 Sep 2009 14:17:14 -0400 Da: Joey Boggs Rispondi-A:Joey Boggs Oggetto: Re: [Ovirt-devel] ovirt ace error A: ignazio.cassano at provincia.torino.it Cc: ovirt-devel at redhat.com > ignazio.cassano at provincia.torino.it wrote: >> Good morning, >> I'd like to add some information to my previous email. >> Reading ace.log I saw kinit fails. >> Escaping to shell, I tried to execute: >> kinit admin >> kinit: Looping detected inside krb5_get_in_tkt while getting >> initial credentials >> >> >> After entering password, the following error is displayed: >> >> >> >> >> ----- Messaggio da ignazio.cassano at provincia.torino.it --------- >> Data: Fri, 11 Sep 2009 18:06:36 +0200 >> Da: ignazio.cassano at provincia.torino.it >> Rispondi-A:ignazio.cassano at provincia.torino.it >> Oggetto: [Ovirt-devel] ovirt ace error >> A: ovirt-devel at redhat.com >> >> >>> Good morning, >>> I have succesfully buil ovirt on fedora 11 but running >>> ace -d l /tmp/ace.log install ovirt I got en error (I think it is >>> krb5 issue). >>> >>> My server was not a kerberos server before installing ovirt, so I think ace >>> procedure has installed it. >>> Attacchede here there is the ace.log file. >>> Could anyone help me ? >>> Thanks & Regards >>> Ignazio >> >> >> ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- >> >> >> >> >> _______________________________________________ >> Ovirt-devel mailing list >> Ovirt-devel at redhat.com >> https://www.redhat.com/mailman/listinfo/ovirt-devel > Hmm, looks like the error message from this email, the install log > looks good other than the kinit failing so 101/108 items were > completed, can you send the error message from kinit admin again? ----- Fine del messaggio da jboggs at redhat.com ----- From apevec at redhat.com Mon Sep 14 12:36:45 2009 From: apevec at redhat.com (Alan Pevec) Date: Mon, 14 Sep 2009 14:36:45 +0200 Subject: [Ovirt-devel] [PATCH node-image] allow environment passing for sudo livecd-creator In-Reply-To: <20090910114907.bctgq7v2jdw0c0c8@webmail.provincia.torino.it> References: <20090910114907.bctgq7v2jdw0c0c8@webmail.provincia.torino.it> Message-ID: <1252931805-11143-1-git-send-email-apevec@redhat.com> This allows e.g. http_proxy env.variable to be used by the build process. Signed-off-by: Alan Pevec --- Makefile.am | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Makefile.am b/Makefile.am index a44ae49..40d199b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -135,7 +135,7 @@ $(NVR).$(PKG_FMT): no_nscd repos.ks keys fi ;; \ esac ;\ ) - sudo livecd-creator --skip-minimize -c $(PACKAGE).ks \ + sudo -E livecd-creator --skip-minimize -c $(PACKAGE).ks \ -f $(PACKAGE) \ --tmpdir='$(NODE_TMP)' \ --cache='$(OVIRT_CACHE_DIR)/yum-$(ARCH)' -- 1.6.2.5 From jboggs at redhat.com Mon Sep 14 15:31:21 2009 From: jboggs at redhat.com (Joey Boggs) Date: Mon, 14 Sep 2009 11:31:21 -0400 Subject: [Ovirt-devel] [PATCH node] Introduces the node-admin toolset. In-Reply-To: <1252694486-11597-2-git-send-email-dpierce@redhat.com> References: <1252694486-11597-1-git-send-email-dpierce@redhat.com> <1252694486-11597-2-git-send-email-dpierce@redhat.com> Message-ID: <4AAE61C9.2040502@redhat.com> Darryl L. Pierce wrote: > Defines a primary entry point that displays a menu of options that user > can use to administer the managed node. It leverages the code from > virtinst-python to do the heavy lifting and just provides a front end > for collecting user data. > > Created a new configuration class to be used for all configuration > screens. > > The user can select to create a node. They are then walked through the > steps to create a domain similar to virt-manager. > > The user can create a defined domain. > > The user can destroy a created domain. > > The user can undefine a defined domain. > > The user can list all domains on the system. > > The user can create a new user account. > > When the RPM is created, a separate entry point is created for each > node admin command. This allows the commands to be invoked individually > as well as from the main menu. > > Signed-off-by: Darryl L. Pierce > --- > .gitignore | 1 + > Makefile.am | 15 ++ > configure.ac | 1 + > nodeadmin/__init__.py | 20 ++ > nodeadmin/configscreen.py | 150 ++++++++++++++ > nodeadmin/createdomain.py | 68 +++++++ > nodeadmin/createuser.py | 106 ++++++++++ > nodeadmin/definedomain.py | 470 +++++++++++++++++++++++++++++++++++++++++++ > nodeadmin/destroydomain.py | 66 ++++++ > nodeadmin/domainconfig.py | 217 ++++++++++++++++++++ > nodeadmin/halworker.py | 37 ++++ > nodeadmin/libvirtworker.py | 271 +++++++++++++++++++++++++ > nodeadmin/listdomains.py | 68 +++++++ > nodeadmin/mainmenu.py | 71 +++++++ > nodeadmin/nodeadmin.py | 29 +++ > nodeadmin/setup.py.in | 34 +++ > nodeadmin/undefinedomain.py | 83 ++++++++ > nodeadmin/userworker.py | 38 ++++ > ovirt-node.spec.in | 37 ++++ > 19 files changed, 1782 insertions(+), 0 deletions(-) > create mode 100644 nodeadmin/__init__.py > create mode 100644 nodeadmin/configscreen.py > create mode 100755 nodeadmin/createdomain.py > create mode 100755 nodeadmin/createuser.py > create mode 100755 nodeadmin/definedomain.py > create mode 100755 nodeadmin/destroydomain.py > create mode 100644 nodeadmin/domainconfig.py > create mode 100644 nodeadmin/halworker.py > create mode 100644 nodeadmin/libvirtworker.py > create mode 100755 nodeadmin/listdomains.py > create mode 100755 nodeadmin/mainmenu.py > create mode 100755 nodeadmin/nodeadmin.py > create mode 100644 nodeadmin/setup.py.in > create mode 100755 nodeadmin/undefinedomain.py > create mode 100644 nodeadmin/userworker.py > > diff --git a/.gitignore b/.gitignore > index 26a0210..19b15d1 100644 > --- a/.gitignore > +++ b/.gitignore > @@ -13,3 +13,4 @@ missing > stamp-h1 > ovirt-node*.gz > ovirt-node.spec > +*.pyc > diff --git a/Makefile.am b/Makefile.am > index 419cdf1..5192d9d 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -26,6 +26,21 @@ EXTRA_DIST = \ > ovirt-node-selinux.fc \ > images/grub-splash.xpm.gz \ > images/syslinux-vesa-splash.jpg \ > + nodeadmin/__init__.py \ > + nodeadmin/configscreen.py \ > + nodeadmin/createuser.py \ > + nodeadmin/destroydomain.py \ > + nodeadmin/halworker.py \ > + nodeadmin/libvirtworker.py \ > + nodeadmin/userworker.py \ > + nodeadmin/mainmenu.py \ > + nodeadmin/undefinedomain.py \ > + nodeadmin/createdomain.py \ > + nodeadmin/definedomain.py \ > + nodeadmin/domainconfig.py \ > + nodeadmin/listdomains.py \ > + nodeadmin/nodeadmin.py \ > + nodeadmin/setup.py \ > scripts/collectd.conf.in \ > scripts/ovirt \ > scripts/ovirt-awake \ > diff --git a/configure.ac b/configure.ac > index b60afeb..780b757 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -8,6 +8,7 @@ test x"$ac_ct_CC:$CFLAGS" = 'xgcc:-g -O2' \ > && CFLAGS="$CFLAGS -Wshadow -Wall -Werror" > > AC_CONFIG_FILES([Makefile > + nodeadmin/setup.py > gptsync/Makefile > ovirt-node.spec > ]) > diff --git a/nodeadmin/__init__.py b/nodeadmin/__init__.py > new file mode 100644 > index 0000000..1f3c72c > --- /dev/null > +++ b/nodeadmin/__init__.py > @@ -0,0 +1,20 @@ > +# __init__.py - Copyright (C) 2009 Red Hat, Inc. > +# Written by Darryl L. Pierce > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +from nodeadmin import NodeAdmin > + > diff --git a/nodeadmin/configscreen.py b/nodeadmin/configscreen.py > new file mode 100644 > index 0000000..0282eee > --- /dev/null > +++ b/nodeadmin/configscreen.py > @@ -0,0 +1,150 @@ > +# configscreen.py - Copyright (C) 2009 Red Hat, Inc. > +# Written by Darryl L. Pierce > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +from snack import * > +from halworker import HALWorker > +from libvirtworker import LibvirtWorker > +import traceback > + > +BACK_BUTTON = "back" > +NEXT_BUTTON = "next" > +CANCEL_BUTTON = "cancel" > +FINISH_BUTTON = "finish" > + > +class ConfigScreen: > + '''Enables the creation of navigable, multi-paged configuration screens.''' > + > + def __init__(self, title): > + self.__title = title > + self.__current_page = 1 > + self.__finished = False > + self.__hal = HALWorker() > + self.__libvirt = LibvirtWorker() > + > + def get_hal(self): > + return self.__hal > + > + def get_libvirt(self): > + return self.__libvirt > + > + def set_finished(self): > + self.__finished = True > + > + def get_elements_for_page(self, screen, page): > + return [] > + > + def page_has_next(self, page): > + return False > + > + def page_has_finish(self, page): > + return False > + > + def get_back_page(self, page): > + if page > 1: return page - 1 > + return page > + > + def go_back(self): > + self.__current_page = self.get_back_page(self.__current_page) > + > + def get_next_page(self, page): > + return page + 1 > + > + def go_next(self): > + self.__current_page = self.get_next_page(self.__current_page) > + > + def validate_input(self, page, errors): > + return True > + > + def process_input(self, page): > + return > + > + def start(self): > + active = True > + while active and (self.__finished == False): > + screen = SnackScreen() > + gridform = GridForm(screen, self.__title, 1, 4) > + elements = self.get_elements_for_page(screen, self.__current_page) > + current_element = 0 > + for element in elements: > + gridform.add(element, 0, current_element) > + current_element += 1 > + # create the navigation buttons > + buttons = [] > + if self.__current_page > 1: buttons.append(["Back", BACK_BUTTON, "F11"]) > + if self.page_has_next(self.__current_page): buttons.append(["Next", NEXT_BUTTON, "F12"]) > + if self.page_has_finish(self.__current_page): buttons.append(["Finish", FINISH_BUTTON, "F10"]) > + buttons.append(["Cancel", CANCEL_BUTTON, "ESC"]) > + buttonbar = ButtonBar(screen, buttons) > + gridform.add(buttonbar, 0, current_element, growx = 1) > + current_element += 1 > + try: > + result = gridform.runOnce() > + pressed = buttonbar.buttonPressed(result) > + if pressed == BACK_BUTTON: > + self.go_back() > + elif pressed == NEXT_BUTTON or pressed == FINISH_BUTTON: > + errors = [] > + if self.validate_input(self.__current_page, errors): > + self.process_input(self.__current_page) > + self.go_next() > + else: > + error_text = "" > + for error in errors: > + error_text += "%s\n" % error > + ButtonChoiceWindow(screen, > + "There Were Errors", > + error_text, > + buttons = ["OK"]) > + elif pressed == CANCEL_BUTTON: > + active = False > + except Exception, error: > + ButtonChoiceWindow(screen, > + "An Exception Has Occurred", > + str(error) + "\n" + traceback.format_exc(), > + buttons = ["OK"]) > + screen.popWindow() > + screen.finish() > + > +class DomainListConfigScreen(ConfigScreen): > + '''Provides a base class for all config screens that require a domain list.''' > + > + def __init__(self, title): > + ConfigScreen.__init__(self, title) > + > + def get_domain_list_page(self, screen, defined=True, created=True): > + domains = self.get_libvirt().list_domains(defined, created) > + result = None > + > + if len(domains) > 0: > + self.__has_domains = True > + self.__domain_list = Listbox(0) > + for name in self.get_libvirt().list_domains(defined, created): > + self.__domain_list.append(name, name) > + result = [self.__domain_list] > + else: > + self.__has_domains = False > + grid = Grid(1, 1) > + grid.setField(Label("There are no domains available."), 0, 0) > + result = [grid] > + return result > + > + def get_selected_domain(self): > + return self.__domain_list.current() > + > + def has_selectable_domains(self): > + return self.__has_domains > diff --git a/nodeadmin/createdomain.py b/nodeadmin/createdomain.py > new file mode 100755 > index 0000000..b73a09e > --- /dev/null > +++ b/nodeadmin/createdomain.py > @@ -0,0 +1,68 @@ > +#!/usr/bin/env python > +# > +# createdomain.py - Copyright (C) 2009 Red Hat, Inc. > +# Written by Darryl L. Pierce > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +from snack import * > +from configscreen import * > + > +class CreateDomainConfigScreen(DomainListConfigScreen): > + LIST_PAGE = 1 > + CREATE_PAGE = 2 > + > + def __init__(self): > + DomainListConfigScreen.__init__(self, "Create A Domain") > + > + def get_elements_for_page(self, screen, page): > + if page is self.LIST_PAGE: > + return self.get_domain_list_page(screen, created = False) > + elif page is self.CREATE_PAGE: > + return self.get_create_domain_page(screen) > + > + def page_has_next(self, page): > + if page is self.LIST_PAGE: return self.has_selectable_domains() > + return False > + > + def page_has_back(self, page): > + if page is self.CREATE_PAGE: return True > + return False > + > + def validate_input(self, page, errors): > + if page is self.LIST_PAGE: > + if self.get_selected_domain() is not None: > + domain = self.get_selected_domain() > + try: > + self.get_libvirt().create_domain(domain) > + return True > + except Exception, error: > + errors.append("There was an error creating the domain: %s" % domain) > + errors.append(str(error)) > + else: > + errors.append("You must first select a domain to create.") > + > + def process_input(self, page): > + print "foo" > + > + def get_create_domain_page(self, screen): > + grid = Grid(1, 1) > + grid.setField(Label("%s was successfully created." % self.get_selected_domain()), 0, 0) > + return [grid] > + > +def CreateDomain(): > + screen = CreateDomainConfigScreen() > + screen.start() > diff --git a/nodeadmin/createuser.py b/nodeadmin/createuser.py > new file mode 100755 > index 0000000..dbc4626 > --- /dev/null > +++ b/nodeadmin/createuser.py > @@ -0,0 +1,106 @@ > +#!/usr/bin/env python > +# > +# createuser.py - Copyright (C) 2009 Red Hat, Inc. > +# Written by Darryl L. Pierce > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +from snack import * > +from configscreen import ConfigScreen > +from userworker import UserWorker > + > +import libuser > + > +DETAILS_PAGE = 1 > +CONFIRM_PAGE = 2 > + > +class CreateUserConfigScreen(ConfigScreen): > + def __init__(self): > + ConfigScreen.__init__(self, "Create A User Account") > + self.__username = None > + self.__useradmin = libuser.admin() > + self.__user_worker = UserWorker() > + > + def get_elements_for_page(self, screen, page): > + if page is DETAILS_PAGE: return self.get_details_page(screen) > + elif page is CONFIRM_PAGE: return self.get_confirm_page(screen) > + > + def validate_input(self, page, errors): > + if page is DETAILS_PAGE: > + if len(self.__username.value()) > 0: > + name = self.__username.value() > + if self.__useradmin.lookupUserByName(name) is None: > + if len(self.__password.value()) > 0: > + if self.__password.value() == self.__confirm.value(): > + return True > + else: > + errors.append("Passwords do not match.") > + else: > + errors.append("You must enter a password.") > + else: > + errors.append("User %s already exists." % name) > + else: > + errors.append("You must enter a username.") > + self.__confirm.value() > + return False > + > + def process_input(self, page): > + if page is CONFIRM_PAGE: > + self.__user_worker.create_user(self.__username.value(), > + self.__password.value(), > + "wheel" if self.__adminuser.value() else None) > + self.set_finished() > + > + def page_has_next(self, page): > + return (page is DETAILS_PAGE) > + > + def page_has_back(self, page): > + return (page is CONFIRM_PAGE) > + > + def page_has_finish(self, page): > + return (page is CONFIRM_PAGE) > + > + def get_details_page(self, screen): > + if self.__username is None: > + self.__username = Entry(50, "") > + self.__password = Entry(50, "", password = 1) > + self.__confirm = Entry(50, "", password = 1) > + self.__adminuser = Checkbox("This user is an administrator", False) > + grid = Grid(2, 4) > + grid.setField(Label("Username:"), 0, 0, anchorRight = 1) > + grid.setField(self.__username, 1, 0, anchorLeft = 1) > + grid.setField(Label("Password:"), 0, 1, anchorRight = 1) > + grid.setField(self.__password, 1, 1, anchorLeft = 1) > + grid.setField(Label("Confirm password:"), 0, 2, anchorRight = 1) > + grid.setField(self.__confirm, 1, 2, anchorLeft = 1) > + grid.setField(Label(" "), 0, 3) > + grid.setField(self.__adminuser, 1, 3, anchorLeft = 1) > + return [Label("Enter The User Details"), > + grid] > + > + def get_confirm_page(self, screen): > + grid = Grid(1, 2) > + grid.setField(Label("Username: %s" % self.__username.value()), 0, 0) > + admin_label = "is not" > + if self.__adminuser.value(): > + admin_label = "is" > + grid.setField(Label("This user %s an administrator." % admin_label), 0, 1) > + return [Label("Create this user account?"), > + grid] > + > +def CreateUser(): > + screen = CreateUserConfigScreen() > + screen.start() > diff --git a/nodeadmin/definedomain.py b/nodeadmin/definedomain.py > new file mode 100755 > index 0000000..ea4c986 > --- /dev/null > +++ b/nodeadmin/definedomain.py > @@ -0,0 +1,470 @@ > +#!/usr/bin/env python > +# > +# definedomain.py - Copyright (C) 2009 Red Hat, Inc. > +# Written by Darryl L. Pierce > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +from snack import * > +import os > +from domainconfig import DomainConfig > +from configscreen import ConfigScreen > +import urlgrabber.progress as progress > + > +from virtinst import * > + > +VM_DETAILS_PAGE = 1 > +LOCAL_INSTALL_PAGE = 2 > +SELECT_CDROM_PAGE = 3 > +SELECT_ISO_PAGE = 4 > +NETWORK_INSTALL_PAGE = 10 > +OS_TYPE_PAGE = 11 > +OS_VARIANT_PAGE = 12 > +RAM_CPU_PAGE = 13 > +ENABLE_STORAGE_PAGE = 14 > +LOCAL_STORAGE_PAGE = 15 > +MANAGED_STORAGE_PAGE = 16 > +BRIDGE_PAGE = 17 > +VIRT_DETAILS_PAGE = 18 > +CONFIRM_PAGE = 19 > + > +LOCATION="location" > +KICKSTART="kickstart" > +KERNELOPTS="kernel.options" > +OS_TYPE="os.type" > +OS_VARIANT="os.variant" > +MEMORY="memory" > +CPUS="cpus" > + > +class DummyMeter(progress.BaseMeter): > + > + def _do_start(self, now = None): > + print "Starting..." > + > + def _do_end(self, amount_read, now = None): > + print "Ending: read=%d" % amount_read > + > + def _do_update(self, amount_read, now = None): > + print "Update: read=%d" % amount_read > + > +class DomainConfigScreen(ConfigScreen): > + > + def __init__(self): > + ConfigScreen.__init__(self, "Create A New Virtual Machine") > + self.__config = DomainConfig() > + self.__config.set_architecture(self.get_libvirt().get_default_architecture()) > + self.__config.set_virt_type(self.get_libvirt().get_default_virt_type()) > + > + def get_elements_for_page(self, screen, page): > + if page == VM_DETAILS_PAGE: return self.get_vm_details_page(screen) > + elif page == LOCAL_INSTALL_PAGE: return self.get_local_install_page(screen) > + elif page == SELECT_CDROM_PAGE: return self.get_select_cdrom_page(screen) > + elif page == SELECT_ISO_PAGE: return self.get_select_iso_page(screen) > + elif page == NETWORK_INSTALL_PAGE: return self.get_network_install_page(screen) > + elif page == OS_TYPE_PAGE: return self.get_os_type_page(screen) > + elif page == OS_VARIANT_PAGE: return self.get_os_variant_page(screen) > + elif page == RAM_CPU_PAGE: return self.get_ram_and_cpu_page(screen) > + elif page == ENABLE_STORAGE_PAGE: return self.get_enable_storage_page(screen) > + elif page == LOCAL_STORAGE_PAGE: return self.get_local_storage_page(screen) > + elif page == MANAGED_STORAGE_PAGE: return self.get_managed_storage_page(screen) > + elif page == BRIDGE_PAGE: return self.get_bridge_page(screen) > + elif page == VIRT_DETAILS_PAGE: return self.get_virt_details_page(screen) > + elif page == CONFIRM_PAGE: return self.get_confirm_page(screen) > + return [] > + > + def validate_input(self, page, errors): > + if page == VM_DETAILS_PAGE: > + if len(self.__guest_name.value()) > 0: > + if self.get_libvirt().domain_exists(self.__guest_name.value()): > + errors.append("Guest name '%s' is already in use." % self.__guest_name.value()) > + else: > + return True > + else: > + errors.append("Guest name must be a string between 0 and 50 characters.") > + elif page == LOCAL_INSTALL_PAGE: > + if self.__install_source.getSelection() == DomainConfig.INSTALL_SOURCE_CDROM: > + return True > + elif self.__install_source.getSelection() == DomainConfig.INSTALL_SOURCE_ISO: > + return True > + elif page == SELECT_CDROM_PAGE: > + if self.__install_media.getSelection() != None: > + if len(self.get_hal().list_installable_volumes()) == 0: > + errors.append("No installable media is available.") > + else: > + return True > + else: > + errors.append("You must select an install media.") > + elif page == SELECT_ISO_PAGE: > + if len(self.__iso_path.value()) > 0: > + if os.path.exists(self.__iso_path.value()): > + if os.path.isfile(self.__iso_path.value()): > + return True > + else: > + errors.append("%s is not a file." % self.__iso_path.value()) > + else: > + errors.append("No such install media exists:") > + errors.append(self.__iso_path.value()) > + else: > + errors.append("An install media selection is required.") > + elif page == NETWORK_INSTALL_PAGE: > + if len(self.__install_url.value()) > 0: > + return True > + else: > + errors.append("An install tree is required.") > + elif page == OS_TYPE_PAGE: return True > + elif page == OS_VARIANT_PAGE: return True > + elif page == RAM_CPU_PAGE: > + if (len(self.__memory.value()) > 0 and len(self.__cpus.value()) > 0) \ > + and (int(self.__memory.value()) > 0 and int(self.__cpus.value()) > 0): > + return True > + else: > + if len(self.__memory.value()) == 0: > + errors.append("A value must be entered for memory.") > + elif int(self.__memory.value()) <= 0: > + errors.append("A positive integer value must be entered for memory.") > + if len(self.__cpus.value()) == 0: > + errors.append("A value must be entered for CPUs.") > + elif int(self.__cpus.value()) <= 0: > + errors.append("A positive integer value must be entered for memory.") > + elif page == ENABLE_STORAGE_PAGE: return True > + elif page == LOCAL_STORAGE_PAGE: > + if len(self.__storage_size.value()) > 0: > + if float(self.__storage_size.value()) > 0: > + return True > + else: > + errors.append("A positive value must be entered for the storage size.") > + else: > + errors.append("A value must be entered for the storage size.") > + elif page == MANAGED_STORAGE_PAGE: > + if self.__existing_storage.getSelection() is not None: > + return True > + else: > + errors.append("Please select a storage volume.") > + elif page == BRIDGE_PAGE: > + if self.__network_bridges.getSelection() != None: > + if len(self.__mac_address.value()) > 0: > + # TODO: regex check the format > + return True > + else: > + errors.append("MAC address must be supplied.") > + else: > + errors.append("A network bridge must be selected.") > + elif page == VIRT_DETAILS_PAGE: > + if self.__virt_types.getSelection() != None and self.__architectures.getSelection() != None: > + return True > + if self.__virt_types.getSelection() is None: > + errors.append("Please select a virtualization type.") > + if self.__architectures.getSelection() is None: > + errors.append("Please selection an architecture.") > + elif page == CONFIRM_PAGE: return True > + return False > + > + def process_input(self, page): > + if page == VM_DETAILS_PAGE: > + self.__config.set_guest_name(self.__guest_name.value()) > + self.__config.set_install_type(self.__install_type.getSelection()) > + elif page == LOCAL_INSTALL_PAGE: > + self.__config.set_use_cdrom_source(self.__install_source.getSelection() == DomainConfig.INSTALL_SOURCE_CDROM) > + elif page == SELECT_CDROM_PAGE: > + self.__config.set_install_media(self.__install_media.getSelection()) > + elif page == SELECT_ISO_PAGE: > + self.__config.set_iso_path(self.__iso_path.value()) > + elif page == NETWORK_INSTALL_PAGE: > + self.__config.set_install_url(self.__install_url.value()) > + self.__config.set_kickstart_url(self.__kickstart_url.value()) > + self.__config.set_kernel_options(self.__kernel_options.value()) > + elif page == OS_TYPE_PAGE: > + self.__config.set_os_type(self.__os_types.getSelection()) > + elif page == OS_VARIANT_PAGE: > + self.__config.set_os_variant(self.__os_variants.getSelection()) > + elif page == RAM_CPU_PAGE: > + self.__config.set_memory(int(self.__memory.value())) > + self.__config.set_cpus(int(self.__cpus.value())) > + elif page == ENABLE_STORAGE_PAGE: > + self.__config.set_enable_storage(self.__enable_storage.value()) > + if self.__storage_type.getSelection() == DomainConfig.NEW_STORAGE: > + self.__config.set_use_local_storage(True) > + elif self.__storage_type.getSelection() == Node.STORAGE_TYPE_EXISTING: > + self.__config.set_use_local_storage(False) > + elif page == LOCAL_STORAGE_PAGE: > + self.__config.set_storage_size(float(self.__storage_size.value())) > + self.__config.set_allocate_storage(self.__allocate_storage.value()) > + elif page == MANAGED_STORAGE_PAGE: > + self.__config.set_use_local_storage(False) > + self.__config.set_existing_storage(self.__existing_storage.getSelection()) > + self.__config.set_storage_size(self.get_libvirt().get_storage_size(self.__existing_storage.getSelection())) > + elif page == BRIDGE_PAGE: > + self.__config.set_network_bridge(self.__network_bridges.getSelection()) > + elif page == VIRT_DETAILS_PAGE: > + self.__config.set_virt_type(self.__virt_types.getSelection()) > + self.__config.set_architecture(self.__architectures.getSelection()) > + elif page == CONFIRM_PAGE: > + self.get_libvirt().define_domain(self.__config, DummyMeter()) > + self.set_finished() > + > + def get_back_page(self, page): > + result = page > + if page == OS_TYPE_PAGE: > + install_type = self.__config.get_install_type() > + if install_type == DomainConfig.LOCAL_INSTALL: > + if self.__config.get_use_cdrom_source(): > + result = SELECT_CDROM_PAGE > + else: > + result = SELECT_ISO_PAGE > + elif install_type == DomainConfig.NETWORK_INSTALL: > + result = NETWORK_INSTALL_PAGE > + elif install_type == DomainConfig.PXE_INSTALL: > + result = VM_DETAILS_PAGE > + elif page == LOCAL_STORAGE_PAGE or page == MANAGED_STORAGE_PAGE: > + result = ENABLE_STORAGE_PAGE > + elif page == NETWORK_INSTALL_PAGE: > + result = VM_DETAILS_PAGE > + elif page == SELECT_CDROM_PAGE or page == SELECT_ISO_PAGE: > + result = LOCAL_INSTALL_PAGE > + elif page == BRIDGE_PAGE: > + if self.__config.get_use_local_storage(): > + result = LOCAL_STORAGE_PAGE > + else: > + result = MANAGED_STORAGE_PAGE > + else: > + if page > 1: result = page - 1 > + return result > + > + def get_next_page(self, page): > + result = page > + if page == VM_DETAILS_PAGE: > + install_type = self.__config.get_install_type() > + if install_type == DomainConfig.LOCAL_INSTALL: > + result = LOCAL_INSTALL_PAGE > + elif install_type == DomainConfig.NETWORK_INSTALL: > + result = NETWORK_INSTALL_PAGE > + elif install_type == DomainConfig.PXE_INSTALL: > + result = OS_TYPE_PAGE > + elif page == LOCAL_INSTALL_PAGE: > + if self.__config.get_use_cdrom_source(): > + result = SELECT_CDROM_PAGE > + else: > + result = SELECT_ISO_PAGE > + elif page == SELECT_CDROM_PAGE or page == SELECT_ISO_PAGE: > + result = OS_TYPE_PAGE > + elif page == NETWORK_INSTALL_PAGE: > + result = OS_TYPE_PAGE > + elif page == ENABLE_STORAGE_PAGE: > + result = BRIDGE_PAGE > + if self.__config.get_enable_storage(): > + if self.__config.get_use_local_storage(): > + result = LOCAL_STORAGE_PAGE > + else: > + result = MANAGED_STORAGE_PAGE > + elif page == LOCAL_STORAGE_PAGE or page == MANAGED_STORAGE_PAGE: > + result = BRIDGE_PAGE > + else: > + result = page + 1 > + return result > + > + def page_has_finish(self, page): > + if page == CONFIRM_PAGE: return True > + return False > + > + def page_has_next(self, page): > + if page < CONFIRM_PAGE: > + return True > + > + def get_vm_details_page(self, screen): > + self.__guest_name = Entry(50, self.__config.get_guest_name()) > + self.__install_type = RadioBar(screen, (("Local install media (ISO image or CDROM)", > + DomainConfig.LOCAL_INSTALL, > + self.__config.is_install_type(DomainConfig.LOCAL_INSTALL)), > + ("Network Install (HTTP, FTP, or NFS)", > + DomainConfig.NETWORK_INSTALL, > + self.__config.is_install_type(DomainConfig.NETWORK_INSTALL)), > + ("Network Boot (PXE)", > + DomainConfig.PXE_INSTALL, > + self.__config.is_install_type(DomainConfig.PXE_INSTALL)))) > + grid = Grid(2,3) > + grid.setField(Label("Name:"), 0, 0, anchorRight = 1) > + grid.setField(self.__guest_name, 1, 0, anchorLeft = 1) > + grid.setField(Label("Choose how you would like to install the operating system"), 1, 1, > + anchorLeft = 1, anchorTop = 1) > + grid.setField(self.__install_type, 1, 2, anchorLeft = 1) > + return [Label("Enter your machine details"), > + grid] > + > + def get_local_install_page(self, screen): > + self.__install_source = RadioBar(screen, (("Use CDROM or DVD", > + DomainConfig.INSTALL_SOURCE_CDROM, > + self.__config.get_use_cdrom_source()), > + ("Use ISO image", > + DomainConfig.INSTALL_SOURCE_ISO, > + self.__config.get_use_cdrom_source() is False))) > + grid = Grid(1,1) > + grid.setField(self.__install_source, 0, 0, anchorLeft = 1) > + return [Label("Locate your install media"), > + grid] > + > + def get_select_cdrom_page(self, screen): > + drives = [] > + media = self.get_hal().list_installable_volumes() > + for drive in media.keys(): > + drives.append([media[drive], drive, self.__config.is_install_media(drive)]) > + self.__install_media = RadioBar(screen, (drives)) > + grid = Grid(1, 1) > + grid.setField(self.__install_media, 0, 0) > + return [Label("Select the install media"), > + grid] > + > + def get_select_iso_page(self, screen): > + self.__iso_path = Entry(50, self.__config.get_iso_path()) > + grid = Grid(1, 2) > + grid.setField(Label("Enter ISO path:"), 0, 0, anchorLeft = 1) > + grid.setField(self.__iso_path, 0, 1, anchorLeft = 1) > + return [Label("Enter the full path to an install ISO"), > + grid] > + > + def get_network_install_page(self, screen): > + self.__install_url = Entry(50, self.__config.get_install_url()) > + self.__kickstart_url = Entry(50, self.__config.get_kickstart_url()) > + self.__kernel_options = Entry(50, self.__config.get_kernel_options()) > + grid = Grid(2,3) > + grid.setField(Label("URL:"), 0, 0, anchorRight = 1) > + grid.setField(self.__install_url, 1, 0, anchorLeft = 1) > + grid.setField(Label("Kickstart URL:"), 0, 1, anchorRight = 1) > + grid.setField(self.__kickstart_url, 1, 1, anchorLeft = 1) > + grid.setField(Label("Kernel Options:"), 0, 2, anchorRight = 1) > + grid.setField(self.__kernel_options, 1, 2, anchorLeft = 1) > + return [Label("Provide the operating system URL"), > + grid] > + > + def get_os_type_page(self, screen): > + types = [] > + for type in Guest.list_os_types(): > + types.append([Guest.get_os_type_label(type), type, self.__config.is_os_type(type)]) > + self.__os_types = RadioBar(screen, types) > + grid = Grid(1, 1) > + grid.setField(self.__os_types, 0, 0, anchorLeft = 1) > + return [Label("Choose the operating system type"), > + grid] > + > + def get_os_variant_page(self, screen): > + variants = [] > + type = self.__config.get_os_type() > + for variant in Guest.list_os_variants(type): > + variants.append([Guest.get_os_variant_label(type, variant), variant, self.__config.is_os_variant(variant)]) > + self.__os_variants = RadioBar(screen, variants) > + grid = Grid(1, 1) > + grid.setField(self.__os_variants, 0, 0, anchorLeft = 1) > + return [Label("Choose the operating system version"), > + grid] > + > + def get_ram_and_cpu_page(self, screen): > + self.__memory = Entry(10, str(self.__config.get_memory())) > + self.__cpus = Entry(10, str(self.__config.get_cpus())) > + grid = Grid(2,2) > + grid.setField(Label("Memory (RAM):"), 0, 0, anchorRight = 1) > + grid.setField(self.__memory, 1, 0, anchorLeft = 1) > + grid.setField(Label("CPUs:"), 0, 1, anchorRight = 1) > + grid.setField(self.__cpus, 1, 1, anchorLeft = 1) > + return [Label("Choose memory and CPU settings"), > + grid] > + > + def get_enable_storage_page(self, screen): > + self.__enable_storage = Checkbox("Enable storage for this virtual machine", self.__config.get_enable_storage()) > + self.__storage_type = RadioBar(screen,((["Create a disk image on the computer's hard disk", > + DomainConfig.NEW_STORAGE, > + self.__config.get_use_local_storage()]), > + (["Select managed or other existing storage", > + DomainConfig.EXISTING_STORAGE, > + self.__config.get_use_local_storage() is False]))) > + grid = Grid(1,2) > + grid.setField(self.__enable_storage, 0, 0, anchorLeft = 1) > + grid.setField(self.__storage_type, 0, 1, anchorLeft = 1) > + return [Label("Configure storage"), > + grid] > + > + def get_local_storage_page(self, screen): > + self.__storage_size = Entry(6, str(self.__config.get_storage_size())) > + self.__allocate_storage = Checkbox("Allocate entire disk now", self.__config.get_allocate_storage()) > + grid = Grid(2, 2) > + grid.setField(self.__allocate_storage, 0, 0, growx = 1, anchorLeft = 1) > + grid.setField(Label("Storage size (GB):"), 0, 1, anchorLeft = 1) > + grid.setField(self.__storage_size, 1, 1) > + return [Label("Configure local storage"), > + grid] > + > + def get_managed_storage_page(self, screen): > + volumes = [] > + for volume in self.get_libvirt().list_storage_volumes(): > + volumes.append(["%s (%d GB)" % (volume.name(), volume.info()[1] / (1024 ** 3)), > + volume.name(), > + self.__config.is_existing_storage(volume.name())]) > + self.__existing_storage = RadioBar(screen, (volumes)) > + grid = Grid(2, 1) > + grid.setField(Label("Existing storage:"), 0, 0) > + grid.setField(self.__existing_storage, 1, 0) > + return [Label("Configure managed storage"), > + grid] > + > + def get_bridge_page(self, screen): > + bridges = [] > + for bridge in self.get_libvirt().list_bridges(): > + bridges.append(["Virtual network '%s'" % bridge.name(), bridge.name(), self.__config.get_network_bridge() == bridge.name()]) > + self.__network_bridges = RadioBar(screen, (bridges)) > + if self.__config.get_mac_address() == None: > + self.__config.set_mac_address(self.get_libvirt().generate_mac_address()) > + self.__mac_address = Entry(20, self.__config.get_mac_address()) > + grid = Grid(1, 1) > + grid.setField(self.__network_bridges, 0, 0) > + return [Label("Select an existing bridge"), > + grid] > + > + def get_virt_details_page(self, screen): > + virt_types = [] > + for type in self.get_libvirt().list_virt_types(): > + virt_types.append([type, type, self.__config.is_virt_type(type)]) > + self.__virt_types = RadioBar(screen, (virt_types)) > + archs = [] > + for arch in self.get_libvirt().list_architectures(): > + archs.append([arch, arch, self.__config.is_architecture(arch)]) > + self.__architectures = RadioBar(screen, (archs)) > + grid = Grid(2, 2) > + grid.setField(Label("Virt Type:"), 0, 0, anchorRight = 1, anchorTop = 1) > + grid.setField(self.__virt_types, 1, 0, anchorLeft = 1) > + grid.setField(Label("Architecture:"), 0, 1, anchorRight = 1, anchorTop = 1) > + grid.setField(self.__architectures, 1, 1, anchorLeft = 1) > + return [Label("Configure virtualization details"), > + grid] > + > + def get_confirm_page(self, screen): > + grid = Grid(2, 6) > + grid.setField(Label("OS:"), 0, 0, anchorRight = 1) > + grid.setField(Label(Guest.get_os_variant_label(self.__config.get_os_type(), > + self.__config.get_os_variant())), 1, 0, anchorLeft = 1) > + grid.setField(Label("Install:"), 0, 1, anchorRight = 1) > + grid.setField(Label(self.__config.get_install_type_text()), 1, 1, anchorLeft = 1) > + grid.setField(Label("Memory:"), 0, 2, anchorRight = 1) > + grid.setField(Label("%s MB" % self.__config.get_memory()), 1, 2, anchorLeft = 1) > + grid.setField(Label("CPUs:"), 0, 3, anchorRight = 1) > + grid.setField(Label("%d" % self.__config.get_cpus()), 1, 3, anchorLeft = 1) > + grid.setField(Label("Storage:"), 0, 4, anchorRight = 1) > + grid.setField(Label(self.__config.get_existing_storage()), 1, 4, anchorLeft = 1) > + grid.setField(Label("Network:"), 0, 5, anchorRight = 1) > + grid.setField(Label(self.__config.get_network_bridge()), 1, 5, anchorLeft = 1) > + return [Label("Ready to begin installation of %s" % self.__config.get_guest_name()), > + grid] > + > +def DefineDomain(): > + screen = DomainConfigScreen() > + screen.start() > diff --git a/nodeadmin/destroydomain.py b/nodeadmin/destroydomain.py > new file mode 100755 > index 0000000..350c32e > --- /dev/null > +++ b/nodeadmin/destroydomain.py > @@ -0,0 +1,66 @@ > +#!/usr/bin/env python > +# > +# destroydomain.py - Copyright (C) 2009 Red Hat, Inc. > +# Written by Darryl L. Pierce > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +from snack import * > +from configscreen import * > + > +class DestroyDomainConfigScreen(DomainListConfigScreen): > + LIST_PAGE = 1 > + DESTROY_PAGE = 2 > + > + def __init__(self): > + DomainListConfigScreen.__init__(self, "Destroy A Domain") > + > + def get_elements_for_page(self, screen, page): > + if page is self.LIST_PAGE: > + return self.get_domain_list_page(screen, defined = False) > + elif page is self.DESTROY_PAGE: > + return self.get_destroy_page(screen) > + > + def page_has_next(self, page): > + if page is self.LIST_PAGE: return self.has_selectable_domains() > + return False > + > + def page_has_back(self, page): > + if page is self.DESTROY_PAGE: return True > + return False > + > + def validate_input(self, page, errors): > + if page is self.LIST_PAGE: > + if self.get_selected_domain() is not None: > + domain = self.get_selected_domain() > + try: > + self.get_libvirt().destroy_domain(domain) > + return True > + except Exception, error: > + errors.append("There was an error destroy the domain: %s" % domain) > + errors.append(str(error)) > + else: > + errors.append("You must first select a domain to destroy.") > + return False > + > + def get_destroy_page(self, screen): > + grid = Grid(1, 1) > + grid.setField(Label("%s was successfully destroyed." % self.get_selected_domain()), 0, 0) > + return [grid] > + > +def DestroyDomain(): > + screen = DestroyDomainConfigScreen() > + screen.start() > diff --git a/nodeadmin/domainconfig.py b/nodeadmin/domainconfig.py > new file mode 100644 > index 0000000..ef39fe0 > --- /dev/null > +++ b/nodeadmin/domainconfig.py > @@ -0,0 +1,217 @@ > +# domainconfig.py - Copyright (C) 2009 Red Hat, Inc. > +# Written by Darryl L. Pierce > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +from virtinst import Guest > + > +class DomainConfig: > + LOCAL_INSTALL = "local" > + NETWORK_INSTALL = "network" > + PXE_INSTALL = "pxe" > + INSTALL_TYPE_TEXT = {LOCAL_INSTALL : "Local CDROM/ISO", > + NETWORK_INSTALL : "URL INstall Tree", > + PXE_INSTALL : "PXE Install"} > + > + INSTALL_SOURCE_CDROM = "cdrom" > + INSTALL_SOURCE_ISO = "iso" > + > + NEW_STORAGE = "new" > + EXISTING_STORAGE = "existing" > + > + def __init__(self): > + self.__guest_name = "" > + self.__install_type = DomainConfig.LOCAL_INSTALL > + self.__use_cdrom_source = True > + self.__install_location = "" > + self.__install_media = "" > + self.__iso_path = "" > + self.__install_url = "" > + self.__kickstart_url = "" > + self.__kernel_options = "" > + self.__os_type = "other" > + self.__os_variant = None > + self.__memory = 512 > + self.__cpus = 1 > + self.__enable_storage = True > + self.__use_local_storage = True > + self.__storage_size = 8.0 > + self.__allocate_storage = True > + self.__existing_storage = "" > + self.__network_bridge = None > + self.__mac_address = None > + self.__virt_type = None > + self.__architecture = None > + > + def set_guest_name(self, name): > + self.__guest_name = name > + > + def get_guest_name(self): > + return self.__guest_name > + > + def set_install_type(self, type): > + self.__install_type = type > + > + def get_install_type(self): > + return self.__install_type > + > + def get_install_type_text(self): > + return DomainConfig.INSTALL_TYPE_TEXT[self.get_install_type()] > + > + def is_install_type(self, type): > + return self.__install_type == type > + > + def set_install_location(self, location): > + self.__install_location = location > + > + def set_use_cdrom_source(self, use): > + self.__use_cdrom_source = use > + > + def get_use_cdrom_source(self): > + return self.__use_cdrom_source > + > + def get_install_location(self): > + return self.__install_location > + > + def is_install_location(self, location): > + return self.__install_location == location > + > + def set_install_media(self, media): > + self.__install_media = media > + > + def get_install_media(self): > + return self.__install_media > + > + def is_install_media(self, media): > + return self.__install_media == media > + > + def set_iso_path(self, path): > + self.__iso_path = path > + > + def get_iso_path(self): > + return self.__iso_path > + > + def set_install_url(self, url): > + self.__install_url = url > + > + def get_install_url(self): > + return self.__install_url > + > + def set_kickstart_url(self, url): > + self.__kickstart_url = url > + > + def get_kickstart_url(self): > + return self.__kickstart_url > + > + def set_kernel_options(self, options): > + self.__kernel_options = options > + > + def get_kernel_options(self): > + return self.__kernel_options > + > + def set_os_type(self, type): > + self.__os_type = type > + self.__os_variant = Guest.list_os_variants(type)[0] > + > + def get_os_type(self): > + return self.__os_type > + > + def is_os_type(self, type): > + return self.__os_type == type > + > + def set_os_variant(self, variant): > + self.__os_variant = variant > + > + def get_os_variant(self): > + return self.__os_variant > + > + def is_os_variant(self, variant): > + return self.__os_variant == variant > + > + def set_memory(self, memory): > + self.__memory = int(memory) > + > + def get_memory(self): > + return self.__memory > + > + def set_cpus(self, cpus): > + self.__cpus = cpus > + > + def get_cpus(self): > + return self.__cpus > + > + def set_enable_storage(self, enable): > + self.__enable_storage = enable > + > + def get_enable_storage(self): > + return self.__enable_storage > + > + def set_use_local_storage(self, use): > + self.__use_local_storage = use > + > + def get_use_local_storage(self): > + return self.__use_local_storage > + > + def set_storage_size(self, size): > + self.__storage_size = size > + > + def get_storage_size(self): > + return self.__storage_size > + > + def set_allocate_storage(self, allocate): > + self.__allocate_storage = allocate > + > + def get_allocate_storage(self): > + return self.__allocate_storage > + > + def set_existing_storage(self, storage): > + self.__existing_storage = storage > + > + def get_existing_storage(self): > + return self.__existing_storage > + > + def is_existing_storage(self, storage): > + return self.__existing_storage == storage > + > + def set_network_bridge(self, bridge): > + self.__network_bridge = bridge > + > + def get_network_bridge(self): > + return self.__network_bridge > + > + def set_mac_address(self, address): > + self.__mac_address = address > + > + def get_mac_address(self): > + return self.__mac_address > + > + def set_virt_type(self, type): > + self.__virt_type = type > + > + def get_virt_type(self): > + return self.__virt_type > + > + def is_virt_type(self, type): > + return self.__virt_type == type > + > + def set_architecture(self, architecture): > + self.__architecture = architecture > + > + def get_architecture(self): > + return self.__architecture > + > + def is_architecture(self, architecture): > + return self.__architecture == architecture > diff --git a/nodeadmin/halworker.py b/nodeadmin/halworker.py > new file mode 100644 > index 0000000..448c22d > --- /dev/null > +++ b/nodeadmin/halworker.py > @@ -0,0 +1,37 @@ > +# halworker.py - Copyright (C) 2009 Red Hat, Inc. > +# Written by Darryl L. Pierce > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +import dbus > +import virtinst > + > +class HALWorker: > + '''Provides utilities for working with HAL to get hardware information.''' > + def __init__(self): > + self.__bus = dbus.SystemBus() > + hobj = self.__bus.get_object("org.freedesktop.Hal", "/org/freedesktop/Hal/Manager") > + self.__conn = dbus.Interface(hobj, "org.freedesktop.Hal.Manager") > + > + def list_installable_volumes(self): > + result = {} > + for udi in self.__conn.FindDeviceByCapability("volume"): > + device = self.__bus.get_object("org.freedesktop.Hal", udi) > + info = dbus.Interface(device, "org.freedesktop.Hal.Device") > + if info.GetProperty("volume.is_disc"): > + if info.GetProperty("volume.disc.has_data"): > + result[str(info.GetProperty("block.device"))] = info.GetProperty("volume.label") > + return result > diff --git a/nodeadmin/libvirtworker.py b/nodeadmin/libvirtworker.py > new file mode 100644 > index 0000000..d10595c > --- /dev/null > +++ b/nodeadmin/libvirtworker.py > @@ -0,0 +1,271 @@ > +# libvirtworker.py - Copyright (C) 2009 Red Hat, Inc. > +# Written by Darryl L. Pierce > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +import dbus > +import libvirt > +import os > +import virtinst > + > +from domainconfig import DomainConfig > + > +DEFAULT_POOL_TARGET_PATH="/var/lib/libvirt/images" > + > +class LibvirtWorker: > + '''Provides utilities for interfacing with libvirt.''' > + def __init__(self, url = "qemu:///system"): > + self.__conn = libvirt.open(url) > + self.__capabilities = virtinst.CapabilitiesParser.parse(self.__conn.getCapabilities()) > + self.__net = virtinst.VirtualNetworkInterface(conn = self.__conn) > + self.__net.setup(self.__conn) > + (self.__new_guest, self.__new_domain) = virtinst.CapabilitiesParser.guest_lookup(conn = self.__conn) > + > + def list_domains(self, defined = True, started = True): > + '''Lists all domains.''' > + result = [] > + if defined: > + result.extend(self.__conn.listDefinedDomains()) > + if started: > + for id in self.__conn.listDomainsID(): > + result.append(self.__conn.lookupByID(id).name()) > + return result > + > + def get_domain(self, name): > + '''Returns the specified domain.''' > + result = self.__conn.lookupByName(name) > + if result is None: raise Exception("No such domain exists: %s" % name) > + > + return result > + > + def domain_exists(self, name): > + '''Returns whether a domain with the specified node exists.''' > + domains = self.list_domains() > + if name in domains: return True > + return False > + > + def create_domain(self, name): > + '''Creates the specified domain.''' > + domain = self.get_domain(name) > + domain.create() > + > + def destroy_domain(self, name): > + '''Destroys the specified domain.''' > + domain = self.get_domain(name) > + domain.destroy() > + > + def undefine_domain(self, name): > + '''Undefines the specified domain.''' > + domain = self.get_domain(name) > + domain.undefine() > + > + def list_storage_pools(self): > + '''Returns the list of all defined storage pools.''' > + return self.__conn.listStoragePools() > + > + def storage_pool_exists(self, name): > + '''Returns whether a storage pool exists.''' > + pools = self.list_storage_pools() > + if name in pools: return True > + return False > + > + def define_storage_pool(self, name): > + '''Defines a storage pool with the given name.''' > + try: > + pool = virtinst.Storage.DirectoryPool(conn=self.__conn, > + name=name, > + target_path=DEFAULT_POOL_TARGET_PATH) > + newpool = pool.install(build=True, create=True) > + newpool.setAutostart(True) > + except Exception, error: > + raise RuntimeError("Could not create pool: %s - %s", str(error)) > + > + def list_bridges(self): > + '''Lists all defined and active bridges.''' > + bridges = self.__conn.listNetworks() > + bridges.extend(self.__conn.listDefinedNetworks()) > + result = [] > + for name in bridges: > + bridge = self.__conn.networkLookupByName(name) > + result.append(bridge) > + return result > + > + def generate_mac_address(self): > + return self.__net.macaddr > + > + def list_storage_volumes(self): > + '''Lists all defined storage volumes.''' > + pools = self.__conn.listStoragePools() > + pools.extend(self.__conn.listDefinedStoragePools()) > + result = [] > + for name in pools: > + pool = self.__conn.storagePoolLookupByName(name) > + for volname in pool.listVolumes(): > + volume = self.__conn.storageVolLookupByPath("/var/lib/libvirt/images/%s" % volname) > + result.append(volume) > + return result > + > + def get_storage_size(self, name): > + '''Returns the size of the specified storage volume.''' > + volume = self.__conn.storageVolLookupByPath("/var/lib/libvirt/images/%s" % name) > + return volume.info()[1] / (1024.0 ** 3) > + > + def get_virt_types(self): > + result = [] > + for guest in self.__capabilities.guests: > + guest_type = guest.os_type > + for domain in guest.domains: > + domain_type = domain.hypervisor_type > + label = domain_type > + > + if domain_type is "kvm" and guest_type is "xen": label = "xenner" > + elif domain_type is "xen": > + if guest_type is "xen": > + label = "xen (paravirt)" > + elif guest_type is "kvm": > + label = "xen (fullvirt)" > + elif domain_type is "test": > + if guest_type is "xen": > + label = "test (xen)" > + elif guest_type is "hvm": > + label = "test (hvm)" > + > + for row in result: > + if row[0] == label: > + label = None > + break > + if label is None: continue > + > + result.append([label, domain_type, guest_type]) > + return result > + > + def list_virt_types(self): > + virt_types = self.get_virt_types() > + result = [] > + for type in virt_types: > + result.append(type[0]) > + return result > + > + def get_default_architecture(self): > + '''Returns a default hypervisor type for new domains.''' > + return self.__new_guest.arch > + > + def get_hypervisor(self, virt_type): > + virt_types = self.get_virt_types() > + for type in virt_types: > + if type[0] is virt_type: return type[1] > + return None > + > + def get_default_virt_type(self): > + '''Returns the default virtualization type for new domains.''' > + return self.__new_domain.hypervisor_type > + > + def get_os_type(self, virt_type): > + virt_types = self.get_virt_types() > + for type in virt_types: > + if type[0] is virt_type: return type[2] > + return None > + > + def list_architectures(self): > + result = [] > + for guest in self.__capabilities.guests: > + for domain in guest.domains: > + label = guest.arch > + for row in result: > + if row == label: > + label = None > + break > + if label is None: continue > + > + result.append(label) > + return result > + > + def define_domain(self, config, meter): > + location = extra = kickstart = None > + > + if config.get_install_type() == DomainConfig.LOCAL_INSTALL: > + if config.get_use_cdrom_source(): > + iclass = virtinst.DistroInstaller > + location = config.get_install_media() > + else: > + iclass = virtinst.LiveCDInstaller > + location = config.get_is_path() > + elif config.get_install_type() == DomainConfig.NETWORK_INSTALL: > + iclass = virtinst.DistroInstaller > + location = config.get_install_url() > + extra = config.get_kernel_options() > + kickstart = config.get_kickstart_url() > + elif config.get_install_type() == DomainConfig.PXE_INSTALL: > + iclass = virtinst.PXEInstaller > + > + installer = iclass(conn = self.__conn, > + type = self.get_hypervisor(config.get_virt_type()), > + os_type = self.get_os_type(config.get_virt_type())) > + self.__guest = installer.guest_from_installer() > + self.__guest.name = config.get_guest_name() > + self.__guest.vcpus = config.get_cpus() > + self.__guest.memory = config.get_memory() > + self.__guest.maxmemory = config.get_memory() > + > + self.__guest.installer.location = location > + if config.get_use_cdrom_source(): self.__guest.installer.cdrom = True > + extraargs = "" > + if extra: extraargs += extra > + if kickstart: extraargs += " ks=%s" % kickstart > + if extraargs: self.__guest.installer.extraarags = extraargs > + > + self.__guest.uuid = virtinst.util.uuidToString(virtinst.util.randomUUID()) > + > + if config.get_os_type() != "generic": self.__guest.os_type = config.get_os_type() > + if config.get_os_variant() != "generic": self.__guest.os_variant = config.get_os_variant() > + > + self.__guest._graphics_dev = virtinst.VirtualGraphics(type = virtinst.VirtualGraphics.TYPE_VNC) > + self.__guest.sound_devs = [] > + self.__guest.sound_devs.append(virtinst.VirtualAudio(model = "es1370")) > + > + self._setup_nics(config) > + self._setup_disks(config) > + > + self.__guest.conn = self.__conn > + self.__domain = self.__guest.start_install(False, meter = meter) > + > + def _setup_nics(self, config): > + self.__guest.nics = [] > + nic = virtinst.VirtualNetworkInterface(type = virtinst.VirtualNetworkInterface.TYPE_VIRTUAL, > + bridge = config.get_network_bridge(), > + network = config.get_network_bridge(), > + macaddr = config.get_mac_address()) > + self.__guest.nics.append(nic) > + > + def _setup_disks(self, config): > + self.__guest.disks = [] > + if config.get_enable_storage(): > + path = None > + if config.get_use_local_storage(): > + if self.storage_pool_exists("default") is False: > + self.define_storage_pool("default") > + pool = self.__conn.storagePoolLookupByName("default") > + path = virtinst.Storage.StorageVolume.find_free_name(config.get_guest_name(), > + pool_object = pool, > + suffix = ".img") > + path = os.path.join(DEFAULT_POOL_TARGET_PATH, path) > + > + if path is not None: > + storage= virtinst.VirtualDisk(conn = self.__conn, > + path = path, > + size = config.get_storage_size()) > + self.__guest.disks.append(storage) > + self.__guest.conn = self.__conn > diff --git a/nodeadmin/listdomains.py b/nodeadmin/listdomains.py > new file mode 100755 > index 0000000..1b51ee2 > --- /dev/null > +++ b/nodeadmin/listdomains.py > @@ -0,0 +1,68 @@ > +#!/usr/bin/env python > +# > +# listdomains.py - Copyright (C) 2009 Red Hat, Inc. > +# Written by Darryl L. Pierce > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +from snack import * > +from libvirtworker import LibvirtWorker > +from configscreen import * > + > +class ListDomainsConfigScreen(DomainListConfigScreen): > + LIST_PAGE = 1 > + DETAIL_PAGE = 2 > + > + def __init__(self): > + DomainListConfigScreen.__init__(self, 'List Domains') > + > + def page_has_next(self, page): > + return (page == self.LIST_PAGE) > + > + def page_has_back(self, page): > + return (page == self.DETAIL_PAGE) > + > + def validate_input(self, page, errors): > + if page == self.LIST_PAGE: > + if self.get_selected_domain() is None: > + errors.append("Please select a domain to view.") > + else: > + return True > + > + def get_elements_for_page(self, screen, page): > + if page == self.LIST_PAGE: > + return self.get_domain_list_page(screen) > + elif page == self.DETAIL_PAGE: > + return self.get_detail_page_elements(screen) > + > + def get_detail_page_elements(self, screen): > + domain = self.get_libvirt().get_domain(self.get_selected_domain()) > + grid = Grid(2, 5) > + grid.setField(Label("Name: "), 0, 0, anchorRight = 1) > + grid.setField(Label(domain.name()), 1, 0, anchorLeft = 1) > + grid.setField(Label("UUID: "), 0, 1, anchorRight = 1) > + grid.setField(Label(domain.UUIDString()), 1, 1, anchorLeft = 1) > + grid.setField(Label("OS Type: "), 0, 2, anchorRight = 1) > + grid.setField(Label(domain.OSType()), 1, 2, anchorLeft = 1) > + grid.setField(Label("Max. Memory: "), 0, 3, anchorRight = 1) > + grid.setField(Label(str(domain.maxMemory())), 1, 3, anchorLeft = 1) > + grid.setField(Label("Max. VCPUs: "), 0, 4, anchorRight = 1) > + grid.setField(Label(str(domain.maxVcpus())), 1, 4, anchorLeft = 1) > + return [grid] > + > +def ListDomains(): > + screen = ListDomainsConfigScreen() > + screen.start() > diff --git a/nodeadmin/mainmenu.py b/nodeadmin/mainmenu.py > new file mode 100755 > index 0000000..2808dad > --- /dev/null > +++ b/nodeadmin/mainmenu.py > @@ -0,0 +1,71 @@ > +# mainmenu.py - Copyright (C) 2009 Red Hat, Inc. > +# Written by Darryl L. Pierce > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +from snack import * > +import traceback > +from configscreen import ConfigScreen > +from definedomain import DefineDomain > +from createdomain import CreateDomain > +from destroydomain import DestroyDomain > +from undefinedomain import UndefineDomain > +from listdomains import ListDomains > +from createuser import CreateUser > + > +DEFINE_DOMAIN = 1 > +CREATE_DOMAIN = 2 > +DESTROY_DOMAIN = 3 > +UNDEFINE_DOMAIN = 4 > +LIST_DOMAINS = 5 > +CREATE_USER = 6 > +EXIT_CONSOLE = 99 > + > +def MainMenu(): > + finished = False > + while finished == False: > + screen = SnackScreen() > + menu = Listbox(height = 0, width = 0, returnExit = 1) > + menu.append("Define A Domain", DEFINE_DOMAIN) > + menu.append("Create A Domain", CREATE_DOMAIN) > + menu.append("Destroy A Domain", DESTROY_DOMAIN) > + menu.append("Undefine A Domain", UNDEFINE_DOMAIN) > + menu.append("List All Domains", LIST_DOMAINS) > + menu.append("Create A User", CREATE_USER) > + menu.append("Exit Administration", EXIT_CONSOLE) > + gridform = GridForm(screen, "Node Administration Console", 1, 4) > + gridform.add(menu, 0, 0) > + result = gridform.run(); > + screen.popWindow() > + screen.finish() > + > + try: > + if result.current() == DEFINE_DOMAIN: DefineDomain() > + elif result.current() == CREATE_DOMAIN: CreateDomain() > + elif result.current() == DESTROY_DOMAIN: DestroyDomain() > + elif result.current() == UNDEFINE_DOMAIN: UndefineDomain() > + elif result.current() == LIST_DOMAINS: ListDomains() > + elif result.current() == CREATE_USER: CreateUser() > + elif result.current() == EXIT_CONSOLE: finished = True > + except Exception, error: > + screen = SnackScreen() > + ButtonChoiceWindow(screen, > + "An Exception Has Occurred", > + str(error) + "\n" + traceback.format_exc(), > + buttons = ["OK"]) > + screen.popWindow() > + screen.finish() > + finished = True > diff --git a/nodeadmin/nodeadmin.py b/nodeadmin/nodeadmin.py > new file mode 100755 > index 0000000..864a4c0 > --- /dev/null > +++ b/nodeadmin/nodeadmin.py > @@ -0,0 +1,29 @@ > +#!/usr/bin/env python > +# > +# node-admin - Copyright (C) 2009 Red Hat, Inc. > +# Written by Darryl L. Pierce > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +import sys > + > +from mainmenu import MainMenu > + > +def NodeAdmin(): > + MainMenu() > + > +if __name__ == "__main__": > + sys.exit(NodeAdmin()) > diff --git a/nodeadmin/setup.py.in b/nodeadmin/setup.py.in > new file mode 100644 > index 0000000..f51a34c > --- /dev/null > +++ b/nodeadmin/setup.py.in > @@ -0,0 +1,34 @@ > +# setup.py - Copyright (C) 2009 Red Hat, Inc. > +# Written by Darryl L. Pierce > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +from setuptools import setup, find_packages > + > +setup(name = "nodeadmin", > + version = "@VERSION@", > + package_dir = {'nodeadmin': 'nodeadmin'}, > + packages = find_packages('.'), > + entry_points = { > + 'console_scripts': [ > + 'nodeadmin = nodeadmin.nodeadmin:NodeAdmin', > + 'definedom = nodeadmin.definedomain:DefineDomain', > + 'createdom = nodeadmin.createdomain:CreateDomain', > + 'destroydom = nodeadmin.destroydomain:DestroyDomain', > + 'undefinedom = nodeadmin.undefinedomain:UndefineDomain', > + 'createuser = nodeadmin.createuser:CreateUser', > + 'listdoms = nodeadmin.listdomains:ListDomains'] > + }) > diff --git a/nodeadmin/undefinedomain.py b/nodeadmin/undefinedomain.py > new file mode 100755 > index 0000000..2620540 > --- /dev/null > +++ b/nodeadmin/undefinedomain.py > @@ -0,0 +1,83 @@ > +#!/usr/bin/env python > +# > +# undefinedomain.py - Copyright (C) 2009 Red Hat, Inc. > +# Written by Darryl L. Pierce > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +from snack import * > +from configscreen import * > + > +class UndefineDomainConfigScreen(DomainListConfigScreen): > + LIST_PAGE = 1 > + CONFIRM_PAGE = 2 > + UNDEFINE_PAGE = 3 > + > + def __init__(self): > + DomainListConfigScreen.__init__(self, "Undefine A Domain") > + > + def get_elements_for_page(self, screen, page): > + if page is self.LIST_PAGE: return self.get_domain_list_page(screen) > + elif page is self.CONFIRM_PAGE: return self.get_confirm_page(screen) > + elif page is self.UNDEFINE_PAGE: return self.get_undefine_page(screen) > + > + def page_has_next(self, page): > + if page is self.LIST_PAGE: return self.has_selectable_domains() > + elif page is self.CONFIRM_PAGE: return True > + return False > + > + def page_has_back(self, page): > + if page is self.CONFIRM_PAGE: return True > + elif page is self.UNDEFINE_PAGE: return True > + return False > + > + def get_back_page(self, page): > + if page is self.CONFIRM_PAGE: return self.LIST_PAGE > + elif page is self.UNDEFINE_PAGE: return self.LIST_PAGE > + > + def validate_input(self, page, errors): > + if page is self.LIST_PAGE: > + if self.get_selected_domain() is not None: > + return True > + else: > + errors.append("You must first select a domain.") > + elif page is self.CONFIRM_PAGE: > + if self.__confirm_undefine.value(): > + domain = self.get_selected_domain() > + try: > + self.get_libvirt().undefine_domain(domain) > + return True > + except Exception, error: > + errors.append("Failed to undefine %s." % domain) > + errors.append(str(error)) > + else: > + errors.append("You must confirm undefining the domain to proceed.") > + return False > + > + def get_confirm_page(self, screen): > + self.__confirm_undefine = Checkbox("Check here to confirm undefining %s." % self.get_selected_domain(), 0) > + grid = Grid(1, 1) > + grid.setField(self.__confirm_undefine, 0, 0) > + return [grid] > + > + def get_undefine_page(self, screen): > + grid = Grid(1, 1) > + grid.setField(Label("%s has been undefined." % self.get_selected_domain()), 0, 0) > + return [grid] > + > +def UndefineDomain(): > + screen = UndefineDomainConfigScreen() > + screen.start() > diff --git a/nodeadmin/userworker.py b/nodeadmin/userworker.py > new file mode 100644 > index 0000000..167197b > --- /dev/null > +++ b/nodeadmin/userworker.py > @@ -0,0 +1,38 @@ > +# userworker.py - Copyright (C) 2009 Red Hat, Inc. > +# Written by Darryl L. Pierce > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +import libuser > + > +class UserWorker: > + '''Provides APIs for creating, modifying and deleting user accounts.''' > + def __init__(self): > + self.__admin = libuser.admin() > + > + def create_user(self, username, password, other_group): > + '''Creates a new user account with the provides username, > + password. The user is also added to the optional group > + if one is specified.''' > + user = self.__admin.initUser(username) > + user.set('pw_passwd', password) > + self.__admin.addUser(user) > + if other_group is not None: > + group = self.__admin.lookupGroupByName(other_group) > + if group is None: raise Exception("Invalid group specified: %s" % other_group) > + user.add('pw_gid', group.get('pw_gid')[0]) > + self.__admin.modifyUser(user) > + > diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in > index 12815c9..9091f4f 100644 > --- a/ovirt-node.spec.in > +++ b/ovirt-node.spec.in > @@ -1,5 +1,7 @@ > %define product_family oVirt Node > %define beta Beta > +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} > + > > Summary: The oVirt Node daemons/scripts > Name: ovirt-node > @@ -21,6 +23,8 @@ Requires(post): /sbin/chkconfig > Requires(preun): /sbin/chkconfig > BuildRequires: libvirt-devel >= 0.5.1 > BuildRequires: dbus-devel hal-devel > +BuildRequires: python-devel > +BuildRequires: python-setuptools > Requires: libvirt >= 0.6.3 > Requires: augeas >= 0.3.5 > Requires: libvirt-qpid >= 0.2.14-3 > @@ -44,6 +48,10 @@ Requires: nc > Requires: grub > Requires: /usr/sbin/crond > Requires: anyterm > +Requires: newt-python > +Requires: libuser-python > +Requires: dbus-python > + > ExclusiveArch: %{ix86} x86_64 > > %define app_root %{_datadir}/%{name} > @@ -144,6 +152,7 @@ cd - > %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/cron.d > %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/cron.hourly > %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/logrotate.d > +%{__install} -d -m0755 %{buildroot}%{python_sitelib}/nodeadmin > > %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir} > %{__install} -p -m0755 scripts/ovirt-config-boot %{buildroot}%{_sbindir} > @@ -164,6 +173,21 @@ cd - > %{__install} -p -m0755 scripts/persist %{buildroot}%{_sbindir} > %{__install} -p -m0755 scripts/unpersist %{buildroot}%{_sbindir} > > +%{__install} -p -m0644 nodeadmin/__init__.py %{buildroot}%{python_sitelib}/nodeadmin > +%{__install} -p -m0644 nodeadmin/configscreen.py %{buildroot}%{python_sitelib}/nodeadmin > +%{__install} -p -m0755 nodeadmin/createdomain.py %{buildroot}%{python_sitelib}/nodeadmin > +%{__install} -p -m0755 nodeadmin/createuser.py %{buildroot}%{python_sitelib}/nodeadmin > +%{__install} -p -m0755 nodeadmin/definedomain.py %{buildroot}%{python_sitelib}/nodeadmin > +%{__install} -p -m0755 nodeadmin/destroydomain.py %{buildroot}%{python_sitelib}/nodeadmin > +%{__install} -p -m0644 nodeadmin/domainconfig.py %{buildroot}%{python_sitelib}/nodeadmin > +%{__install} -p -m0644 nodeadmin/halworker.py %{buildroot}%{python_sitelib}/nodeadmin > +%{__install} -p -m0644 nodeadmin/libvirtworker.py %{buildroot}%{python_sitelib}/nodeadmin > +%{__install} -p -m0644 nodeadmin/userworker.py %{buildroot}%{python_sitelib}/nodeadmin > +%{__install} -p -m0755 nodeadmin/listdomains.py %{buildroot}%{python_sitelib}/nodeadmin > +%{__install} -p -m0644 nodeadmin/mainmenu.py %{buildroot}%{python_sitelib}/nodeadmin > +%{__install} -p -m0755 nodeadmin/nodeadmin.py %{buildroot}%{python_sitelib}/nodeadmin > +%{__install} -p -m0755 nodeadmin/undefinedomain.py %{buildroot}%{python_sitelib}/nodeadmin > + > # gptsync > %{__install} -p -m0755 gptsync/gptsync %{buildroot}%{_sbindir} > %{__install} -p -m0755 gptsync/showpart %{buildroot}%{_sbindir} > @@ -182,6 +206,10 @@ cd - > %{__install} -p -m0644 logrotate/ovirt-logrotate %{buildroot}%{_sysconfdir}/cron.d > %{__install} -p -m0644 logrotate/ovirt-logrotate.conf %{buildroot}%{_sysconfdir}/logrotate.d > > +# install the admin tools > +python nodeadmin/setup.py install --root %{buildroot} > +# rm -rf %{buildroot}%{python_sitelib}/nodeadmin- at VERSION@* > + > echo "oVirt Node release %{version}-%{release}" > %{buildroot}%{_sysconfdir}/ovirt-release > mkdir -p %{buildroot}/%{_sysconfdir}/default > touch %{buildroot}/%{_sysconfdir}/default/ovirt > @@ -325,7 +353,16 @@ fi > %{_sbindir}/ovirt-awake > %{_initrddir}/ovirt-functions > %defattr(-,root,root,0644) > +%{_bindir}/nodeadmin > +%{_bindir}/definedom > +%{_bindir}/createdom > +%{_bindir}/destroydom > +%{_bindir}/undefinedom > +%{_bindir}/listdoms > +%{_bindir}/createuser > %{_sysconfdir}/collectd.conf.in > +%{python_sitelib}/nodeadmin > +%{python_sitelib}/nodeadmin- at VERSION@-py2.6.egg-info > %config %attr(0644,root,root) %{_sysconfdir}/ovirt-release > %config %attr(0644,root,root) %{_sysconfdir}/default/ovirt > > Found an issue in libvirtworker.py when trying to install using an iso: "/usr/lib/python2.6/site-packages/ ? ? nodeadmin/libvirtworker.py", line ? ? 205, in define_domain ? ? AttributeError: DomainConfig ? ? instance has no attribute ? ? 'get_is_path' diff --git a/nodeadmin/libvirtworker.py b/nodeadmin/libvirtworker.py index d10595c..aec9d70 100644 --- a/nodeadmin/libvirtworker.py +++ b/nodeadmin/libvirtworker.py @@ -202,7 +202,7 @@ class LibvirtWorker: location = config.get_install_media() else: iclass = virtinst.LiveCDInstaller - location = config.get_is_path() + location = config.get_iso_path() elif config.get_install_type() == DomainConfig.NETWORK_INSTALL: iclass = virtinst.DistroInstaller location = config.get_install_url() Seems to work afa defining a domain, I'm stuck at this point of the adding tap device error but I don't see any problems pushing this and fixing as need be since it's a big addition and it's not going to cause regressions From ignazio.cassano at provincia.torino.it Mon Sep 14 16:00:40 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Mon, 14 Sep 2009 18:00:40 +0200 Subject: [Ovirt-devel] ovirt ace error In-Reply-To: <4AAA942A.6080709@redhat.com> References: <20090911180636.87h1g03oevj4gw8w@webmail.provincia.torino.it> <20090911181421.0w0idny67a8kwwk8@webmail.provincia.torino.it> <4AAA942A.6080709@redhat.com> Message-ID: <20090914180040.xbxz5g4u2jcc8cko@webmail.provincia.torino.it> Hello, I tried to not use repository rawhide when I install ovirt-server (built using ovirt.org instructions) and the problem with ipa-server kerkeros does not appear (probably the problem exists only whith the ipa and kerberos downloaded from rawhide repository). With the above procedure , ace finishes fine. When a phisical node starts, it gets pxe image but does not finish the boot procedure (it remains frozen) and it does not appear on ovirt web interface. At this time ovirt packages installed are the followings: ovirt-server-0.101-0.fc11.20090911113058git02c7e44.noarch ovirt-node-image-1.0.3-0.fc11.20090911120258git1194106.x86_64 ovirt-server-installer-0.101-0.fc11.20090911113058git02c7e44.noarch ovirt-node-image-pxe-1.0.3-0.fc11.20090911120258git1194106.x86_64 And ipa are the followings: ipa-python-1.2.1-5.fc11.x86_64 ipa-server-selinux-1.2.1-5.fc11.x86_64 ipa-admintools-1.2.1-5.fc11.x86_64 ipa-client-1.2.1-5.fc11.x86_64 ipa-server-1.2.1-5.fc11.x86_64 ----- Messaggio da jboggs at redhat.com --------- Data: Fri, 11 Sep 2009 14:17:14 -0400 Da: Joey Boggs Rispondi-A:Joey Boggs Oggetto: Re: [Ovirt-devel] ovirt ace error A: ignazio.cassano at provincia.torino.it Cc: ovirt-devel at redhat.com > ignazio.cassano at provincia.torino.it wrote: >> Good morning, >> I'd like to add some information to my previous email. >> Reading ace.log I saw kinit fails. >> Escaping to shell, I tried to execute: >> kinit admin >> kinit: Looping detected inside krb5_get_in_tkt while getting >> initial credentials >> >> >> After entering password, the following error is displayed: >> >> >> >> >> ----- Messaggio da ignazio.cassano at provincia.torino.it --------- >> Data: Fri, 11 Sep 2009 18:06:36 +0200 >> Da: ignazio.cassano at provincia.torino.it >> Rispondi-A:ignazio.cassano at provincia.torino.it >> Oggetto: [Ovirt-devel] ovirt ace error >> A: ovirt-devel at redhat.com >> >> >>> Good morning, >>> I have succesfully buil ovirt on fedora 11 but running >>> ace -d l /tmp/ace.log install ovirt I got en error (I think it is >>> krb5 issue). >>> >>> My server was not a kerberos server before installing ovirt, so I think ace >>> procedure has installed it. >>> Attacchede here there is the ace.log file. >>> Could anyone help me ? >>> Thanks & Regards >>> Ignazio >> >> >> ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- >> >> >> >> >> _______________________________________________ >> Ovirt-devel mailing list >> Ovirt-devel at redhat.com >> https://www.redhat.com/mailman/listinfo/ovirt-devel > Hmm, looks like the error message from this email, the install log > looks good other than the kinit failing so 101/108 items were > completed, can you send the error message from kinit admin again? ----- Fine del messaggio da jboggs at redhat.com ----- From jboggs at redhat.com Mon Sep 14 16:34:13 2009 From: jboggs at redhat.com (Joey Boggs) Date: Mon, 14 Sep 2009 12:34:13 -0400 Subject: [Ovirt-devel] ovirt ace error In-Reply-To: <20090914180040.xbxz5g4u2jcc8cko@webmail.provincia.torino.it> References: <20090911180636.87h1g03oevj4gw8w@webmail.provincia.torino.it> <20090911181421.0w0idny67a8kwwk8@webmail.provincia.torino.it> <4AAA942A.6080709@redhat.com> <20090914180040.xbxz5g4u2jcc8cko@webmail.provincia.torino.it> Message-ID: <4AAE7085.7060201@redhat.com> ignazio.cassano at provincia.torino.it wrote: > Hello, > I tried to not use repository rawhide when I install ovirt-server > (built using > ovirt.org instructions) and the problem with ipa-server kerkeros does not > appear (probably the problem exists only whith the ipa and kerberos > downloaded > from rawhide repository). > With the above procedure , ace finishes fine. > When a phisical node starts, it gets pxe image but does not finish the > boot > procedure (it remains frozen) and it does not appear on ovirt web > interface. > > At this time ovirt packages installed are the followings: > > ovirt-server-0.101-0.fc11.20090911113058git02c7e44.noarch > ovirt-node-image-1.0.3-0.fc11.20090911120258git1194106.x86_64 > ovirt-server-installer-0.101-0.fc11.20090911113058git02c7e44.noarch > ovirt-node-image-pxe-1.0.3-0.fc11.20090911120258git1194106.x86_64 > > > And ipa are the followings: > > ipa-python-1.2.1-5.fc11.x86_64 > ipa-server-selinux-1.2.1-5.fc11.x86_64 > ipa-admintools-1.2.1-5.fc11.x86_64 > ipa-client-1.2.1-5.fc11.x86_64 > ipa-server-1.2.1-5.fc11.x86_64 > > > > ----- Messaggio da jboggs at redhat.com --------- > Data: Fri, 11 Sep 2009 14:17:14 -0400 > Da: Joey Boggs > Rispondi-A:Joey Boggs > Oggetto: Re: [Ovirt-devel] ovirt ace error > A: ignazio.cassano at provincia.torino.it > Cc: ovirt-devel at redhat.com > > >> ignazio.cassano at provincia.torino.it wrote: >>> Good morning, >>> I'd like to add some information to my previous email. >>> Reading ace.log I saw kinit fails. >>> Escaping to shell, I tried to execute: >>> kinit admin >>> kinit: Looping detected inside krb5_get_in_tkt while getting >>> initial credentials >>> >>> >>> After entering password, the following error is displayed: >>> >>> >>> >>> >>> ----- Messaggio da ignazio.cassano at provincia.torino.it --------- >>> Data: Fri, 11 Sep 2009 18:06:36 +0200 >>> Da: ignazio.cassano at provincia.torino.it >>> Rispondi-A:ignazio.cassano at provincia.torino.it >>> Oggetto: [Ovirt-devel] ovirt ace error >>> A: ovirt-devel at redhat.com >>> >>> >>>> Good morning, >>>> I have succesfully buil ovirt on fedora 11 but running >>>> ace -d l /tmp/ace.log install ovirt I got en error (I think it is >>>> krb5 issue). >>>> >>>> My server was not a kerberos server before installing ovirt, so I >>>> think ace >>>> procedure has installed it. >>>> Attacchede here there is the ace.log file. >>>> Could anyone help me ? >>>> Thanks & Regards >>>> Ignazio >>> >>> >>> ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- >>> >>> >>> >>> >>> _______________________________________________ >>> Ovirt-devel mailing list >>> Ovirt-devel at redhat.com >>> https://www.redhat.com/mailman/listinfo/ovirt-devel >> Hmm, looks like the error message from this email, the install log >> looks good other than the kinit failing so 101/108 items were >> completed, can you send the error message from kinit admin again? > > > ----- Fine del messaggio da jboggs at redhat.com ----- > > > At what point does the boot process hang? Can you ping/ssh the node? The dhcp request is logged in /var/log/messages on the management server if you need to get the ip address From dpierce at redhat.com Mon Sep 14 16:53:00 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Mon, 14 Sep 2009 12:53:00 -0400 Subject: [Ovirt-devel] [PATCH node] Introduces the node-admin toolset. In-Reply-To: <4AAE61C9.2040502@redhat.com> References: <1252694486-11597-1-git-send-email-dpierce@redhat.com> <1252694486-11597-2-git-send-email-dpierce@redhat.com> <4AAE61C9.2040502@redhat.com> Message-ID: <20090914165300.GE3255@mcpierce-laptop> On Mon, Sep 14, 2009 at 11:31:21AM -0400, Joey Boggs wrote: > Found an issue in libvirtworker.py when trying to install using an iso: > > "/usr/lib/python2.6/site-packages/ ? > ? nodeadmin/libvirtworker.py", line ? > ? 205, in define_domain ? > ? AttributeError: DomainConfig ? > ? instance has no attribute ? > ? 'get_is_path' > > > > diff --git a/nodeadmin/libvirtworker.py b/nodeadmin/libvirtworker.py > index d10595c..aec9d70 100644 > --- a/nodeadmin/libvirtworker.py > +++ b/nodeadmin/libvirtworker.py > @@ -202,7 +202,7 @@ class LibvirtWorker: > location = config.get_install_media() > else: > iclass = virtinst.LiveCDInstaller > - location = config.get_is_path() > + location = config.get_iso_path() > elif config.get_install_type() == DomainConfig.NETWORK_INSTALL: > iclass = virtinst.DistroInstaller > location = config.get_install_url() Okay, I've fixed this in my repo locally. > Seems to work afa defining a domain, I'm stuck at this point of the > adding tap device error but I don't see any problems pushing this and > fixing as need be since it's a big addition and it's not going to cause > regressions I'm not sure what that is. One checking I've put in today, but haven't tested, is to ensure that the network interface is up and running. I saw that the bridge named "default" is not started when the node is booted. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Virtual Machine Management - http://www.ovirt.org/ Is fearr Gaeilge bhriste n? B?arla cliste. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: From dpierce at redhat.com Mon Sep 14 20:51:16 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Mon, 14 Sep 2009 16:51:16 -0400 Subject: [Ovirt-devel] Bugfixes... Message-ID: <1252961477-10938-1-git-send-email-dpierce@redhat.com> This version fixes a few bugs found by jboggs. It also includes some logging facilities that need to be fleshed out more. From dpierce at redhat.com Mon Sep 14 20:51:17 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Mon, 14 Sep 2009 16:51:17 -0400 Subject: [Ovirt-devel] [PATCH node] Introduces the node-admin toolset. In-Reply-To: <1252961477-10938-1-git-send-email-dpierce@redhat.com> References: <1252961477-10938-1-git-send-email-dpierce@redhat.com> Message-ID: <1252961477-10938-2-git-send-email-dpierce@redhat.com> Defines a primary entry point that displays a menu of options that user can use to administer the managed node. It leverages the code from virtinst-python to do the heavy lifting and just provides a front end for collecting user data. Created a new configuration class to be used for all configuration screens. The user can select to create a node. They are then walked through the steps to create a domain similar to virt-manager. The user can create a defined domain. The user can destroy a created domain. The user can undefine a defined domain. The user can list all domains on the system. The user can create a new user account. When the RPM is created, a separate entry point is created for each node admin command. This allows the commands to be invoked individually as well as from the main menu. Signed-off-by: Darryl L. Pierce --- .gitignore | 1 + Makefile.am | 16 ++ configure.ac | 1 + nodeadmin/__init__.py | 20 ++ nodeadmin/configscreen.py | 150 ++++++++++++++ nodeadmin/createdomain.py | 68 ++++++ nodeadmin/createuser.py | 106 ++++++++++ nodeadmin/definedomain.py | 471 +++++++++++++++++++++++++++++++++++++++++++ nodeadmin/destroydomain.py | 66 ++++++ nodeadmin/domainconfig.py | 217 ++++++++++++++++++++ nodeadmin/halworker.py | 37 ++++ nodeadmin/libvirtworker.py | 276 +++++++++++++++++++++++++ nodeadmin/listdomains.py | 68 ++++++ nodeadmin/mainmenu.py | 74 +++++++ nodeadmin/nodeadmin.py | 29 +++ nodeadmin/setup.py.in | 34 +++ nodeadmin/undefinedomain.py | 83 ++++++++ nodeadmin/userworker.py | 38 ++++ ovirt-node.spec.in | 38 ++++ 19 files changed, 1793 insertions(+), 0 deletions(-) create mode 100644 nodeadmin/__init__.py create mode 100644 nodeadmin/configscreen.py create mode 100755 nodeadmin/createdomain.py create mode 100755 nodeadmin/createuser.py create mode 100755 nodeadmin/definedomain.py create mode 100755 nodeadmin/destroydomain.py create mode 100644 nodeadmin/domainconfig.py create mode 100644 nodeadmin/halworker.py create mode 100644 nodeadmin/libvirtworker.py create mode 100755 nodeadmin/listdomains.py create mode 100755 nodeadmin/mainmenu.py create mode 100755 nodeadmin/nodeadmin.py create mode 100644 nodeadmin/setup.py.in create mode 100755 nodeadmin/undefinedomain.py create mode 100644 nodeadmin/userworker.py diff --git a/.gitignore b/.gitignore index 26a0210..19b15d1 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ missing stamp-h1 ovirt-node*.gz ovirt-node.spec +*.pyc diff --git a/Makefile.am b/Makefile.am index 419cdf1..2d195c0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,6 +26,22 @@ EXTRA_DIST = \ ovirt-node-selinux.fc \ images/grub-splash.xpm.gz \ images/syslinux-vesa-splash.jpg \ + nodeadmin/__init__.py \ + nodeadmin/configscreen.py \ + nodeadmin/createuser.py \ + nodeadmin/destroydomain.py \ + nodeadmin/halworker.py \ + nodeadmin/libvirtworker.py \ + nodeadmin/userworker.py \ + nodeadmin/mainmenu.py \ + nodeadmin/undefinedomain.py \ + nodeadmin/createdomain.py \ + nodeadmin/definedomain.py \ + nodeadmin/domainconfig.py \ + nodeadmin/listdomains.py \ + nodeadmin/nodeadmin.py \ + nodeadmin/setup.py \ + nodeadmin/utils.py \ scripts/collectd.conf.in \ scripts/ovirt \ scripts/ovirt-awake \ diff --git a/configure.ac b/configure.ac index b60afeb..780b757 100644 --- a/configure.ac +++ b/configure.ac @@ -8,6 +8,7 @@ test x"$ac_ct_CC:$CFLAGS" = 'xgcc:-g -O2' \ && CFLAGS="$CFLAGS -Wshadow -Wall -Werror" AC_CONFIG_FILES([Makefile + nodeadmin/setup.py gptsync/Makefile ovirt-node.spec ]) diff --git a/nodeadmin/__init__.py b/nodeadmin/__init__.py new file mode 100644 index 0000000..1f3c72c --- /dev/null +++ b/nodeadmin/__init__.py @@ -0,0 +1,20 @@ +# __init__.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from nodeadmin import NodeAdmin + diff --git a/nodeadmin/configscreen.py b/nodeadmin/configscreen.py new file mode 100644 index 0000000..0282eee --- /dev/null +++ b/nodeadmin/configscreen.py @@ -0,0 +1,150 @@ +# configscreen.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from halworker import HALWorker +from libvirtworker import LibvirtWorker +import traceback + +BACK_BUTTON = "back" +NEXT_BUTTON = "next" +CANCEL_BUTTON = "cancel" +FINISH_BUTTON = "finish" + +class ConfigScreen: + '''Enables the creation of navigable, multi-paged configuration screens.''' + + def __init__(self, title): + self.__title = title + self.__current_page = 1 + self.__finished = False + self.__hal = HALWorker() + self.__libvirt = LibvirtWorker() + + def get_hal(self): + return self.__hal + + def get_libvirt(self): + return self.__libvirt + + def set_finished(self): + self.__finished = True + + def get_elements_for_page(self, screen, page): + return [] + + def page_has_next(self, page): + return False + + def page_has_finish(self, page): + return False + + def get_back_page(self, page): + if page > 1: return page - 1 + return page + + def go_back(self): + self.__current_page = self.get_back_page(self.__current_page) + + def get_next_page(self, page): + return page + 1 + + def go_next(self): + self.__current_page = self.get_next_page(self.__current_page) + + def validate_input(self, page, errors): + return True + + def process_input(self, page): + return + + def start(self): + active = True + while active and (self.__finished == False): + screen = SnackScreen() + gridform = GridForm(screen, self.__title, 1, 4) + elements = self.get_elements_for_page(screen, self.__current_page) + current_element = 0 + for element in elements: + gridform.add(element, 0, current_element) + current_element += 1 + # create the navigation buttons + buttons = [] + if self.__current_page > 1: buttons.append(["Back", BACK_BUTTON, "F11"]) + if self.page_has_next(self.__current_page): buttons.append(["Next", NEXT_BUTTON, "F12"]) + if self.page_has_finish(self.__current_page): buttons.append(["Finish", FINISH_BUTTON, "F10"]) + buttons.append(["Cancel", CANCEL_BUTTON, "ESC"]) + buttonbar = ButtonBar(screen, buttons) + gridform.add(buttonbar, 0, current_element, growx = 1) + current_element += 1 + try: + result = gridform.runOnce() + pressed = buttonbar.buttonPressed(result) + if pressed == BACK_BUTTON: + self.go_back() + elif pressed == NEXT_BUTTON or pressed == FINISH_BUTTON: + errors = [] + if self.validate_input(self.__current_page, errors): + self.process_input(self.__current_page) + self.go_next() + else: + error_text = "" + for error in errors: + error_text += "%s\n" % error + ButtonChoiceWindow(screen, + "There Were Errors", + error_text, + buttons = ["OK"]) + elif pressed == CANCEL_BUTTON: + active = False + except Exception, error: + ButtonChoiceWindow(screen, + "An Exception Has Occurred", + str(error) + "\n" + traceback.format_exc(), + buttons = ["OK"]) + screen.popWindow() + screen.finish() + +class DomainListConfigScreen(ConfigScreen): + '''Provides a base class for all config screens that require a domain list.''' + + def __init__(self, title): + ConfigScreen.__init__(self, title) + + def get_domain_list_page(self, screen, defined=True, created=True): + domains = self.get_libvirt().list_domains(defined, created) + result = None + + if len(domains) > 0: + self.__has_domains = True + self.__domain_list = Listbox(0) + for name in self.get_libvirt().list_domains(defined, created): + self.__domain_list.append(name, name) + result = [self.__domain_list] + else: + self.__has_domains = False + grid = Grid(1, 1) + grid.setField(Label("There are no domains available."), 0, 0) + result = [grid] + return result + + def get_selected_domain(self): + return self.__domain_list.current() + + def has_selectable_domains(self): + return self.__has_domains diff --git a/nodeadmin/createdomain.py b/nodeadmin/createdomain.py new file mode 100755 index 0000000..b73a09e --- /dev/null +++ b/nodeadmin/createdomain.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# +# createdomain.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from configscreen import * + +class CreateDomainConfigScreen(DomainListConfigScreen): + LIST_PAGE = 1 + CREATE_PAGE = 2 + + def __init__(self): + DomainListConfigScreen.__init__(self, "Create A Domain") + + def get_elements_for_page(self, screen, page): + if page is self.LIST_PAGE: + return self.get_domain_list_page(screen, created = False) + elif page is self.CREATE_PAGE: + return self.get_create_domain_page(screen) + + def page_has_next(self, page): + if page is self.LIST_PAGE: return self.has_selectable_domains() + return False + + def page_has_back(self, page): + if page is self.CREATE_PAGE: return True + return False + + def validate_input(self, page, errors): + if page is self.LIST_PAGE: + if self.get_selected_domain() is not None: + domain = self.get_selected_domain() + try: + self.get_libvirt().create_domain(domain) + return True + except Exception, error: + errors.append("There was an error creating the domain: %s" % domain) + errors.append(str(error)) + else: + errors.append("You must first select a domain to create.") + + def process_input(self, page): + print "foo" + + def get_create_domain_page(self, screen): + grid = Grid(1, 1) + grid.setField(Label("%s was successfully created." % self.get_selected_domain()), 0, 0) + return [grid] + +def CreateDomain(): + screen = CreateDomainConfigScreen() + screen.start() diff --git a/nodeadmin/createuser.py b/nodeadmin/createuser.py new file mode 100755 index 0000000..dbc4626 --- /dev/null +++ b/nodeadmin/createuser.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python +# +# createuser.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from configscreen import ConfigScreen +from userworker import UserWorker + +import libuser + +DETAILS_PAGE = 1 +CONFIRM_PAGE = 2 + +class CreateUserConfigScreen(ConfigScreen): + def __init__(self): + ConfigScreen.__init__(self, "Create A User Account") + self.__username = None + self.__useradmin = libuser.admin() + self.__user_worker = UserWorker() + + def get_elements_for_page(self, screen, page): + if page is DETAILS_PAGE: return self.get_details_page(screen) + elif page is CONFIRM_PAGE: return self.get_confirm_page(screen) + + def validate_input(self, page, errors): + if page is DETAILS_PAGE: + if len(self.__username.value()) > 0: + name = self.__username.value() + if self.__useradmin.lookupUserByName(name) is None: + if len(self.__password.value()) > 0: + if self.__password.value() == self.__confirm.value(): + return True + else: + errors.append("Passwords do not match.") + else: + errors.append("You must enter a password.") + else: + errors.append("User %s already exists." % name) + else: + errors.append("You must enter a username.") + self.__confirm.value() + return False + + def process_input(self, page): + if page is CONFIRM_PAGE: + self.__user_worker.create_user(self.__username.value(), + self.__password.value(), + "wheel" if self.__adminuser.value() else None) + self.set_finished() + + def page_has_next(self, page): + return (page is DETAILS_PAGE) + + def page_has_back(self, page): + return (page is CONFIRM_PAGE) + + def page_has_finish(self, page): + return (page is CONFIRM_PAGE) + + def get_details_page(self, screen): + if self.__username is None: + self.__username = Entry(50, "") + self.__password = Entry(50, "", password = 1) + self.__confirm = Entry(50, "", password = 1) + self.__adminuser = Checkbox("This user is an administrator", False) + grid = Grid(2, 4) + grid.setField(Label("Username:"), 0, 0, anchorRight = 1) + grid.setField(self.__username, 1, 0, anchorLeft = 1) + grid.setField(Label("Password:"), 0, 1, anchorRight = 1) + grid.setField(self.__password, 1, 1, anchorLeft = 1) + grid.setField(Label("Confirm password:"), 0, 2, anchorRight = 1) + grid.setField(self.__confirm, 1, 2, anchorLeft = 1) + grid.setField(Label(" "), 0, 3) + grid.setField(self.__adminuser, 1, 3, anchorLeft = 1) + return [Label("Enter The User Details"), + grid] + + def get_confirm_page(self, screen): + grid = Grid(1, 2) + grid.setField(Label("Username: %s" % self.__username.value()), 0, 0) + admin_label = "is not" + if self.__adminuser.value(): + admin_label = "is" + grid.setField(Label("This user %s an administrator." % admin_label), 0, 1) + return [Label("Create this user account?"), + grid] + +def CreateUser(): + screen = CreateUserConfigScreen() + screen.start() diff --git a/nodeadmin/definedomain.py b/nodeadmin/definedomain.py new file mode 100755 index 0000000..dcd74e8 --- /dev/null +++ b/nodeadmin/definedomain.py @@ -0,0 +1,471 @@ +#!/usr/bin/env python +# +# definedomain.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +import os +from domainconfig import DomainConfig +from configscreen import ConfigScreen +import urlgrabber.progress as progress + +from virtinst import * + +VM_DETAILS_PAGE = 1 +LOCAL_INSTALL_PAGE = 2 +SELECT_CDROM_PAGE = 3 +SELECT_ISO_PAGE = 4 +NETWORK_INSTALL_PAGE = 10 +OS_TYPE_PAGE = 11 +OS_VARIANT_PAGE = 12 +RAM_CPU_PAGE = 13 +ENABLE_STORAGE_PAGE = 14 +LOCAL_STORAGE_PAGE = 15 +MANAGED_STORAGE_PAGE = 16 +BRIDGE_PAGE = 17 +VIRT_DETAILS_PAGE = 18 +CONFIRM_PAGE = 19 + +LOCATION="location" +KICKSTART="kickstart" +KERNELOPTS="kernel.options" +OS_TYPE="os.type" +OS_VARIANT="os.variant" +MEMORY="memory" +CPUS="cpus" + +class DummyMeter(progress.BaseMeter): + def _do_start(self, now = None): + log("Starting...") + + def _do_end(self, amount_read, now = None): + log("Ending: read=%d" % amount_read) + + def _do_update(self, amount_read, now = None): + log("Update: read=%d" % amount_read) + + def log(self, text): + utils.log(text) + +class DomainConfigScreen(ConfigScreen): + def __init__(self): + ConfigScreen.__init__(self, "Create A New Virtual Machine") + self.__config = DomainConfig() + self.__config.set_architecture(self.get_libvirt().get_default_architecture()) + self.__config.set_virt_type(self.get_libvirt().get_default_virt_type()) + + def get_elements_for_page(self, screen, page): + if page == VM_DETAILS_PAGE: return self.get_vm_details_page(screen) + elif page == LOCAL_INSTALL_PAGE: return self.get_local_install_page(screen) + elif page == SELECT_CDROM_PAGE: return self.get_select_cdrom_page(screen) + elif page == SELECT_ISO_PAGE: return self.get_select_iso_page(screen) + elif page == NETWORK_INSTALL_PAGE: return self.get_network_install_page(screen) + elif page == OS_TYPE_PAGE: return self.get_os_type_page(screen) + elif page == OS_VARIANT_PAGE: return self.get_os_variant_page(screen) + elif page == RAM_CPU_PAGE: return self.get_ram_and_cpu_page(screen) + elif page == ENABLE_STORAGE_PAGE: return self.get_enable_storage_page(screen) + elif page == LOCAL_STORAGE_PAGE: return self.get_local_storage_page(screen) + elif page == MANAGED_STORAGE_PAGE: return self.get_managed_storage_page(screen) + elif page == BRIDGE_PAGE: return self.get_bridge_page(screen) + elif page == VIRT_DETAILS_PAGE: return self.get_virt_details_page(screen) + elif page == CONFIRM_PAGE: return self.get_confirm_page(screen) + return [] + + def validate_input(self, page, errors): + if page == VM_DETAILS_PAGE: + if len(self.__guest_name.value()) > 0: + if self.get_libvirt().domain_exists(self.__guest_name.value()): + errors.append("Guest name '%s' is already in use." % self.__guest_name.value()) + else: + return True + else: + errors.append("Guest name must be a string between 0 and 50 characters.") + elif page == LOCAL_INSTALL_PAGE: + if self.__install_source.getSelection() == DomainConfig.INSTALL_SOURCE_CDROM: + return True + elif self.__install_source.getSelection() == DomainConfig.INSTALL_SOURCE_ISO: + return True + elif page == SELECT_CDROM_PAGE: + if self.__install_media.getSelection() != None: + if len(self.get_hal().list_installable_volumes()) == 0: + errors.append("No installable media is available.") + else: + return True + else: + errors.append("You must select an install media.") + elif page == SELECT_ISO_PAGE: + if len(self.__iso_path.value()) > 0: + if os.path.exists(self.__iso_path.value()): + if os.path.isfile(self.__iso_path.value()): + return True + else: + errors.append("%s is not a file." % self.__iso_path.value()) + else: + errors.append("No such install media exists:") + errors.append(self.__iso_path.value()) + else: + errors.append("An install media selection is required.") + elif page == NETWORK_INSTALL_PAGE: + if len(self.__install_url.value()) > 0: + return True + else: + errors.append("An install tree is required.") + elif page == OS_TYPE_PAGE: return True + elif page == OS_VARIANT_PAGE: return True + elif page == RAM_CPU_PAGE: + if (len(self.__memory.value()) > 0 and len(self.__cpus.value()) > 0) \ + and (int(self.__memory.value()) > 0 and int(self.__cpus.value()) > 0): + return True + else: + if len(self.__memory.value()) == 0: + errors.append("A value must be entered for memory.") + elif int(self.__memory.value()) <= 0: + errors.append("A positive integer value must be entered for memory.") + if len(self.__cpus.value()) == 0: + errors.append("A value must be entered for CPUs.") + elif int(self.__cpus.value()) <= 0: + errors.append("A positive integer value must be entered for memory.") + elif page == ENABLE_STORAGE_PAGE: return True + elif page == LOCAL_STORAGE_PAGE: + if len(self.__storage_size.value()) > 0: + if float(self.__storage_size.value()) > 0: + return True + else: + errors.append("A positive value must be entered for the storage size.") + else: + errors.append("A value must be entered for the storage size.") + elif page == MANAGED_STORAGE_PAGE: + if self.__existing_storage.getSelection() is not None: + return True + else: + errors.append("Please select a storage volume.") + elif page == BRIDGE_PAGE: + if self.__network_bridges.getSelection() != None: + if len(self.__mac_address.value()) > 0: + # TODO: regex check the format + return True + else: + errors.append("MAC address must be supplied.") + else: + errors.append("A network bridge must be selected.") + elif page == VIRT_DETAILS_PAGE: + if self.__virt_types.getSelection() != None and self.__architectures.getSelection() != None: + return True + if self.__virt_types.getSelection() is None: + errors.append("Please select a virtualization type.") + if self.__architectures.getSelection() is None: + errors.append("Please selection an architecture.") + elif page == CONFIRM_PAGE: return True + return False + + def process_input(self, page): + if page == VM_DETAILS_PAGE: + self.__config.set_guest_name(self.__guest_name.value()) + self.__config.set_install_type(self.__install_type.getSelection()) + elif page == LOCAL_INSTALL_PAGE: + self.__config.set_use_cdrom_source(self.__install_source.getSelection() == DomainConfig.INSTALL_SOURCE_CDROM) + elif page == SELECT_CDROM_PAGE: + self.__config.set_install_media(self.__install_media.getSelection()) + elif page == SELECT_ISO_PAGE: + self.__config.set_iso_path(self.__iso_path.value()) + elif page == NETWORK_INSTALL_PAGE: + self.__config.set_install_url(self.__install_url.value()) + self.__config.set_kickstart_url(self.__kickstart_url.value()) + self.__config.set_kernel_options(self.__kernel_options.value()) + elif page == OS_TYPE_PAGE: + self.__config.set_os_type(self.__os_types.getSelection()) + elif page == OS_VARIANT_PAGE: + self.__config.set_os_variant(self.__os_variants.getSelection()) + elif page == RAM_CPU_PAGE: + self.__config.set_memory(int(self.__memory.value())) + self.__config.set_cpus(int(self.__cpus.value())) + elif page == ENABLE_STORAGE_PAGE: + self.__config.set_enable_storage(self.__enable_storage.value()) + if self.__storage_type.getSelection() == DomainConfig.NEW_STORAGE: + self.__config.set_use_local_storage(True) + elif self.__storage_type.getSelection() == Node.STORAGE_TYPE_EXISTING: + self.__config.set_use_local_storage(False) + elif page == LOCAL_STORAGE_PAGE: + self.__config.set_storage_size(float(self.__storage_size.value())) + self.__config.set_allocate_storage(self.__allocate_storage.value()) + elif page == MANAGED_STORAGE_PAGE: + self.__config.set_use_local_storage(False) + self.__config.set_existing_storage(self.__existing_storage.getSelection()) + self.__config.set_storage_size(self.get_libvirt().get_storage_size(self.__existing_storage.getSelection())) + elif page == BRIDGE_PAGE: + self.__config.set_network_bridge(self.__network_bridges.getSelection()) + elif page == VIRT_DETAILS_PAGE: + self.__config.set_virt_type(self.__virt_types.getSelection()) + self.__config.set_architecture(self.__architectures.getSelection()) + elif page == CONFIRM_PAGE: + self.get_libvirt().define_domain(self.__config, DummyMeter()) + self.set_finished() + + def get_back_page(self, page): + result = page + if page == OS_TYPE_PAGE: + install_type = self.__config.get_install_type() + if install_type == DomainConfig.LOCAL_INSTALL: + if self.__config.get_use_cdrom_source(): + result = SELECT_CDROM_PAGE + else: + result = SELECT_ISO_PAGE + elif install_type == DomainConfig.NETWORK_INSTALL: + result = NETWORK_INSTALL_PAGE + elif install_type == DomainConfig.PXE_INSTALL: + result = VM_DETAILS_PAGE + elif page == LOCAL_STORAGE_PAGE or page == MANAGED_STORAGE_PAGE: + result = ENABLE_STORAGE_PAGE + elif page == NETWORK_INSTALL_PAGE: + result = VM_DETAILS_PAGE + elif page == SELECT_CDROM_PAGE or page == SELECT_ISO_PAGE: + result = LOCAL_INSTALL_PAGE + elif page == BRIDGE_PAGE: + if self.__config.get_use_local_storage(): + result = LOCAL_STORAGE_PAGE + else: + result = MANAGED_STORAGE_PAGE + else: + if page > 1: result = page - 1 + return result + + def get_next_page(self, page): + result = page + if page == VM_DETAILS_PAGE: + install_type = self.__config.get_install_type() + if install_type == DomainConfig.LOCAL_INSTALL: + result = LOCAL_INSTALL_PAGE + elif install_type == DomainConfig.NETWORK_INSTALL: + result = NETWORK_INSTALL_PAGE + elif install_type == DomainConfig.PXE_INSTALL: + result = OS_TYPE_PAGE + elif page == LOCAL_INSTALL_PAGE: + if self.__config.get_use_cdrom_source(): + result = SELECT_CDROM_PAGE + else: + result = SELECT_ISO_PAGE + elif page == SELECT_CDROM_PAGE or page == SELECT_ISO_PAGE: + result = OS_TYPE_PAGE + elif page == NETWORK_INSTALL_PAGE: + result = OS_TYPE_PAGE + elif page == ENABLE_STORAGE_PAGE: + result = BRIDGE_PAGE + if self.__config.get_enable_storage(): + if self.__config.get_use_local_storage(): + result = LOCAL_STORAGE_PAGE + else: + result = MANAGED_STORAGE_PAGE + elif page == LOCAL_STORAGE_PAGE or page == MANAGED_STORAGE_PAGE: + result = BRIDGE_PAGE + else: + result = page + 1 + return result + + def page_has_finish(self, page): + if page == CONFIRM_PAGE: return True + return False + + def page_has_next(self, page): + if page < CONFIRM_PAGE: + return True + + def get_vm_details_page(self, screen): + self.__guest_name = Entry(50, self.__config.get_guest_name()) + self.__install_type = RadioBar(screen, (("Local install media (ISO image or CDROM)", + DomainConfig.LOCAL_INSTALL, + self.__config.is_install_type(DomainConfig.LOCAL_INSTALL)), + ("Network Install (HTTP, FTP, or NFS)", + DomainConfig.NETWORK_INSTALL, + self.__config.is_install_type(DomainConfig.NETWORK_INSTALL)), + ("Network Boot (PXE)", + DomainConfig.PXE_INSTALL, + self.__config.is_install_type(DomainConfig.PXE_INSTALL)))) + grid = Grid(2,3) + grid.setField(Label("Name:"), 0, 0, anchorRight = 1) + grid.setField(self.__guest_name, 1, 0, anchorLeft = 1) + grid.setField(Label("Choose how you would like to install the operating system"), 1, 1, + anchorLeft = 1, anchorTop = 1) + grid.setField(self.__install_type, 1, 2, anchorLeft = 1) + return [Label("Enter your machine details"), + grid] + + def get_local_install_page(self, screen): + self.__install_source = RadioBar(screen, (("Use CDROM or DVD", + DomainConfig.INSTALL_SOURCE_CDROM, + self.__config.get_use_cdrom_source()), + ("Use ISO image", + DomainConfig.INSTALL_SOURCE_ISO, + self.__config.get_use_cdrom_source() is False))) + grid = Grid(1,1) + grid.setField(self.__install_source, 0, 0, anchorLeft = 1) + return [Label("Locate your install media"), + grid] + + def get_select_cdrom_page(self, screen): + drives = [] + media = self.get_hal().list_installable_volumes() + for drive in media.keys(): + drives.append([media[drive], drive, self.__config.is_install_media(drive)]) + self.__install_media = RadioBar(screen, (drives)) + grid = Grid(1, 1) + grid.setField(self.__install_media, 0, 0) + return [Label("Select the install media"), + grid] + + def get_select_iso_page(self, screen): + self.__iso_path = Entry(50, self.__config.get_iso_path()) + grid = Grid(1, 2) + grid.setField(Label("Enter ISO path:"), 0, 0, anchorLeft = 1) + grid.setField(self.__iso_path, 0, 1, anchorLeft = 1) + return [Label("Enter the full path to an install ISO"), + grid] + + def get_network_install_page(self, screen): + self.__install_url = Entry(50, self.__config.get_install_url()) + self.__kickstart_url = Entry(50, self.__config.get_kickstart_url()) + self.__kernel_options = Entry(50, self.__config.get_kernel_options()) + grid = Grid(2,3) + grid.setField(Label("URL:"), 0, 0, anchorRight = 1) + grid.setField(self.__install_url, 1, 0, anchorLeft = 1) + grid.setField(Label("Kickstart URL:"), 0, 1, anchorRight = 1) + grid.setField(self.__kickstart_url, 1, 1, anchorLeft = 1) + grid.setField(Label("Kernel Options:"), 0, 2, anchorRight = 1) + grid.setField(self.__kernel_options, 1, 2, anchorLeft = 1) + return [Label("Provide the operating system URL"), + grid] + + def get_os_type_page(self, screen): + types = [] + for type in Guest.list_os_types(): + types.append([Guest.get_os_type_label(type), type, self.__config.is_os_type(type)]) + self.__os_types = RadioBar(screen, types) + grid = Grid(1, 1) + grid.setField(self.__os_types, 0, 0, anchorLeft = 1) + return [Label("Choose the operating system type"), + grid] + + def get_os_variant_page(self, screen): + variants = [] + type = self.__config.get_os_type() + for variant in Guest.list_os_variants(type): + variants.append([Guest.get_os_variant_label(type, variant), variant, self.__config.is_os_variant(variant)]) + self.__os_variants = RadioBar(screen, variants) + grid = Grid(1, 1) + grid.setField(self.__os_variants, 0, 0, anchorLeft = 1) + return [Label("Choose the operating system version"), + grid] + + def get_ram_and_cpu_page(self, screen): + self.__memory = Entry(10, str(self.__config.get_memory())) + self.__cpus = Entry(10, str(self.__config.get_cpus())) + grid = Grid(2,2) + grid.setField(Label("Memory (RAM):"), 0, 0, anchorRight = 1) + grid.setField(self.__memory, 1, 0, anchorLeft = 1) + grid.setField(Label("CPUs:"), 0, 1, anchorRight = 1) + grid.setField(self.__cpus, 1, 1, anchorLeft = 1) + return [Label("Choose memory and CPU settings"), + grid] + + def get_enable_storage_page(self, screen): + self.__enable_storage = Checkbox("Enable storage for this virtual machine", self.__config.get_enable_storage()) + self.__storage_type = RadioBar(screen,((["Create a disk image on the computer's hard disk", + DomainConfig.NEW_STORAGE, + self.__config.get_use_local_storage()]), + (["Select managed or other existing storage", + DomainConfig.EXISTING_STORAGE, + self.__config.get_use_local_storage() is False]))) + grid = Grid(1,2) + grid.setField(self.__enable_storage, 0, 0, anchorLeft = 1) + grid.setField(self.__storage_type, 0, 1, anchorLeft = 1) + return [Label("Configure storage"), + grid] + + def get_local_storage_page(self, screen): + self.__storage_size = Entry(6, str(self.__config.get_storage_size())) + self.__allocate_storage = Checkbox("Allocate entire disk now", self.__config.get_allocate_storage()) + grid = Grid(2, 2) + grid.setField(self.__allocate_storage, 0, 0, growx = 1, anchorLeft = 1) + grid.setField(Label("Storage size (GB):"), 0, 1, anchorLeft = 1) + grid.setField(self.__storage_size, 1, 1) + return [Label("Configure local storage"), + grid] + + def get_managed_storage_page(self, screen): + volumes = [] + for volume in self.get_libvirt().list_storage_volumes(): + volumes.append(["%s (%d GB)" % (volume.name(), volume.info()[1] / (1024 ** 3)), + volume.name(), + self.__config.is_existing_storage(volume.name())]) + self.__existing_storage = RadioBar(screen, (volumes)) + grid = Grid(2, 1) + grid.setField(Label("Existing storage:"), 0, 0) + grid.setField(self.__existing_storage, 1, 0) + return [Label("Configure managed storage"), + grid] + + def get_bridge_page(self, screen): + bridges = [] + for bridge in self.get_libvirt().list_bridges(): + bridges.append(["Virtual network '%s'" % bridge.name(), bridge.name(), self.__config.get_network_bridge() == bridge.name()]) + self.__network_bridges = RadioBar(screen, (bridges)) + if self.__config.get_mac_address() == None: + self.__config.set_mac_address(self.get_libvirt().generate_mac_address()) + self.__mac_address = Entry(20, self.__config.get_mac_address()) + grid = Grid(1, 1) + grid.setField(self.__network_bridges, 0, 0) + return [Label("Select an existing bridge"), + grid] + + def get_virt_details_page(self, screen): + virt_types = [] + for type in self.get_libvirt().list_virt_types(): + virt_types.append([type, type, self.__config.is_virt_type(type)]) + self.__virt_types = RadioBar(screen, (virt_types)) + archs = [] + for arch in self.get_libvirt().list_architectures(): + archs.append([arch, arch, self.__config.is_architecture(arch)]) + self.__architectures = RadioBar(screen, (archs)) + grid = Grid(2, 2) + grid.setField(Label("Virt Type:"), 0, 0, anchorRight = 1, anchorTop = 1) + grid.setField(self.__virt_types, 1, 0, anchorLeft = 1) + grid.setField(Label("Architecture:"), 0, 1, anchorRight = 1, anchorTop = 1) + grid.setField(self.__architectures, 1, 1, anchorLeft = 1) + return [Label("Configure virtualization details"), + grid] + + def get_confirm_page(self, screen): + grid = Grid(2, 6) + grid.setField(Label("OS:"), 0, 0, anchorRight = 1) + grid.setField(Label(Guest.get_os_variant_label(self.__config.get_os_type(), + self.__config.get_os_variant())), 1, 0, anchorLeft = 1) + grid.setField(Label("Install:"), 0, 1, anchorRight = 1) + grid.setField(Label(self.__config.get_install_type_text()), 1, 1, anchorLeft = 1) + grid.setField(Label("Memory:"), 0, 2, anchorRight = 1) + grid.setField(Label("%s MB" % self.__config.get_memory()), 1, 2, anchorLeft = 1) + grid.setField(Label("CPUs:"), 0, 3, anchorRight = 1) + grid.setField(Label("%d" % self.__config.get_cpus()), 1, 3, anchorLeft = 1) + grid.setField(Label("Storage:"), 0, 4, anchorRight = 1) + grid.setField(Label(self.__config.get_existing_storage()), 1, 4, anchorLeft = 1) + grid.setField(Label("Network:"), 0, 5, anchorRight = 1) + grid.setField(Label(self.__config.get_network_bridge()), 1, 5, anchorLeft = 1) + return [Label("Ready to begin installation of %s" % self.__config.get_guest_name()), + grid] + +def DefineDomain(): + screen = DomainConfigScreen() + screen.start() diff --git a/nodeadmin/destroydomain.py b/nodeadmin/destroydomain.py new file mode 100755 index 0000000..350c32e --- /dev/null +++ b/nodeadmin/destroydomain.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# +# destroydomain.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from configscreen import * + +class DestroyDomainConfigScreen(DomainListConfigScreen): + LIST_PAGE = 1 + DESTROY_PAGE = 2 + + def __init__(self): + DomainListConfigScreen.__init__(self, "Destroy A Domain") + + def get_elements_for_page(self, screen, page): + if page is self.LIST_PAGE: + return self.get_domain_list_page(screen, defined = False) + elif page is self.DESTROY_PAGE: + return self.get_destroy_page(screen) + + def page_has_next(self, page): + if page is self.LIST_PAGE: return self.has_selectable_domains() + return False + + def page_has_back(self, page): + if page is self.DESTROY_PAGE: return True + return False + + def validate_input(self, page, errors): + if page is self.LIST_PAGE: + if self.get_selected_domain() is not None: + domain = self.get_selected_domain() + try: + self.get_libvirt().destroy_domain(domain) + return True + except Exception, error: + errors.append("There was an error destroy the domain: %s" % domain) + errors.append(str(error)) + else: + errors.append("You must first select a domain to destroy.") + return False + + def get_destroy_page(self, screen): + grid = Grid(1, 1) + grid.setField(Label("%s was successfully destroyed." % self.get_selected_domain()), 0, 0) + return [grid] + +def DestroyDomain(): + screen = DestroyDomainConfigScreen() + screen.start() diff --git a/nodeadmin/domainconfig.py b/nodeadmin/domainconfig.py new file mode 100644 index 0000000..ef39fe0 --- /dev/null +++ b/nodeadmin/domainconfig.py @@ -0,0 +1,217 @@ +# domainconfig.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from virtinst import Guest + +class DomainConfig: + LOCAL_INSTALL = "local" + NETWORK_INSTALL = "network" + PXE_INSTALL = "pxe" + INSTALL_TYPE_TEXT = {LOCAL_INSTALL : "Local CDROM/ISO", + NETWORK_INSTALL : "URL INstall Tree", + PXE_INSTALL : "PXE Install"} + + INSTALL_SOURCE_CDROM = "cdrom" + INSTALL_SOURCE_ISO = "iso" + + NEW_STORAGE = "new" + EXISTING_STORAGE = "existing" + + def __init__(self): + self.__guest_name = "" + self.__install_type = DomainConfig.LOCAL_INSTALL + self.__use_cdrom_source = True + self.__install_location = "" + self.__install_media = "" + self.__iso_path = "" + self.__install_url = "" + self.__kickstart_url = "" + self.__kernel_options = "" + self.__os_type = "other" + self.__os_variant = None + self.__memory = 512 + self.__cpus = 1 + self.__enable_storage = True + self.__use_local_storage = True + self.__storage_size = 8.0 + self.__allocate_storage = True + self.__existing_storage = "" + self.__network_bridge = None + self.__mac_address = None + self.__virt_type = None + self.__architecture = None + + def set_guest_name(self, name): + self.__guest_name = name + + def get_guest_name(self): + return self.__guest_name + + def set_install_type(self, type): + self.__install_type = type + + def get_install_type(self): + return self.__install_type + + def get_install_type_text(self): + return DomainConfig.INSTALL_TYPE_TEXT[self.get_install_type()] + + def is_install_type(self, type): + return self.__install_type == type + + def set_install_location(self, location): + self.__install_location = location + + def set_use_cdrom_source(self, use): + self.__use_cdrom_source = use + + def get_use_cdrom_source(self): + return self.__use_cdrom_source + + def get_install_location(self): + return self.__install_location + + def is_install_location(self, location): + return self.__install_location == location + + def set_install_media(self, media): + self.__install_media = media + + def get_install_media(self): + return self.__install_media + + def is_install_media(self, media): + return self.__install_media == media + + def set_iso_path(self, path): + self.__iso_path = path + + def get_iso_path(self): + return self.__iso_path + + def set_install_url(self, url): + self.__install_url = url + + def get_install_url(self): + return self.__install_url + + def set_kickstart_url(self, url): + self.__kickstart_url = url + + def get_kickstart_url(self): + return self.__kickstart_url + + def set_kernel_options(self, options): + self.__kernel_options = options + + def get_kernel_options(self): + return self.__kernel_options + + def set_os_type(self, type): + self.__os_type = type + self.__os_variant = Guest.list_os_variants(type)[0] + + def get_os_type(self): + return self.__os_type + + def is_os_type(self, type): + return self.__os_type == type + + def set_os_variant(self, variant): + self.__os_variant = variant + + def get_os_variant(self): + return self.__os_variant + + def is_os_variant(self, variant): + return self.__os_variant == variant + + def set_memory(self, memory): + self.__memory = int(memory) + + def get_memory(self): + return self.__memory + + def set_cpus(self, cpus): + self.__cpus = cpus + + def get_cpus(self): + return self.__cpus + + def set_enable_storage(self, enable): + self.__enable_storage = enable + + def get_enable_storage(self): + return self.__enable_storage + + def set_use_local_storage(self, use): + self.__use_local_storage = use + + def get_use_local_storage(self): + return self.__use_local_storage + + def set_storage_size(self, size): + self.__storage_size = size + + def get_storage_size(self): + return self.__storage_size + + def set_allocate_storage(self, allocate): + self.__allocate_storage = allocate + + def get_allocate_storage(self): + return self.__allocate_storage + + def set_existing_storage(self, storage): + self.__existing_storage = storage + + def get_existing_storage(self): + return self.__existing_storage + + def is_existing_storage(self, storage): + return self.__existing_storage == storage + + def set_network_bridge(self, bridge): + self.__network_bridge = bridge + + def get_network_bridge(self): + return self.__network_bridge + + def set_mac_address(self, address): + self.__mac_address = address + + def get_mac_address(self): + return self.__mac_address + + def set_virt_type(self, type): + self.__virt_type = type + + def get_virt_type(self): + return self.__virt_type + + def is_virt_type(self, type): + return self.__virt_type == type + + def set_architecture(self, architecture): + self.__architecture = architecture + + def get_architecture(self): + return self.__architecture + + def is_architecture(self, architecture): + return self.__architecture == architecture diff --git a/nodeadmin/halworker.py b/nodeadmin/halworker.py new file mode 100644 index 0000000..448c22d --- /dev/null +++ b/nodeadmin/halworker.py @@ -0,0 +1,37 @@ +# halworker.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +import dbus +import virtinst + +class HALWorker: + '''Provides utilities for working with HAL to get hardware information.''' + def __init__(self): + self.__bus = dbus.SystemBus() + hobj = self.__bus.get_object("org.freedesktop.Hal", "/org/freedesktop/Hal/Manager") + self.__conn = dbus.Interface(hobj, "org.freedesktop.Hal.Manager") + + def list_installable_volumes(self): + result = {} + for udi in self.__conn.FindDeviceByCapability("volume"): + device = self.__bus.get_object("org.freedesktop.Hal", udi) + info = dbus.Interface(device, "org.freedesktop.Hal.Device") + if info.GetProperty("volume.is_disc"): + if info.GetProperty("volume.disc.has_data"): + result[str(info.GetProperty("block.device"))] = info.GetProperty("volume.label") + return result diff --git a/nodeadmin/libvirtworker.py b/nodeadmin/libvirtworker.py new file mode 100644 index 0000000..adaea16 --- /dev/null +++ b/nodeadmin/libvirtworker.py @@ -0,0 +1,276 @@ +# libvirtworker.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +import dbus +import libvirt +import os +import virtinst +import utils + +from domainconfig import DomainConfig + +DEFAULT_POOL_TARGET_PATH="/var/lib/libvirt/images" + +class LibvirtWorker: + '''Provides utilities for interfacing with libvirt.''' + def __init__(self, url = "qemu:///system"): + self.__conn = libvirt.open(url) + self.__capabilities = virtinst.CapabilitiesParser.parse(self.__conn.getCapabilities()) + self.__net = virtinst.VirtualNetworkInterface(conn = self.__conn) + self.__net.setup(self.__conn) + (self.__new_guest, self.__new_domain) = virtinst.CapabilitiesParser.guest_lookup(conn = self.__conn) + + def list_domains(self, defined = True, started = True): + '''Lists all domains.''' + result = [] + if defined: + result.extend(self.__conn.listDefinedDomains()) + if started: + for id in self.__conn.listDomainsID(): + result.append(self.__conn.lookupByID(id).name()) + return result + + def get_domain(self, name): + '''Returns the specified domain.''' + result = self.__conn.lookupByName(name) + if result is None: raise Exception("No such domain exists: %s" % name) + + return result + + def domain_exists(self, name): + '''Returns whether a domain with the specified node exists.''' + domains = self.list_domains() + if name in domains: return True + return False + + def create_domain(self, name): + '''Creates the specified domain.''' + domain = self.get_domain(name) + domain.create() + + def destroy_domain(self, name): + '''Destroys the specified domain.''' + domain = self.get_domain(name) + domain.destroy() + + def undefine_domain(self, name): + '''Undefines the specified domain.''' + domain = self.get_domain(name) + domain.undefine() + + def list_storage_pools(self): + '''Returns the list of all defined storage pools.''' + return self.__conn.listStoragePools() + + def storage_pool_exists(self, name): + '''Returns whether a storage pool exists.''' + pools = self.list_storage_pools() + if name in pools: return True + return False + + def define_storage_pool(self, name): + '''Defines a storage pool with the given name.''' + try: + pool = virtinst.Storage.DirectoryPool(conn=self.__conn, + name=name, + target_path=DEFAULT_POOL_TARGET_PATH) + newpool = pool.install(build=True, create=True) + newpool.setAutostart(True) + except Exception, error: + raise RuntimeError("Could not create pool: %s - %s", str(error)) + + def list_bridges(self): + '''Lists all defined and active bridges.''' + bridges = self.__conn.listNetworks() + bridges.extend(self.__conn.listDefinedNetworks()) + result = [] + for name in bridges: + bridge = self.__conn.networkLookupByName(name) + result.append(bridge) + return result + + def generate_mac_address(self): + return self.__net.macaddr + + def list_storage_volumes(self): + '''Lists all defined storage volumes.''' + pools = self.__conn.listStoragePools() + pools.extend(self.__conn.listDefinedStoragePools()) + result = [] + for name in pools: + pool = self.__conn.storagePoolLookupByName(name) + for volname in pool.listVolumes(): + volume = self.__conn.storageVolLookupByPath("/var/lib/libvirt/images/%s" % volname) + result.append(volume) + return result + + def get_storage_size(self, name): + '''Returns the size of the specified storage volume.''' + volume = self.__conn.storageVolLookupByPath("/var/lib/libvirt/images/%s" % name) + return volume.info()[1] / (1024.0 ** 3) + + def get_virt_types(self): + result = [] + for guest in self.__capabilities.guests: + guest_type = guest.os_type + for domain in guest.domains: + domain_type = domain.hypervisor_type + label = domain_type + + if domain_type is "kvm" and guest_type is "xen": label = "xenner" + elif domain_type is "xen": + if guest_type is "xen": + label = "xen (paravirt)" + elif guest_type is "kvm": + label = "xen (fullvirt)" + elif domain_type is "test": + if guest_type is "xen": + label = "test (xen)" + elif guest_type is "hvm": + label = "test (hvm)" + + for row in result: + if row[0] == label: + label = None + break + if label is None: continue + + result.append([label, domain_type, guest_type]) + return result + + def list_virt_types(self): + virt_types = self.get_virt_types() + result = [] + for type in virt_types: + result.append(type[0]) + return result + + def get_default_architecture(self): + '''Returns a default hypervisor type for new domains.''' + return self.__new_guest.arch + + def get_hypervisor(self, virt_type): + virt_types = self.get_virt_types() + for type in virt_types: + if type[0] is virt_type: return type[1] + return None + + def get_default_virt_type(self): + '''Returns the default virtualization type for new domains.''' + return self.__new_domain.hypervisor_type + + def get_os_type(self, virt_type): + virt_types = self.get_virt_types() + for type in virt_types: + if type[0] is virt_type: return type[2] + return None + + def list_architectures(self): + result = [] + for guest in self.__capabilities.guests: + for domain in guest.domains: + label = guest.arch + for row in result: + if row == label: + label = None + break + if label is None: continue + + result.append(label) + return result + + def define_domain(self, config, meter): + location = extra = kickstart = None + + if config.get_install_type() == DomainConfig.LOCAL_INSTALL: + if config.get_use_cdrom_source(): + iclass = virtinst.DistroInstaller + location = config.get_install_media() + else: + iclass = virtinst.LiveCDInstaller + location = config.get_iso_path() + elif config.get_install_type() == DomainConfig.NETWORK_INSTALL: + iclass = virtinst.DistroInstaller + location = config.get_install_url() + extra = config.get_kernel_options() + kickstart = config.get_kickstart_url() + elif config.get_install_type() == DomainConfig.PXE_INSTALL: + iclass = virtinst.PXEInstaller + + installer = iclass(conn = self.__conn, + type = self.get_hypervisor(config.get_virt_type()), + os_type = self.get_os_type(config.get_virt_type())) + self.__guest = installer.guest_from_installer() + self.__guest.name = config.get_guest_name() + self.__guest.vcpus = config.get_cpus() + self.__guest.memory = config.get_memory() + self.__guest.maxmemory = config.get_memory() + + self.__guest.installer.location = location + if config.get_use_cdrom_source(): self.__guest.installer.cdrom = True + extraargs = "" + if extra: extraargs += extra + if kickstart: extraargs += " ks=%s" % kickstart + if extraargs: self.__guest.installer.extraarags = extraargs + + self.__guest.uuid = virtinst.util.uuidToString(virtinst.util.randomUUID()) + + if config.get_os_type() != "generic": self.__guest.os_type = config.get_os_type() + if config.get_os_variant() != "generic": self.__guest.os_variant = config.get_os_variant() + + self.__guest._graphics_dev = virtinst.VirtualGraphics(type = virtinst.VirtualGraphics.TYPE_VNC) + self.__guest.sound_devs = [] + self.__guest.sound_devs.append(virtinst.VirtualAudio(model = "es1370")) + + self._setup_nics(config) + self._setup_disks(config) + + self.__guest.conn = self.__conn + self.__domain = self.__guest.start_install(False, meter = meter) + + def _setup_nics(self, config): + self.__guest.nics = [] + nic = virtinst.VirtualNetworkInterface(type = virtinst.VirtualNetworkInterface.TYPE_VIRTUAL, + bridge = config.get_network_bridge(), + network = config.get_network_bridge(), + macaddr = config.get_mac_address()) + self.__guest.nics.append(nic) + # ensure the network is running + if config.get_network_bridge() not in self.__conn.listNetworks(): + network = self.__conn.networkLookupByName(config.get_network_bridge()) + network.create() + + def _setup_disks(self, config): + self.__guest.disks = [] + if config.get_enable_storage(): + path = None + if config.get_use_local_storage(): + if self.storage_pool_exists("default") is False: + self.define_storage_pool("default") + pool = self.__conn.storagePoolLookupByName("default") + path = virtinst.Storage.StorageVolume.find_free_name(config.get_guest_name(), + pool_object = pool, + suffix = ".img") + path = os.path.join(DEFAULT_POOL_TARGET_PATH, path) + + if path is not None: + storage= virtinst.VirtualDisk(conn = self.__conn, + path = path, + size = config.get_storage_size()) + self.__guest.disks.append(storage) + self.__guest.conn = self.__conn diff --git a/nodeadmin/listdomains.py b/nodeadmin/listdomains.py new file mode 100755 index 0000000..1b51ee2 --- /dev/null +++ b/nodeadmin/listdomains.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# +# listdomains.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from libvirtworker import LibvirtWorker +from configscreen import * + +class ListDomainsConfigScreen(DomainListConfigScreen): + LIST_PAGE = 1 + DETAIL_PAGE = 2 + + def __init__(self): + DomainListConfigScreen.__init__(self, 'List Domains') + + def page_has_next(self, page): + return (page == self.LIST_PAGE) + + def page_has_back(self, page): + return (page == self.DETAIL_PAGE) + + def validate_input(self, page, errors): + if page == self.LIST_PAGE: + if self.get_selected_domain() is None: + errors.append("Please select a domain to view.") + else: + return True + + def get_elements_for_page(self, screen, page): + if page == self.LIST_PAGE: + return self.get_domain_list_page(screen) + elif page == self.DETAIL_PAGE: + return self.get_detail_page_elements(screen) + + def get_detail_page_elements(self, screen): + domain = self.get_libvirt().get_domain(self.get_selected_domain()) + grid = Grid(2, 5) + grid.setField(Label("Name: "), 0, 0, anchorRight = 1) + grid.setField(Label(domain.name()), 1, 0, anchorLeft = 1) + grid.setField(Label("UUID: "), 0, 1, anchorRight = 1) + grid.setField(Label(domain.UUIDString()), 1, 1, anchorLeft = 1) + grid.setField(Label("OS Type: "), 0, 2, anchorRight = 1) + grid.setField(Label(domain.OSType()), 1, 2, anchorLeft = 1) + grid.setField(Label("Max. Memory: "), 0, 3, anchorRight = 1) + grid.setField(Label(str(domain.maxMemory())), 1, 3, anchorLeft = 1) + grid.setField(Label("Max. VCPUs: "), 0, 4, anchorRight = 1) + grid.setField(Label(str(domain.maxVcpus())), 1, 4, anchorLeft = 1) + return [grid] + +def ListDomains(): + screen = ListDomainsConfigScreen() + screen.start() diff --git a/nodeadmin/mainmenu.py b/nodeadmin/mainmenu.py new file mode 100755 index 0000000..497ad57 --- /dev/null +++ b/nodeadmin/mainmenu.py @@ -0,0 +1,74 @@ +# mainmenu.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +import traceback +from configscreen import ConfigScreen +from definedomain import DefineDomain +from createdomain import CreateDomain +from destroydomain import DestroyDomain +from undefinedomain import UndefineDomain +from listdomains import ListDomains +from createuser import CreateUser +import utils +import logging + +DEFINE_DOMAIN = 1 +CREATE_DOMAIN = 2 +DESTROY_DOMAIN = 3 +UNDEFINE_DOMAIN = 4 +LIST_DOMAINS = 5 +CREATE_USER = 6 +EXIT_CONSOLE = 99 + +def MainMenu(): + finished = False + while finished == False: + screen = SnackScreen() + menu = Listbox(height = 0, width = 0, returnExit = 1) + menu.append("Define A Domain", DEFINE_DOMAIN) + menu.append("Create A Domain", CREATE_DOMAIN) + menu.append("Destroy A Domain", DESTROY_DOMAIN) + menu.append("Undefine A Domain", UNDEFINE_DOMAIN) + menu.append("List All Domains", LIST_DOMAINS) + menu.append("Create A User", CREATE_USER) + menu.append("Exit Administration", EXIT_CONSOLE) + gridform = GridForm(screen, "Node Administration Console", 1, 4) + gridform.add(menu, 0, 0) + result = gridform.run(); + screen.popWindow() + screen.finish() + + try: + if result.current() == DEFINE_DOMAIN: DefineDomain() + elif result.current() == CREATE_DOMAIN: CreateDomain() + elif result.current() == DESTROY_DOMAIN: DestroyDomain() + elif result.current() == UNDEFINE_DOMAIN: UndefineDomain() + elif result.current() == LIST_DOMAINS: ListDomains() + elif result.current() == CREATE_USER: CreateUser() + elif result.current() == EXIT_CONSOLE: finished = True + except Exception, error: + screen = SnackScreen() + logging.info("An exception occurred: %s" % str(error)) + ButtonChoiceWindow(screen, + "An Exception Has Occurred", + str(error) + "\n" + traceback.format_exc(), + buttons = ["OK"]) + screen.popWindow() + screen.finish() + finished = True diff --git a/nodeadmin/nodeadmin.py b/nodeadmin/nodeadmin.py new file mode 100755 index 0000000..864a4c0 --- /dev/null +++ b/nodeadmin/nodeadmin.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# +# node-admin - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +import sys + +from mainmenu import MainMenu + +def NodeAdmin(): + MainMenu() + +if __name__ == "__main__": + sys.exit(NodeAdmin()) diff --git a/nodeadmin/setup.py.in b/nodeadmin/setup.py.in new file mode 100644 index 0000000..f51a34c --- /dev/null +++ b/nodeadmin/setup.py.in @@ -0,0 +1,34 @@ +# setup.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from setuptools import setup, find_packages + +setup(name = "nodeadmin", + version = "@VERSION@", + package_dir = {'nodeadmin': 'nodeadmin'}, + packages = find_packages('.'), + entry_points = { + 'console_scripts': [ + 'nodeadmin = nodeadmin.nodeadmin:NodeAdmin', + 'definedom = nodeadmin.definedomain:DefineDomain', + 'createdom = nodeadmin.createdomain:CreateDomain', + 'destroydom = nodeadmin.destroydomain:DestroyDomain', + 'undefinedom = nodeadmin.undefinedomain:UndefineDomain', + 'createuser = nodeadmin.createuser:CreateUser', + 'listdoms = nodeadmin.listdomains:ListDomains'] + }) diff --git a/nodeadmin/undefinedomain.py b/nodeadmin/undefinedomain.py new file mode 100755 index 0000000..2620540 --- /dev/null +++ b/nodeadmin/undefinedomain.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python +# +# undefinedomain.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from configscreen import * + +class UndefineDomainConfigScreen(DomainListConfigScreen): + LIST_PAGE = 1 + CONFIRM_PAGE = 2 + UNDEFINE_PAGE = 3 + + def __init__(self): + DomainListConfigScreen.__init__(self, "Undefine A Domain") + + def get_elements_for_page(self, screen, page): + if page is self.LIST_PAGE: return self.get_domain_list_page(screen) + elif page is self.CONFIRM_PAGE: return self.get_confirm_page(screen) + elif page is self.UNDEFINE_PAGE: return self.get_undefine_page(screen) + + def page_has_next(self, page): + if page is self.LIST_PAGE: return self.has_selectable_domains() + elif page is self.CONFIRM_PAGE: return True + return False + + def page_has_back(self, page): + if page is self.CONFIRM_PAGE: return True + elif page is self.UNDEFINE_PAGE: return True + return False + + def get_back_page(self, page): + if page is self.CONFIRM_PAGE: return self.LIST_PAGE + elif page is self.UNDEFINE_PAGE: return self.LIST_PAGE + + def validate_input(self, page, errors): + if page is self.LIST_PAGE: + if self.get_selected_domain() is not None: + return True + else: + errors.append("You must first select a domain.") + elif page is self.CONFIRM_PAGE: + if self.__confirm_undefine.value(): + domain = self.get_selected_domain() + try: + self.get_libvirt().undefine_domain(domain) + return True + except Exception, error: + errors.append("Failed to undefine %s." % domain) + errors.append(str(error)) + else: + errors.append("You must confirm undefining the domain to proceed.") + return False + + def get_confirm_page(self, screen): + self.__confirm_undefine = Checkbox("Check here to confirm undefining %s." % self.get_selected_domain(), 0) + grid = Grid(1, 1) + grid.setField(self.__confirm_undefine, 0, 0) + return [grid] + + def get_undefine_page(self, screen): + grid = Grid(1, 1) + grid.setField(Label("%s has been undefined." % self.get_selected_domain()), 0, 0) + return [grid] + +def UndefineDomain(): + screen = UndefineDomainConfigScreen() + screen.start() diff --git a/nodeadmin/userworker.py b/nodeadmin/userworker.py new file mode 100644 index 0000000..167197b --- /dev/null +++ b/nodeadmin/userworker.py @@ -0,0 +1,38 @@ +# userworker.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +import libuser + +class UserWorker: + '''Provides APIs for creating, modifying and deleting user accounts.''' + def __init__(self): + self.__admin = libuser.admin() + + def create_user(self, username, password, other_group): + '''Creates a new user account with the provides username, + password. The user is also added to the optional group + if one is specified.''' + user = self.__admin.initUser(username) + user.set('pw_passwd', password) + self.__admin.addUser(user) + if other_group is not None: + group = self.__admin.lookupGroupByName(other_group) + if group is None: raise Exception("Invalid group specified: %s" % other_group) + user.add('pw_gid', group.get('pw_gid')[0]) + self.__admin.modifyUser(user) + diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index 12815c9..ee1942b 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -1,5 +1,7 @@ %define product_family oVirt Node %define beta Beta +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} + Summary: The oVirt Node daemons/scripts Name: ovirt-node @@ -21,6 +23,8 @@ Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig BuildRequires: libvirt-devel >= 0.5.1 BuildRequires: dbus-devel hal-devel +BuildRequires: python-devel +BuildRequires: python-setuptools Requires: libvirt >= 0.6.3 Requires: augeas >= 0.3.5 Requires: libvirt-qpid >= 0.2.14-3 @@ -44,6 +48,10 @@ Requires: nc Requires: grub Requires: /usr/sbin/crond Requires: anyterm +Requires: newt-python +Requires: libuser-python +Requires: dbus-python + ExclusiveArch: %{ix86} x86_64 %define app_root %{_datadir}/%{name} @@ -144,6 +152,7 @@ cd - %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/cron.d %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/cron.hourly %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/logrotate.d +%{__install} -d -m0755 %{buildroot}%{python_sitelib}/nodeadmin %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-config-boot %{buildroot}%{_sbindir} @@ -164,6 +173,22 @@ cd - %{__install} -p -m0755 scripts/persist %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/unpersist %{buildroot}%{_sbindir} +%{__install} -p -m0644 nodeadmin/__init__.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/configscreen.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/createdomain.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/createuser.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/definedomain.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/destroydomain.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/domainconfig.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/halworker.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/libvirtworker.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/userworker.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/listdomains.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/mainmenu.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/nodeadmin.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/undefinedomain.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/utils.py %{buildroot}%{python_sitelib}/nodeadmin + # gptsync %{__install} -p -m0755 gptsync/gptsync %{buildroot}%{_sbindir} %{__install} -p -m0755 gptsync/showpart %{buildroot}%{_sbindir} @@ -182,6 +207,10 @@ cd - %{__install} -p -m0644 logrotate/ovirt-logrotate %{buildroot}%{_sysconfdir}/cron.d %{__install} -p -m0644 logrotate/ovirt-logrotate.conf %{buildroot}%{_sysconfdir}/logrotate.d +# install the admin tools +python nodeadmin/setup.py install --root %{buildroot} +# rm -rf %{buildroot}%{python_sitelib}/nodeadmin- at VERSION@* + echo "oVirt Node release %{version}-%{release}" > %{buildroot}%{_sysconfdir}/ovirt-release mkdir -p %{buildroot}/%{_sysconfdir}/default touch %{buildroot}/%{_sysconfdir}/default/ovirt @@ -325,7 +354,16 @@ fi %{_sbindir}/ovirt-awake %{_initrddir}/ovirt-functions %defattr(-,root,root,0644) +%{_bindir}/nodeadmin +%{_bindir}/definedom +%{_bindir}/createdom +%{_bindir}/destroydom +%{_bindir}/undefinedom +%{_bindir}/listdoms +%{_bindir}/createuser %{_sysconfdir}/collectd.conf.in +%{python_sitelib}/nodeadmin +%{python_sitelib}/nodeadmin- at VERSION@-py2.6.egg-info %config %attr(0644,root,root) %{_sysconfdir}/ovirt-release %config %attr(0644,root,root) %{_sysconfdir}/default/ovirt -- 1.6.2.5 From apevec at redhat.com Mon Sep 14 21:13:06 2009 From: apevec at redhat.com (Alan Pevec) Date: Mon, 14 Sep 2009 23:13:06 +0200 Subject: [Ovirt-devel] Re: [PATCH node-image] Changed packages and dependencies so virt-manager-tui runs properly. In-Reply-To: <1252694692-12082-2-git-send-email-dpierce@redhat.com> References: <1252694692-12082-1-git-send-email-dpierce@redhat.com> <1252694692-12082-2-git-send-email-dpierce@redhat.com> Message-ID: <4AAEB1E2.6080409@redhat.com> Darryl L. Pierce wrote: > -kvm qemu-system-x86 has Provides: kvm so just "kvm" in the package list should work > +qemu qemu RPM installs all qemu-system* packages, which we don't need on the node. > +qemu-kvm > --selinux-policy-targeted > +selinux-policy-targeted please keep -minimum only, verified that it works on F11 > +python-setuptools Isn't this BR only? Why is it need in the image? > --- a/common-post.ks > +++ b/common-post.ks > + > +# add nodeadmin as a valid shell > +cat >> /etc/shells < +/usr/bin/nodeadmin > +EOF > + > +chsh -s /usr/bin/nodeadmin root I got this in the image build log: chsh: unconfined_u:unconfined_r:livecd_t:s0-s0:c0.c1023 is not authorized to change the shell of root You could use augeas instead: -chsh -s /usr/bin/nodeadmin root +augtool <<\EOF +set /files/etc/passwd/root/shell /usr/bin/nodeadmin +save +EOF From jboggs at redhat.com Mon Sep 14 21:23:44 2009 From: jboggs at redhat.com (Joey Boggs) Date: Mon, 14 Sep 2009 17:23:44 -0400 Subject: [Ovirt-devel] Re: [PATCH node-image] Changed packages and dependencies so virt-manager-tui runs properly. In-Reply-To: <4AAEB1E2.6080409@redhat.com> References: <1252694692-12082-1-git-send-email-dpierce@redhat.com> <1252694692-12082-2-git-send-email-dpierce@redhat.com> <4AAEB1E2.6080409@redhat.com> Message-ID: <4AAEB460.5000508@redhat.com> Alan Pevec wrote: > Darryl L. Pierce wrote: >> -kvm > qemu-system-x86 has Provides: kvm so just "kvm" in the package list > should work > >> +qemu > qemu RPM installs all qemu-system* packages, which we don't need on > the node. > >> +qemu-kvm > >> --selinux-policy-targeted >> +selinux-policy-targeted > > please keep -minimum only, verified that it works on F11 > >> +python-setuptools > Isn't this BR only? Why is it need in the image? > This was needed to build one of the menus i believe , I'll have to double check to see if we can remove it now with the latest build working >> --- a/common-post.ks >> +++ b/common-post.ks >> + >> +# add nodeadmin as a valid shell >> +cat >> /etc/shells <> +/usr/bin/nodeadmin >> +EOF >> + >> +chsh -s /usr/bin/nodeadmin root > > I got this in the image build log: > chsh: unconfined_u:unconfined_r:livecd_t:s0-s0:c0.c1023 is not > authorized to change the shell of root > You could use augeas instead: > -chsh -s /usr/bin/nodeadmin root > +augtool <<\EOF > +set /files/etc/passwd/root/shell /usr/bin/nodeadmin > +save > +EOF Saw this as well, but if you login via ssh and exit from nodeadmin, it kills the connection. How will we be able to troubleshoot the node? Add a debug option which goes to bash? > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel From jan.mrozek at nalinuxu.cz Mon Sep 14 21:24:04 2009 From: jan.mrozek at nalinuxu.cz (Jan Mrozek) Date: Mon, 14 Sep 2009 23:24:04 +0200 Subject: [Ovirt-devel] Node unavailable after ovirt-server reboot Message-ID: <6524aa500909141424y4cfa4d88l3f84416901ede8d2@mail.gmail.com> Hi, I builded ovirt from next ... installed ... node is booted from pxe. After reboot of ovirt-server machine is node unavailable(enabled). According to jguiditta's advice I restarted libvirt-qpid on node and node becomes available. Is there a bug? Thanks for help. Jan Mrozek From jboggs at redhat.com Mon Sep 14 21:43:28 2009 From: jboggs at redhat.com (Joey Boggs) Date: Mon, 14 Sep 2009 17:43:28 -0400 Subject: [Ovirt-devel] [PATCH node-image] add livecd-iso-to-iscsi script to support iscsi root booting setup Message-ID: <1252964608-6124-1-git-send-email-jboggs@redhat.com> This enables the ability to take the ovirt-node-image iso and deploy it to an iscsi disk. It also provides a sample pxe configuration for booting based on the iscsi root device. Includes support for user/password as well as reverse chap user/password. --- Makefile.am | 1 + livecd-iso-to-iscsi | 201 ++++++++++++++++++++++++++++++++++++++++++++++ ovirt-node-image.spec.in | 2 + 3 files changed, 204 insertions(+), 0 deletions(-) create mode 100755 livecd-iso-to-iscsi diff --git a/Makefile.am b/Makefile.am index a44ae49..d920813 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,6 +45,7 @@ EXTRA_DIST = \ $(PACKAGE).ks \ create-ovirt-iso-nodes \ edit-livecd \ + livecdiso-to-iscsi \ livecd-setauth \ livecd-rpms \ README diff --git a/livecd-iso-to-iscsi b/livecd-iso-to-iscsi new file mode 100755 index 0000000..fd3934d --- /dev/null +++ b/livecd-iso-to-iscsi @@ -0,0 +1,201 @@ +#!/usr/bin/python +# Convert a live CD iso into iscsi root bootable format +# iSCSI lun must be accessible via this script +# Copyright 2009 Red Hat, Inc. +# Written by Joey boggs +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +from optparse import OptionParser +from tempfile import mkdtemp +import dbus +import dbus.glib +import sys +import os +import subprocess +import shutil + +parser = OptionParser() +parser.add_option("--iso", dest="iso", help="LiveCD iso filename") +parser.add_option("--target", dest="target", help="iSCSI target ip address") +parser.add_option("--targetname", dest="targetname", help="iSCSI target lun") +parser.add_option("--targetport", dest="targetport", default="3260", help="iSCSI port number, defaults to 3260") +parser.add_option("--user", dest="user", help="Target username(optional)") +parser.add_option("--password", dest="password", help="Target password") +parser.add_option("--reverse_user", dest="reverse_user", help="Reverse CHAP username(optional)") +parser.add_option("--reverse_password", dest="reverse_password", help="Reverse CHAP password(optional)") +parser.add_option("--disk", dest="disk", help="iSCSI disk device name") +parser.add_option("--disk-label", dest="disk_label", default="ovirt-node-root", help="file system label") + +(options, args) = parser.parse_args() + +def fail(msg): + print(msg) + sys.exit(1) + +if os.geteuid () != 0: + fail("You must run as root") + +if options.iso is None: + fail("ERROR: iso file must be defined") +else: + options.iso = os.path.abspath(options.iso) + +if options.target is None: + fail("ERROR: iscsi target must be defined") + +if options.targetname is None: + fail("ERROR: iscsi targetname must be defined") + +if len(options.disk_label.strip()) > 15: + fail("ERROR: disk label must be 14 characters or less") + +try: + file = os.mkdir("tftpboot") +except OSError, e: + tftp_remove = raw_input("tftpboot directory exists, overwrite? (y/N)? ") + if tftp_remove.lower() == "y": + shutil.rmtree("tftpboot") + os.mkdir("tftpboot") + else: + print "Aborting" + sys.exit(1) + +if options.disk is None: + print "Below are the detected disks, if the iscsi disk is not shown, please ensure you are logged into the correct target\n" + bus = dbus.SystemBus () + hal_obj = bus.get_object ('org.freedesktop.Hal', '/org/freedesktop/Hal/Manager') + hal = dbus.Interface (hal_obj, 'org.freedesktop.Hal.Manager') + udis = hal.FindDeviceByCapability ('storage') + dev_dict = {} + dev_count = 1 + for udi in udis: + dev_obj = bus.get_object ('org.freedesktop.Hal', udi) + dev = dbus.Interface (dev_obj, 'org.freedesktop.Hal.Device') + dev_bus=dev.GetProperty ('storage.bus') + dev_name=dev.GetProperty ('block.device') + dev_size=dev.GetProperty ('storage.size') + dev_size=(dev_size/1024/1024) + basename=os.path.basename(udi) + if dev_bus == "scsi": + print "%s. %s %sM %s \n" % (dev_count,dev_name,dev_size,basename) + dev_dict[str(dev_count)] = dev_name + dev_count = dev_count + 1 + print "Enter Q to Quit" + dev_choice = raw_input("Which device? ") + while not dev_dict.has_key(dev_choice): + if dev_choice.lower() == "q": + print "Aborting" + sys.exit(1) + else: + print "%s is an invalid choice" % dev_choice + dev_choice = raw_input("Which device? ") + options.disk = dev_dict[dev_choice] + +cont = raw_input("Creating file system on %s, do you wish to continue (y/N) " % options.disk) +if cont.lower() != "y": + print "Aborting" + sys.exit(1) + +isomount = mkdtemp() +isomount_ret = subprocess.call(["mount", "-o", "loop", options.iso, isomount]) +if isomount_ret != 0: + fail("Error mounting %s" % options.iso) + +kernel="%s/isolinux/vmlinuz0" % isomount +initrd="%s/isolinux/initrd0.img" % isomount +squashfs="%s/LiveOS/squashfs.img" % isomount +ext3fs="tftpboot/squashfs-root/LiveOS/ext3fs.img" +shutil.copy(kernel,"tftpboot") +shutil.copy(initrd,"tftpboot") + +unsquash = subprocess.call(["unsquashfs", squashfs]) + +# workaround until bug is fixed with squashfs -d option +shutil.move("squashfs-root","tftpboot/squashfs-root") + +print "Placing embedded file system on %s" % options.disk +dd_cmd="dd if=%s of=%s" % (ext3fs,options.disk) +copy_iscsi_ret = subprocess.call(dd_cmd, shell=True) +if copy_iscsi_ret != 0: + fail("Error copying to %s" % options.disk) + +umount_ret = subprocess.call(["umount", isomount]) +if umount_ret != 0: + fail("Error unmounting %s, continuing" % isomount) +else: + os.rmdir(isomount) +shutil.rmtree("tftpboot/squashfs-root") + +pxe_template = """ + +# pxelinux configuration. +DEFAULT pxeboot +TIMEOUT 20 +PROMPT 0 +LABEL ovirt-node-iscsi + KERNEL /vmlinuz0 + APPEND initrd=/initrd0.img ro root=LABEL=%(disk_label)s netroot=iscsi:%(user)s%(password)s@%(target)s::%(target_port)s::%(target_name)s ip=eth0:dhcp + ipappend 2 +ONERROR LOCALBOOT 0 +""" + +# insert empty values for unneeded variables in the pxe template +if not options.user is None: + options.user = options.user + ":" +else: + options.user = "" + +if not options.password is None: + options.password = options.password + ":" +else: + options.password = "" + +if not options.reverse_user is None: + options.reverse_user = options.reverse_user + ":" +else: + options.reverse_user = "" + +if not options.reverse_password is None: + options.reverse_password = options.reverse_password + ":" +else: + options.reverse_password = "" + +os.mkdir("tftpboot/pxelinux.cfg") +pxe_cfg = pxe_template % { + "disk_label": options.disk_label, + "target": options.target, + "target_port": options.targetport, + "target_name": options.targetname, + "user": options.user, + "password": options.password, + "reverse_user": options.reverse_user, + "reverse_password": options.reverse_password + } + +pxe_conf = open("tftpboot/pxelinux.cfg/default", 'w') +pxe_conf.write(pxe_cfg) +pxe_conf.close() + +if os.path.exists("/usr/share/syslinux/pxelinux.0"): + shutil.copy("/usr/share/syslinux/pxelinux.0","tftpboot") +elif os.path.exists("/usr/lib/syslinux/pxelinux.0"): + shutil.copy("/usr/lib/syslinux/pxelinux.0","tftpboot") +else: + print "Warning: You need to add pxelinux.0 to tftpboot/ subdirectory" + +print "Your iscsiroot has been setup on %s" % options.disk +print "" +print "Copy the tftpboot/ subdirectory to your tftpserver root directory" +print "Set up your DHCP, TFTP and PXE server to serve /tftpboot/.../pxeboot.0" diff --git a/ovirt-node-image.spec.in b/ovirt-node-image.spec.in index e64f4de..1f8c31b 100644 --- a/ovirt-node-image.spec.in +++ b/ovirt-node-image.spec.in @@ -65,6 +65,7 @@ mkdir %{buildroot} %{__install} -d -m0755 %{buildroot}%{_sbindir} %{__install} -p -m0755 create-ovirt-iso-nodes %{buildroot}%{_sbindir} %{__install} -p -m0755 edit-livecd %{buildroot}%{_sbindir} +%{__install} -p -m0755 livecd-iso-to-iscsi %{buildroot}%{_sbindir} %{__install} -p -m0755 livecd-setauth %{buildroot}%{_sbindir} %{__install} -p -m0755 livecd-rpms %{buildroot}%{_sbindir} %{__tar} -xf %{image_manifests} -C %{buildroot}%{app_root} @@ -94,6 +95,7 @@ cobbler sync > /dev/null 2>&1 || : %defattr(0755,root,root,0755) %{_sbindir}/create-ovirt-iso-nodes %{_sbindir}/edit-livecd +%{_sbindir}/livecd-iso-to-iscsi %{_sbindir}/livecd-setauth %{_sbindir}/livecd-rpms -- 1.6.2.5 From jboggs at redhat.com Tue Sep 15 02:34:34 2009 From: jboggs at redhat.com (Joey Boggs) Date: Mon, 14 Sep 2009 22:34:34 -0400 Subject: [Ovirt-devel] Re: [PATCH node-image] add livecd-iso-to-iscsi script to support iscsi root booting setup In-Reply-To: <1252964608-6124-1-git-send-email-jboggs@redhat.com> References: <1252964608-6124-1-git-send-email-jboggs@redhat.com> Message-ID: <4AAEFD3A.30902@redhat.com> ignore this version, theres a typo in Makefile.am causing the build to fail From jboggs at redhat.com Tue Sep 15 02:35:16 2009 From: jboggs at redhat.com (Joey Boggs) Date: Mon, 14 Sep 2009 22:35:16 -0400 Subject: [Ovirt-devel] [PATCH node-image] add livecd-iso-to-iscsi script to support iscsi root booting setup Message-ID: <1252982116-14011-1-git-send-email-jboggs@redhat.com> This enables the ability to take the ovirt-node-image iso and deploy it to an iscsi disk. It also provides a sample pxe configuration for booting based on the iscsi root device. Includes support for user/password as well as reverse chap user/password. --- Makefile.am | 1 + livecd-iso-to-iscsi | 201 ++++++++++++++++++++++++++++++++++++++++++++++ ovirt-node-image.spec.in | 2 + 3 files changed, 204 insertions(+), 0 deletions(-) create mode 100755 livecd-iso-to-iscsi diff --git a/Makefile.am b/Makefile.am index a44ae49..306f49f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,6 +45,7 @@ EXTRA_DIST = \ $(PACKAGE).ks \ create-ovirt-iso-nodes \ edit-livecd \ + livecd-iso-to-iscsi \ livecd-setauth \ livecd-rpms \ README diff --git a/livecd-iso-to-iscsi b/livecd-iso-to-iscsi new file mode 100755 index 0000000..fd3934d --- /dev/null +++ b/livecd-iso-to-iscsi @@ -0,0 +1,201 @@ +#!/usr/bin/python +# Convert a live CD iso into iscsi root bootable format +# iSCSI lun must be accessible via this script +# Copyright 2009 Red Hat, Inc. +# Written by Joey boggs +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +from optparse import OptionParser +from tempfile import mkdtemp +import dbus +import dbus.glib +import sys +import os +import subprocess +import shutil + +parser = OptionParser() +parser.add_option("--iso", dest="iso", help="LiveCD iso filename") +parser.add_option("--target", dest="target", help="iSCSI target ip address") +parser.add_option("--targetname", dest="targetname", help="iSCSI target lun") +parser.add_option("--targetport", dest="targetport", default="3260", help="iSCSI port number, defaults to 3260") +parser.add_option("--user", dest="user", help="Target username(optional)") +parser.add_option("--password", dest="password", help="Target password") +parser.add_option("--reverse_user", dest="reverse_user", help="Reverse CHAP username(optional)") +parser.add_option("--reverse_password", dest="reverse_password", help="Reverse CHAP password(optional)") +parser.add_option("--disk", dest="disk", help="iSCSI disk device name") +parser.add_option("--disk-label", dest="disk_label", default="ovirt-node-root", help="file system label") + +(options, args) = parser.parse_args() + +def fail(msg): + print(msg) + sys.exit(1) + +if os.geteuid () != 0: + fail("You must run as root") + +if options.iso is None: + fail("ERROR: iso file must be defined") +else: + options.iso = os.path.abspath(options.iso) + +if options.target is None: + fail("ERROR: iscsi target must be defined") + +if options.targetname is None: + fail("ERROR: iscsi targetname must be defined") + +if len(options.disk_label.strip()) > 15: + fail("ERROR: disk label must be 14 characters or less") + +try: + file = os.mkdir("tftpboot") +except OSError, e: + tftp_remove = raw_input("tftpboot directory exists, overwrite? (y/N)? ") + if tftp_remove.lower() == "y": + shutil.rmtree("tftpboot") + os.mkdir("tftpboot") + else: + print "Aborting" + sys.exit(1) + +if options.disk is None: + print "Below are the detected disks, if the iscsi disk is not shown, please ensure you are logged into the correct target\n" + bus = dbus.SystemBus () + hal_obj = bus.get_object ('org.freedesktop.Hal', '/org/freedesktop/Hal/Manager') + hal = dbus.Interface (hal_obj, 'org.freedesktop.Hal.Manager') + udis = hal.FindDeviceByCapability ('storage') + dev_dict = {} + dev_count = 1 + for udi in udis: + dev_obj = bus.get_object ('org.freedesktop.Hal', udi) + dev = dbus.Interface (dev_obj, 'org.freedesktop.Hal.Device') + dev_bus=dev.GetProperty ('storage.bus') + dev_name=dev.GetProperty ('block.device') + dev_size=dev.GetProperty ('storage.size') + dev_size=(dev_size/1024/1024) + basename=os.path.basename(udi) + if dev_bus == "scsi": + print "%s. %s %sM %s \n" % (dev_count,dev_name,dev_size,basename) + dev_dict[str(dev_count)] = dev_name + dev_count = dev_count + 1 + print "Enter Q to Quit" + dev_choice = raw_input("Which device? ") + while not dev_dict.has_key(dev_choice): + if dev_choice.lower() == "q": + print "Aborting" + sys.exit(1) + else: + print "%s is an invalid choice" % dev_choice + dev_choice = raw_input("Which device? ") + options.disk = dev_dict[dev_choice] + +cont = raw_input("Creating file system on %s, do you wish to continue (y/N) " % options.disk) +if cont.lower() != "y": + print "Aborting" + sys.exit(1) + +isomount = mkdtemp() +isomount_ret = subprocess.call(["mount", "-o", "loop", options.iso, isomount]) +if isomount_ret != 0: + fail("Error mounting %s" % options.iso) + +kernel="%s/isolinux/vmlinuz0" % isomount +initrd="%s/isolinux/initrd0.img" % isomount +squashfs="%s/LiveOS/squashfs.img" % isomount +ext3fs="tftpboot/squashfs-root/LiveOS/ext3fs.img" +shutil.copy(kernel,"tftpboot") +shutil.copy(initrd,"tftpboot") + +unsquash = subprocess.call(["unsquashfs", squashfs]) + +# workaround until bug is fixed with squashfs -d option +shutil.move("squashfs-root","tftpboot/squashfs-root") + +print "Placing embedded file system on %s" % options.disk +dd_cmd="dd if=%s of=%s" % (ext3fs,options.disk) +copy_iscsi_ret = subprocess.call(dd_cmd, shell=True) +if copy_iscsi_ret != 0: + fail("Error copying to %s" % options.disk) + +umount_ret = subprocess.call(["umount", isomount]) +if umount_ret != 0: + fail("Error unmounting %s, continuing" % isomount) +else: + os.rmdir(isomount) +shutil.rmtree("tftpboot/squashfs-root") + +pxe_template = """ + +# pxelinux configuration. +DEFAULT pxeboot +TIMEOUT 20 +PROMPT 0 +LABEL ovirt-node-iscsi + KERNEL /vmlinuz0 + APPEND initrd=/initrd0.img ro root=LABEL=%(disk_label)s netroot=iscsi:%(user)s%(password)s@%(target)s::%(target_port)s::%(target_name)s ip=eth0:dhcp + ipappend 2 +ONERROR LOCALBOOT 0 +""" + +# insert empty values for unneeded variables in the pxe template +if not options.user is None: + options.user = options.user + ":" +else: + options.user = "" + +if not options.password is None: + options.password = options.password + ":" +else: + options.password = "" + +if not options.reverse_user is None: + options.reverse_user = options.reverse_user + ":" +else: + options.reverse_user = "" + +if not options.reverse_password is None: + options.reverse_password = options.reverse_password + ":" +else: + options.reverse_password = "" + +os.mkdir("tftpboot/pxelinux.cfg") +pxe_cfg = pxe_template % { + "disk_label": options.disk_label, + "target": options.target, + "target_port": options.targetport, + "target_name": options.targetname, + "user": options.user, + "password": options.password, + "reverse_user": options.reverse_user, + "reverse_password": options.reverse_password + } + +pxe_conf = open("tftpboot/pxelinux.cfg/default", 'w') +pxe_conf.write(pxe_cfg) +pxe_conf.close() + +if os.path.exists("/usr/share/syslinux/pxelinux.0"): + shutil.copy("/usr/share/syslinux/pxelinux.0","tftpboot") +elif os.path.exists("/usr/lib/syslinux/pxelinux.0"): + shutil.copy("/usr/lib/syslinux/pxelinux.0","tftpboot") +else: + print "Warning: You need to add pxelinux.0 to tftpboot/ subdirectory" + +print "Your iscsiroot has been setup on %s" % options.disk +print "" +print "Copy the tftpboot/ subdirectory to your tftpserver root directory" +print "Set up your DHCP, TFTP and PXE server to serve /tftpboot/.../pxeboot.0" diff --git a/ovirt-node-image.spec.in b/ovirt-node-image.spec.in index e64f4de..1f8c31b 100644 --- a/ovirt-node-image.spec.in +++ b/ovirt-node-image.spec.in @@ -65,6 +65,7 @@ mkdir %{buildroot} %{__install} -d -m0755 %{buildroot}%{_sbindir} %{__install} -p -m0755 create-ovirt-iso-nodes %{buildroot}%{_sbindir} %{__install} -p -m0755 edit-livecd %{buildroot}%{_sbindir} +%{__install} -p -m0755 livecd-iso-to-iscsi %{buildroot}%{_sbindir} %{__install} -p -m0755 livecd-setauth %{buildroot}%{_sbindir} %{__install} -p -m0755 livecd-rpms %{buildroot}%{_sbindir} %{__tar} -xf %{image_manifests} -C %{buildroot}%{app_root} @@ -94,6 +95,7 @@ cobbler sync > /dev/null 2>&1 || : %defattr(0755,root,root,0755) %{_sbindir}/create-ovirt-iso-nodes %{_sbindir}/edit-livecd +%{_sbindir}/livecd-iso-to-iscsi %{_sbindir}/livecd-setauth %{_sbindir}/livecd-rpms -- 1.6.2.5 From ignazio.cassano at provincia.torino.it Tue Sep 15 07:18:37 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Tue, 15 Sep 2009 09:18:37 +0200 Subject: [Ovirt-devel] ovirt ace error In-Reply-To: <4AAE7085.7060201@redhat.com> References: <20090911180636.87h1g03oevj4gw8w@webmail.provincia.torino.it> <20090911181421.0w0idny67a8kwwk8@webmail.provincia.torino.it> <4AAA942A.6080709@redhat.com> <20090914180040.xbxz5g4u2jcc8cko@webmail.provincia.torino.it> <4AAE7085.7060201@redhat.com> Message-ID: <20090915091837.cx15lnf2ewsg8s4s@webmail.provincia.torino.it> Hello Joey, I cannot ping the node but dhcp and tftp work fine. After the pxe image is sent to the node, the following messages is displayed on ovirt server in /var/log/messages: ep 15 09:12:13 mgmt dnsmasq[2389]: TFTP sent /var/lib/tftpboot/menu.c32 to 192.168.1.216 Sep 15 09:12:13 mgmt dnsmasq[2389]: TFTP sent /var/lib/tftpboot/pxelinux.cfg/default to 192.168.1.216 Sep 15 09:12:14 mgmt dnsmasq[2389]: TFTP sent /var/lib/tftpboot/images/oVirt-Node-x86_64/vmlinuz0 to 192.168.1.216 Sep 15 09:12:16 mgmt dnsmasq[2389]: TFTP sent /var/lib/tftpboot/images/oVirt-Node-x86_64/initrd0.img to 192.168.1.216 Sep 15 09:14:11 mgmt qpidd[1858]: 2009-09-15 09:14:11 warning Client closed connection with 501: internal-error: Sasl error: SASL(-1): generic failure: GSSAPI Error: Unspecified GSS failure. Minor code may provide more information (Generic error (see e-text)) (qpid/client/SaslFactory.cpp:226) ----- Messaggio da jboggs at redhat.com --------- Data: Mon, 14 Sep 2009 12:34:13 -0400 Da: Joey Boggs Rispondi-A:Joey Boggs Oggetto: Re: [Ovirt-devel] ovirt ace error A: ignazio.cassano at provincia.torino.it Cc: ovirt-devel at redhat.com > ignazio.cassano at provincia.torino.it wrote: >> Hello, >> I tried to not use repository rawhide when I install ovirt-server >> (built using >> ovirt.org instructions) and the problem with ipa-server kerkeros does not >> appear (probably the problem exists only whith the ipa and kerberos >> downloaded >> from rawhide repository). >> With the above procedure , ace finishes fine. >> When a phisical node starts, it gets pxe image but does not finish the boot >> procedure (it remains frozen) and it does not appear on ovirt web interface. >> >> At this time ovirt packages installed are the followings: >> >> ovirt-server-0.101-0.fc11.20090911113058git02c7e44.noarch >> ovirt-node-image-1.0.3-0.fc11.20090911120258git1194106.x86_64 >> ovirt-server-installer-0.101-0.fc11.20090911113058git02c7e44.noarch >> ovirt-node-image-pxe-1.0.3-0.fc11.20090911120258git1194106.x86_64 >> >> >> And ipa are the followings: >> >> ipa-python-1.2.1-5.fc11.x86_64 >> ipa-server-selinux-1.2.1-5.fc11.x86_64 >> ipa-admintools-1.2.1-5.fc11.x86_64 >> ipa-client-1.2.1-5.fc11.x86_64 >> ipa-server-1.2.1-5.fc11.x86_64 >> >> >> >> ----- Messaggio da jboggs at redhat.com --------- >> Data: Fri, 11 Sep 2009 14:17:14 -0400 >> Da: Joey Boggs >> Rispondi-A:Joey Boggs >> Oggetto: Re: [Ovirt-devel] ovirt ace error >> A: ignazio.cassano at provincia.torino.it >> Cc: ovirt-devel at redhat.com >> >> >>> ignazio.cassano at provincia.torino.it wrote: >>>> Good morning, >>>> I'd like to add some information to my previous email. >>>> Reading ace.log I saw kinit fails. >>>> Escaping to shell, I tried to execute: >>>> kinit admin >>>> kinit: Looping detected inside krb5_get_in_tkt while getting >>>> initial credentials >>>> >>>> >>>> After entering password, the following error is displayed: >>>> >>>> >>>> >>>> >>>> ----- Messaggio da ignazio.cassano at provincia.torino.it --------- >>>> Data: Fri, 11 Sep 2009 18:06:36 +0200 >>>> Da: ignazio.cassano at provincia.torino.it >>>> Rispondi-A:ignazio.cassano at provincia.torino.it >>>> Oggetto: [Ovirt-devel] ovirt ace error >>>> A: ovirt-devel at redhat.com >>>> >>>> >>>>> Good morning, >>>>> I have succesfully buil ovirt on fedora 11 but running >>>>> ace -d l /tmp/ace.log install ovirt I got en error (I think it >>>>> is krb5 issue). >>>>> >>>>> My server was not a kerberos server before installing ovirt, so >>>>> I think ace >>>>> procedure has installed it. >>>>> Attacchede here there is the ace.log file. >>>>> Could anyone help me ? >>>>> Thanks & Regards >>>>> Ignazio >>>> >>>> >>>> ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> Ovirt-devel mailing list >>>> Ovirt-devel at redhat.com >>>> https://www.redhat.com/mailman/listinfo/ovirt-devel >>> Hmm, looks like the error message from this email, the install log >>> looks good other than the kinit failing so 101/108 items were >>> completed, can you send the error message from kinit admin again? >> >> >> ----- Fine del messaggio da jboggs at redhat.com ----- >> >> >> > At what point does the boot process hang? Can you ping/ssh the node? > The dhcp request is logged in /var/log/messages on the management > server if you need to get the ip address ----- Fine del messaggio da jboggs at redhat.com ----- From ignazio.cassano at provincia.torino.it Tue Sep 15 09:27:38 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Tue, 15 Sep 2009 11:27:38 +0200 Subject: [Ovirt-devel] ovirt node GSS Failure Message-ID: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> Good morning, I successfully built ovirt-server and now on my ovirt server and now I have the following ovirt packages: ovirt-node-image-1.0.3-0.fc11.20090915072742git1194106.x86_64 ovirt-server-0.101-0.fc11.20090915064524gita449210.noarch ovirt-node-image-pxe-1.0.3-0.fc11.20090915072742git1194106.x86_64 ovirt-server-installer-0.101-0.fc11.20090915064524gita449210.noarch I tried to start a phisical node and it start to load the pxe image but then it seems frozen. On the ovirt server in /var/log/messages the folloqing error is displayed: Sep 15 11:25:27 mgmt qpidd[1856]: 2009-09-15 11:25:27 warning Client closed connection with 501: internal-error: Sasl error: SASL(-1): generic failure: GSSAPI Error: Unspecified GSS failure. Minor code may provide more information (Generic error (see e-text)) (qpid/client/SaslFactory.cpp:226) Thanks From apevec at gmail.com Tue Sep 15 12:37:14 2009 From: apevec at gmail.com (Alan Pevec) Date: Tue, 15 Sep 2009 14:37:14 +0200 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> Message-ID: <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> On Tue, Sep 15, 2009 at 11:27 AM, wrote: > I tried to start a phisical node and it start to load the pxe image but > then > it seems frozen. > Could you capture serial console log? At what point it freezes? Please check if you have livecd-tools-024-1ovirt.fc11.x86_64 (from ovirt.orgrepo) installed on the machine where ovirt-node-image-pxe RPM is installed. If not, install it first and then reinstall -pxe (it runs livecd-iso-to-pxeboot in post script) -------------- next part -------------- An HTML attachment was scrubbed... URL: From ignazio.cassano at provincia.torino.it Tue Sep 15 13:06:19 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Tue, 15 Sep 2009 15:06:19 +0200 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> Message-ID: <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> Hello, I am going to install livecd tools but I have a question first: must management net and public net comunicate isung a router ? In my configuration mgmt net and pub net are isolated. ----- Messaggio da apevec at gmail.com --------- Data: Tue, 15 Sep 2009 14:37:14 +0200 Da: Alan Pevec Rispondi-A:Alan Pevec Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure A: ignazio.cassano at provincia.torino.it Cc: ovirt-devel at redhat.com > On Tue, Sep 15, 2009 at 11:27 AM, wrote: > >> I tried to start a phisical node and it start to load the pxe image but >> then >> it seems frozen. >> > > Could you capture serial console log? At what point it freezes? > Please check if you have livecd-tools-024-1ovirt.fc11.x86_64 (from > ovirt.orgrepo) installed on the machine where ovirt-node-image-pxe RPM > is installed. > If not, install it first and then reinstall -pxe (it runs > livecd-iso-to-pxeboot in post script) > ----- Fine del messaggio da apevec at gmail.com ----- From dpierce at redhat.com Tue Sep 15 13:13:11 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Tue, 15 Sep 2009 09:13:11 -0400 Subject: [Ovirt-devel] Re: [PATCH node-image] Changed packages and dependencies so virt-manager-tui runs properly. In-Reply-To: <4AAEB1E2.6080409@redhat.com> References: <1252694692-12082-1-git-send-email-dpierce@redhat.com> <1252694692-12082-2-git-send-email-dpierce@redhat.com> <4AAEB1E2.6080409@redhat.com> Message-ID: <20090915131311.GA3349@mcpierce-laptop.rdu.redhat.com> On Mon, Sep 14, 2009 at 11:13:06PM +0200, Alan Pevec wrote: > Darryl L. Pierce wrote: >> -kvm > qemu-system-x86 has Provides: kvm so just "kvm" in the package list should work > >> +qemu > qemu RPM installs all qemu-system* packages, which we don't need on the node. > >> +qemu-kvm > >> --selinux-policy-targeted >> +selinux-policy-targeted > > please keep -minimum only, verified that it works on F11 kk - added the above fixes. >> +python-setuptools > Isn't this BR only? Why is it need in the image? There are runtime files provides by python-setuptools that we need. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Virtual Machine Management - http://www.ovirt.org/ Is fearr Gaeilge bhriste n? B?arla cliste. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: From dpierce at redhat.com Tue Sep 15 13:14:09 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Tue, 15 Sep 2009 09:14:09 -0400 Subject: [Ovirt-devel] Re: [PATCH node-image] Changed packages and dependencies so virt-manager-tui runs properly. In-Reply-To: <4AAEB460.5000508@redhat.com> References: <1252694692-12082-1-git-send-email-dpierce@redhat.com> <1252694692-12082-2-git-send-email-dpierce@redhat.com> <4AAEB1E2.6080409@redhat.com> <4AAEB460.5000508@redhat.com> Message-ID: <20090915131409.GB3349@mcpierce-laptop.rdu.redhat.com> On Mon, Sep 14, 2009 at 05:23:44PM -0400, Joey Boggs wrote: > Saw this as well, but if you login via ssh and exit from nodeadmin, it > kills the connection. How will we be able to troubleshoot the node? Add > a debug option which goes to bash? That's a good suggestion. I can add that to the menu. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Virtual Machine Management - http://www.ovirt.org/ Is fearr Gaeilge bhriste n? B?arla cliste. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: From jboggs at redhat.com Tue Sep 15 13:24:40 2009 From: jboggs at redhat.com (Joey Boggs) Date: Tue, 15 Sep 2009 09:24:40 -0400 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> Message-ID: <4AAF9598.90108@redhat.com> ignazio.cassano at provincia.torino.it wrote: > Hello, I am going to install livecd tools but I have a question first: > > must management net and public net comunicate isung a router ? > In my configuration mgmt net and pub net are isolated. > > They can be either, however the admin network *should* be isolated to keep provisioning/cobbler/iso etc traffic on the admin network and off the guest network. > > ----- Messaggio da apevec at gmail.com --------- > Data: Tue, 15 Sep 2009 14:37:14 +0200 > Da: Alan Pevec > Rispondi-A:Alan Pevec > Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure > A: ignazio.cassano at provincia.torino.it > Cc: ovirt-devel at redhat.com > > >> On Tue, Sep 15, 2009 at 11:27 AM, >> wrote: >> >>> I tried to start a phisical node and it start to load the pxe image but >>> then >>> it seems frozen. >>> >> >> Could you capture serial console log? At what point it freezes? >> Please check if you have livecd-tools-024-1ovirt.fc11.x86_64 (from >> ovirt.orgrepo) installed on the machine where ovirt-node-image-pxe RPM >> is installed. >> If not, install it first and then reinstall -pxe (it runs >> livecd-iso-to-pxeboot in post script) >> > > > ----- Fine del messaggio da apevec at gmail.com ----- > > > > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel From ignazio.cassano at provincia.torino.it Tue Sep 15 13:47:55 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Tue, 15 Sep 2009 15:47:55 +0200 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> Message-ID: <20090915154755.amdf4a327a1ws0k8@webmail.provincia.torino.it> Alan, now node finishes the boot e "root login:" appears. The problem is it does not respond if I ping it. How can I login on it ? Which is the root password ? I'd like to check network configuration ----- Messaggio da ignazio.cassano at provincia.torino.it --------- Data: Tue, 15 Sep 2009 15:06:19 +0200 Da: ignazio.cassano at provincia.torino.it Rispondi-A:ignazio.cassano at provincia.torino.it Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure A: Alan Pevec Cc: ovirt-devel at redhat.com > Hello, I am going to install livecd tools but I have a question first: > > must management net and public net comunicate isung a router ? > In my configuration mgmt net and pub net are isolated. > > > > ----- Messaggio da apevec at gmail.com --------- > Data: Tue, 15 Sep 2009 14:37:14 +0200 > Da: Alan Pevec > Rispondi-A:Alan Pevec > Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure > A: ignazio.cassano at provincia.torino.it > Cc: ovirt-devel at redhat.com > > >> On Tue, Sep 15, 2009 at 11:27 AM, >> wrote: >> >>> I tried to start a phisical node and it start to load the pxe image but >>> then >>> it seems frozen. >>> >> >> Could you capture serial console log? At what point it freezes? >> Please check if you have livecd-tools-024-1ovirt.fc11.x86_64 (from >> ovirt.orgrepo) installed on the machine where ovirt-node-image-pxe RPM >> is installed. >> If not, install it first and then reinstall -pxe (it runs >> livecd-iso-to-pxeboot in post script) >> > > > ----- Fine del messaggio da apevec at gmail.com ----- > > > > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- From ignazio.cassano at provincia.torino.it Tue Sep 15 13:49:04 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Tue, 15 Sep 2009 15:49:04 +0200 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> Message-ID: <20090915154904.324cmp4adv1ccok4@webmail.provincia.torino.it> Alan, now node finishes the boot e "root login:" appears. The problem is it does not respond if I ping it. How can I login on it ? Which is the root password ? I'd like to check network configuration ----- Messaggio da apevec at gmail.com --------- Data: Tue, 15 Sep 2009 14:37:14 +0200 Da: Alan Pevec Rispondi-A:Alan Pevec Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure A: ignazio.cassano at provincia.torino.it Cc: ovirt-devel at redhat.com > On Tue, Sep 15, 2009 at 11:27 AM, wrote: > >> I tried to start a phisical node and it start to load the pxe image but >> then >> it seems frozen. >> > > Could you capture serial console log? At what point it freezes? > Please check if you have livecd-tools-024-1ovirt.fc11.x86_64 (from > ovirt.orgrepo) installed on the machine where ovirt-node-image-pxe RPM > is installed. > If not, install it first and then reinstall -pxe (it runs > livecd-iso-to-pxeboot in post script) > ----- Fine del messaggio da apevec at gmail.com ----- From jboggs at redhat.com Tue Sep 15 13:50:31 2009 From: jboggs at redhat.com (Joey Boggs) Date: Tue, 15 Sep 2009 09:50:31 -0400 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <20090915154755.amdf4a327a1ws0k8@webmail.provincia.torino.it> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> <20090915154755.amdf4a327a1ws0k8@webmail.provincia.torino.it> Message-ID: <4AAF9BA7.70602@redhat.com> ignazio.cassano at provincia.torino.it wrote: > Alan, now node finishes the boot e "root login:" appears. > The problem is it does not respond if I ping it. > How can I login on it ? > Which is the root password ? > I'd like to check network configuration > > ----- Messaggio da ignazio.cassano at provincia.torino.it --------- > Data: Tue, 15 Sep 2009 15:06:19 +0200 > Da: ignazio.cassano at provincia.torino.it > Rispondi-A:ignazio.cassano at provincia.torino.it > Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure > A: Alan Pevec > Cc: ovirt-devel at redhat.com > > >> Hello, I am going to install livecd tools but I have a question first: >> >> must management net and public net comunicate isung a router ? >> In my configuration mgmt net and pub net are isolated. >> >> >> >> ----- Messaggio da apevec at gmail.com --------- >> Data: Tue, 15 Sep 2009 14:37:14 +0200 >> Da: Alan Pevec >> Rispondi-A:Alan Pevec >> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >> A: ignazio.cassano at provincia.torino.it >> Cc: ovirt-devel at redhat.com >> >> >>> On Tue, Sep 15, 2009 at 11:27 AM, >>> wrote: >>> >>>> I tried to start a phisical node and it start to load the pxe image >>>> but >>>> then >>>> it seems frozen. >>>> >>> >>> Could you capture serial console log? At what point it freezes? >>> Please check if you have livecd-tools-024-1ovirt.fc11.x86_64 (from >>> ovirt.orgrepo) installed on the machine where ovirt-node-image-pxe RPM >>> is installed. >>> If not, install it first and then reinstall -pxe (it runs >>> livecd-iso-to-pxeboot in post script) >>> >> >> >> ----- Fine del messaggio da apevec at gmail.com ----- >> >> >> >> >> _______________________________________________ >> Ovirt-devel mailing list >> Ovirt-devel at redhat.com >> https://www.redhat.com/mailman/listinfo/ovirt-devel > > > ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- > > > > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel In /var/log/messages you can check for the dhcp request/ack which will have the mac/ip address assigned to the node. You can then ssh from the management server to it. Does the root login prompt have an associated hostname? nodeXX login: ? From ignazio.cassano at provincia.torino.it Tue Sep 15 14:12:09 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Tue, 15 Sep 2009 16:12:09 +0200 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <4AAF9BA7.70602@redhat.com> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> <20090915154755.amdf4a327a1ws0k8@webmail.provincia.torino.it> <4AAF9BA7.70602@redhat.com> Message-ID: <20090915161209.ery3nead1pc08s00@webmail.provincia.torino.it> Joey, The node gets valid ip adress from ovirt dhcp server but it is never reachable by ping or ssh. During boot it waits a long time when detects disks. The very strange thing is the node starts using pxe but at the and it displays the "login:" related to the operating system that is installed on its local disk (I am using the same node to test redhat virtualization beta so thi node has a redhat hypervisor installed on ots disk). Since I have not another machine to test as node, I tried to pxe boot a virtual machine and it works fine (it appears in the ovirt web interface) bt of course I cannot use it. ----- Messaggio da jboggs at redhat.com --------- Data: Tue, 15 Sep 2009 09:50:31 -0400 Da: Joey Boggs Rispondi-A:Joey Boggs Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure A: ignazio.cassano at provincia.torino.it Cc: ovirt-devel at redhat.com > ignazio.cassano at provincia.torino.it wrote: >> Alan, now node finishes the boot e "root login:" appears. >> The problem is it does not respond if I ping it. >> How can I login on it ? >> Which is the root password ? >> I'd like to check network configuration >> >> ----- Messaggio da ignazio.cassano at provincia.torino.it --------- >> Data: Tue, 15 Sep 2009 15:06:19 +0200 >> Da: ignazio.cassano at provincia.torino.it >> Rispondi-A:ignazio.cassano at provincia.torino.it >> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >> A: Alan Pevec >> Cc: ovirt-devel at redhat.com >> >> >>> Hello, I am going to install livecd tools but I have a question first: >>> >>> must management net and public net comunicate isung a router ? >>> In my configuration mgmt net and pub net are isolated. >>> >>> >>> >>> ----- Messaggio da apevec at gmail.com --------- >>> Data: Tue, 15 Sep 2009 14:37:14 +0200 >>> Da: Alan Pevec >>> Rispondi-A:Alan Pevec >>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>> A: ignazio.cassano at provincia.torino.it >>> Cc: ovirt-devel at redhat.com >>> >>> >>>> On Tue, Sep 15, 2009 at 11:27 AM, >>>> wrote: >>>> >>>>> I tried to start a phisical node and it start to load the pxe image but >>>>> then >>>>> it seems frozen. >>>>> >>>> >>>> Could you capture serial console log? At what point it freezes? >>>> Please check if you have livecd-tools-024-1ovirt.fc11.x86_64 (from >>>> ovirt.orgrepo) installed on the machine where ovirt-node-image-pxe RPM >>>> is installed. >>>> If not, install it first and then reinstall -pxe (it runs >>>> livecd-iso-to-pxeboot in post script) >>>> >>> >>> >>> ----- Fine del messaggio da apevec at gmail.com ----- >>> >>> >>> >>> >>> _______________________________________________ >>> Ovirt-devel mailing list >>> Ovirt-devel at redhat.com >>> https://www.redhat.com/mailman/listinfo/ovirt-devel >> >> >> ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- >> >> >> >> >> _______________________________________________ >> Ovirt-devel mailing list >> Ovirt-devel at redhat.com >> https://www.redhat.com/mailman/listinfo/ovirt-devel > > In /var/log/messages you can check for the dhcp request/ack which will > have the mac/ip address assigned to the node. You can then ssh from the > management server to it. Does the root login prompt have an associated > hostname? nodeXX login: ? ----- Fine del messaggio da jboggs at redhat.com ----- From laurent at open-minds.org Tue Sep 15 14:15:12 2009 From: laurent at open-minds.org (Laurent =?iso-8859-1?q?L=E9onard?=) Date: Tue, 15 Sep 2009 16:15:12 +0200 Subject: [Ovirt-devel] Links on website download section Message-ID: <200909151615.15810.laurent@open-minds.org> Hi, The links to oVirt Node ISO seems to be down on http://www.ovirt.org/download.html -- Laurent L?onard -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part. URL: From ignazio.cassano at provincia.torino.it Tue Sep 15 14:25:23 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Tue, 15 Sep 2009 16:25:23 +0200 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <4AAF9BA7.70602@redhat.com> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> <20090915154755.amdf4a327a1ws0k8@webmail.provincia.torino.it> <4AAF9BA7.70602@redhat.com> Message-ID: <20090915162523.wbbkujac6lkogk8w@webmail.provincia.torino.it> I disconnected local disk on my phisical node. Now it finishes boot and "localhost login:" appears. I logged on and I discovered it does not know eth0 device. ----- Messaggio da jboggs at redhat.com --------- Data: Tue, 15 Sep 2009 09:50:31 -0400 Da: Joey Boggs Rispondi-A:Joey Boggs Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure A: ignazio.cassano at provincia.torino.it Cc: ovirt-devel at redhat.com > ignazio.cassano at provincia.torino.it wrote: >> Alan, now node finishes the boot e "root login:" appears. >> The problem is it does not respond if I ping it. >> How can I login on it ? >> Which is the root password ? >> I'd like to check network configuration >> >> ----- Messaggio da ignazio.cassano at provincia.torino.it --------- >> Data: Tue, 15 Sep 2009 15:06:19 +0200 >> Da: ignazio.cassano at provincia.torino.it >> Rispondi-A:ignazio.cassano at provincia.torino.it >> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >> A: Alan Pevec >> Cc: ovirt-devel at redhat.com >> >> >>> Hello, I am going to install livecd tools but I have a question first: >>> >>> must management net and public net comunicate isung a router ? >>> In my configuration mgmt net and pub net are isolated. >>> >>> >>> >>> ----- Messaggio da apevec at gmail.com --------- >>> Data: Tue, 15 Sep 2009 14:37:14 +0200 >>> Da: Alan Pevec >>> Rispondi-A:Alan Pevec >>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>> A: ignazio.cassano at provincia.torino.it >>> Cc: ovirt-devel at redhat.com >>> >>> >>>> On Tue, Sep 15, 2009 at 11:27 AM, >>>> wrote: >>>> >>>>> I tried to start a phisical node and it start to load the pxe image but >>>>> then >>>>> it seems frozen. >>>>> >>>> >>>> Could you capture serial console log? At what point it freezes? >>>> Please check if you have livecd-tools-024-1ovirt.fc11.x86_64 (from >>>> ovirt.orgrepo) installed on the machine where ovirt-node-image-pxe RPM >>>> is installed. >>>> If not, install it first and then reinstall -pxe (it runs >>>> livecd-iso-to-pxeboot in post script) >>>> >>> >>> >>> ----- Fine del messaggio da apevec at gmail.com ----- >>> >>> >>> >>> >>> _______________________________________________ >>> Ovirt-devel mailing list >>> Ovirt-devel at redhat.com >>> https://www.redhat.com/mailman/listinfo/ovirt-devel >> >> >> ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- >> >> >> >> >> _______________________________________________ >> Ovirt-devel mailing list >> Ovirt-devel at redhat.com >> https://www.redhat.com/mailman/listinfo/ovirt-devel > > In /var/log/messages you can check for the dhcp request/ack which will > have the mac/ip address assigned to the node. You can then ssh from the > management server to it. Does the root login prompt have an associated > hostname? nodeXX login: ? ----- Fine del messaggio da jboggs at redhat.com ----- From ignazio.cassano at provincia.torino.it Tue Sep 15 14:28:34 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Tue, 15 Sep 2009 16:28:34 +0200 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <4AAF9BA7.70602@redhat.com> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> <20090915154755.amdf4a327a1ws0k8@webmail.provincia.torino.it> <4AAF9BA7.70602@redhat.com> Message-ID: <20090915162834.fkw0tm6tzq7wgco8@webmail.provincia.torino.it> Ethernet card on my node is Broadcom NetXtreme II BCM5709 Gigabith ethernet ----- Messaggio da jboggs at redhat.com --------- Data: Tue, 15 Sep 2009 09:50:31 -0400 Da: Joey Boggs Rispondi-A:Joey Boggs Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure A: ignazio.cassano at provincia.torino.it Cc: ovirt-devel at redhat.com > ignazio.cassano at provincia.torino.it wrote: >> Alan, now node finishes the boot e "root login:" appears. >> The problem is it does not respond if I ping it. >> How can I login on it ? >> Which is the root password ? >> I'd like to check network configuration >> >> ----- Messaggio da ignazio.cassano at provincia.torino.it --------- >> Data: Tue, 15 Sep 2009 15:06:19 +0200 >> Da: ignazio.cassano at provincia.torino.it >> Rispondi-A:ignazio.cassano at provincia.torino.it >> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >> A: Alan Pevec >> Cc: ovirt-devel at redhat.com >> >> >>> Hello, I am going to install livecd tools but I have a question first: >>> >>> must management net and public net comunicate isung a router ? >>> In my configuration mgmt net and pub net are isolated. >>> >>> >>> >>> ----- Messaggio da apevec at gmail.com --------- >>> Data: Tue, 15 Sep 2009 14:37:14 +0200 >>> Da: Alan Pevec >>> Rispondi-A:Alan Pevec >>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>> A: ignazio.cassano at provincia.torino.it >>> Cc: ovirt-devel at redhat.com >>> >>> >>>> On Tue, Sep 15, 2009 at 11:27 AM, >>>> wrote: >>>> >>>>> I tried to start a phisical node and it start to load the pxe image but >>>>> then >>>>> it seems frozen. >>>>> >>>> >>>> Could you capture serial console log? At what point it freezes? >>>> Please check if you have livecd-tools-024-1ovirt.fc11.x86_64 (from >>>> ovirt.orgrepo) installed on the machine where ovirt-node-image-pxe RPM >>>> is installed. >>>> If not, install it first and then reinstall -pxe (it runs >>>> livecd-iso-to-pxeboot in post script) >>>> >>> >>> >>> ----- Fine del messaggio da apevec at gmail.com ----- >>> >>> >>> >>> >>> _______________________________________________ >>> Ovirt-devel mailing list >>> Ovirt-devel at redhat.com >>> https://www.redhat.com/mailman/listinfo/ovirt-devel >> >> >> ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- >> >> >> >> >> _______________________________________________ >> Ovirt-devel mailing list >> Ovirt-devel at redhat.com >> https://www.redhat.com/mailman/listinfo/ovirt-devel > > In /var/log/messages you can check for the dhcp request/ack which will > have the mac/ip address assigned to the node. You can then ssh from the > management server to it. Does the root login prompt have an associated > hostname? nodeXX login: ? ----- Fine del messaggio da jboggs at redhat.com ----- From jboggs at redhat.com Tue Sep 15 14:30:43 2009 From: jboggs at redhat.com (Joey Boggs) Date: Tue, 15 Sep 2009 10:30:43 -0400 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <20090915162834.fkw0tm6tzq7wgco8@webmail.provincia.torino.it> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> <20090915154755.amdf4a327a1ws0k8@webmail.provincia.torino.it> <4AAF9BA7.70602@redhat.com> <20090915162834.fkw0tm6tzq7wgco8@webmail.provincia.torino.it> Message-ID: <4AAFA513.602@redhat.com> Pretty standard broadcom card. on the node run lsmod and see if tg3 or bnx2 show up, also see if breth0 or eth0 show up in ifconfig. Are you sure the node is pxebooting and not booting off the local disk? ignazio.cassano at provincia.torino.it wrote: > Ethernet card on my node is Broadcom NetXtreme II BCM5709 Gigabith > ethernet > > > > ----- Messaggio da jboggs at redhat.com --------- > Data: Tue, 15 Sep 2009 09:50:31 -0400 > Da: Joey Boggs > Rispondi-A:Joey Boggs > Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure > A: ignazio.cassano at provincia.torino.it > Cc: ovirt-devel at redhat.com > > >> ignazio.cassano at provincia.torino.it wrote: >>> Alan, now node finishes the boot e "root login:" appears. >>> The problem is it does not respond if I ping it. >>> How can I login on it ? >>> Which is the root password ? >>> I'd like to check network configuration >>> >>> ----- Messaggio da ignazio.cassano at provincia.torino.it --------- >>> Data: Tue, 15 Sep 2009 15:06:19 +0200 >>> Da: ignazio.cassano at provincia.torino.it >>> Rispondi-A:ignazio.cassano at provincia.torino.it >>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>> A: Alan Pevec >>> Cc: ovirt-devel at redhat.com >>> >>> >>>> Hello, I am going to install livecd tools but I have a question first: >>>> >>>> must management net and public net comunicate isung a router ? >>>> In my configuration mgmt net and pub net are isolated. >>>> >>>> >>>> >>>> ----- Messaggio da apevec at gmail.com --------- >>>> Data: Tue, 15 Sep 2009 14:37:14 +0200 >>>> Da: Alan Pevec >>>> Rispondi-A:Alan Pevec >>>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>>> A: ignazio.cassano at provincia.torino.it >>>> Cc: ovirt-devel at redhat.com >>>> >>>> >>>>> On Tue, Sep 15, 2009 at 11:27 AM, >>>>> wrote: >>>>> >>>>>> I tried to start a phisical node and it start to load the pxe >>>>>> image but >>>>>> then >>>>>> it seems frozen. >>>>>> >>>>> >>>>> Could you capture serial console log? At what point it freezes? >>>>> Please check if you have livecd-tools-024-1ovirt.fc11.x86_64 (from >>>>> ovirt.orgrepo) installed on the machine where ovirt-node-image-pxe >>>>> RPM >>>>> is installed. >>>>> If not, install it first and then reinstall -pxe (it runs >>>>> livecd-iso-to-pxeboot in post script) >>>>> >>>> >>>> >>>> ----- Fine del messaggio da apevec at gmail.com ----- >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> Ovirt-devel mailing list >>>> Ovirt-devel at redhat.com >>>> https://www.redhat.com/mailman/listinfo/ovirt-devel >>> >>> >>> ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- >>> >>> >>> >>> >>> _______________________________________________ >>> Ovirt-devel mailing list >>> Ovirt-devel at redhat.com >>> https://www.redhat.com/mailman/listinfo/ovirt-devel >> >> In /var/log/messages you can check for the dhcp request/ack which will >> have the mac/ip address assigned to the node. You can then ssh from the >> management server to it. Does the root login prompt have an associated >> hostname? nodeXX login: ? > > > ----- Fine del messaggio da jboggs at redhat.com ----- > > > From jboggs at redhat.com Tue Sep 15 14:39:03 2009 From: jboggs at redhat.com (Joey Boggs) Date: Tue, 15 Sep 2009 10:39:03 -0400 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <4AAFA513.602@redhat.com> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> <20090915154755.amdf4a327a1ws0k8@webmail.provincia.torino.it> <4AAF9BA7.70602@redhat.com> <20090915162834.fkw0tm6tzq7wgco8@webmail.provincia.torino.it> <4AAFA513.602@redhat.com> Message-ID: <4AAFA707.7030005@redhat.com> Joey Boggs wrote: > Pretty standard broadcom card. on the node run lsmod and see if tg3 or > bnx2 show up, also see if breth0 or eth0 show up in ifconfig. Are you > sure the node is pxebooting and not booting off the local disk? > > > > ignazio.cassano at provincia.torino.it wrote: >> Ethernet card on my node is Broadcom NetXtreme II BCM5709 Gigabith >> ethernet >> >> >> >> ----- Messaggio da jboggs at redhat.com --------- >> Data: Tue, 15 Sep 2009 09:50:31 -0400 >> Da: Joey Boggs >> Rispondi-A:Joey Boggs >> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >> A: ignazio.cassano at provincia.torino.it >> Cc: ovirt-devel at redhat.com >> >> >>> ignazio.cassano at provincia.torino.it wrote: >>>> Alan, now node finishes the boot e "root login:" appears. >>>> The problem is it does not respond if I ping it. >>>> How can I login on it ? >>>> Which is the root password ? >>>> I'd like to check network configuration >>>> >>>> ----- Messaggio da ignazio.cassano at provincia.torino.it --------- >>>> Data: Tue, 15 Sep 2009 15:06:19 +0200 >>>> Da: ignazio.cassano at provincia.torino.it >>>> Rispondi-A:ignazio.cassano at provincia.torino.it >>>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>>> A: Alan Pevec >>>> Cc: ovirt-devel at redhat.com >>>> >>>> >>>>> Hello, I am going to install livecd tools but I have a question >>>>> first: >>>>> >>>>> must management net and public net comunicate isung a router ? >>>>> In my configuration mgmt net and pub net are isolated. >>>>> >>>>> >>>>> >>>>> ----- Messaggio da apevec at gmail.com --------- >>>>> Data: Tue, 15 Sep 2009 14:37:14 +0200 >>>>> Da: Alan Pevec >>>>> Rispondi-A:Alan Pevec >>>>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>>>> A: ignazio.cassano at provincia.torino.it >>>>> Cc: ovirt-devel at redhat.com >>>>> >>>>> >>>>>> On Tue, Sep 15, 2009 at 11:27 AM, >>>>>> wrote: >>>>>> >>>>>>> I tried to start a phisical node and it start to load the pxe >>>>>>> image but >>>>>>> then >>>>>>> it seems frozen. >>>>>>> >>>>>> >>>>>> Could you capture serial console log? At what point it freezes? >>>>>> Please check if you have livecd-tools-024-1ovirt.fc11.x86_64 (from >>>>>> ovirt.orgrepo) installed on the machine where >>>>>> ovirt-node-image-pxe RPM >>>>>> is installed. >>>>>> If not, install it first and then reinstall -pxe (it runs >>>>>> livecd-iso-to-pxeboot in post script) >>>>>> >>>>> >>>>> >>>>> ----- Fine del messaggio da apevec at gmail.com ----- >>>>> >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> Ovirt-devel mailing list >>>>> Ovirt-devel at redhat.com >>>>> https://www.redhat.com/mailman/listinfo/ovirt-devel >>>> >>>> >>>> ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> Ovirt-devel mailing list >>>> Ovirt-devel at redhat.com >>>> https://www.redhat.com/mailman/listinfo/ovirt-devel >>> >>> In /var/log/messages you can check for the dhcp request/ack which will >>> have the mac/ip address assigned to the node. You can then ssh from the >>> management server to it. Does the root login prompt have an associated >>> hostname? nodeXX login: ? >> >> >> ----- Fine del messaggio da jboggs at redhat.com ----- >> >> >> > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel Looks like that card might not have the updated module mapping based on a quick search: Run lspci -nn on the node and grab the output for the broadcom card: Here's an example for an intel nic: 02:00.0 Ethernet controller [0200]: Intel Corporation 82573L Gigabit Ethernet Controller [8086:109a] From ignazio.cassano at provincia.torino.it Tue Sep 15 14:41:37 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Tue, 15 Sep 2009 16:41:37 +0200 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <4AAFA513.602@redhat.com> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> <20090915154755.amdf4a327a1ws0k8@webmail.provincia.torino.it> <4AAF9BA7.70602@redhat.com> <20090915162834.fkw0tm6tzq7wgco8@webmail.provincia.torino.it> <4AAFA513.602@redhat.com> Message-ID: <20090915164137.s9rqhx208ggcwkw8@webmail.provincia.torino.it> Local disks are disconnected. Lsmod reports bnx2 is loaded. The breth0 bridge does not link any interface because eth0 seems not present infact if I try /etc/init.d/network restart an error is displayed: eth0 is not present ----- Messaggio da jboggs at redhat.com --------- Data: Tue, 15 Sep 2009 10:30:43 -0400 Da: Joey Boggs Rispondi-A:Joey Boggs Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure A: ignazio.cassano at provincia.torino.it Cc: ovirt-devel at redhat.com > Pretty standard broadcom card. on the node run lsmod and see if tg3 or > bnx2 show up, also see if breth0 or eth0 show up in ifconfig. Are you > sure the node is pxebooting and not booting off the local disk? > > > > ignazio.cassano at provincia.torino.it wrote: >> Ethernet card on my node is Broadcom NetXtreme II BCM5709 Gigabith ethernet >> >> >> >> ----- Messaggio da jboggs at redhat.com --------- >> Data: Tue, 15 Sep 2009 09:50:31 -0400 >> Da: Joey Boggs >> Rispondi-A:Joey Boggs >> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >> A: ignazio.cassano at provincia.torino.it >> Cc: ovirt-devel at redhat.com >> >> >>> ignazio.cassano at provincia.torino.it wrote: >>>> Alan, now node finishes the boot e "root login:" appears. >>>> The problem is it does not respond if I ping it. >>>> How can I login on it ? >>>> Which is the root password ? >>>> I'd like to check network configuration >>>> >>>> ----- Messaggio da ignazio.cassano at provincia.torino.it --------- >>>> Data: Tue, 15 Sep 2009 15:06:19 +0200 >>>> Da: ignazio.cassano at provincia.torino.it >>>> Rispondi-A:ignazio.cassano at provincia.torino.it >>>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>>> A: Alan Pevec >>>> Cc: ovirt-devel at redhat.com >>>> >>>> >>>>> Hello, I am going to install livecd tools but I have a question first: >>>>> >>>>> must management net and public net comunicate isung a router ? >>>>> In my configuration mgmt net and pub net are isolated. >>>>> >>>>> >>>>> >>>>> ----- Messaggio da apevec at gmail.com --------- >>>>> Data: Tue, 15 Sep 2009 14:37:14 +0200 >>>>> Da: Alan Pevec >>>>> Rispondi-A:Alan Pevec >>>>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>>>> A: ignazio.cassano at provincia.torino.it >>>>> Cc: ovirt-devel at redhat.com >>>>> >>>>> >>>>>> On Tue, Sep 15, 2009 at 11:27 AM, >>>>>> wrote: >>>>>> >>>>>>> I tried to start a phisical node and it start to load the pxe image but >>>>>>> then >>>>>>> it seems frozen. >>>>>>> >>>>>> >>>>>> Could you capture serial console log? At what point it freezes? >>>>>> Please check if you have livecd-tools-024-1ovirt.fc11.x86_64 (from >>>>>> ovirt.orgrepo) installed on the machine where ovirt-node-image-pxe RPM >>>>>> is installed. >>>>>> If not, install it first and then reinstall -pxe (it runs >>>>>> livecd-iso-to-pxeboot in post script) >>>>>> >>>>> >>>>> >>>>> ----- Fine del messaggio da apevec at gmail.com ----- >>>>> >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> Ovirt-devel mailing list >>>>> Ovirt-devel at redhat.com >>>>> https://www.redhat.com/mailman/listinfo/ovirt-devel >>>> >>>> >>>> ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> Ovirt-devel mailing list >>>> Ovirt-devel at redhat.com >>>> https://www.redhat.com/mailman/listinfo/ovirt-devel >>> >>> In /var/log/messages you can check for the dhcp request/ack which will >>> have the mac/ip address assigned to the node. You can then ssh from the >>> management server to it. Does the root login prompt have an associated >>> hostname? nodeXX login: ? >> >> >> ----- Fine del messaggio da jboggs at redhat.com ----- >> >> >> ----- Fine del messaggio da jboggs at redhat.com ----- From ignazio.cassano at provincia.torino.it Tue Sep 15 14:43:42 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Tue, 15 Sep 2009 16:43:42 +0200 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <4AAFA707.7030005@redhat.com> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> <20090915154755.amdf4a327a1ws0k8@webmail.provincia.torino.it> <4AAF9BA7.70602@redhat.com> <20090915162834.fkw0tm6tzq7wgco8@webmail.provincia.torino.it> <4AAFA513.602@redhat.com> <4AAFA707.7030005@redhat.com> Message-ID: <20090915164342.botpauuun4joogk8@webmail.provincia.torino.it> lspci is not present on the node. ----- Messaggio da jboggs at redhat.com --------- Data: Tue, 15 Sep 2009 10:39:03 -0400 Da: Joey Boggs Rispondi-A:Joey Boggs Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure A: ignazio.cassano at provincia.torino.it Cc: ovirt-devel at redhat.com > Joey Boggs wrote: >> Pretty standard broadcom card. on the node run lsmod and see if tg3 >> or bnx2 show up, also see if breth0 or eth0 show up in ifconfig. >> Are you sure the node is pxebooting and not booting off the local >> disk? >> >> >> >> ignazio.cassano at provincia.torino.it wrote: >>> Ethernet card on my node is Broadcom NetXtreme II BCM5709 Gigabith ethernet >>> >>> >>> >>> ----- Messaggio da jboggs at redhat.com --------- >>> Data: Tue, 15 Sep 2009 09:50:31 -0400 >>> Da: Joey Boggs >>> Rispondi-A:Joey Boggs >>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>> A: ignazio.cassano at provincia.torino.it >>> Cc: ovirt-devel at redhat.com >>> >>> >>>> ignazio.cassano at provincia.torino.it wrote: >>>>> Alan, now node finishes the boot e "root login:" appears. >>>>> The problem is it does not respond if I ping it. >>>>> How can I login on it ? >>>>> Which is the root password ? >>>>> I'd like to check network configuration >>>>> >>>>> ----- Messaggio da ignazio.cassano at provincia.torino.it --------- >>>>> Data: Tue, 15 Sep 2009 15:06:19 +0200 >>>>> Da: ignazio.cassano at provincia.torino.it >>>>> Rispondi-A:ignazio.cassano at provincia.torino.it >>>>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>>>> A: Alan Pevec >>>>> Cc: ovirt-devel at redhat.com >>>>> >>>>> >>>>>> Hello, I am going to install livecd tools but I have a question first: >>>>>> >>>>>> must management net and public net comunicate isung a router ? >>>>>> In my configuration mgmt net and pub net are isolated. >>>>>> >>>>>> >>>>>> >>>>>> ----- Messaggio da apevec at gmail.com --------- >>>>>> Data: Tue, 15 Sep 2009 14:37:14 +0200 >>>>>> Da: Alan Pevec >>>>>> Rispondi-A:Alan Pevec >>>>>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>>>>> A: ignazio.cassano at provincia.torino.it >>>>>> Cc: ovirt-devel at redhat.com >>>>>> >>>>>> >>>>>>> On Tue, Sep 15, 2009 at 11:27 AM, >>>>>>> wrote: >>>>>>> >>>>>>>> I tried to start a phisical node and it start to load the pxe >>>>>>>> image but >>>>>>>> then >>>>>>>> it seems frozen. >>>>>>>> >>>>>>> >>>>>>> Could you capture serial console log? At what point it freezes? >>>>>>> Please check if you have livecd-tools-024-1ovirt.fc11.x86_64 (from >>>>>>> ovirt.orgrepo) installed on the machine where ovirt-node-image-pxe RPM >>>>>>> is installed. >>>>>>> If not, install it first and then reinstall -pxe (it runs >>>>>>> livecd-iso-to-pxeboot in post script) >>>>>>> >>>>>> >>>>>> >>>>>> ----- Fine del messaggio da apevec at gmail.com ----- >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> Ovirt-devel mailing list >>>>>> Ovirt-devel at redhat.com >>>>>> https://www.redhat.com/mailman/listinfo/ovirt-devel >>>>> >>>>> >>>>> ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- >>>>> >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> Ovirt-devel mailing list >>>>> Ovirt-devel at redhat.com >>>>> https://www.redhat.com/mailman/listinfo/ovirt-devel >>>> >>>> In /var/log/messages you can check for the dhcp request/ack which will >>>> have the mac/ip address assigned to the node. You can then ssh from the >>>> management server to it. Does the root login prompt have an associated >>>> hostname? nodeXX login: ? >>> >>> >>> ----- Fine del messaggio da jboggs at redhat.com ----- >>> >>> >>> >> >> _______________________________________________ >> Ovirt-devel mailing list >> Ovirt-devel at redhat.com >> https://www.redhat.com/mailman/listinfo/ovirt-devel > > > Looks like that card might not have the updated module mapping based on > a quick search: > > Run lspci -nn on the node and grab the output for the broadcom card: > > Here's an example for an intel nic: > 02:00.0 Ethernet controller [0200]: Intel Corporation 82573L Gigabit > Ethernet Controller [8086:109a] ----- Fine del messaggio da jboggs at redhat.com ----- From jboggs at redhat.com Tue Sep 15 14:54:52 2009 From: jboggs at redhat.com (Joey Boggs) Date: Tue, 15 Sep 2009 10:54:52 -0400 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <20090915164342.botpauuun4joogk8@webmail.provincia.torino.it> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> <20090915154755.amdf4a327a1ws0k8@webmail.provincia.torino.it> <4AAF9BA7.70602@redhat.com> <20090915162834.fkw0tm6tzq7wgco8@webmail.provincia.torino.it> <4AAFA513.602@redhat.com> <4AAFA707.7030005@redhat.com> <20090915164342.botpauuun4joogk8@webmail.provincia.torino.it> Message-ID: <4AAFAABC.9030209@redhat.com> ignazio.cassano at provincia.torino.it wrote: > lspci is not present on the node. > > > ----- Messaggio da jboggs at redhat.com --------- > Data: Tue, 15 Sep 2009 10:39:03 -0400 > Da: Joey Boggs > Rispondi-A:Joey Boggs > Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure > A: ignazio.cassano at provincia.torino.it > Cc: ovirt-devel at redhat.com > > >> Joey Boggs wrote: >>> Pretty standard broadcom card. on the node run lsmod and see if tg3 >>> or bnx2 show up, also see if breth0 or eth0 show up in ifconfig. >>> Are you sure the node is pxebooting and not booting off the local >>> disk? >>> >>> >>> >>> ignazio.cassano at provincia.torino.it wrote: >>>> Ethernet card on my node is Broadcom NetXtreme II BCM5709 Gigabith >>>> ethernet >>>> >>>> >>>> >>>> ----- Messaggio da jboggs at redhat.com --------- >>>> Data: Tue, 15 Sep 2009 09:50:31 -0400 >>>> Da: Joey Boggs >>>> Rispondi-A:Joey Boggs >>>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>>> A: ignazio.cassano at provincia.torino.it >>>> Cc: ovirt-devel at redhat.com >>>> >>>> >>>>> ignazio.cassano at provincia.torino.it wrote: >>>>>> Alan, now node finishes the boot e "root login:" appears. >>>>>> The problem is it does not respond if I ping it. >>>>>> How can I login on it ? >>>>>> Which is the root password ? >>>>>> I'd like to check network configuration >>>>>> >>>>>> ----- Messaggio da ignazio.cassano at provincia.torino.it --------- >>>>>> Data: Tue, 15 Sep 2009 15:06:19 +0200 >>>>>> Da: ignazio.cassano at provincia.torino.it >>>>>> Rispondi-A:ignazio.cassano at provincia.torino.it >>>>>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>>>>> A: Alan Pevec >>>>>> Cc: ovirt-devel at redhat.com >>>>>> >>>>>> >>>>>>> Hello, I am going to install livecd tools but I have a question >>>>>>> first: >>>>>>> >>>>>>> must management net and public net comunicate isung a router ? >>>>>>> In my configuration mgmt net and pub net are isolated. >>>>>>> >>>>>>> >>>>>>> >>>>>>> ----- Messaggio da apevec at gmail.com --------- >>>>>>> Data: Tue, 15 Sep 2009 14:37:14 +0200 >>>>>>> Da: Alan Pevec >>>>>>> Rispondi-A:Alan Pevec >>>>>>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>>>>>> A: ignazio.cassano at provincia.torino.it >>>>>>> Cc: ovirt-devel at redhat.com >>>>>>> >>>>>>> >>>>>>>> On Tue, Sep 15, 2009 at 11:27 AM, >>>>>>>> wrote: >>>>>>>> >>>>>>>>> I tried to start a phisical node and it start to load the pxe >>>>>>>>> image but >>>>>>>>> then >>>>>>>>> it seems frozen. >>>>>>>>> >>>>>>>> >>>>>>>> Could you capture serial console log? At what point it freezes? >>>>>>>> Please check if you have livecd-tools-024-1ovirt.fc11.x86_64 (from >>>>>>>> ovirt.orgrepo) installed on the machine where >>>>>>>> ovirt-node-image-pxe RPM >>>>>>>> is installed. >>>>>>>> If not, install it first and then reinstall -pxe (it runs >>>>>>>> livecd-iso-to-pxeboot in post script) >>>>>>>> >>>>>>> >>>>>>> >>>>>>> ----- Fine del messaggio da apevec at gmail.com ----- >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Ovirt-devel mailing list >>>>>>> Ovirt-devel at redhat.com >>>>>>> https://www.redhat.com/mailman/listinfo/ovirt-devel >>>>>> >>>>>> >>>>>> ----- Fine del messaggio da ignazio.cassano at provincia.torino.it >>>>>> ----- >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> Ovirt-devel mailing list >>>>>> Ovirt-devel at redhat.com >>>>>> https://www.redhat.com/mailman/listinfo/ovirt-devel >>>>> >>>>> In /var/log/messages you can check for the dhcp request/ack which >>>>> will >>>>> have the mac/ip address assigned to the node. You can then ssh >>>>> from the >>>>> management server to it. Does the root login prompt have an >>>>> associated >>>>> hostname? nodeXX login: ? >>>> >>>> >>>> ----- Fine del messaggio da jboggs at redhat.com ----- >>>> >>>> >>>> >>> >>> _______________________________________________ >>> Ovirt-devel mailing list >>> Ovirt-devel at redhat.com >>> https://www.redhat.com/mailman/listinfo/ovirt-devel >> >> >> Looks like that card might not have the updated module mapping based on >> a quick search: >> >> Run lspci -nn on the node and grab the output for the broadcom card: >> >> Here's an example for an intel nic: >> 02:00.0 Ethernet controller [0200]: Intel Corporation 82573L Gigabit >> Ethernet Controller [8086:109a] > > > ----- Fine del messaggio da jboggs at redhat.com ----- > > > Limited to how we can figure it out but give this a shot on the node: lshal > /root/hal.out vi /root/hal.out and locate your entry for the nic, here's a sample one again for an intel nic: We only need the first line (udi = '/org/freedesktop/Hal/devices/pci_8086_109a') udi = '/org/freedesktop/Hal/devices/pci_8086_109a' info.linux.driver = 'e1000e' (string) info.parent = '/org/freedesktop/Hal/devices/pci_8086_27d0' (string) info.product = '82573L Gigabit Ethernet Controller' (string) info.subsystem = 'pci' (string) info.udi = '/org/freedesktop/Hal/devices/pci_8086_109a' (string) info.vendor = 'Intel Corporation' (string) linux.hotplug_type = 2 (0x2) (int) linux.subsystem = 'pci' (string) linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0' (string) pci.device_class = 2 (0x2) (int) pci.device_protocol = 0 (0x0) (int) pci.device_subclass = 0 (0x0) (int) pci.linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0' (string) pci.product = '82573L Gigabit Ethernet Controller' (string) pci.product_id = 4250 (0x109a) (int) pci.subsys_product = 'ThinkPad T60' (string) pci.subsys_product_id = 8193 (0x2001) (int) pci.subsys_vendor = 'Lenovo' (string) pci.subsys_vendor_id = 6058 (0x17aa) (int) pci.vendor = 'Intel Corporation' (string) pci.vendor_id = 32902 (0x8086) (int) From pmialon at linagora.com Tue Sep 15 15:15:46 2009 From: pmialon at linagora.com (Pierre-Gilles Mialon) Date: Tue, 15 Sep 2009 17:15:46 +0200 Subject: [Ovirt-devel] [PATCH node] Add support for automatic remote logging on PXE ovirt-node In-Reply-To: <1252422735-24943-1-git-send-email-pmialon@linagora.com> References: <1252422735-24943-1-git-send-email-pmialon@linagora.com> Message-ID: <200909151715.54107.pmialon@linagora.com> could someone to review this patch ? It is usefull for my stateless nodes ;-) Le mardi 8 septembre 2009 17:12:15 pmialon at linagora.com, vous avez ?crit : > From: root > > Use ovirt-config-logging in /etc/init.d/ovirt > --- > scripts/ovirt | 19 ++++--------------- > scripts/ovirt-config-logging | 2 +- > scripts/ovirt-functions | 4 ++++ > 3 files changed, 9 insertions(+), 16 deletions(-) > > diff --git a/scripts/ovirt b/scripts/ovirt > index 4ff03f2..0c5e3be 100755 > --- a/scripts/ovirt > +++ b/scripts/ovirt > @@ -14,6 +14,9 @@ start() { > if is_standalone; then > return 0 > fi > + > + ovirt-config-logging AUTO > + > find_srv ipa tcp > if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then > krb5_conf=/etc/krb5.conf > @@ -43,21 +46,7 @@ start() { > log "skipping ovirt-awake, oVirt identify service not available" > fi > > - find_srv collectd udp > - if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then > - collectd_conf=/etc/collectd.conf > - if [ -f $collectd_conf.in ]; then > - sed -e "s/@COLLECTD_SERVER@/$SRV_HOST/" \ > - -e "s/@COLLECTD_PORT@/$SRV_PORT/" \ > - -e "//,/<\/Plugin>/d" $collectd_conf.in \ > - > $collectd_conf > - if [ $? -ne 0 ]; then > - log "Failed to write $collectd_conf"; return 1 > - fi > - fi > - else > - log "skipping collectd configuration, collectd service not > available" - fi > + ovirt-config-collectd AUTO > > find_srv qpidd tcp > if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then > diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging > index d8e5c95..598b7cb 100755 > --- a/scripts/ovirt-config-logging > +++ b/scripts/ovirt-config-logging > @@ -8,7 +8,7 @@ > trap '__st=$?; stop_log; exit $__st' 0 > trap 'exit $?' 1 2 13 15 > > -if ! is_local_storage_configured; then > +if ! is_local_storage_configured && ! is_diskless ; then > printf "Local storage must be configured prior to configuring the > logging system.\n" exit 99 > fi > diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions > index 98e88e7..f86543e 100644 > --- a/scripts/ovirt-functions > +++ b/scripts/ovirt-functions > @@ -88,6 +88,10 @@ is_local_storage_configured () { > return 1 > } > > +is_diskless() { > + grep -q '/dev/mapper/live-rw /' /proc/mounts > +} > + > # perform automatic local disk installation > # when at least following boot parameters are present: > # for networking - OVIRT_BOOTIF, management NIC -- Pierre-Gilles Mialon Responsable h?bergement :: Head of Hosting services pmialon at linagora.com :: +33.1 58 18 65 46 Linagora :: http://www.linagora.com 27 rue de Berri :: 75008 PARIS -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part. URL: From apevec at gmail.com Tue Sep 15 15:26:42 2009 From: apevec at gmail.com (Alan Pevec) Date: Tue, 15 Sep 2009 17:26:42 +0200 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <20090915161209.ery3nead1pc08s00@webmail.provincia.torino.it> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> <20090915154755.amdf4a327a1ws0k8@webmail.provincia.torino.it> <4AAF9BA7.70602@redhat.com> <20090915161209.ery3nead1pc08s00@webmail.provincia.torino.it> Message-ID: <2be7262f0909150826m26d43d25vfdeaab8315aefdd4@mail.gmail.com> On Tue, Sep 15, 2009 at 4:12 PM, wrote: > The node gets valid ip adress from ovirt dhcp server but it is never > reachable > by ping or ssh. > During boot it waits a long time when detects disks. > The very strange thing is the node starts using pxe but at the and > it displays the "login:" related to the operating system that is installed > on its local disk (I am using the same node to test redhat virtualization > beta so > thi node has a redhat hypervisor installed on ots disk). > > Since I have not another machine to test as node, I tried to pxe boot a > virtual machine and it works fine (it appears in the ovirt web interface) bt > of course I cannot use it. > > You should either wipe or disconnect local disk where you had RHEV Hypervisor installed. ovirt.org Node uses the same HostVG for local installation, so it will automatically mount and use RHEV-H persisted configuration. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ignazio.cassano at provincia.torino.it Tue Sep 15 15:44:06 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Tue, 15 Sep 2009 17:44:06 +0200 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <4AAFAABC.9030209@redhat.com> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> <20090915154755.amdf4a327a1ws0k8@webmail.provincia.torino.it> <4AAF9BA7.70602@redhat.com> <20090915162834.fkw0tm6tzq7wgco8@webmail.provincia.torino.it> <4AAFA513.602@redhat.com> <4AAFA707.7030005@redhat.com> <20090915164342.botpauuun4joogk8@webmail.provincia.torino.it> <4AAFAABC.9030209@redhat.com> Message-ID: <20090915174406.4zbk2aoc956muc0g@webmail.provincia.torino.it> On the node in /var/log/messages I detected: bnx2: probe of xxxxxxx failed with error -2 ----- Messaggio da jboggs at redhat.com --------- Data: Tue, 15 Sep 2009 10:54:52 -0400 Da: Joey Boggs Rispondi-A:Joey Boggs Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure A: ignazio.cassano at provincia.torino.it Cc: ovirt-devel at redhat.com > ignazio.cassano at provincia.torino.it wrote: >> lspci is not present on the node. >> >> >> ----- Messaggio da jboggs at redhat.com --------- >> Data: Tue, 15 Sep 2009 10:39:03 -0400 >> Da: Joey Boggs >> Rispondi-A:Joey Boggs >> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >> A: ignazio.cassano at provincia.torino.it >> Cc: ovirt-devel at redhat.com >> >> >>> Joey Boggs wrote: >>>> Pretty standard broadcom card. on the node run lsmod and see if >>>> tg3 or bnx2 show up, also see if breth0 or eth0 show up in >>>> ifconfig. Are you sure the node is pxebooting and not booting >>>> off the local disk? >>>> >>>> >>>> >>>> ignazio.cassano at provincia.torino.it wrote: >>>>> Ethernet card on my node is Broadcom NetXtreme II BCM5709 >>>>> Gigabith ethernet >>>>> >>>>> >>>>> >>>>> ----- Messaggio da jboggs at redhat.com --------- >>>>> Data: Tue, 15 Sep 2009 09:50:31 -0400 >>>>> Da: Joey Boggs >>>>> Rispondi-A:Joey Boggs >>>>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>>>> A: ignazio.cassano at provincia.torino.it >>>>> Cc: ovirt-devel at redhat.com >>>>> >>>>> >>>>>> ignazio.cassano at provincia.torino.it wrote: >>>>>>> Alan, now node finishes the boot e "root login:" appears. >>>>>>> The problem is it does not respond if I ping it. >>>>>>> How can I login on it ? >>>>>>> Which is the root password ? >>>>>>> I'd like to check network configuration >>>>>>> >>>>>>> ----- Messaggio da ignazio.cassano at provincia.torino.it --------- >>>>>>> Data: Tue, 15 Sep 2009 15:06:19 +0200 >>>>>>> Da: ignazio.cassano at provincia.torino.it >>>>>>> Rispondi-A:ignazio.cassano at provincia.torino.it >>>>>>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>>>>>> A: Alan Pevec >>>>>>> Cc: ovirt-devel at redhat.com >>>>>>> >>>>>>> >>>>>>>> Hello, I am going to install livecd tools but I have a question first: >>>>>>>> >>>>>>>> must management net and public net comunicate isung a router ? >>>>>>>> In my configuration mgmt net and pub net are isolated. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> ----- Messaggio da apevec at gmail.com --------- >>>>>>>> Data: Tue, 15 Sep 2009 14:37:14 +0200 >>>>>>>> Da: Alan Pevec >>>>>>>> Rispondi-A:Alan Pevec >>>>>>>> Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure >>>>>>>> A: ignazio.cassano at provincia.torino.it >>>>>>>> Cc: ovirt-devel at redhat.com >>>>>>>> >>>>>>>> >>>>>>>>> On Tue, Sep 15, 2009 at 11:27 AM, >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>>> I tried to start a phisical node and it start to load the >>>>>>>>>> pxe image but >>>>>>>>>> then >>>>>>>>>> it seems frozen. >>>>>>>>>> >>>>>>>>> >>>>>>>>> Could you capture serial console log? At what point it freezes? >>>>>>>>> Please check if you have livecd-tools-024-1ovirt.fc11.x86_64 (from >>>>>>>>> ovirt.orgrepo) installed on the machine where >>>>>>>>> ovirt-node-image-pxe RPM >>>>>>>>> is installed. >>>>>>>>> If not, install it first and then reinstall -pxe (it runs >>>>>>>>> livecd-iso-to-pxeboot in post script) >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> ----- Fine del messaggio da apevec at gmail.com ----- >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Ovirt-devel mailing list >>>>>>>> Ovirt-devel at redhat.com >>>>>>>> https://www.redhat.com/mailman/listinfo/ovirt-devel >>>>>>> >>>>>>> >>>>>>> ----- Fine del messaggio da ignazio.cassano at provincia.torino.it ----- >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Ovirt-devel mailing list >>>>>>> Ovirt-devel at redhat.com >>>>>>> https://www.redhat.com/mailman/listinfo/ovirt-devel >>>>>> >>>>>> In /var/log/messages you can check for the dhcp request/ack which will >>>>>> have the mac/ip address assigned to the node. You can then ssh from the >>>>>> management server to it. Does the root login prompt have an associated >>>>>> hostname? nodeXX login: ? >>>>> >>>>> >>>>> ----- Fine del messaggio da jboggs at redhat.com ----- >>>>> >>>>> >>>>> >>>> >>>> _______________________________________________ >>>> Ovirt-devel mailing list >>>> Ovirt-devel at redhat.com >>>> https://www.redhat.com/mailman/listinfo/ovirt-devel >>> >>> >>> Looks like that card might not have the updated module mapping based on >>> a quick search: >>> >>> Run lspci -nn on the node and grab the output for the broadcom card: >>> >>> Here's an example for an intel nic: >>> 02:00.0 Ethernet controller [0200]: Intel Corporation 82573L Gigabit >>> Ethernet Controller [8086:109a] >> >> >> ----- Fine del messaggio da jboggs at redhat.com ----- >> >> >> > > Limited to how we can figure it out but give this a shot > > on the node: lshal > /root/hal.out > > vi /root/hal.out and locate your entry for the nic, here's a sample one > again for an intel nic: We only need the first line (udi = > '/org/freedesktop/Hal/devices/pci_8086_109a') > > udi = '/org/freedesktop/Hal/devices/pci_8086_109a' > info.linux.driver = 'e1000e' (string) > info.parent = '/org/freedesktop/Hal/devices/pci_8086_27d0' (string) > info.product = '82573L Gigabit Ethernet Controller' (string) > info.subsystem = 'pci' (string) > info.udi = '/org/freedesktop/Hal/devices/pci_8086_109a' (string) > info.vendor = 'Intel Corporation' (string) > linux.hotplug_type = 2 (0x2) (int) > linux.subsystem = 'pci' (string) > linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0' > (string) > pci.device_class = 2 (0x2) (int) > pci.device_protocol = 0 (0x0) (int) > pci.device_subclass = 0 (0x0) (int) > pci.linux.sysfs_path = > '/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0' (string) > pci.product = '82573L Gigabit Ethernet Controller' (string) > pci.product_id = 4250 (0x109a) (int) > pci.subsys_product = 'ThinkPad T60' (string) > pci.subsys_product_id = 8193 (0x2001) (int) > pci.subsys_vendor = 'Lenovo' (string) > pci.subsys_vendor_id = 6058 (0x17aa) (int) > pci.vendor = 'Intel Corporation' (string) > pci.vendor_id = 32902 (0x8086) (int) ----- Fine del messaggio da jboggs at redhat.com ----- From apevec at gmail.com Tue Sep 15 15:47:30 2009 From: apevec at gmail.com (Alan Pevec) Date: Tue, 15 Sep 2009 17:47:30 +0200 Subject: [Ovirt-devel] [PATCH node] Add support for automatic remote logging on PXE ovirt-node In-Reply-To: <1252422735-24943-1-git-send-email-pmialon@linagora.com> References: <1252422735-24943-1-git-send-email-pmialon@linagora.com> Message-ID: <2be7262f0909150847l2023ff6q613eecac45356a66@mail.gmail.com> > > +is_diskless() { > + grep -q '/dev/mapper/live-rw /' /proc/mounts > +} > + > patch is ok, but this check needs to be improved: livecd image always has that even when booted from a local disk (we keep compressed squashfs image on HostVG/Root) One way would be to check for root=*.iso parameter in kernel command line: grep -q 'root=/[^ ]*\.iso' /proc/cmdline -------------- next part -------------- An HTML attachment was scrubbed... URL: From ignazio.cassano at provincia.torino.it Tue Sep 15 15:48:27 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Tue, 15 Sep 2009 17:48:27 +0200 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <2be7262f0909150826m26d43d25vfdeaab8315aefdd4@mail.gmail.com> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> <20090915154755.amdf4a327a1ws0k8@webmail.provincia.torino.it> <4AAF9BA7.70602@redhat.com> <20090915161209.ery3nead1pc08s00@webmail.provincia.torino.it> <2be7262f0909150826m26d43d25vfdeaab8315aefdd4@mail.gmail.com> Message-ID: <20090915174827.8odkx0czdxgkcs0k@webmail.provincia.torino.it> On node in /var/log/messages I also detected: bnx2: Can't load firmware file bnx2/bnx2-mips-09-4.6.17.fw ----- Messaggio da apevec at gmail.com --------- Data: Tue, 15 Sep 2009 17:26:42 +0200 Da: Alan Pevec Rispondi-A:Alan Pevec Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure A: ignazio.cassano at provincia.torino.it Cc: Joey Boggs , ovirt-devel at redhat.com > On Tue, Sep 15, 2009 at 4:12 PM, wrote: > >> The node gets valid ip adress from ovirt dhcp server but it is never >> reachable >> by ping or ssh. >> During boot it waits a long time when detects disks. >> The very strange thing is the node starts using pxe but at the and >> it displays the "login:" related to the operating system that is installed >> on its local disk (I am using the same node to test redhat virtualization >> beta so >> thi node has a redhat hypervisor installed on ots disk). >> >> Since I have not another machine to test as node, I tried to pxe boot a >> virtual machine and it works fine (it appears in the ovirt web interface) bt >> of course I cannot use it. >> >> > You should either wipe or disconnect local disk where you had RHEV > Hypervisor installed. > ovirt.org Node uses the same HostVG for local installation, so it will > automatically mount and use RHEV-H persisted configuration. > ----- Fine del messaggio da apevec at gmail.com ----- From apevec at gmail.com Tue Sep 15 16:03:01 2009 From: apevec at gmail.com (Alan Pevec) Date: Tue, 15 Sep 2009 18:03:01 +0200 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <20090915174827.8odkx0czdxgkcs0k@webmail.provincia.torino.it> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> <20090915154755.amdf4a327a1ws0k8@webmail.provincia.torino.it> <4AAF9BA7.70602@redhat.com> <20090915161209.ery3nead1pc08s00@webmail.provincia.torino.it> <2be7262f0909150826m26d43d25vfdeaab8315aefdd4@mail.gmail.com> <20090915174827.8odkx0czdxgkcs0k@webmail.provincia.torino.it> Message-ID: <2be7262f0909150903s8d9f53axa7b6d4ebf742df27@mail.gmail.com> On Tue, Sep 15, 2009 at 5:48 PM, wrote: > > On node in /var/log/messages I also detected: > > bnx2: Can't load firmware file bnx2/bnx2-mips-09-4.6.17.fw ok, this is the root cause then: we need to unblacklist bnx2 firmwares in node-image kickstart -------------- next part -------------- An HTML attachment was scrubbed... URL: From ignazio.cassano at provincia.torino.it Tue Sep 15 16:13:05 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Tue, 15 Sep 2009 18:13:05 +0200 Subject: [Ovirt-devel] ovirt node GSS Failure In-Reply-To: <2be7262f0909150903s8d9f53axa7b6d4ebf742df27@mail.gmail.com> References: <20090915112738.zbkfoumuce6sokk4@webmail.provincia.torino.it> <2be7262f0909150537m164fd3b9idf9336c1070bb9ef@mail.gmail.com> <20090915150619.5x20c22ji9csogo4@webmail.provincia.torino.it> <20090915154755.amdf4a327a1ws0k8@webmail.provincia.torino.it> <4AAF9BA7.70602@redhat.com> <20090915161209.ery3nead1pc08s00@webmail.provincia.torino.it> <2be7262f0909150826m26d43d25vfdeaab8315aefdd4@mail.gmail.com> <20090915174827.8odkx0czdxgkcs0k@webmail.provincia.torino.it> <2be7262f0909150903s8d9f53axa7b6d4ebf742df27@mail.gmail.com> Message-ID: <20090915181305.nzvyhqflft1c0g84@webmail.provincia.torino.it> Sorry for my bad english but I don't know what unblacklist means.... I suppose you must patch ovirt-node.... Could you send me information when the problem will be solved ? Thanks Ignazio ----- Messaggio da apevec at gmail.com --------- Data: Tue, 15 Sep 2009 18:03:01 +0200 Da: Alan Pevec Rispondi-A:Alan Pevec Oggetto: Re: [Ovirt-devel] ovirt node GSS Failure A: ignazio.cassano at provincia.torino.it Cc: Joey Boggs , ovirt-devel at redhat.com > On Tue, Sep 15, 2009 at 5:48 PM, wrote: > >> >> On node in /var/log/messages I also detected: >> >> bnx2: Can't load firmware file bnx2/bnx2-mips-09-4.6.17.fw > > > ok, this is the root cause then: we need to unblacklist bnx2 firmwares in > node-image kickstart > ----- Fine del messaggio da apevec at gmail.com ----- From imain at redhat.com Tue Sep 15 16:39:22 2009 From: imain at redhat.com (Ian Main) Date: Tue, 15 Sep 2009 09:39:22 -0700 Subject: [Ovirt-devel] Node unavailable after ovirt-server reboot In-Reply-To: <6524aa500909141424y4cfa4d88l3f84416901ede8d2@mail.gmail.com> References: <6524aa500909141424y4cfa4d88l3f84416901ede8d2@mail.gmail.com> Message-ID: <20090915093922.23602ea8@tp.mains.net> On Mon, 14 Sep 2009 23:24:04 +0200 Jan Mrozek wrote: > Hi, > > I builded ovirt from next ... installed ... node is booted from pxe. > After reboot of ovirt-server machine is node unavailable(enabled). > > According to jguiditta's advice I restarted libvirt-qpid on node and > node becomes available. > > Is there a bug? Yes, qmf has issues. There's a new version coming out shortly which I'm hoping will address a bunch of these problems. Sorry.. :-/ Ian From apevec at redhat.com Tue Sep 15 21:34:58 2009 From: apevec at redhat.com (Alan Pevec) Date: Tue, 15 Sep 2009 23:34:58 +0200 Subject: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares In-Reply-To: <20090915181305.nzvyhqflft1c0g84@webmail.provincia.torino.it> References: <20090915181305.nzvyhqflft1c0g84@webmail.provincia.torino.it> Message-ID: <1253050498-18413-1-git-send-email-apevec@redhat.com> Signed-off-by: Alan Pevec --- common-blacklist.ks | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/common-blacklist.ks b/common-blacklist.ks index 2f8842f..39d4156 100644 --- a/common-blacklist.ks +++ b/common-blacklist.ks @@ -102,7 +102,7 @@ blacklist_lib="/usr/{,lib64}/tc \ /usr/lib{,64}/pkgconfig /usr/lib{,64}/nss \ /usr/lib{,64}/games /usr/lib{,64}/alsa-lib /usr/lib{,64}/fs/reiserfs \ /usr/lib{,64}/krb5 /usr/lib{,64}/hal /usr/lib{,64}/gio \ - /lib/firmware /usr/lib/locale /usr/lib/syslinux" + /usr/lib/locale /usr/lib/syslinux" blacklist_pango="/usr/lib{,64}/pango /usr/lib{,64}/libpango* \ /etc/pango /usr/bin/pango*" blacklist_hal="/usr/bin/hal-disable-polling \ @@ -144,5 +144,18 @@ keep /usr/lib64/libboost_system.so* drop /usr/kerberos keep /usr/kerberos/bin/kinit keep /usr/kerberos/bin/klist +drop /lib/firmware +keep /lib/firmware/3com +keep /lib/firmware/acenic +keep /lib/firmware/adaptec +keep /lib/firmware/advansys +keep /lib/firmware/bnx2 +keep /lib/firmware/cxgb3 +keep /lib/firmware/e100 +keep /lib/firmware/myricom +keep /lib/firmware/qlogic +keep /lib/firmware/sun +keep /lib/firmware/tehuti +keep /lib/firmware/tigon %end -- 1.6.0.6 From jboggs at redhat.com Tue Sep 15 22:04:55 2009 From: jboggs at redhat.com (Joey Boggs) Date: Tue, 15 Sep 2009 18:04:55 -0400 Subject: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares In-Reply-To: <1253050498-18413-1-git-send-email-apevec@redhat.com> References: <20090915181305.nzvyhqflft1c0g84@webmail.provincia.torino.it> <1253050498-18413-1-git-send-email-apevec@redhat.com> Message-ID: <4AB00F87.1000606@redhat.com> Alan Pevec wrote: > Signed-off-by: Alan Pevec > --- > common-blacklist.ks | 15 ++++++++++++++- > 1 files changed, 14 insertions(+), 1 deletions(-) > > diff --git a/common-blacklist.ks b/common-blacklist.ks > index 2f8842f..39d4156 100644 > --- a/common-blacklist.ks > +++ b/common-blacklist.ks > @@ -102,7 +102,7 @@ blacklist_lib="/usr/{,lib64}/tc \ > /usr/lib{,64}/pkgconfig /usr/lib{,64}/nss \ > /usr/lib{,64}/games /usr/lib{,64}/alsa-lib /usr/lib{,64}/fs/reiserfs \ > /usr/lib{,64}/krb5 /usr/lib{,64}/hal /usr/lib{,64}/gio \ > - /lib/firmware /usr/lib/locale /usr/lib/syslinux" > + /usr/lib/locale /usr/lib/syslinux" > blacklist_pango="/usr/lib{,64}/pango /usr/lib{,64}/libpango* \ > /etc/pango /usr/bin/pango*" > blacklist_hal="/usr/bin/hal-disable-polling \ > @@ -144,5 +144,18 @@ keep /usr/lib64/libboost_system.so* > drop /usr/kerberos > keep /usr/kerberos/bin/kinit > keep /usr/kerberos/bin/klist > +drop /lib/firmware > +keep /lib/firmware/3com > +keep /lib/firmware/acenic > +keep /lib/firmware/adaptec > +keep /lib/firmware/advansys > +keep /lib/firmware/bnx2 > +keep /lib/firmware/cxgb3 > +keep /lib/firmware/e100 > +keep /lib/firmware/myricom > +keep /lib/firmware/qlogic > +keep /lib/firmware/sun > +keep /lib/firmware/tehuti > +keep /lib/firmware/tigon > %end > > ACK all directories and subfiles are intact From dpierce at redhat.com Wed Sep 16 12:34:19 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 16 Sep 2009 08:34:19 -0400 Subject: [Ovirt-devel] Final push candidate for nodeadmin tool... Message-ID: <1253104460-21142-1-git-send-email-dpierce@redhat.com> This patch is ready for pushing upstream. From dpierce at redhat.com Wed Sep 16 12:34:20 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 16 Sep 2009 08:34:20 -0400 Subject: [Ovirt-devel] [PATCH node] Introduces the node-admin toolset. In-Reply-To: <1253104460-21142-1-git-send-email-dpierce@redhat.com> References: <1253104460-21142-1-git-send-email-dpierce@redhat.com> Message-ID: <1253104460-21142-2-git-send-email-dpierce@redhat.com> Defines a primary entry point that displays a menu of options that user can use to administer the managed node. It leverages the code from virtinst-python to do the heavy lifting and just provides a front end for collecting user data. Created a new configuration class to be used for all configuration screens. The user can select to create a node. They are then walked through the steps to create a domain similar to virt-manager. The user can create a defined domain. The user can destroy a created domain. The user can undefine a defined domain. The user can list all domains on the system. The user can create a new user account. When the RPM is created, a separate entry point is created for each node admin command. This allows the commands to be invoked individually as well as from the main menu. Signed-off-by: Darryl L. Pierce --- .gitignore | 1 + Makefile.am | 16 ++ configure.ac | 1 + nodeadmin/__init__.py | 20 ++ nodeadmin/configscreen.py | 150 ++++++++++++++ nodeadmin/createdomain.py | 68 +++++++ nodeadmin/createuser.py | 106 ++++++++++ nodeadmin/definedomain.py | 470 +++++++++++++++++++++++++++++++++++++++++++ nodeadmin/destroydomain.py | 66 ++++++ nodeadmin/domainconfig.py | 217 ++++++++++++++++++++ nodeadmin/halworker.py | 37 ++++ nodeadmin/libvirtworker.py | 276 +++++++++++++++++++++++++ nodeadmin/listdomains.py | 68 +++++++ nodeadmin/mainmenu.py | 74 +++++++ nodeadmin/nodeadmin.py | 29 +++ nodeadmin/setup.py.in | 34 +++ nodeadmin/undefinedomain.py | 83 ++++++++ nodeadmin/userworker.py | 38 ++++ ovirt-node.spec.in | 38 ++++ 19 files changed, 1792 insertions(+), 0 deletions(-) create mode 100644 nodeadmin/__init__.py create mode 100644 nodeadmin/configscreen.py create mode 100755 nodeadmin/createdomain.py create mode 100755 nodeadmin/createuser.py create mode 100755 nodeadmin/definedomain.py create mode 100755 nodeadmin/destroydomain.py create mode 100644 nodeadmin/domainconfig.py create mode 100644 nodeadmin/halworker.py create mode 100644 nodeadmin/libvirtworker.py create mode 100755 nodeadmin/listdomains.py create mode 100755 nodeadmin/mainmenu.py create mode 100755 nodeadmin/nodeadmin.py create mode 100644 nodeadmin/setup.py.in create mode 100755 nodeadmin/undefinedomain.py create mode 100644 nodeadmin/userworker.py diff --git a/.gitignore b/.gitignore index 26a0210..19b15d1 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ missing stamp-h1 ovirt-node*.gz ovirt-node.spec +*.pyc diff --git a/Makefile.am b/Makefile.am index 419cdf1..2d195c0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,6 +26,22 @@ EXTRA_DIST = \ ovirt-node-selinux.fc \ images/grub-splash.xpm.gz \ images/syslinux-vesa-splash.jpg \ + nodeadmin/__init__.py \ + nodeadmin/configscreen.py \ + nodeadmin/createuser.py \ + nodeadmin/destroydomain.py \ + nodeadmin/halworker.py \ + nodeadmin/libvirtworker.py \ + nodeadmin/userworker.py \ + nodeadmin/mainmenu.py \ + nodeadmin/undefinedomain.py \ + nodeadmin/createdomain.py \ + nodeadmin/definedomain.py \ + nodeadmin/domainconfig.py \ + nodeadmin/listdomains.py \ + nodeadmin/nodeadmin.py \ + nodeadmin/setup.py \ + nodeadmin/utils.py \ scripts/collectd.conf.in \ scripts/ovirt \ scripts/ovirt-awake \ diff --git a/configure.ac b/configure.ac index b60afeb..780b757 100644 --- a/configure.ac +++ b/configure.ac @@ -8,6 +8,7 @@ test x"$ac_ct_CC:$CFLAGS" = 'xgcc:-g -O2' \ && CFLAGS="$CFLAGS -Wshadow -Wall -Werror" AC_CONFIG_FILES([Makefile + nodeadmin/setup.py gptsync/Makefile ovirt-node.spec ]) diff --git a/nodeadmin/__init__.py b/nodeadmin/__init__.py new file mode 100644 index 0000000..1f3c72c --- /dev/null +++ b/nodeadmin/__init__.py @@ -0,0 +1,20 @@ +# __init__.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from nodeadmin import NodeAdmin + diff --git a/nodeadmin/configscreen.py b/nodeadmin/configscreen.py new file mode 100644 index 0000000..0282eee --- /dev/null +++ b/nodeadmin/configscreen.py @@ -0,0 +1,150 @@ +# configscreen.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from halworker import HALWorker +from libvirtworker import LibvirtWorker +import traceback + +BACK_BUTTON = "back" +NEXT_BUTTON = "next" +CANCEL_BUTTON = "cancel" +FINISH_BUTTON = "finish" + +class ConfigScreen: + '''Enables the creation of navigable, multi-paged configuration screens.''' + + def __init__(self, title): + self.__title = title + self.__current_page = 1 + self.__finished = False + self.__hal = HALWorker() + self.__libvirt = LibvirtWorker() + + def get_hal(self): + return self.__hal + + def get_libvirt(self): + return self.__libvirt + + def set_finished(self): + self.__finished = True + + def get_elements_for_page(self, screen, page): + return [] + + def page_has_next(self, page): + return False + + def page_has_finish(self, page): + return False + + def get_back_page(self, page): + if page > 1: return page - 1 + return page + + def go_back(self): + self.__current_page = self.get_back_page(self.__current_page) + + def get_next_page(self, page): + return page + 1 + + def go_next(self): + self.__current_page = self.get_next_page(self.__current_page) + + def validate_input(self, page, errors): + return True + + def process_input(self, page): + return + + def start(self): + active = True + while active and (self.__finished == False): + screen = SnackScreen() + gridform = GridForm(screen, self.__title, 1, 4) + elements = self.get_elements_for_page(screen, self.__current_page) + current_element = 0 + for element in elements: + gridform.add(element, 0, current_element) + current_element += 1 + # create the navigation buttons + buttons = [] + if self.__current_page > 1: buttons.append(["Back", BACK_BUTTON, "F11"]) + if self.page_has_next(self.__current_page): buttons.append(["Next", NEXT_BUTTON, "F12"]) + if self.page_has_finish(self.__current_page): buttons.append(["Finish", FINISH_BUTTON, "F10"]) + buttons.append(["Cancel", CANCEL_BUTTON, "ESC"]) + buttonbar = ButtonBar(screen, buttons) + gridform.add(buttonbar, 0, current_element, growx = 1) + current_element += 1 + try: + result = gridform.runOnce() + pressed = buttonbar.buttonPressed(result) + if pressed == BACK_BUTTON: + self.go_back() + elif pressed == NEXT_BUTTON or pressed == FINISH_BUTTON: + errors = [] + if self.validate_input(self.__current_page, errors): + self.process_input(self.__current_page) + self.go_next() + else: + error_text = "" + for error in errors: + error_text += "%s\n" % error + ButtonChoiceWindow(screen, + "There Were Errors", + error_text, + buttons = ["OK"]) + elif pressed == CANCEL_BUTTON: + active = False + except Exception, error: + ButtonChoiceWindow(screen, + "An Exception Has Occurred", + str(error) + "\n" + traceback.format_exc(), + buttons = ["OK"]) + screen.popWindow() + screen.finish() + +class DomainListConfigScreen(ConfigScreen): + '''Provides a base class for all config screens that require a domain list.''' + + def __init__(self, title): + ConfigScreen.__init__(self, title) + + def get_domain_list_page(self, screen, defined=True, created=True): + domains = self.get_libvirt().list_domains(defined, created) + result = None + + if len(domains) > 0: + self.__has_domains = True + self.__domain_list = Listbox(0) + for name in self.get_libvirt().list_domains(defined, created): + self.__domain_list.append(name, name) + result = [self.__domain_list] + else: + self.__has_domains = False + grid = Grid(1, 1) + grid.setField(Label("There are no domains available."), 0, 0) + result = [grid] + return result + + def get_selected_domain(self): + return self.__domain_list.current() + + def has_selectable_domains(self): + return self.__has_domains diff --git a/nodeadmin/createdomain.py b/nodeadmin/createdomain.py new file mode 100755 index 0000000..b73a09e --- /dev/null +++ b/nodeadmin/createdomain.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# +# createdomain.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from configscreen import * + +class CreateDomainConfigScreen(DomainListConfigScreen): + LIST_PAGE = 1 + CREATE_PAGE = 2 + + def __init__(self): + DomainListConfigScreen.__init__(self, "Create A Domain") + + def get_elements_for_page(self, screen, page): + if page is self.LIST_PAGE: + return self.get_domain_list_page(screen, created = False) + elif page is self.CREATE_PAGE: + return self.get_create_domain_page(screen) + + def page_has_next(self, page): + if page is self.LIST_PAGE: return self.has_selectable_domains() + return False + + def page_has_back(self, page): + if page is self.CREATE_PAGE: return True + return False + + def validate_input(self, page, errors): + if page is self.LIST_PAGE: + if self.get_selected_domain() is not None: + domain = self.get_selected_domain() + try: + self.get_libvirt().create_domain(domain) + return True + except Exception, error: + errors.append("There was an error creating the domain: %s" % domain) + errors.append(str(error)) + else: + errors.append("You must first select a domain to create.") + + def process_input(self, page): + print "foo" + + def get_create_domain_page(self, screen): + grid = Grid(1, 1) + grid.setField(Label("%s was successfully created." % self.get_selected_domain()), 0, 0) + return [grid] + +def CreateDomain(): + screen = CreateDomainConfigScreen() + screen.start() diff --git a/nodeadmin/createuser.py b/nodeadmin/createuser.py new file mode 100755 index 0000000..dbc4626 --- /dev/null +++ b/nodeadmin/createuser.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python +# +# createuser.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from configscreen import ConfigScreen +from userworker import UserWorker + +import libuser + +DETAILS_PAGE = 1 +CONFIRM_PAGE = 2 + +class CreateUserConfigScreen(ConfigScreen): + def __init__(self): + ConfigScreen.__init__(self, "Create A User Account") + self.__username = None + self.__useradmin = libuser.admin() + self.__user_worker = UserWorker() + + def get_elements_for_page(self, screen, page): + if page is DETAILS_PAGE: return self.get_details_page(screen) + elif page is CONFIRM_PAGE: return self.get_confirm_page(screen) + + def validate_input(self, page, errors): + if page is DETAILS_PAGE: + if len(self.__username.value()) > 0: + name = self.__username.value() + if self.__useradmin.lookupUserByName(name) is None: + if len(self.__password.value()) > 0: + if self.__password.value() == self.__confirm.value(): + return True + else: + errors.append("Passwords do not match.") + else: + errors.append("You must enter a password.") + else: + errors.append("User %s already exists." % name) + else: + errors.append("You must enter a username.") + self.__confirm.value() + return False + + def process_input(self, page): + if page is CONFIRM_PAGE: + self.__user_worker.create_user(self.__username.value(), + self.__password.value(), + "wheel" if self.__adminuser.value() else None) + self.set_finished() + + def page_has_next(self, page): + return (page is DETAILS_PAGE) + + def page_has_back(self, page): + return (page is CONFIRM_PAGE) + + def page_has_finish(self, page): + return (page is CONFIRM_PAGE) + + def get_details_page(self, screen): + if self.__username is None: + self.__username = Entry(50, "") + self.__password = Entry(50, "", password = 1) + self.__confirm = Entry(50, "", password = 1) + self.__adminuser = Checkbox("This user is an administrator", False) + grid = Grid(2, 4) + grid.setField(Label("Username:"), 0, 0, anchorRight = 1) + grid.setField(self.__username, 1, 0, anchorLeft = 1) + grid.setField(Label("Password:"), 0, 1, anchorRight = 1) + grid.setField(self.__password, 1, 1, anchorLeft = 1) + grid.setField(Label("Confirm password:"), 0, 2, anchorRight = 1) + grid.setField(self.__confirm, 1, 2, anchorLeft = 1) + grid.setField(Label(" "), 0, 3) + grid.setField(self.__adminuser, 1, 3, anchorLeft = 1) + return [Label("Enter The User Details"), + grid] + + def get_confirm_page(self, screen): + grid = Grid(1, 2) + grid.setField(Label("Username: %s" % self.__username.value()), 0, 0) + admin_label = "is not" + if self.__adminuser.value(): + admin_label = "is" + grid.setField(Label("This user %s an administrator." % admin_label), 0, 1) + return [Label("Create this user account?"), + grid] + +def CreateUser(): + screen = CreateUserConfigScreen() + screen.start() diff --git a/nodeadmin/definedomain.py b/nodeadmin/definedomain.py new file mode 100755 index 0000000..6a6612c --- /dev/null +++ b/nodeadmin/definedomain.py @@ -0,0 +1,470 @@ +#!/usr/bin/env python +# +# definedomain.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +import os +from domainconfig import DomainConfig +from configscreen import ConfigScreen +import urlgrabber.progress as progress +import utils +import logging + +from virtinst import * + +VM_DETAILS_PAGE = 1 +LOCAL_INSTALL_PAGE = 2 +SELECT_CDROM_PAGE = 3 +SELECT_ISO_PAGE = 4 +NETWORK_INSTALL_PAGE = 10 +OS_TYPE_PAGE = 11 +OS_VARIANT_PAGE = 12 +RAM_CPU_PAGE = 13 +ENABLE_STORAGE_PAGE = 14 +LOCAL_STORAGE_PAGE = 15 +MANAGED_STORAGE_PAGE = 16 +BRIDGE_PAGE = 17 +VIRT_DETAILS_PAGE = 18 +CONFIRM_PAGE = 19 + +LOCATION="location" +KICKSTART="kickstart" +KERNELOPTS="kernel.options" +OS_TYPE="os.type" +OS_VARIANT="os.variant" +MEMORY="memory" +CPUS="cpus" + +class DummyMeter(progress.BaseMeter): + def _do_start(self, now = None): + logging.info("Starting...") + + def _do_end(self, amount_read, now = None): + logging.info("Ending: read=%d" % amount_read) + + def _do_update(self, amount_read, now = None): + logging.info("Update: read=%d" % amount_read) + +class DomainConfigScreen(ConfigScreen): + def __init__(self): + ConfigScreen.__init__(self, "Create A New Virtual Machine") + self.__config = DomainConfig() + self.__config.set_architecture(self.get_libvirt().get_default_architecture()) + self.__config.set_virt_type(self.get_libvirt().get_default_virt_type()) + + def get_elements_for_page(self, screen, page): + if page == VM_DETAILS_PAGE: return self.get_vm_details_page(screen) + elif page == LOCAL_INSTALL_PAGE: return self.get_local_install_page(screen) + elif page == SELECT_CDROM_PAGE: return self.get_select_cdrom_page(screen) + elif page == SELECT_ISO_PAGE: return self.get_select_iso_page(screen) + elif page == NETWORK_INSTALL_PAGE: return self.get_network_install_page(screen) + elif page == OS_TYPE_PAGE: return self.get_os_type_page(screen) + elif page == OS_VARIANT_PAGE: return self.get_os_variant_page(screen) + elif page == RAM_CPU_PAGE: return self.get_ram_and_cpu_page(screen) + elif page == ENABLE_STORAGE_PAGE: return self.get_enable_storage_page(screen) + elif page == LOCAL_STORAGE_PAGE: return self.get_local_storage_page(screen) + elif page == MANAGED_STORAGE_PAGE: return self.get_managed_storage_page(screen) + elif page == BRIDGE_PAGE: return self.get_bridge_page(screen) + elif page == VIRT_DETAILS_PAGE: return self.get_virt_details_page(screen) + elif page == CONFIRM_PAGE: return self.get_confirm_page(screen) + return [] + + def validate_input(self, page, errors): + if page == VM_DETAILS_PAGE: + if len(self.__guest_name.value()) > 0: + if self.get_libvirt().domain_exists(self.__guest_name.value()): + errors.append("Guest name '%s' is already in use." % self.__guest_name.value()) + else: + return True + else: + errors.append("Guest name must be a string between 0 and 50 characters.") + elif page == LOCAL_INSTALL_PAGE: + if self.__install_source.getSelection() == DomainConfig.INSTALL_SOURCE_CDROM: + return True + elif self.__install_source.getSelection() == DomainConfig.INSTALL_SOURCE_ISO: + return True + elif page == SELECT_CDROM_PAGE: + if self.__install_media.getSelection() != None: + if len(self.get_hal().list_installable_volumes()) == 0: + errors.append("No installable media is available.") + else: + return True + else: + errors.append("You must select an install media.") + elif page == SELECT_ISO_PAGE: + if len(self.__iso_path.value()) > 0: + if os.path.exists(self.__iso_path.value()): + if os.path.isfile(self.__iso_path.value()): + return True + else: + errors.append("%s is not a file." % self.__iso_path.value()) + else: + errors.append("No such install media exists:") + errors.append(self.__iso_path.value()) + else: + errors.append("An install media selection is required.") + elif page == NETWORK_INSTALL_PAGE: + if len(self.__install_url.value()) > 0: + return True + else: + errors.append("An install tree is required.") + elif page == OS_TYPE_PAGE: return True + elif page == OS_VARIANT_PAGE: return True + elif page == RAM_CPU_PAGE: + if (len(self.__memory.value()) > 0 and len(self.__cpus.value()) > 0) \ + and (int(self.__memory.value()) > 0 and int(self.__cpus.value()) > 0): + return True + else: + if len(self.__memory.value()) == 0: + errors.append("A value must be entered for memory.") + elif int(self.__memory.value()) <= 0: + errors.append("A positive integer value must be entered for memory.") + if len(self.__cpus.value()) == 0: + errors.append("A value must be entered for CPUs.") + elif int(self.__cpus.value()) <= 0: + errors.append("A positive integer value must be entered for memory.") + elif page == ENABLE_STORAGE_PAGE: return True + elif page == LOCAL_STORAGE_PAGE: + if len(self.__storage_size.value()) > 0: + if float(self.__storage_size.value()) > 0: + return True + else: + errors.append("A positive value must be entered for the storage size.") + else: + errors.append("A value must be entered for the storage size.") + elif page == MANAGED_STORAGE_PAGE: + if self.__existing_storage.getSelection() is not None: + return True + else: + errors.append("Please select a storage volume.") + elif page == BRIDGE_PAGE: + if self.__network_bridges.getSelection() != None: + if len(self.__mac_address.value()) > 0: + # TODO: regex check the format + return True + else: + errors.append("MAC address must be supplied.") + else: + errors.append("A network bridge must be selected.") + elif page == VIRT_DETAILS_PAGE: + if self.__virt_types.getSelection() != None and self.__architectures.getSelection() != None: + return True + if self.__virt_types.getSelection() is None: + errors.append("Please select a virtualization type.") + if self.__architectures.getSelection() is None: + errors.append("Please selection an architecture.") + elif page == CONFIRM_PAGE: return True + return False + + def process_input(self, page): + if page == VM_DETAILS_PAGE: + self.__config.set_guest_name(self.__guest_name.value()) + self.__config.set_install_type(self.__install_type.getSelection()) + elif page == LOCAL_INSTALL_PAGE: + self.__config.set_use_cdrom_source(self.__install_source.getSelection() == DomainConfig.INSTALL_SOURCE_CDROM) + elif page == SELECT_CDROM_PAGE: + self.__config.set_install_media(self.__install_media.getSelection()) + elif page == SELECT_ISO_PAGE: + self.__config.set_iso_path(self.__iso_path.value()) + elif page == NETWORK_INSTALL_PAGE: + self.__config.set_install_url(self.__install_url.value()) + self.__config.set_kickstart_url(self.__kickstart_url.value()) + self.__config.set_kernel_options(self.__kernel_options.value()) + elif page == OS_TYPE_PAGE: + self.__config.set_os_type(self.__os_types.getSelection()) + elif page == OS_VARIANT_PAGE: + self.__config.set_os_variant(self.__os_variants.getSelection()) + elif page == RAM_CPU_PAGE: + self.__config.set_memory(int(self.__memory.value())) + self.__config.set_cpus(int(self.__cpus.value())) + elif page == ENABLE_STORAGE_PAGE: + self.__config.set_enable_storage(self.__enable_storage.value()) + if self.__storage_type.getSelection() == DomainConfig.NEW_STORAGE: + self.__config.set_use_local_storage(True) + elif self.__storage_type.getSelection() == Node.STORAGE_TYPE_EXISTING: + self.__config.set_use_local_storage(False) + elif page == LOCAL_STORAGE_PAGE: + self.__config.set_storage_size(float(self.__storage_size.value())) + self.__config.set_allocate_storage(self.__allocate_storage.value()) + elif page == MANAGED_STORAGE_PAGE: + self.__config.set_use_local_storage(False) + self.__config.set_existing_storage(self.__existing_storage.getSelection()) + self.__config.set_storage_size(self.get_libvirt().get_storage_size(self.__existing_storage.getSelection())) + elif page == BRIDGE_PAGE: + self.__config.set_network_bridge(self.__network_bridges.getSelection()) + elif page == VIRT_DETAILS_PAGE: + self.__config.set_virt_type(self.__virt_types.getSelection()) + self.__config.set_architecture(self.__architectures.getSelection()) + elif page == CONFIRM_PAGE: + self.get_libvirt().define_domain(self.__config, DummyMeter()) + self.set_finished() + + def get_back_page(self, page): + result = page + if page == OS_TYPE_PAGE: + install_type = self.__config.get_install_type() + if install_type == DomainConfig.LOCAL_INSTALL: + if self.__config.get_use_cdrom_source(): + result = SELECT_CDROM_PAGE + else: + result = SELECT_ISO_PAGE + elif install_type == DomainConfig.NETWORK_INSTALL: + result = NETWORK_INSTALL_PAGE + elif install_type == DomainConfig.PXE_INSTALL: + result = VM_DETAILS_PAGE + elif page == LOCAL_STORAGE_PAGE or page == MANAGED_STORAGE_PAGE: + result = ENABLE_STORAGE_PAGE + elif page == NETWORK_INSTALL_PAGE: + result = VM_DETAILS_PAGE + elif page == SELECT_CDROM_PAGE or page == SELECT_ISO_PAGE: + result = LOCAL_INSTALL_PAGE + elif page == BRIDGE_PAGE: + if self.__config.get_use_local_storage(): + result = LOCAL_STORAGE_PAGE + else: + result = MANAGED_STORAGE_PAGE + else: + if page > 1: result = page - 1 + return result + + def get_next_page(self, page): + result = page + if page == VM_DETAILS_PAGE: + install_type = self.__config.get_install_type() + if install_type == DomainConfig.LOCAL_INSTALL: + result = LOCAL_INSTALL_PAGE + elif install_type == DomainConfig.NETWORK_INSTALL: + result = NETWORK_INSTALL_PAGE + elif install_type == DomainConfig.PXE_INSTALL: + result = OS_TYPE_PAGE + elif page == LOCAL_INSTALL_PAGE: + if self.__config.get_use_cdrom_source(): + result = SELECT_CDROM_PAGE + else: + result = SELECT_ISO_PAGE + elif page == SELECT_CDROM_PAGE or page == SELECT_ISO_PAGE: + result = OS_TYPE_PAGE + elif page == NETWORK_INSTALL_PAGE: + result = OS_TYPE_PAGE + elif page == ENABLE_STORAGE_PAGE: + result = BRIDGE_PAGE + if self.__config.get_enable_storage(): + if self.__config.get_use_local_storage(): + result = LOCAL_STORAGE_PAGE + else: + result = MANAGED_STORAGE_PAGE + elif page == LOCAL_STORAGE_PAGE or page == MANAGED_STORAGE_PAGE: + result = BRIDGE_PAGE + else: + result = page + 1 + return result + + def page_has_finish(self, page): + if page == CONFIRM_PAGE: return True + return False + + def page_has_next(self, page): + if page < CONFIRM_PAGE: + return True + + def get_vm_details_page(self, screen): + self.__guest_name = Entry(50, self.__config.get_guest_name()) + self.__install_type = RadioBar(screen, (("Local install media (ISO image or CDROM)", + DomainConfig.LOCAL_INSTALL, + self.__config.is_install_type(DomainConfig.LOCAL_INSTALL)), + ("Network Install (HTTP, FTP, or NFS)", + DomainConfig.NETWORK_INSTALL, + self.__config.is_install_type(DomainConfig.NETWORK_INSTALL)), + ("Network Boot (PXE)", + DomainConfig.PXE_INSTALL, + self.__config.is_install_type(DomainConfig.PXE_INSTALL)))) + grid = Grid(2,3) + grid.setField(Label("Name:"), 0, 0, anchorRight = 1) + grid.setField(self.__guest_name, 1, 0, anchorLeft = 1) + grid.setField(Label("Choose how you would like to install the operating system"), 1, 1, + anchorLeft = 1, anchorTop = 1) + grid.setField(self.__install_type, 1, 2, anchorLeft = 1) + return [Label("Enter your machine details"), + grid] + + def get_local_install_page(self, screen): + self.__install_source = RadioBar(screen, (("Use CDROM or DVD", + DomainConfig.INSTALL_SOURCE_CDROM, + self.__config.get_use_cdrom_source()), + ("Use ISO image", + DomainConfig.INSTALL_SOURCE_ISO, + self.__config.get_use_cdrom_source() is False))) + grid = Grid(1,1) + grid.setField(self.__install_source, 0, 0, anchorLeft = 1) + return [Label("Locate your install media"), + grid] + + def get_select_cdrom_page(self, screen): + drives = [] + media = self.get_hal().list_installable_volumes() + for drive in media.keys(): + drives.append([media[drive], drive, self.__config.is_install_media(drive)]) + self.__install_media = RadioBar(screen, (drives)) + grid = Grid(1, 1) + grid.setField(self.__install_media, 0, 0) + return [Label("Select the install media"), + grid] + + def get_select_iso_page(self, screen): + self.__iso_path = Entry(50, self.__config.get_iso_path()) + grid = Grid(1, 2) + grid.setField(Label("Enter ISO path:"), 0, 0, anchorLeft = 1) + grid.setField(self.__iso_path, 0, 1, anchorLeft = 1) + return [Label("Enter the full path to an install ISO"), + grid] + + def get_network_install_page(self, screen): + self.__install_url = Entry(50, self.__config.get_install_url()) + self.__kickstart_url = Entry(50, self.__config.get_kickstart_url()) + self.__kernel_options = Entry(50, self.__config.get_kernel_options()) + grid = Grid(2,3) + grid.setField(Label("URL:"), 0, 0, anchorRight = 1) + grid.setField(self.__install_url, 1, 0, anchorLeft = 1) + grid.setField(Label("Kickstart URL:"), 0, 1, anchorRight = 1) + grid.setField(self.__kickstart_url, 1, 1, anchorLeft = 1) + grid.setField(Label("Kernel Options:"), 0, 2, anchorRight = 1) + grid.setField(self.__kernel_options, 1, 2, anchorLeft = 1) + return [Label("Provide the operating system URL"), + grid] + + def get_os_type_page(self, screen): + types = [] + for type in Guest.list_os_types(): + types.append([Guest.get_os_type_label(type), type, self.__config.is_os_type(type)]) + self.__os_types = RadioBar(screen, types) + grid = Grid(1, 1) + grid.setField(self.__os_types, 0, 0, anchorLeft = 1) + return [Label("Choose the operating system type"), + grid] + + def get_os_variant_page(self, screen): + variants = [] + type = self.__config.get_os_type() + for variant in Guest.list_os_variants(type): + variants.append([Guest.get_os_variant_label(type, variant), variant, self.__config.is_os_variant(variant)]) + self.__os_variants = RadioBar(screen, variants) + grid = Grid(1, 1) + grid.setField(self.__os_variants, 0, 0, anchorLeft = 1) + return [Label("Choose the operating system version"), + grid] + + def get_ram_and_cpu_page(self, screen): + self.__memory = Entry(10, str(self.__config.get_memory())) + self.__cpus = Entry(10, str(self.__config.get_cpus())) + grid = Grid(2,2) + grid.setField(Label("Memory (RAM):"), 0, 0, anchorRight = 1) + grid.setField(self.__memory, 1, 0, anchorLeft = 1) + grid.setField(Label("CPUs:"), 0, 1, anchorRight = 1) + grid.setField(self.__cpus, 1, 1, anchorLeft = 1) + return [Label("Choose memory and CPU settings"), + grid] + + def get_enable_storage_page(self, screen): + self.__enable_storage = Checkbox("Enable storage for this virtual machine", self.__config.get_enable_storage()) + self.__storage_type = RadioBar(screen,((["Create a disk image on the computer's hard disk", + DomainConfig.NEW_STORAGE, + self.__config.get_use_local_storage()]), + (["Select managed or other existing storage", + DomainConfig.EXISTING_STORAGE, + self.__config.get_use_local_storage() is False]))) + grid = Grid(1,2) + grid.setField(self.__enable_storage, 0, 0, anchorLeft = 1) + grid.setField(self.__storage_type, 0, 1, anchorLeft = 1) + return [Label("Configure storage"), + grid] + + def get_local_storage_page(self, screen): + self.__storage_size = Entry(6, str(self.__config.get_storage_size())) + self.__allocate_storage = Checkbox("Allocate entire disk now", self.__config.get_allocate_storage()) + grid = Grid(2, 2) + grid.setField(self.__allocate_storage, 0, 0, growx = 1, anchorLeft = 1) + grid.setField(Label("Storage size (GB):"), 0, 1, anchorLeft = 1) + grid.setField(self.__storage_size, 1, 1) + return [Label("Configure local storage"), + grid] + + def get_managed_storage_page(self, screen): + volumes = [] + for volume in self.get_libvirt().list_storage_volumes(): + volumes.append(["%s (%d GB)" % (volume.name(), volume.info()[1] / (1024 ** 3)), + volume.name(), + self.__config.is_existing_storage(volume.name())]) + self.__existing_storage = RadioBar(screen, (volumes)) + grid = Grid(2, 1) + grid.setField(Label("Existing storage:"), 0, 0) + grid.setField(self.__existing_storage, 1, 0) + return [Label("Configure managed storage"), + grid] + + def get_bridge_page(self, screen): + bridges = [] + for bridge in self.get_libvirt().list_bridges(): + bridges.append(["Virtual network '%s'" % bridge.name(), bridge.name(), self.__config.get_network_bridge() == bridge.name()]) + self.__network_bridges = RadioBar(screen, (bridges)) + if self.__config.get_mac_address() == None: + self.__config.set_mac_address(self.get_libvirt().generate_mac_address()) + self.__mac_address = Entry(20, self.__config.get_mac_address()) + grid = Grid(1, 1) + grid.setField(self.__network_bridges, 0, 0) + return [Label("Select an existing bridge"), + grid] + + def get_virt_details_page(self, screen): + virt_types = [] + for type in self.get_libvirt().list_virt_types(): + virt_types.append([type, type, self.__config.is_virt_type(type)]) + self.__virt_types = RadioBar(screen, (virt_types)) + archs = [] + for arch in self.get_libvirt().list_architectures(): + archs.append([arch, arch, self.__config.is_architecture(arch)]) + self.__architectures = RadioBar(screen, (archs)) + grid = Grid(2, 2) + grid.setField(Label("Virt Type:"), 0, 0, anchorRight = 1, anchorTop = 1) + grid.setField(self.__virt_types, 1, 0, anchorLeft = 1) + grid.setField(Label("Architecture:"), 0, 1, anchorRight = 1, anchorTop = 1) + grid.setField(self.__architectures, 1, 1, anchorLeft = 1) + return [Label("Configure virtualization details"), + grid] + + def get_confirm_page(self, screen): + grid = Grid(2, 6) + grid.setField(Label("OS:"), 0, 0, anchorRight = 1) + grid.setField(Label(Guest.get_os_variant_label(self.__config.get_os_type(), + self.__config.get_os_variant())), 1, 0, anchorLeft = 1) + grid.setField(Label("Install:"), 0, 1, anchorRight = 1) + grid.setField(Label(self.__config.get_install_type_text()), 1, 1, anchorLeft = 1) + grid.setField(Label("Memory:"), 0, 2, anchorRight = 1) + grid.setField(Label("%s MB" % self.__config.get_memory()), 1, 2, anchorLeft = 1) + grid.setField(Label("CPUs:"), 0, 3, anchorRight = 1) + grid.setField(Label("%d" % self.__config.get_cpus()), 1, 3, anchorLeft = 1) + grid.setField(Label("Storage:"), 0, 4, anchorRight = 1) + grid.setField(Label(self.__config.get_existing_storage()), 1, 4, anchorLeft = 1) + grid.setField(Label("Network:"), 0, 5, anchorRight = 1) + grid.setField(Label(self.__config.get_network_bridge()), 1, 5, anchorLeft = 1) + return [Label("Ready to begin installation of %s" % self.__config.get_guest_name()), + grid] + +def DefineDomain(): + screen = DomainConfigScreen() + screen.start() diff --git a/nodeadmin/destroydomain.py b/nodeadmin/destroydomain.py new file mode 100755 index 0000000..350c32e --- /dev/null +++ b/nodeadmin/destroydomain.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# +# destroydomain.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from configscreen import * + +class DestroyDomainConfigScreen(DomainListConfigScreen): + LIST_PAGE = 1 + DESTROY_PAGE = 2 + + def __init__(self): + DomainListConfigScreen.__init__(self, "Destroy A Domain") + + def get_elements_for_page(self, screen, page): + if page is self.LIST_PAGE: + return self.get_domain_list_page(screen, defined = False) + elif page is self.DESTROY_PAGE: + return self.get_destroy_page(screen) + + def page_has_next(self, page): + if page is self.LIST_PAGE: return self.has_selectable_domains() + return False + + def page_has_back(self, page): + if page is self.DESTROY_PAGE: return True + return False + + def validate_input(self, page, errors): + if page is self.LIST_PAGE: + if self.get_selected_domain() is not None: + domain = self.get_selected_domain() + try: + self.get_libvirt().destroy_domain(domain) + return True + except Exception, error: + errors.append("There was an error destroy the domain: %s" % domain) + errors.append(str(error)) + else: + errors.append("You must first select a domain to destroy.") + return False + + def get_destroy_page(self, screen): + grid = Grid(1, 1) + grid.setField(Label("%s was successfully destroyed." % self.get_selected_domain()), 0, 0) + return [grid] + +def DestroyDomain(): + screen = DestroyDomainConfigScreen() + screen.start() diff --git a/nodeadmin/domainconfig.py b/nodeadmin/domainconfig.py new file mode 100644 index 0000000..ef39fe0 --- /dev/null +++ b/nodeadmin/domainconfig.py @@ -0,0 +1,217 @@ +# domainconfig.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from virtinst import Guest + +class DomainConfig: + LOCAL_INSTALL = "local" + NETWORK_INSTALL = "network" + PXE_INSTALL = "pxe" + INSTALL_TYPE_TEXT = {LOCAL_INSTALL : "Local CDROM/ISO", + NETWORK_INSTALL : "URL INstall Tree", + PXE_INSTALL : "PXE Install"} + + INSTALL_SOURCE_CDROM = "cdrom" + INSTALL_SOURCE_ISO = "iso" + + NEW_STORAGE = "new" + EXISTING_STORAGE = "existing" + + def __init__(self): + self.__guest_name = "" + self.__install_type = DomainConfig.LOCAL_INSTALL + self.__use_cdrom_source = True + self.__install_location = "" + self.__install_media = "" + self.__iso_path = "" + self.__install_url = "" + self.__kickstart_url = "" + self.__kernel_options = "" + self.__os_type = "other" + self.__os_variant = None + self.__memory = 512 + self.__cpus = 1 + self.__enable_storage = True + self.__use_local_storage = True + self.__storage_size = 8.0 + self.__allocate_storage = True + self.__existing_storage = "" + self.__network_bridge = None + self.__mac_address = None + self.__virt_type = None + self.__architecture = None + + def set_guest_name(self, name): + self.__guest_name = name + + def get_guest_name(self): + return self.__guest_name + + def set_install_type(self, type): + self.__install_type = type + + def get_install_type(self): + return self.__install_type + + def get_install_type_text(self): + return DomainConfig.INSTALL_TYPE_TEXT[self.get_install_type()] + + def is_install_type(self, type): + return self.__install_type == type + + def set_install_location(self, location): + self.__install_location = location + + def set_use_cdrom_source(self, use): + self.__use_cdrom_source = use + + def get_use_cdrom_source(self): + return self.__use_cdrom_source + + def get_install_location(self): + return self.__install_location + + def is_install_location(self, location): + return self.__install_location == location + + def set_install_media(self, media): + self.__install_media = media + + def get_install_media(self): + return self.__install_media + + def is_install_media(self, media): + return self.__install_media == media + + def set_iso_path(self, path): + self.__iso_path = path + + def get_iso_path(self): + return self.__iso_path + + def set_install_url(self, url): + self.__install_url = url + + def get_install_url(self): + return self.__install_url + + def set_kickstart_url(self, url): + self.__kickstart_url = url + + def get_kickstart_url(self): + return self.__kickstart_url + + def set_kernel_options(self, options): + self.__kernel_options = options + + def get_kernel_options(self): + return self.__kernel_options + + def set_os_type(self, type): + self.__os_type = type + self.__os_variant = Guest.list_os_variants(type)[0] + + def get_os_type(self): + return self.__os_type + + def is_os_type(self, type): + return self.__os_type == type + + def set_os_variant(self, variant): + self.__os_variant = variant + + def get_os_variant(self): + return self.__os_variant + + def is_os_variant(self, variant): + return self.__os_variant == variant + + def set_memory(self, memory): + self.__memory = int(memory) + + def get_memory(self): + return self.__memory + + def set_cpus(self, cpus): + self.__cpus = cpus + + def get_cpus(self): + return self.__cpus + + def set_enable_storage(self, enable): + self.__enable_storage = enable + + def get_enable_storage(self): + return self.__enable_storage + + def set_use_local_storage(self, use): + self.__use_local_storage = use + + def get_use_local_storage(self): + return self.__use_local_storage + + def set_storage_size(self, size): + self.__storage_size = size + + def get_storage_size(self): + return self.__storage_size + + def set_allocate_storage(self, allocate): + self.__allocate_storage = allocate + + def get_allocate_storage(self): + return self.__allocate_storage + + def set_existing_storage(self, storage): + self.__existing_storage = storage + + def get_existing_storage(self): + return self.__existing_storage + + def is_existing_storage(self, storage): + return self.__existing_storage == storage + + def set_network_bridge(self, bridge): + self.__network_bridge = bridge + + def get_network_bridge(self): + return self.__network_bridge + + def set_mac_address(self, address): + self.__mac_address = address + + def get_mac_address(self): + return self.__mac_address + + def set_virt_type(self, type): + self.__virt_type = type + + def get_virt_type(self): + return self.__virt_type + + def is_virt_type(self, type): + return self.__virt_type == type + + def set_architecture(self, architecture): + self.__architecture = architecture + + def get_architecture(self): + return self.__architecture + + def is_architecture(self, architecture): + return self.__architecture == architecture diff --git a/nodeadmin/halworker.py b/nodeadmin/halworker.py new file mode 100644 index 0000000..448c22d --- /dev/null +++ b/nodeadmin/halworker.py @@ -0,0 +1,37 @@ +# halworker.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +import dbus +import virtinst + +class HALWorker: + '''Provides utilities for working with HAL to get hardware information.''' + def __init__(self): + self.__bus = dbus.SystemBus() + hobj = self.__bus.get_object("org.freedesktop.Hal", "/org/freedesktop/Hal/Manager") + self.__conn = dbus.Interface(hobj, "org.freedesktop.Hal.Manager") + + def list_installable_volumes(self): + result = {} + for udi in self.__conn.FindDeviceByCapability("volume"): + device = self.__bus.get_object("org.freedesktop.Hal", udi) + info = dbus.Interface(device, "org.freedesktop.Hal.Device") + if info.GetProperty("volume.is_disc"): + if info.GetProperty("volume.disc.has_data"): + result[str(info.GetProperty("block.device"))] = info.GetProperty("volume.label") + return result diff --git a/nodeadmin/libvirtworker.py b/nodeadmin/libvirtworker.py new file mode 100644 index 0000000..adaea16 --- /dev/null +++ b/nodeadmin/libvirtworker.py @@ -0,0 +1,276 @@ +# libvirtworker.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +import dbus +import libvirt +import os +import virtinst +import utils + +from domainconfig import DomainConfig + +DEFAULT_POOL_TARGET_PATH="/var/lib/libvirt/images" + +class LibvirtWorker: + '''Provides utilities for interfacing with libvirt.''' + def __init__(self, url = "qemu:///system"): + self.__conn = libvirt.open(url) + self.__capabilities = virtinst.CapabilitiesParser.parse(self.__conn.getCapabilities()) + self.__net = virtinst.VirtualNetworkInterface(conn = self.__conn) + self.__net.setup(self.__conn) + (self.__new_guest, self.__new_domain) = virtinst.CapabilitiesParser.guest_lookup(conn = self.__conn) + + def list_domains(self, defined = True, started = True): + '''Lists all domains.''' + result = [] + if defined: + result.extend(self.__conn.listDefinedDomains()) + if started: + for id in self.__conn.listDomainsID(): + result.append(self.__conn.lookupByID(id).name()) + return result + + def get_domain(self, name): + '''Returns the specified domain.''' + result = self.__conn.lookupByName(name) + if result is None: raise Exception("No such domain exists: %s" % name) + + return result + + def domain_exists(self, name): + '''Returns whether a domain with the specified node exists.''' + domains = self.list_domains() + if name in domains: return True + return False + + def create_domain(self, name): + '''Creates the specified domain.''' + domain = self.get_domain(name) + domain.create() + + def destroy_domain(self, name): + '''Destroys the specified domain.''' + domain = self.get_domain(name) + domain.destroy() + + def undefine_domain(self, name): + '''Undefines the specified domain.''' + domain = self.get_domain(name) + domain.undefine() + + def list_storage_pools(self): + '''Returns the list of all defined storage pools.''' + return self.__conn.listStoragePools() + + def storage_pool_exists(self, name): + '''Returns whether a storage pool exists.''' + pools = self.list_storage_pools() + if name in pools: return True + return False + + def define_storage_pool(self, name): + '''Defines a storage pool with the given name.''' + try: + pool = virtinst.Storage.DirectoryPool(conn=self.__conn, + name=name, + target_path=DEFAULT_POOL_TARGET_PATH) + newpool = pool.install(build=True, create=True) + newpool.setAutostart(True) + except Exception, error: + raise RuntimeError("Could not create pool: %s - %s", str(error)) + + def list_bridges(self): + '''Lists all defined and active bridges.''' + bridges = self.__conn.listNetworks() + bridges.extend(self.__conn.listDefinedNetworks()) + result = [] + for name in bridges: + bridge = self.__conn.networkLookupByName(name) + result.append(bridge) + return result + + def generate_mac_address(self): + return self.__net.macaddr + + def list_storage_volumes(self): + '''Lists all defined storage volumes.''' + pools = self.__conn.listStoragePools() + pools.extend(self.__conn.listDefinedStoragePools()) + result = [] + for name in pools: + pool = self.__conn.storagePoolLookupByName(name) + for volname in pool.listVolumes(): + volume = self.__conn.storageVolLookupByPath("/var/lib/libvirt/images/%s" % volname) + result.append(volume) + return result + + def get_storage_size(self, name): + '''Returns the size of the specified storage volume.''' + volume = self.__conn.storageVolLookupByPath("/var/lib/libvirt/images/%s" % name) + return volume.info()[1] / (1024.0 ** 3) + + def get_virt_types(self): + result = [] + for guest in self.__capabilities.guests: + guest_type = guest.os_type + for domain in guest.domains: + domain_type = domain.hypervisor_type + label = domain_type + + if domain_type is "kvm" and guest_type is "xen": label = "xenner" + elif domain_type is "xen": + if guest_type is "xen": + label = "xen (paravirt)" + elif guest_type is "kvm": + label = "xen (fullvirt)" + elif domain_type is "test": + if guest_type is "xen": + label = "test (xen)" + elif guest_type is "hvm": + label = "test (hvm)" + + for row in result: + if row[0] == label: + label = None + break + if label is None: continue + + result.append([label, domain_type, guest_type]) + return result + + def list_virt_types(self): + virt_types = self.get_virt_types() + result = [] + for type in virt_types: + result.append(type[0]) + return result + + def get_default_architecture(self): + '''Returns a default hypervisor type for new domains.''' + return self.__new_guest.arch + + def get_hypervisor(self, virt_type): + virt_types = self.get_virt_types() + for type in virt_types: + if type[0] is virt_type: return type[1] + return None + + def get_default_virt_type(self): + '''Returns the default virtualization type for new domains.''' + return self.__new_domain.hypervisor_type + + def get_os_type(self, virt_type): + virt_types = self.get_virt_types() + for type in virt_types: + if type[0] is virt_type: return type[2] + return None + + def list_architectures(self): + result = [] + for guest in self.__capabilities.guests: + for domain in guest.domains: + label = guest.arch + for row in result: + if row == label: + label = None + break + if label is None: continue + + result.append(label) + return result + + def define_domain(self, config, meter): + location = extra = kickstart = None + + if config.get_install_type() == DomainConfig.LOCAL_INSTALL: + if config.get_use_cdrom_source(): + iclass = virtinst.DistroInstaller + location = config.get_install_media() + else: + iclass = virtinst.LiveCDInstaller + location = config.get_iso_path() + elif config.get_install_type() == DomainConfig.NETWORK_INSTALL: + iclass = virtinst.DistroInstaller + location = config.get_install_url() + extra = config.get_kernel_options() + kickstart = config.get_kickstart_url() + elif config.get_install_type() == DomainConfig.PXE_INSTALL: + iclass = virtinst.PXEInstaller + + installer = iclass(conn = self.__conn, + type = self.get_hypervisor(config.get_virt_type()), + os_type = self.get_os_type(config.get_virt_type())) + self.__guest = installer.guest_from_installer() + self.__guest.name = config.get_guest_name() + self.__guest.vcpus = config.get_cpus() + self.__guest.memory = config.get_memory() + self.__guest.maxmemory = config.get_memory() + + self.__guest.installer.location = location + if config.get_use_cdrom_source(): self.__guest.installer.cdrom = True + extraargs = "" + if extra: extraargs += extra + if kickstart: extraargs += " ks=%s" % kickstart + if extraargs: self.__guest.installer.extraarags = extraargs + + self.__guest.uuid = virtinst.util.uuidToString(virtinst.util.randomUUID()) + + if config.get_os_type() != "generic": self.__guest.os_type = config.get_os_type() + if config.get_os_variant() != "generic": self.__guest.os_variant = config.get_os_variant() + + self.__guest._graphics_dev = virtinst.VirtualGraphics(type = virtinst.VirtualGraphics.TYPE_VNC) + self.__guest.sound_devs = [] + self.__guest.sound_devs.append(virtinst.VirtualAudio(model = "es1370")) + + self._setup_nics(config) + self._setup_disks(config) + + self.__guest.conn = self.__conn + self.__domain = self.__guest.start_install(False, meter = meter) + + def _setup_nics(self, config): + self.__guest.nics = [] + nic = virtinst.VirtualNetworkInterface(type = virtinst.VirtualNetworkInterface.TYPE_VIRTUAL, + bridge = config.get_network_bridge(), + network = config.get_network_bridge(), + macaddr = config.get_mac_address()) + self.__guest.nics.append(nic) + # ensure the network is running + if config.get_network_bridge() not in self.__conn.listNetworks(): + network = self.__conn.networkLookupByName(config.get_network_bridge()) + network.create() + + def _setup_disks(self, config): + self.__guest.disks = [] + if config.get_enable_storage(): + path = None + if config.get_use_local_storage(): + if self.storage_pool_exists("default") is False: + self.define_storage_pool("default") + pool = self.__conn.storagePoolLookupByName("default") + path = virtinst.Storage.StorageVolume.find_free_name(config.get_guest_name(), + pool_object = pool, + suffix = ".img") + path = os.path.join(DEFAULT_POOL_TARGET_PATH, path) + + if path is not None: + storage= virtinst.VirtualDisk(conn = self.__conn, + path = path, + size = config.get_storage_size()) + self.__guest.disks.append(storage) + self.__guest.conn = self.__conn diff --git a/nodeadmin/listdomains.py b/nodeadmin/listdomains.py new file mode 100755 index 0000000..1b51ee2 --- /dev/null +++ b/nodeadmin/listdomains.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# +# listdomains.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from libvirtworker import LibvirtWorker +from configscreen import * + +class ListDomainsConfigScreen(DomainListConfigScreen): + LIST_PAGE = 1 + DETAIL_PAGE = 2 + + def __init__(self): + DomainListConfigScreen.__init__(self, 'List Domains') + + def page_has_next(self, page): + return (page == self.LIST_PAGE) + + def page_has_back(self, page): + return (page == self.DETAIL_PAGE) + + def validate_input(self, page, errors): + if page == self.LIST_PAGE: + if self.get_selected_domain() is None: + errors.append("Please select a domain to view.") + else: + return True + + def get_elements_for_page(self, screen, page): + if page == self.LIST_PAGE: + return self.get_domain_list_page(screen) + elif page == self.DETAIL_PAGE: + return self.get_detail_page_elements(screen) + + def get_detail_page_elements(self, screen): + domain = self.get_libvirt().get_domain(self.get_selected_domain()) + grid = Grid(2, 5) + grid.setField(Label("Name: "), 0, 0, anchorRight = 1) + grid.setField(Label(domain.name()), 1, 0, anchorLeft = 1) + grid.setField(Label("UUID: "), 0, 1, anchorRight = 1) + grid.setField(Label(domain.UUIDString()), 1, 1, anchorLeft = 1) + grid.setField(Label("OS Type: "), 0, 2, anchorRight = 1) + grid.setField(Label(domain.OSType()), 1, 2, anchorLeft = 1) + grid.setField(Label("Max. Memory: "), 0, 3, anchorRight = 1) + grid.setField(Label(str(domain.maxMemory())), 1, 3, anchorLeft = 1) + grid.setField(Label("Max. VCPUs: "), 0, 4, anchorRight = 1) + grid.setField(Label(str(domain.maxVcpus())), 1, 4, anchorLeft = 1) + return [grid] + +def ListDomains(): + screen = ListDomainsConfigScreen() + screen.start() diff --git a/nodeadmin/mainmenu.py b/nodeadmin/mainmenu.py new file mode 100755 index 0000000..497ad57 --- /dev/null +++ b/nodeadmin/mainmenu.py @@ -0,0 +1,74 @@ +# mainmenu.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +import traceback +from configscreen import ConfigScreen +from definedomain import DefineDomain +from createdomain import CreateDomain +from destroydomain import DestroyDomain +from undefinedomain import UndefineDomain +from listdomains import ListDomains +from createuser import CreateUser +import utils +import logging + +DEFINE_DOMAIN = 1 +CREATE_DOMAIN = 2 +DESTROY_DOMAIN = 3 +UNDEFINE_DOMAIN = 4 +LIST_DOMAINS = 5 +CREATE_USER = 6 +EXIT_CONSOLE = 99 + +def MainMenu(): + finished = False + while finished == False: + screen = SnackScreen() + menu = Listbox(height = 0, width = 0, returnExit = 1) + menu.append("Define A Domain", DEFINE_DOMAIN) + menu.append("Create A Domain", CREATE_DOMAIN) + menu.append("Destroy A Domain", DESTROY_DOMAIN) + menu.append("Undefine A Domain", UNDEFINE_DOMAIN) + menu.append("List All Domains", LIST_DOMAINS) + menu.append("Create A User", CREATE_USER) + menu.append("Exit Administration", EXIT_CONSOLE) + gridform = GridForm(screen, "Node Administration Console", 1, 4) + gridform.add(menu, 0, 0) + result = gridform.run(); + screen.popWindow() + screen.finish() + + try: + if result.current() == DEFINE_DOMAIN: DefineDomain() + elif result.current() == CREATE_DOMAIN: CreateDomain() + elif result.current() == DESTROY_DOMAIN: DestroyDomain() + elif result.current() == UNDEFINE_DOMAIN: UndefineDomain() + elif result.current() == LIST_DOMAINS: ListDomains() + elif result.current() == CREATE_USER: CreateUser() + elif result.current() == EXIT_CONSOLE: finished = True + except Exception, error: + screen = SnackScreen() + logging.info("An exception occurred: %s" % str(error)) + ButtonChoiceWindow(screen, + "An Exception Has Occurred", + str(error) + "\n" + traceback.format_exc(), + buttons = ["OK"]) + screen.popWindow() + screen.finish() + finished = True diff --git a/nodeadmin/nodeadmin.py b/nodeadmin/nodeadmin.py new file mode 100755 index 0000000..864a4c0 --- /dev/null +++ b/nodeadmin/nodeadmin.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# +# node-admin - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +import sys + +from mainmenu import MainMenu + +def NodeAdmin(): + MainMenu() + +if __name__ == "__main__": + sys.exit(NodeAdmin()) diff --git a/nodeadmin/setup.py.in b/nodeadmin/setup.py.in new file mode 100644 index 0000000..f51a34c --- /dev/null +++ b/nodeadmin/setup.py.in @@ -0,0 +1,34 @@ +# setup.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from setuptools import setup, find_packages + +setup(name = "nodeadmin", + version = "@VERSION@", + package_dir = {'nodeadmin': 'nodeadmin'}, + packages = find_packages('.'), + entry_points = { + 'console_scripts': [ + 'nodeadmin = nodeadmin.nodeadmin:NodeAdmin', + 'definedom = nodeadmin.definedomain:DefineDomain', + 'createdom = nodeadmin.createdomain:CreateDomain', + 'destroydom = nodeadmin.destroydomain:DestroyDomain', + 'undefinedom = nodeadmin.undefinedomain:UndefineDomain', + 'createuser = nodeadmin.createuser:CreateUser', + 'listdoms = nodeadmin.listdomains:ListDomains'] + }) diff --git a/nodeadmin/undefinedomain.py b/nodeadmin/undefinedomain.py new file mode 100755 index 0000000..2620540 --- /dev/null +++ b/nodeadmin/undefinedomain.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python +# +# undefinedomain.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from configscreen import * + +class UndefineDomainConfigScreen(DomainListConfigScreen): + LIST_PAGE = 1 + CONFIRM_PAGE = 2 + UNDEFINE_PAGE = 3 + + def __init__(self): + DomainListConfigScreen.__init__(self, "Undefine A Domain") + + def get_elements_for_page(self, screen, page): + if page is self.LIST_PAGE: return self.get_domain_list_page(screen) + elif page is self.CONFIRM_PAGE: return self.get_confirm_page(screen) + elif page is self.UNDEFINE_PAGE: return self.get_undefine_page(screen) + + def page_has_next(self, page): + if page is self.LIST_PAGE: return self.has_selectable_domains() + elif page is self.CONFIRM_PAGE: return True + return False + + def page_has_back(self, page): + if page is self.CONFIRM_PAGE: return True + elif page is self.UNDEFINE_PAGE: return True + return False + + def get_back_page(self, page): + if page is self.CONFIRM_PAGE: return self.LIST_PAGE + elif page is self.UNDEFINE_PAGE: return self.LIST_PAGE + + def validate_input(self, page, errors): + if page is self.LIST_PAGE: + if self.get_selected_domain() is not None: + return True + else: + errors.append("You must first select a domain.") + elif page is self.CONFIRM_PAGE: + if self.__confirm_undefine.value(): + domain = self.get_selected_domain() + try: + self.get_libvirt().undefine_domain(domain) + return True + except Exception, error: + errors.append("Failed to undefine %s." % domain) + errors.append(str(error)) + else: + errors.append("You must confirm undefining the domain to proceed.") + return False + + def get_confirm_page(self, screen): + self.__confirm_undefine = Checkbox("Check here to confirm undefining %s." % self.get_selected_domain(), 0) + grid = Grid(1, 1) + grid.setField(self.__confirm_undefine, 0, 0) + return [grid] + + def get_undefine_page(self, screen): + grid = Grid(1, 1) + grid.setField(Label("%s has been undefined." % self.get_selected_domain()), 0, 0) + return [grid] + +def UndefineDomain(): + screen = UndefineDomainConfigScreen() + screen.start() diff --git a/nodeadmin/userworker.py b/nodeadmin/userworker.py new file mode 100644 index 0000000..167197b --- /dev/null +++ b/nodeadmin/userworker.py @@ -0,0 +1,38 @@ +# userworker.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +import libuser + +class UserWorker: + '''Provides APIs for creating, modifying and deleting user accounts.''' + def __init__(self): + self.__admin = libuser.admin() + + def create_user(self, username, password, other_group): + '''Creates a new user account with the provides username, + password. The user is also added to the optional group + if one is specified.''' + user = self.__admin.initUser(username) + user.set('pw_passwd', password) + self.__admin.addUser(user) + if other_group is not None: + group = self.__admin.lookupGroupByName(other_group) + if group is None: raise Exception("Invalid group specified: %s" % other_group) + user.add('pw_gid', group.get('pw_gid')[0]) + self.__admin.modifyUser(user) + diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index 12815c9..ee1942b 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -1,5 +1,7 @@ %define product_family oVirt Node %define beta Beta +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} + Summary: The oVirt Node daemons/scripts Name: ovirt-node @@ -21,6 +23,8 @@ Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig BuildRequires: libvirt-devel >= 0.5.1 BuildRequires: dbus-devel hal-devel +BuildRequires: python-devel +BuildRequires: python-setuptools Requires: libvirt >= 0.6.3 Requires: augeas >= 0.3.5 Requires: libvirt-qpid >= 0.2.14-3 @@ -44,6 +48,10 @@ Requires: nc Requires: grub Requires: /usr/sbin/crond Requires: anyterm +Requires: newt-python +Requires: libuser-python +Requires: dbus-python + ExclusiveArch: %{ix86} x86_64 %define app_root %{_datadir}/%{name} @@ -144,6 +152,7 @@ cd - %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/cron.d %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/cron.hourly %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/logrotate.d +%{__install} -d -m0755 %{buildroot}%{python_sitelib}/nodeadmin %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-config-boot %{buildroot}%{_sbindir} @@ -164,6 +173,22 @@ cd - %{__install} -p -m0755 scripts/persist %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/unpersist %{buildroot}%{_sbindir} +%{__install} -p -m0644 nodeadmin/__init__.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/configscreen.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/createdomain.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/createuser.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/definedomain.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/destroydomain.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/domainconfig.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/halworker.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/libvirtworker.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/userworker.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/listdomains.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/mainmenu.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/nodeadmin.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/undefinedomain.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/utils.py %{buildroot}%{python_sitelib}/nodeadmin + # gptsync %{__install} -p -m0755 gptsync/gptsync %{buildroot}%{_sbindir} %{__install} -p -m0755 gptsync/showpart %{buildroot}%{_sbindir} @@ -182,6 +207,10 @@ cd - %{__install} -p -m0644 logrotate/ovirt-logrotate %{buildroot}%{_sysconfdir}/cron.d %{__install} -p -m0644 logrotate/ovirt-logrotate.conf %{buildroot}%{_sysconfdir}/logrotate.d +# install the admin tools +python nodeadmin/setup.py install --root %{buildroot} +# rm -rf %{buildroot}%{python_sitelib}/nodeadmin- at VERSION@* + echo "oVirt Node release %{version}-%{release}" > %{buildroot}%{_sysconfdir}/ovirt-release mkdir -p %{buildroot}/%{_sysconfdir}/default touch %{buildroot}/%{_sysconfdir}/default/ovirt @@ -325,7 +354,16 @@ fi %{_sbindir}/ovirt-awake %{_initrddir}/ovirt-functions %defattr(-,root,root,0644) +%{_bindir}/nodeadmin +%{_bindir}/definedom +%{_bindir}/createdom +%{_bindir}/destroydom +%{_bindir}/undefinedom +%{_bindir}/listdoms +%{_bindir}/createuser %{_sysconfdir}/collectd.conf.in +%{python_sitelib}/nodeadmin +%{python_sitelib}/nodeadmin- at VERSION@-py2.6.egg-info %config %attr(0644,root,root) %{_sysconfdir}/ovirt-release %config %attr(0644,root,root) %{_sysconfdir}/default/ovirt -- 1.6.2.5 From dpierce at redhat.com Wed Sep 16 12:35:21 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 16 Sep 2009 08:35:21 -0400 Subject: [Ovirt-devel] Final push candidate... Message-ID: <1253104522-21207-1-git-send-email-dpierce@redhat.com> This patch goes with the node patch just sent, and is ready for pushing upstream. I'll be doing the blacklisting in a later patch once this is upstream. From dpierce at redhat.com Wed Sep 16 12:35:22 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 16 Sep 2009 08:35:22 -0400 Subject: [Ovirt-devel] [PATCH node-image] Changed packages and dependencies so virt-manager-tui runs properly. In-Reply-To: <1253104522-21207-1-git-send-email-dpierce@redhat.com> References: <1253104522-21207-1-git-send-email-dpierce@redhat.com> Message-ID: <1253104522-21207-2-git-send-email-dpierce@redhat.com> Signed-off-by: Darryl L. Pierce --- common-blacklist.ks | 4 ++-- common-install.ks | 2 +- common-pkgs.ks | 2 ++ common-post.ks | 7 +++++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/common-blacklist.ks b/common-blacklist.ks index 2f8842f..4c196e5 100644 --- a/common-blacklist.ks +++ b/common-blacklist.ks @@ -8,14 +8,14 @@ echo "Removing excess RPMs" # However, this is just an install-time dependency; we can remove # it afterwards, which we do here RPMS="system-config-firewall-tui system-config-network-tui rhpl \ - rpm-python dbus-python kudzu newt-python newt libsemanage-python" + rpm-python kudzu libsemanage-python" RPMS="$RPMS kpartx mkinitrd isomd5sum dmraid checkpolicy" # Remove additional RPMs forcefully RPMS="$RPMS gamin pm-utils kbd usermode vbetool ConsoleKit hdparm \ efibootmgr linux-atm-libs fedora-release-notes \ - slang psmisc cryptsetup-luks pciutils mtools syslinux \ + psmisc cryptsetup-luks pciutils mtools syslinux \ wireless-tools radeontool libicu gnupg2 \ fedora-logos" diff --git a/common-install.ks b/common-install.ks index 2a7fbb7..9bcdaa3 100644 --- a/common-install.ks +++ b/common-install.ks @@ -4,7 +4,7 @@ timezone --utc UTC auth --useshadow --enablemd5 selinux --enforcing firewall --disabled -part / --size 600 --fstype ext2 +part / --size 650 --fstype ext2 services --enabled=auditd,ntpd,ntpdate,collectd,iptables,network,rsyslog,libvirt-qpid # This requires a new fixed version of livecd-creator to honor the --append settings. bootloader --timeout=30 --append="console=tty0 console=ttyS0,115200n8" diff --git a/common-pkgs.ks b/common-pkgs.ks index 6f0af6e..094e9cb 100644 --- a/common-pkgs.ks +++ b/common-pkgs.ks @@ -20,6 +20,7 @@ vim-minimal sudo python python-libs +python-setuptools db4 vconfig python-virtinst @@ -37,6 +38,7 @@ pciutils numactl file lsof +newt-python /usr/bin/kvmtrace #remove -audit-libs-python diff --git a/common-post.ks b/common-post.ks index 0c0a3f4..d0a52e9 100644 --- a/common-post.ks +++ b/common-post.ks @@ -146,3 +146,10 @@ EOF # Remove the default logrotate daily cron job # since we run it every 10 minutes instead. rm -f /etc/cron.daily/logrotate + +# add nodeadmin as a valid shell +cat >> /etc/shells < The previous patch was missing this file. Resending. From dpierce at redhat.com Wed Sep 16 13:20:31 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 16 Sep 2009 09:20:31 -0400 Subject: [Ovirt-devel] [PATCH node] Introduces the node-admin toolset. In-Reply-To: <1253107231-22460-1-git-send-email-dpierce@redhat.com> References: <1253107231-22460-1-git-send-email-dpierce@redhat.com> Message-ID: <1253107231-22460-2-git-send-email-dpierce@redhat.com> Defines a primary entry point that displays a menu of options that user can use to administer the managed node. It leverages the code from virtinst-python to do the heavy lifting and just provides a front end for collecting user data. Created a new configuration class to be used for all configuration screens. The user can select to create a node. They are then walked through the steps to create a domain similar to virt-manager. The user can create a defined domain. The user can destroy a created domain. The user can undefine a defined domain. The user can list all domains on the system. The user can create a new user account. When the RPM is created, a separate entry point is created for each node admin command. This allows the commands to be invoked individually as well as from the main menu. Signed-off-by: Darryl L. Pierce --- .gitignore | 1 + Makefile.am | 16 ++ configure.ac | 1 + nodeadmin/__init__.py | 20 ++ nodeadmin/configscreen.py | 150 ++++++++++++++ nodeadmin/createdomain.py | 68 +++++++ nodeadmin/createuser.py | 106 ++++++++++ nodeadmin/definedomain.py | 470 +++++++++++++++++++++++++++++++++++++++++++ nodeadmin/destroydomain.py | 66 ++++++ nodeadmin/domainconfig.py | 217 ++++++++++++++++++++ nodeadmin/halworker.py | 37 ++++ nodeadmin/libvirtworker.py | 276 +++++++++++++++++++++++++ nodeadmin/listdomains.py | 68 +++++++ nodeadmin/mainmenu.py | 74 +++++++ nodeadmin/nodeadmin.py | 29 +++ nodeadmin/setup.py.in | 34 +++ nodeadmin/undefinedomain.py | 83 ++++++++ nodeadmin/userworker.py | 38 ++++ nodeadmin/utils.py | 25 +++ ovirt-node.spec.in | 38 ++++ 20 files changed, 1817 insertions(+), 0 deletions(-) create mode 100644 nodeadmin/__init__.py create mode 100644 nodeadmin/configscreen.py create mode 100755 nodeadmin/createdomain.py create mode 100755 nodeadmin/createuser.py create mode 100755 nodeadmin/definedomain.py create mode 100755 nodeadmin/destroydomain.py create mode 100644 nodeadmin/domainconfig.py create mode 100644 nodeadmin/halworker.py create mode 100644 nodeadmin/libvirtworker.py create mode 100755 nodeadmin/listdomains.py create mode 100755 nodeadmin/mainmenu.py create mode 100755 nodeadmin/nodeadmin.py create mode 100644 nodeadmin/setup.py.in create mode 100755 nodeadmin/undefinedomain.py create mode 100644 nodeadmin/userworker.py create mode 100644 nodeadmin/utils.py diff --git a/.gitignore b/.gitignore index 26a0210..19b15d1 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ missing stamp-h1 ovirt-node*.gz ovirt-node.spec +*.pyc diff --git a/Makefile.am b/Makefile.am index 419cdf1..2d195c0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,6 +26,22 @@ EXTRA_DIST = \ ovirt-node-selinux.fc \ images/grub-splash.xpm.gz \ images/syslinux-vesa-splash.jpg \ + nodeadmin/__init__.py \ + nodeadmin/configscreen.py \ + nodeadmin/createuser.py \ + nodeadmin/destroydomain.py \ + nodeadmin/halworker.py \ + nodeadmin/libvirtworker.py \ + nodeadmin/userworker.py \ + nodeadmin/mainmenu.py \ + nodeadmin/undefinedomain.py \ + nodeadmin/createdomain.py \ + nodeadmin/definedomain.py \ + nodeadmin/domainconfig.py \ + nodeadmin/listdomains.py \ + nodeadmin/nodeadmin.py \ + nodeadmin/setup.py \ + nodeadmin/utils.py \ scripts/collectd.conf.in \ scripts/ovirt \ scripts/ovirt-awake \ diff --git a/configure.ac b/configure.ac index b60afeb..780b757 100644 --- a/configure.ac +++ b/configure.ac @@ -8,6 +8,7 @@ test x"$ac_ct_CC:$CFLAGS" = 'xgcc:-g -O2' \ && CFLAGS="$CFLAGS -Wshadow -Wall -Werror" AC_CONFIG_FILES([Makefile + nodeadmin/setup.py gptsync/Makefile ovirt-node.spec ]) diff --git a/nodeadmin/__init__.py b/nodeadmin/__init__.py new file mode 100644 index 0000000..1f3c72c --- /dev/null +++ b/nodeadmin/__init__.py @@ -0,0 +1,20 @@ +# __init__.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from nodeadmin import NodeAdmin + diff --git a/nodeadmin/configscreen.py b/nodeadmin/configscreen.py new file mode 100644 index 0000000..0282eee --- /dev/null +++ b/nodeadmin/configscreen.py @@ -0,0 +1,150 @@ +# configscreen.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from halworker import HALWorker +from libvirtworker import LibvirtWorker +import traceback + +BACK_BUTTON = "back" +NEXT_BUTTON = "next" +CANCEL_BUTTON = "cancel" +FINISH_BUTTON = "finish" + +class ConfigScreen: + '''Enables the creation of navigable, multi-paged configuration screens.''' + + def __init__(self, title): + self.__title = title + self.__current_page = 1 + self.__finished = False + self.__hal = HALWorker() + self.__libvirt = LibvirtWorker() + + def get_hal(self): + return self.__hal + + def get_libvirt(self): + return self.__libvirt + + def set_finished(self): + self.__finished = True + + def get_elements_for_page(self, screen, page): + return [] + + def page_has_next(self, page): + return False + + def page_has_finish(self, page): + return False + + def get_back_page(self, page): + if page > 1: return page - 1 + return page + + def go_back(self): + self.__current_page = self.get_back_page(self.__current_page) + + def get_next_page(self, page): + return page + 1 + + def go_next(self): + self.__current_page = self.get_next_page(self.__current_page) + + def validate_input(self, page, errors): + return True + + def process_input(self, page): + return + + def start(self): + active = True + while active and (self.__finished == False): + screen = SnackScreen() + gridform = GridForm(screen, self.__title, 1, 4) + elements = self.get_elements_for_page(screen, self.__current_page) + current_element = 0 + for element in elements: + gridform.add(element, 0, current_element) + current_element += 1 + # create the navigation buttons + buttons = [] + if self.__current_page > 1: buttons.append(["Back", BACK_BUTTON, "F11"]) + if self.page_has_next(self.__current_page): buttons.append(["Next", NEXT_BUTTON, "F12"]) + if self.page_has_finish(self.__current_page): buttons.append(["Finish", FINISH_BUTTON, "F10"]) + buttons.append(["Cancel", CANCEL_BUTTON, "ESC"]) + buttonbar = ButtonBar(screen, buttons) + gridform.add(buttonbar, 0, current_element, growx = 1) + current_element += 1 + try: + result = gridform.runOnce() + pressed = buttonbar.buttonPressed(result) + if pressed == BACK_BUTTON: + self.go_back() + elif pressed == NEXT_BUTTON or pressed == FINISH_BUTTON: + errors = [] + if self.validate_input(self.__current_page, errors): + self.process_input(self.__current_page) + self.go_next() + else: + error_text = "" + for error in errors: + error_text += "%s\n" % error + ButtonChoiceWindow(screen, + "There Were Errors", + error_text, + buttons = ["OK"]) + elif pressed == CANCEL_BUTTON: + active = False + except Exception, error: + ButtonChoiceWindow(screen, + "An Exception Has Occurred", + str(error) + "\n" + traceback.format_exc(), + buttons = ["OK"]) + screen.popWindow() + screen.finish() + +class DomainListConfigScreen(ConfigScreen): + '''Provides a base class for all config screens that require a domain list.''' + + def __init__(self, title): + ConfigScreen.__init__(self, title) + + def get_domain_list_page(self, screen, defined=True, created=True): + domains = self.get_libvirt().list_domains(defined, created) + result = None + + if len(domains) > 0: + self.__has_domains = True + self.__domain_list = Listbox(0) + for name in self.get_libvirt().list_domains(defined, created): + self.__domain_list.append(name, name) + result = [self.__domain_list] + else: + self.__has_domains = False + grid = Grid(1, 1) + grid.setField(Label("There are no domains available."), 0, 0) + result = [grid] + return result + + def get_selected_domain(self): + return self.__domain_list.current() + + def has_selectable_domains(self): + return self.__has_domains diff --git a/nodeadmin/createdomain.py b/nodeadmin/createdomain.py new file mode 100755 index 0000000..b73a09e --- /dev/null +++ b/nodeadmin/createdomain.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# +# createdomain.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from configscreen import * + +class CreateDomainConfigScreen(DomainListConfigScreen): + LIST_PAGE = 1 + CREATE_PAGE = 2 + + def __init__(self): + DomainListConfigScreen.__init__(self, "Create A Domain") + + def get_elements_for_page(self, screen, page): + if page is self.LIST_PAGE: + return self.get_domain_list_page(screen, created = False) + elif page is self.CREATE_PAGE: + return self.get_create_domain_page(screen) + + def page_has_next(self, page): + if page is self.LIST_PAGE: return self.has_selectable_domains() + return False + + def page_has_back(self, page): + if page is self.CREATE_PAGE: return True + return False + + def validate_input(self, page, errors): + if page is self.LIST_PAGE: + if self.get_selected_domain() is not None: + domain = self.get_selected_domain() + try: + self.get_libvirt().create_domain(domain) + return True + except Exception, error: + errors.append("There was an error creating the domain: %s" % domain) + errors.append(str(error)) + else: + errors.append("You must first select a domain to create.") + + def process_input(self, page): + print "foo" + + def get_create_domain_page(self, screen): + grid = Grid(1, 1) + grid.setField(Label("%s was successfully created." % self.get_selected_domain()), 0, 0) + return [grid] + +def CreateDomain(): + screen = CreateDomainConfigScreen() + screen.start() diff --git a/nodeadmin/createuser.py b/nodeadmin/createuser.py new file mode 100755 index 0000000..dbc4626 --- /dev/null +++ b/nodeadmin/createuser.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python +# +# createuser.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from configscreen import ConfigScreen +from userworker import UserWorker + +import libuser + +DETAILS_PAGE = 1 +CONFIRM_PAGE = 2 + +class CreateUserConfigScreen(ConfigScreen): + def __init__(self): + ConfigScreen.__init__(self, "Create A User Account") + self.__username = None + self.__useradmin = libuser.admin() + self.__user_worker = UserWorker() + + def get_elements_for_page(self, screen, page): + if page is DETAILS_PAGE: return self.get_details_page(screen) + elif page is CONFIRM_PAGE: return self.get_confirm_page(screen) + + def validate_input(self, page, errors): + if page is DETAILS_PAGE: + if len(self.__username.value()) > 0: + name = self.__username.value() + if self.__useradmin.lookupUserByName(name) is None: + if len(self.__password.value()) > 0: + if self.__password.value() == self.__confirm.value(): + return True + else: + errors.append("Passwords do not match.") + else: + errors.append("You must enter a password.") + else: + errors.append("User %s already exists." % name) + else: + errors.append("You must enter a username.") + self.__confirm.value() + return False + + def process_input(self, page): + if page is CONFIRM_PAGE: + self.__user_worker.create_user(self.__username.value(), + self.__password.value(), + "wheel" if self.__adminuser.value() else None) + self.set_finished() + + def page_has_next(self, page): + return (page is DETAILS_PAGE) + + def page_has_back(self, page): + return (page is CONFIRM_PAGE) + + def page_has_finish(self, page): + return (page is CONFIRM_PAGE) + + def get_details_page(self, screen): + if self.__username is None: + self.__username = Entry(50, "") + self.__password = Entry(50, "", password = 1) + self.__confirm = Entry(50, "", password = 1) + self.__adminuser = Checkbox("This user is an administrator", False) + grid = Grid(2, 4) + grid.setField(Label("Username:"), 0, 0, anchorRight = 1) + grid.setField(self.__username, 1, 0, anchorLeft = 1) + grid.setField(Label("Password:"), 0, 1, anchorRight = 1) + grid.setField(self.__password, 1, 1, anchorLeft = 1) + grid.setField(Label("Confirm password:"), 0, 2, anchorRight = 1) + grid.setField(self.__confirm, 1, 2, anchorLeft = 1) + grid.setField(Label(" "), 0, 3) + grid.setField(self.__adminuser, 1, 3, anchorLeft = 1) + return [Label("Enter The User Details"), + grid] + + def get_confirm_page(self, screen): + grid = Grid(1, 2) + grid.setField(Label("Username: %s" % self.__username.value()), 0, 0) + admin_label = "is not" + if self.__adminuser.value(): + admin_label = "is" + grid.setField(Label("This user %s an administrator." % admin_label), 0, 1) + return [Label("Create this user account?"), + grid] + +def CreateUser(): + screen = CreateUserConfigScreen() + screen.start() diff --git a/nodeadmin/definedomain.py b/nodeadmin/definedomain.py new file mode 100755 index 0000000..6a6612c --- /dev/null +++ b/nodeadmin/definedomain.py @@ -0,0 +1,470 @@ +#!/usr/bin/env python +# +# definedomain.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +import os +from domainconfig import DomainConfig +from configscreen import ConfigScreen +import urlgrabber.progress as progress +import utils +import logging + +from virtinst import * + +VM_DETAILS_PAGE = 1 +LOCAL_INSTALL_PAGE = 2 +SELECT_CDROM_PAGE = 3 +SELECT_ISO_PAGE = 4 +NETWORK_INSTALL_PAGE = 10 +OS_TYPE_PAGE = 11 +OS_VARIANT_PAGE = 12 +RAM_CPU_PAGE = 13 +ENABLE_STORAGE_PAGE = 14 +LOCAL_STORAGE_PAGE = 15 +MANAGED_STORAGE_PAGE = 16 +BRIDGE_PAGE = 17 +VIRT_DETAILS_PAGE = 18 +CONFIRM_PAGE = 19 + +LOCATION="location" +KICKSTART="kickstart" +KERNELOPTS="kernel.options" +OS_TYPE="os.type" +OS_VARIANT="os.variant" +MEMORY="memory" +CPUS="cpus" + +class DummyMeter(progress.BaseMeter): + def _do_start(self, now = None): + logging.info("Starting...") + + def _do_end(self, amount_read, now = None): + logging.info("Ending: read=%d" % amount_read) + + def _do_update(self, amount_read, now = None): + logging.info("Update: read=%d" % amount_read) + +class DomainConfigScreen(ConfigScreen): + def __init__(self): + ConfigScreen.__init__(self, "Create A New Virtual Machine") + self.__config = DomainConfig() + self.__config.set_architecture(self.get_libvirt().get_default_architecture()) + self.__config.set_virt_type(self.get_libvirt().get_default_virt_type()) + + def get_elements_for_page(self, screen, page): + if page == VM_DETAILS_PAGE: return self.get_vm_details_page(screen) + elif page == LOCAL_INSTALL_PAGE: return self.get_local_install_page(screen) + elif page == SELECT_CDROM_PAGE: return self.get_select_cdrom_page(screen) + elif page == SELECT_ISO_PAGE: return self.get_select_iso_page(screen) + elif page == NETWORK_INSTALL_PAGE: return self.get_network_install_page(screen) + elif page == OS_TYPE_PAGE: return self.get_os_type_page(screen) + elif page == OS_VARIANT_PAGE: return self.get_os_variant_page(screen) + elif page == RAM_CPU_PAGE: return self.get_ram_and_cpu_page(screen) + elif page == ENABLE_STORAGE_PAGE: return self.get_enable_storage_page(screen) + elif page == LOCAL_STORAGE_PAGE: return self.get_local_storage_page(screen) + elif page == MANAGED_STORAGE_PAGE: return self.get_managed_storage_page(screen) + elif page == BRIDGE_PAGE: return self.get_bridge_page(screen) + elif page == VIRT_DETAILS_PAGE: return self.get_virt_details_page(screen) + elif page == CONFIRM_PAGE: return self.get_confirm_page(screen) + return [] + + def validate_input(self, page, errors): + if page == VM_DETAILS_PAGE: + if len(self.__guest_name.value()) > 0: + if self.get_libvirt().domain_exists(self.__guest_name.value()): + errors.append("Guest name '%s' is already in use." % self.__guest_name.value()) + else: + return True + else: + errors.append("Guest name must be a string between 0 and 50 characters.") + elif page == LOCAL_INSTALL_PAGE: + if self.__install_source.getSelection() == DomainConfig.INSTALL_SOURCE_CDROM: + return True + elif self.__install_source.getSelection() == DomainConfig.INSTALL_SOURCE_ISO: + return True + elif page == SELECT_CDROM_PAGE: + if self.__install_media.getSelection() != None: + if len(self.get_hal().list_installable_volumes()) == 0: + errors.append("No installable media is available.") + else: + return True + else: + errors.append("You must select an install media.") + elif page == SELECT_ISO_PAGE: + if len(self.__iso_path.value()) > 0: + if os.path.exists(self.__iso_path.value()): + if os.path.isfile(self.__iso_path.value()): + return True + else: + errors.append("%s is not a file." % self.__iso_path.value()) + else: + errors.append("No such install media exists:") + errors.append(self.__iso_path.value()) + else: + errors.append("An install media selection is required.") + elif page == NETWORK_INSTALL_PAGE: + if len(self.__install_url.value()) > 0: + return True + else: + errors.append("An install tree is required.") + elif page == OS_TYPE_PAGE: return True + elif page == OS_VARIANT_PAGE: return True + elif page == RAM_CPU_PAGE: + if (len(self.__memory.value()) > 0 and len(self.__cpus.value()) > 0) \ + and (int(self.__memory.value()) > 0 and int(self.__cpus.value()) > 0): + return True + else: + if len(self.__memory.value()) == 0: + errors.append("A value must be entered for memory.") + elif int(self.__memory.value()) <= 0: + errors.append("A positive integer value must be entered for memory.") + if len(self.__cpus.value()) == 0: + errors.append("A value must be entered for CPUs.") + elif int(self.__cpus.value()) <= 0: + errors.append("A positive integer value must be entered for memory.") + elif page == ENABLE_STORAGE_PAGE: return True + elif page == LOCAL_STORAGE_PAGE: + if len(self.__storage_size.value()) > 0: + if float(self.__storage_size.value()) > 0: + return True + else: + errors.append("A positive value must be entered for the storage size.") + else: + errors.append("A value must be entered for the storage size.") + elif page == MANAGED_STORAGE_PAGE: + if self.__existing_storage.getSelection() is not None: + return True + else: + errors.append("Please select a storage volume.") + elif page == BRIDGE_PAGE: + if self.__network_bridges.getSelection() != None: + if len(self.__mac_address.value()) > 0: + # TODO: regex check the format + return True + else: + errors.append("MAC address must be supplied.") + else: + errors.append("A network bridge must be selected.") + elif page == VIRT_DETAILS_PAGE: + if self.__virt_types.getSelection() != None and self.__architectures.getSelection() != None: + return True + if self.__virt_types.getSelection() is None: + errors.append("Please select a virtualization type.") + if self.__architectures.getSelection() is None: + errors.append("Please selection an architecture.") + elif page == CONFIRM_PAGE: return True + return False + + def process_input(self, page): + if page == VM_DETAILS_PAGE: + self.__config.set_guest_name(self.__guest_name.value()) + self.__config.set_install_type(self.__install_type.getSelection()) + elif page == LOCAL_INSTALL_PAGE: + self.__config.set_use_cdrom_source(self.__install_source.getSelection() == DomainConfig.INSTALL_SOURCE_CDROM) + elif page == SELECT_CDROM_PAGE: + self.__config.set_install_media(self.__install_media.getSelection()) + elif page == SELECT_ISO_PAGE: + self.__config.set_iso_path(self.__iso_path.value()) + elif page == NETWORK_INSTALL_PAGE: + self.__config.set_install_url(self.__install_url.value()) + self.__config.set_kickstart_url(self.__kickstart_url.value()) + self.__config.set_kernel_options(self.__kernel_options.value()) + elif page == OS_TYPE_PAGE: + self.__config.set_os_type(self.__os_types.getSelection()) + elif page == OS_VARIANT_PAGE: + self.__config.set_os_variant(self.__os_variants.getSelection()) + elif page == RAM_CPU_PAGE: + self.__config.set_memory(int(self.__memory.value())) + self.__config.set_cpus(int(self.__cpus.value())) + elif page == ENABLE_STORAGE_PAGE: + self.__config.set_enable_storage(self.__enable_storage.value()) + if self.__storage_type.getSelection() == DomainConfig.NEW_STORAGE: + self.__config.set_use_local_storage(True) + elif self.__storage_type.getSelection() == Node.STORAGE_TYPE_EXISTING: + self.__config.set_use_local_storage(False) + elif page == LOCAL_STORAGE_PAGE: + self.__config.set_storage_size(float(self.__storage_size.value())) + self.__config.set_allocate_storage(self.__allocate_storage.value()) + elif page == MANAGED_STORAGE_PAGE: + self.__config.set_use_local_storage(False) + self.__config.set_existing_storage(self.__existing_storage.getSelection()) + self.__config.set_storage_size(self.get_libvirt().get_storage_size(self.__existing_storage.getSelection())) + elif page == BRIDGE_PAGE: + self.__config.set_network_bridge(self.__network_bridges.getSelection()) + elif page == VIRT_DETAILS_PAGE: + self.__config.set_virt_type(self.__virt_types.getSelection()) + self.__config.set_architecture(self.__architectures.getSelection()) + elif page == CONFIRM_PAGE: + self.get_libvirt().define_domain(self.__config, DummyMeter()) + self.set_finished() + + def get_back_page(self, page): + result = page + if page == OS_TYPE_PAGE: + install_type = self.__config.get_install_type() + if install_type == DomainConfig.LOCAL_INSTALL: + if self.__config.get_use_cdrom_source(): + result = SELECT_CDROM_PAGE + else: + result = SELECT_ISO_PAGE + elif install_type == DomainConfig.NETWORK_INSTALL: + result = NETWORK_INSTALL_PAGE + elif install_type == DomainConfig.PXE_INSTALL: + result = VM_DETAILS_PAGE + elif page == LOCAL_STORAGE_PAGE or page == MANAGED_STORAGE_PAGE: + result = ENABLE_STORAGE_PAGE + elif page == NETWORK_INSTALL_PAGE: + result = VM_DETAILS_PAGE + elif page == SELECT_CDROM_PAGE or page == SELECT_ISO_PAGE: + result = LOCAL_INSTALL_PAGE + elif page == BRIDGE_PAGE: + if self.__config.get_use_local_storage(): + result = LOCAL_STORAGE_PAGE + else: + result = MANAGED_STORAGE_PAGE + else: + if page > 1: result = page - 1 + return result + + def get_next_page(self, page): + result = page + if page == VM_DETAILS_PAGE: + install_type = self.__config.get_install_type() + if install_type == DomainConfig.LOCAL_INSTALL: + result = LOCAL_INSTALL_PAGE + elif install_type == DomainConfig.NETWORK_INSTALL: + result = NETWORK_INSTALL_PAGE + elif install_type == DomainConfig.PXE_INSTALL: + result = OS_TYPE_PAGE + elif page == LOCAL_INSTALL_PAGE: + if self.__config.get_use_cdrom_source(): + result = SELECT_CDROM_PAGE + else: + result = SELECT_ISO_PAGE + elif page == SELECT_CDROM_PAGE or page == SELECT_ISO_PAGE: + result = OS_TYPE_PAGE + elif page == NETWORK_INSTALL_PAGE: + result = OS_TYPE_PAGE + elif page == ENABLE_STORAGE_PAGE: + result = BRIDGE_PAGE + if self.__config.get_enable_storage(): + if self.__config.get_use_local_storage(): + result = LOCAL_STORAGE_PAGE + else: + result = MANAGED_STORAGE_PAGE + elif page == LOCAL_STORAGE_PAGE or page == MANAGED_STORAGE_PAGE: + result = BRIDGE_PAGE + else: + result = page + 1 + return result + + def page_has_finish(self, page): + if page == CONFIRM_PAGE: return True + return False + + def page_has_next(self, page): + if page < CONFIRM_PAGE: + return True + + def get_vm_details_page(self, screen): + self.__guest_name = Entry(50, self.__config.get_guest_name()) + self.__install_type = RadioBar(screen, (("Local install media (ISO image or CDROM)", + DomainConfig.LOCAL_INSTALL, + self.__config.is_install_type(DomainConfig.LOCAL_INSTALL)), + ("Network Install (HTTP, FTP, or NFS)", + DomainConfig.NETWORK_INSTALL, + self.__config.is_install_type(DomainConfig.NETWORK_INSTALL)), + ("Network Boot (PXE)", + DomainConfig.PXE_INSTALL, + self.__config.is_install_type(DomainConfig.PXE_INSTALL)))) + grid = Grid(2,3) + grid.setField(Label("Name:"), 0, 0, anchorRight = 1) + grid.setField(self.__guest_name, 1, 0, anchorLeft = 1) + grid.setField(Label("Choose how you would like to install the operating system"), 1, 1, + anchorLeft = 1, anchorTop = 1) + grid.setField(self.__install_type, 1, 2, anchorLeft = 1) + return [Label("Enter your machine details"), + grid] + + def get_local_install_page(self, screen): + self.__install_source = RadioBar(screen, (("Use CDROM or DVD", + DomainConfig.INSTALL_SOURCE_CDROM, + self.__config.get_use_cdrom_source()), + ("Use ISO image", + DomainConfig.INSTALL_SOURCE_ISO, + self.__config.get_use_cdrom_source() is False))) + grid = Grid(1,1) + grid.setField(self.__install_source, 0, 0, anchorLeft = 1) + return [Label("Locate your install media"), + grid] + + def get_select_cdrom_page(self, screen): + drives = [] + media = self.get_hal().list_installable_volumes() + for drive in media.keys(): + drives.append([media[drive], drive, self.__config.is_install_media(drive)]) + self.__install_media = RadioBar(screen, (drives)) + grid = Grid(1, 1) + grid.setField(self.__install_media, 0, 0) + return [Label("Select the install media"), + grid] + + def get_select_iso_page(self, screen): + self.__iso_path = Entry(50, self.__config.get_iso_path()) + grid = Grid(1, 2) + grid.setField(Label("Enter ISO path:"), 0, 0, anchorLeft = 1) + grid.setField(self.__iso_path, 0, 1, anchorLeft = 1) + return [Label("Enter the full path to an install ISO"), + grid] + + def get_network_install_page(self, screen): + self.__install_url = Entry(50, self.__config.get_install_url()) + self.__kickstart_url = Entry(50, self.__config.get_kickstart_url()) + self.__kernel_options = Entry(50, self.__config.get_kernel_options()) + grid = Grid(2,3) + grid.setField(Label("URL:"), 0, 0, anchorRight = 1) + grid.setField(self.__install_url, 1, 0, anchorLeft = 1) + grid.setField(Label("Kickstart URL:"), 0, 1, anchorRight = 1) + grid.setField(self.__kickstart_url, 1, 1, anchorLeft = 1) + grid.setField(Label("Kernel Options:"), 0, 2, anchorRight = 1) + grid.setField(self.__kernel_options, 1, 2, anchorLeft = 1) + return [Label("Provide the operating system URL"), + grid] + + def get_os_type_page(self, screen): + types = [] + for type in Guest.list_os_types(): + types.append([Guest.get_os_type_label(type), type, self.__config.is_os_type(type)]) + self.__os_types = RadioBar(screen, types) + grid = Grid(1, 1) + grid.setField(self.__os_types, 0, 0, anchorLeft = 1) + return [Label("Choose the operating system type"), + grid] + + def get_os_variant_page(self, screen): + variants = [] + type = self.__config.get_os_type() + for variant in Guest.list_os_variants(type): + variants.append([Guest.get_os_variant_label(type, variant), variant, self.__config.is_os_variant(variant)]) + self.__os_variants = RadioBar(screen, variants) + grid = Grid(1, 1) + grid.setField(self.__os_variants, 0, 0, anchorLeft = 1) + return [Label("Choose the operating system version"), + grid] + + def get_ram_and_cpu_page(self, screen): + self.__memory = Entry(10, str(self.__config.get_memory())) + self.__cpus = Entry(10, str(self.__config.get_cpus())) + grid = Grid(2,2) + grid.setField(Label("Memory (RAM):"), 0, 0, anchorRight = 1) + grid.setField(self.__memory, 1, 0, anchorLeft = 1) + grid.setField(Label("CPUs:"), 0, 1, anchorRight = 1) + grid.setField(self.__cpus, 1, 1, anchorLeft = 1) + return [Label("Choose memory and CPU settings"), + grid] + + def get_enable_storage_page(self, screen): + self.__enable_storage = Checkbox("Enable storage for this virtual machine", self.__config.get_enable_storage()) + self.__storage_type = RadioBar(screen,((["Create a disk image on the computer's hard disk", + DomainConfig.NEW_STORAGE, + self.__config.get_use_local_storage()]), + (["Select managed or other existing storage", + DomainConfig.EXISTING_STORAGE, + self.__config.get_use_local_storage() is False]))) + grid = Grid(1,2) + grid.setField(self.__enable_storage, 0, 0, anchorLeft = 1) + grid.setField(self.__storage_type, 0, 1, anchorLeft = 1) + return [Label("Configure storage"), + grid] + + def get_local_storage_page(self, screen): + self.__storage_size = Entry(6, str(self.__config.get_storage_size())) + self.__allocate_storage = Checkbox("Allocate entire disk now", self.__config.get_allocate_storage()) + grid = Grid(2, 2) + grid.setField(self.__allocate_storage, 0, 0, growx = 1, anchorLeft = 1) + grid.setField(Label("Storage size (GB):"), 0, 1, anchorLeft = 1) + grid.setField(self.__storage_size, 1, 1) + return [Label("Configure local storage"), + grid] + + def get_managed_storage_page(self, screen): + volumes = [] + for volume in self.get_libvirt().list_storage_volumes(): + volumes.append(["%s (%d GB)" % (volume.name(), volume.info()[1] / (1024 ** 3)), + volume.name(), + self.__config.is_existing_storage(volume.name())]) + self.__existing_storage = RadioBar(screen, (volumes)) + grid = Grid(2, 1) + grid.setField(Label("Existing storage:"), 0, 0) + grid.setField(self.__existing_storage, 1, 0) + return [Label("Configure managed storage"), + grid] + + def get_bridge_page(self, screen): + bridges = [] + for bridge in self.get_libvirt().list_bridges(): + bridges.append(["Virtual network '%s'" % bridge.name(), bridge.name(), self.__config.get_network_bridge() == bridge.name()]) + self.__network_bridges = RadioBar(screen, (bridges)) + if self.__config.get_mac_address() == None: + self.__config.set_mac_address(self.get_libvirt().generate_mac_address()) + self.__mac_address = Entry(20, self.__config.get_mac_address()) + grid = Grid(1, 1) + grid.setField(self.__network_bridges, 0, 0) + return [Label("Select an existing bridge"), + grid] + + def get_virt_details_page(self, screen): + virt_types = [] + for type in self.get_libvirt().list_virt_types(): + virt_types.append([type, type, self.__config.is_virt_type(type)]) + self.__virt_types = RadioBar(screen, (virt_types)) + archs = [] + for arch in self.get_libvirt().list_architectures(): + archs.append([arch, arch, self.__config.is_architecture(arch)]) + self.__architectures = RadioBar(screen, (archs)) + grid = Grid(2, 2) + grid.setField(Label("Virt Type:"), 0, 0, anchorRight = 1, anchorTop = 1) + grid.setField(self.__virt_types, 1, 0, anchorLeft = 1) + grid.setField(Label("Architecture:"), 0, 1, anchorRight = 1, anchorTop = 1) + grid.setField(self.__architectures, 1, 1, anchorLeft = 1) + return [Label("Configure virtualization details"), + grid] + + def get_confirm_page(self, screen): + grid = Grid(2, 6) + grid.setField(Label("OS:"), 0, 0, anchorRight = 1) + grid.setField(Label(Guest.get_os_variant_label(self.__config.get_os_type(), + self.__config.get_os_variant())), 1, 0, anchorLeft = 1) + grid.setField(Label("Install:"), 0, 1, anchorRight = 1) + grid.setField(Label(self.__config.get_install_type_text()), 1, 1, anchorLeft = 1) + grid.setField(Label("Memory:"), 0, 2, anchorRight = 1) + grid.setField(Label("%s MB" % self.__config.get_memory()), 1, 2, anchorLeft = 1) + grid.setField(Label("CPUs:"), 0, 3, anchorRight = 1) + grid.setField(Label("%d" % self.__config.get_cpus()), 1, 3, anchorLeft = 1) + grid.setField(Label("Storage:"), 0, 4, anchorRight = 1) + grid.setField(Label(self.__config.get_existing_storage()), 1, 4, anchorLeft = 1) + grid.setField(Label("Network:"), 0, 5, anchorRight = 1) + grid.setField(Label(self.__config.get_network_bridge()), 1, 5, anchorLeft = 1) + return [Label("Ready to begin installation of %s" % self.__config.get_guest_name()), + grid] + +def DefineDomain(): + screen = DomainConfigScreen() + screen.start() diff --git a/nodeadmin/destroydomain.py b/nodeadmin/destroydomain.py new file mode 100755 index 0000000..350c32e --- /dev/null +++ b/nodeadmin/destroydomain.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# +# destroydomain.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from configscreen import * + +class DestroyDomainConfigScreen(DomainListConfigScreen): + LIST_PAGE = 1 + DESTROY_PAGE = 2 + + def __init__(self): + DomainListConfigScreen.__init__(self, "Destroy A Domain") + + def get_elements_for_page(self, screen, page): + if page is self.LIST_PAGE: + return self.get_domain_list_page(screen, defined = False) + elif page is self.DESTROY_PAGE: + return self.get_destroy_page(screen) + + def page_has_next(self, page): + if page is self.LIST_PAGE: return self.has_selectable_domains() + return False + + def page_has_back(self, page): + if page is self.DESTROY_PAGE: return True + return False + + def validate_input(self, page, errors): + if page is self.LIST_PAGE: + if self.get_selected_domain() is not None: + domain = self.get_selected_domain() + try: + self.get_libvirt().destroy_domain(domain) + return True + except Exception, error: + errors.append("There was an error destroy the domain: %s" % domain) + errors.append(str(error)) + else: + errors.append("You must first select a domain to destroy.") + return False + + def get_destroy_page(self, screen): + grid = Grid(1, 1) + grid.setField(Label("%s was successfully destroyed." % self.get_selected_domain()), 0, 0) + return [grid] + +def DestroyDomain(): + screen = DestroyDomainConfigScreen() + screen.start() diff --git a/nodeadmin/domainconfig.py b/nodeadmin/domainconfig.py new file mode 100644 index 0000000..ef39fe0 --- /dev/null +++ b/nodeadmin/domainconfig.py @@ -0,0 +1,217 @@ +# domainconfig.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from virtinst import Guest + +class DomainConfig: + LOCAL_INSTALL = "local" + NETWORK_INSTALL = "network" + PXE_INSTALL = "pxe" + INSTALL_TYPE_TEXT = {LOCAL_INSTALL : "Local CDROM/ISO", + NETWORK_INSTALL : "URL INstall Tree", + PXE_INSTALL : "PXE Install"} + + INSTALL_SOURCE_CDROM = "cdrom" + INSTALL_SOURCE_ISO = "iso" + + NEW_STORAGE = "new" + EXISTING_STORAGE = "existing" + + def __init__(self): + self.__guest_name = "" + self.__install_type = DomainConfig.LOCAL_INSTALL + self.__use_cdrom_source = True + self.__install_location = "" + self.__install_media = "" + self.__iso_path = "" + self.__install_url = "" + self.__kickstart_url = "" + self.__kernel_options = "" + self.__os_type = "other" + self.__os_variant = None + self.__memory = 512 + self.__cpus = 1 + self.__enable_storage = True + self.__use_local_storage = True + self.__storage_size = 8.0 + self.__allocate_storage = True + self.__existing_storage = "" + self.__network_bridge = None + self.__mac_address = None + self.__virt_type = None + self.__architecture = None + + def set_guest_name(self, name): + self.__guest_name = name + + def get_guest_name(self): + return self.__guest_name + + def set_install_type(self, type): + self.__install_type = type + + def get_install_type(self): + return self.__install_type + + def get_install_type_text(self): + return DomainConfig.INSTALL_TYPE_TEXT[self.get_install_type()] + + def is_install_type(self, type): + return self.__install_type == type + + def set_install_location(self, location): + self.__install_location = location + + def set_use_cdrom_source(self, use): + self.__use_cdrom_source = use + + def get_use_cdrom_source(self): + return self.__use_cdrom_source + + def get_install_location(self): + return self.__install_location + + def is_install_location(self, location): + return self.__install_location == location + + def set_install_media(self, media): + self.__install_media = media + + def get_install_media(self): + return self.__install_media + + def is_install_media(self, media): + return self.__install_media == media + + def set_iso_path(self, path): + self.__iso_path = path + + def get_iso_path(self): + return self.__iso_path + + def set_install_url(self, url): + self.__install_url = url + + def get_install_url(self): + return self.__install_url + + def set_kickstart_url(self, url): + self.__kickstart_url = url + + def get_kickstart_url(self): + return self.__kickstart_url + + def set_kernel_options(self, options): + self.__kernel_options = options + + def get_kernel_options(self): + return self.__kernel_options + + def set_os_type(self, type): + self.__os_type = type + self.__os_variant = Guest.list_os_variants(type)[0] + + def get_os_type(self): + return self.__os_type + + def is_os_type(self, type): + return self.__os_type == type + + def set_os_variant(self, variant): + self.__os_variant = variant + + def get_os_variant(self): + return self.__os_variant + + def is_os_variant(self, variant): + return self.__os_variant == variant + + def set_memory(self, memory): + self.__memory = int(memory) + + def get_memory(self): + return self.__memory + + def set_cpus(self, cpus): + self.__cpus = cpus + + def get_cpus(self): + return self.__cpus + + def set_enable_storage(self, enable): + self.__enable_storage = enable + + def get_enable_storage(self): + return self.__enable_storage + + def set_use_local_storage(self, use): + self.__use_local_storage = use + + def get_use_local_storage(self): + return self.__use_local_storage + + def set_storage_size(self, size): + self.__storage_size = size + + def get_storage_size(self): + return self.__storage_size + + def set_allocate_storage(self, allocate): + self.__allocate_storage = allocate + + def get_allocate_storage(self): + return self.__allocate_storage + + def set_existing_storage(self, storage): + self.__existing_storage = storage + + def get_existing_storage(self): + return self.__existing_storage + + def is_existing_storage(self, storage): + return self.__existing_storage == storage + + def set_network_bridge(self, bridge): + self.__network_bridge = bridge + + def get_network_bridge(self): + return self.__network_bridge + + def set_mac_address(self, address): + self.__mac_address = address + + def get_mac_address(self): + return self.__mac_address + + def set_virt_type(self, type): + self.__virt_type = type + + def get_virt_type(self): + return self.__virt_type + + def is_virt_type(self, type): + return self.__virt_type == type + + def set_architecture(self, architecture): + self.__architecture = architecture + + def get_architecture(self): + return self.__architecture + + def is_architecture(self, architecture): + return self.__architecture == architecture diff --git a/nodeadmin/halworker.py b/nodeadmin/halworker.py new file mode 100644 index 0000000..448c22d --- /dev/null +++ b/nodeadmin/halworker.py @@ -0,0 +1,37 @@ +# halworker.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +import dbus +import virtinst + +class HALWorker: + '''Provides utilities for working with HAL to get hardware information.''' + def __init__(self): + self.__bus = dbus.SystemBus() + hobj = self.__bus.get_object("org.freedesktop.Hal", "/org/freedesktop/Hal/Manager") + self.__conn = dbus.Interface(hobj, "org.freedesktop.Hal.Manager") + + def list_installable_volumes(self): + result = {} + for udi in self.__conn.FindDeviceByCapability("volume"): + device = self.__bus.get_object("org.freedesktop.Hal", udi) + info = dbus.Interface(device, "org.freedesktop.Hal.Device") + if info.GetProperty("volume.is_disc"): + if info.GetProperty("volume.disc.has_data"): + result[str(info.GetProperty("block.device"))] = info.GetProperty("volume.label") + return result diff --git a/nodeadmin/libvirtworker.py b/nodeadmin/libvirtworker.py new file mode 100644 index 0000000..adaea16 --- /dev/null +++ b/nodeadmin/libvirtworker.py @@ -0,0 +1,276 @@ +# libvirtworker.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +import dbus +import libvirt +import os +import virtinst +import utils + +from domainconfig import DomainConfig + +DEFAULT_POOL_TARGET_PATH="/var/lib/libvirt/images" + +class LibvirtWorker: + '''Provides utilities for interfacing with libvirt.''' + def __init__(self, url = "qemu:///system"): + self.__conn = libvirt.open(url) + self.__capabilities = virtinst.CapabilitiesParser.parse(self.__conn.getCapabilities()) + self.__net = virtinst.VirtualNetworkInterface(conn = self.__conn) + self.__net.setup(self.__conn) + (self.__new_guest, self.__new_domain) = virtinst.CapabilitiesParser.guest_lookup(conn = self.__conn) + + def list_domains(self, defined = True, started = True): + '''Lists all domains.''' + result = [] + if defined: + result.extend(self.__conn.listDefinedDomains()) + if started: + for id in self.__conn.listDomainsID(): + result.append(self.__conn.lookupByID(id).name()) + return result + + def get_domain(self, name): + '''Returns the specified domain.''' + result = self.__conn.lookupByName(name) + if result is None: raise Exception("No such domain exists: %s" % name) + + return result + + def domain_exists(self, name): + '''Returns whether a domain with the specified node exists.''' + domains = self.list_domains() + if name in domains: return True + return False + + def create_domain(self, name): + '''Creates the specified domain.''' + domain = self.get_domain(name) + domain.create() + + def destroy_domain(self, name): + '''Destroys the specified domain.''' + domain = self.get_domain(name) + domain.destroy() + + def undefine_domain(self, name): + '''Undefines the specified domain.''' + domain = self.get_domain(name) + domain.undefine() + + def list_storage_pools(self): + '''Returns the list of all defined storage pools.''' + return self.__conn.listStoragePools() + + def storage_pool_exists(self, name): + '''Returns whether a storage pool exists.''' + pools = self.list_storage_pools() + if name in pools: return True + return False + + def define_storage_pool(self, name): + '''Defines a storage pool with the given name.''' + try: + pool = virtinst.Storage.DirectoryPool(conn=self.__conn, + name=name, + target_path=DEFAULT_POOL_TARGET_PATH) + newpool = pool.install(build=True, create=True) + newpool.setAutostart(True) + except Exception, error: + raise RuntimeError("Could not create pool: %s - %s", str(error)) + + def list_bridges(self): + '''Lists all defined and active bridges.''' + bridges = self.__conn.listNetworks() + bridges.extend(self.__conn.listDefinedNetworks()) + result = [] + for name in bridges: + bridge = self.__conn.networkLookupByName(name) + result.append(bridge) + return result + + def generate_mac_address(self): + return self.__net.macaddr + + def list_storage_volumes(self): + '''Lists all defined storage volumes.''' + pools = self.__conn.listStoragePools() + pools.extend(self.__conn.listDefinedStoragePools()) + result = [] + for name in pools: + pool = self.__conn.storagePoolLookupByName(name) + for volname in pool.listVolumes(): + volume = self.__conn.storageVolLookupByPath("/var/lib/libvirt/images/%s" % volname) + result.append(volume) + return result + + def get_storage_size(self, name): + '''Returns the size of the specified storage volume.''' + volume = self.__conn.storageVolLookupByPath("/var/lib/libvirt/images/%s" % name) + return volume.info()[1] / (1024.0 ** 3) + + def get_virt_types(self): + result = [] + for guest in self.__capabilities.guests: + guest_type = guest.os_type + for domain in guest.domains: + domain_type = domain.hypervisor_type + label = domain_type + + if domain_type is "kvm" and guest_type is "xen": label = "xenner" + elif domain_type is "xen": + if guest_type is "xen": + label = "xen (paravirt)" + elif guest_type is "kvm": + label = "xen (fullvirt)" + elif domain_type is "test": + if guest_type is "xen": + label = "test (xen)" + elif guest_type is "hvm": + label = "test (hvm)" + + for row in result: + if row[0] == label: + label = None + break + if label is None: continue + + result.append([label, domain_type, guest_type]) + return result + + def list_virt_types(self): + virt_types = self.get_virt_types() + result = [] + for type in virt_types: + result.append(type[0]) + return result + + def get_default_architecture(self): + '''Returns a default hypervisor type for new domains.''' + return self.__new_guest.arch + + def get_hypervisor(self, virt_type): + virt_types = self.get_virt_types() + for type in virt_types: + if type[0] is virt_type: return type[1] + return None + + def get_default_virt_type(self): + '''Returns the default virtualization type for new domains.''' + return self.__new_domain.hypervisor_type + + def get_os_type(self, virt_type): + virt_types = self.get_virt_types() + for type in virt_types: + if type[0] is virt_type: return type[2] + return None + + def list_architectures(self): + result = [] + for guest in self.__capabilities.guests: + for domain in guest.domains: + label = guest.arch + for row in result: + if row == label: + label = None + break + if label is None: continue + + result.append(label) + return result + + def define_domain(self, config, meter): + location = extra = kickstart = None + + if config.get_install_type() == DomainConfig.LOCAL_INSTALL: + if config.get_use_cdrom_source(): + iclass = virtinst.DistroInstaller + location = config.get_install_media() + else: + iclass = virtinst.LiveCDInstaller + location = config.get_iso_path() + elif config.get_install_type() == DomainConfig.NETWORK_INSTALL: + iclass = virtinst.DistroInstaller + location = config.get_install_url() + extra = config.get_kernel_options() + kickstart = config.get_kickstart_url() + elif config.get_install_type() == DomainConfig.PXE_INSTALL: + iclass = virtinst.PXEInstaller + + installer = iclass(conn = self.__conn, + type = self.get_hypervisor(config.get_virt_type()), + os_type = self.get_os_type(config.get_virt_type())) + self.__guest = installer.guest_from_installer() + self.__guest.name = config.get_guest_name() + self.__guest.vcpus = config.get_cpus() + self.__guest.memory = config.get_memory() + self.__guest.maxmemory = config.get_memory() + + self.__guest.installer.location = location + if config.get_use_cdrom_source(): self.__guest.installer.cdrom = True + extraargs = "" + if extra: extraargs += extra + if kickstart: extraargs += " ks=%s" % kickstart + if extraargs: self.__guest.installer.extraarags = extraargs + + self.__guest.uuid = virtinst.util.uuidToString(virtinst.util.randomUUID()) + + if config.get_os_type() != "generic": self.__guest.os_type = config.get_os_type() + if config.get_os_variant() != "generic": self.__guest.os_variant = config.get_os_variant() + + self.__guest._graphics_dev = virtinst.VirtualGraphics(type = virtinst.VirtualGraphics.TYPE_VNC) + self.__guest.sound_devs = [] + self.__guest.sound_devs.append(virtinst.VirtualAudio(model = "es1370")) + + self._setup_nics(config) + self._setup_disks(config) + + self.__guest.conn = self.__conn + self.__domain = self.__guest.start_install(False, meter = meter) + + def _setup_nics(self, config): + self.__guest.nics = [] + nic = virtinst.VirtualNetworkInterface(type = virtinst.VirtualNetworkInterface.TYPE_VIRTUAL, + bridge = config.get_network_bridge(), + network = config.get_network_bridge(), + macaddr = config.get_mac_address()) + self.__guest.nics.append(nic) + # ensure the network is running + if config.get_network_bridge() not in self.__conn.listNetworks(): + network = self.__conn.networkLookupByName(config.get_network_bridge()) + network.create() + + def _setup_disks(self, config): + self.__guest.disks = [] + if config.get_enable_storage(): + path = None + if config.get_use_local_storage(): + if self.storage_pool_exists("default") is False: + self.define_storage_pool("default") + pool = self.__conn.storagePoolLookupByName("default") + path = virtinst.Storage.StorageVolume.find_free_name(config.get_guest_name(), + pool_object = pool, + suffix = ".img") + path = os.path.join(DEFAULT_POOL_TARGET_PATH, path) + + if path is not None: + storage= virtinst.VirtualDisk(conn = self.__conn, + path = path, + size = config.get_storage_size()) + self.__guest.disks.append(storage) + self.__guest.conn = self.__conn diff --git a/nodeadmin/listdomains.py b/nodeadmin/listdomains.py new file mode 100755 index 0000000..1b51ee2 --- /dev/null +++ b/nodeadmin/listdomains.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# +# listdomains.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from libvirtworker import LibvirtWorker +from configscreen import * + +class ListDomainsConfigScreen(DomainListConfigScreen): + LIST_PAGE = 1 + DETAIL_PAGE = 2 + + def __init__(self): + DomainListConfigScreen.__init__(self, 'List Domains') + + def page_has_next(self, page): + return (page == self.LIST_PAGE) + + def page_has_back(self, page): + return (page == self.DETAIL_PAGE) + + def validate_input(self, page, errors): + if page == self.LIST_PAGE: + if self.get_selected_domain() is None: + errors.append("Please select a domain to view.") + else: + return True + + def get_elements_for_page(self, screen, page): + if page == self.LIST_PAGE: + return self.get_domain_list_page(screen) + elif page == self.DETAIL_PAGE: + return self.get_detail_page_elements(screen) + + def get_detail_page_elements(self, screen): + domain = self.get_libvirt().get_domain(self.get_selected_domain()) + grid = Grid(2, 5) + grid.setField(Label("Name: "), 0, 0, anchorRight = 1) + grid.setField(Label(domain.name()), 1, 0, anchorLeft = 1) + grid.setField(Label("UUID: "), 0, 1, anchorRight = 1) + grid.setField(Label(domain.UUIDString()), 1, 1, anchorLeft = 1) + grid.setField(Label("OS Type: "), 0, 2, anchorRight = 1) + grid.setField(Label(domain.OSType()), 1, 2, anchorLeft = 1) + grid.setField(Label("Max. Memory: "), 0, 3, anchorRight = 1) + grid.setField(Label(str(domain.maxMemory())), 1, 3, anchorLeft = 1) + grid.setField(Label("Max. VCPUs: "), 0, 4, anchorRight = 1) + grid.setField(Label(str(domain.maxVcpus())), 1, 4, anchorLeft = 1) + return [grid] + +def ListDomains(): + screen = ListDomainsConfigScreen() + screen.start() diff --git a/nodeadmin/mainmenu.py b/nodeadmin/mainmenu.py new file mode 100755 index 0000000..497ad57 --- /dev/null +++ b/nodeadmin/mainmenu.py @@ -0,0 +1,74 @@ +# mainmenu.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +import traceback +from configscreen import ConfigScreen +from definedomain import DefineDomain +from createdomain import CreateDomain +from destroydomain import DestroyDomain +from undefinedomain import UndefineDomain +from listdomains import ListDomains +from createuser import CreateUser +import utils +import logging + +DEFINE_DOMAIN = 1 +CREATE_DOMAIN = 2 +DESTROY_DOMAIN = 3 +UNDEFINE_DOMAIN = 4 +LIST_DOMAINS = 5 +CREATE_USER = 6 +EXIT_CONSOLE = 99 + +def MainMenu(): + finished = False + while finished == False: + screen = SnackScreen() + menu = Listbox(height = 0, width = 0, returnExit = 1) + menu.append("Define A Domain", DEFINE_DOMAIN) + menu.append("Create A Domain", CREATE_DOMAIN) + menu.append("Destroy A Domain", DESTROY_DOMAIN) + menu.append("Undefine A Domain", UNDEFINE_DOMAIN) + menu.append("List All Domains", LIST_DOMAINS) + menu.append("Create A User", CREATE_USER) + menu.append("Exit Administration", EXIT_CONSOLE) + gridform = GridForm(screen, "Node Administration Console", 1, 4) + gridform.add(menu, 0, 0) + result = gridform.run(); + screen.popWindow() + screen.finish() + + try: + if result.current() == DEFINE_DOMAIN: DefineDomain() + elif result.current() == CREATE_DOMAIN: CreateDomain() + elif result.current() == DESTROY_DOMAIN: DestroyDomain() + elif result.current() == UNDEFINE_DOMAIN: UndefineDomain() + elif result.current() == LIST_DOMAINS: ListDomains() + elif result.current() == CREATE_USER: CreateUser() + elif result.current() == EXIT_CONSOLE: finished = True + except Exception, error: + screen = SnackScreen() + logging.info("An exception occurred: %s" % str(error)) + ButtonChoiceWindow(screen, + "An Exception Has Occurred", + str(error) + "\n" + traceback.format_exc(), + buttons = ["OK"]) + screen.popWindow() + screen.finish() + finished = True diff --git a/nodeadmin/nodeadmin.py b/nodeadmin/nodeadmin.py new file mode 100755 index 0000000..864a4c0 --- /dev/null +++ b/nodeadmin/nodeadmin.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# +# node-admin - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +import sys + +from mainmenu import MainMenu + +def NodeAdmin(): + MainMenu() + +if __name__ == "__main__": + sys.exit(NodeAdmin()) diff --git a/nodeadmin/setup.py.in b/nodeadmin/setup.py.in new file mode 100644 index 0000000..f51a34c --- /dev/null +++ b/nodeadmin/setup.py.in @@ -0,0 +1,34 @@ +# setup.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from setuptools import setup, find_packages + +setup(name = "nodeadmin", + version = "@VERSION@", + package_dir = {'nodeadmin': 'nodeadmin'}, + packages = find_packages('.'), + entry_points = { + 'console_scripts': [ + 'nodeadmin = nodeadmin.nodeadmin:NodeAdmin', + 'definedom = nodeadmin.definedomain:DefineDomain', + 'createdom = nodeadmin.createdomain:CreateDomain', + 'destroydom = nodeadmin.destroydomain:DestroyDomain', + 'undefinedom = nodeadmin.undefinedomain:UndefineDomain', + 'createuser = nodeadmin.createuser:CreateUser', + 'listdoms = nodeadmin.listdomains:ListDomains'] + }) diff --git a/nodeadmin/undefinedomain.py b/nodeadmin/undefinedomain.py new file mode 100755 index 0000000..2620540 --- /dev/null +++ b/nodeadmin/undefinedomain.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python +# +# undefinedomain.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from snack import * +from configscreen import * + +class UndefineDomainConfigScreen(DomainListConfigScreen): + LIST_PAGE = 1 + CONFIRM_PAGE = 2 + UNDEFINE_PAGE = 3 + + def __init__(self): + DomainListConfigScreen.__init__(self, "Undefine A Domain") + + def get_elements_for_page(self, screen, page): + if page is self.LIST_PAGE: return self.get_domain_list_page(screen) + elif page is self.CONFIRM_PAGE: return self.get_confirm_page(screen) + elif page is self.UNDEFINE_PAGE: return self.get_undefine_page(screen) + + def page_has_next(self, page): + if page is self.LIST_PAGE: return self.has_selectable_domains() + elif page is self.CONFIRM_PAGE: return True + return False + + def page_has_back(self, page): + if page is self.CONFIRM_PAGE: return True + elif page is self.UNDEFINE_PAGE: return True + return False + + def get_back_page(self, page): + if page is self.CONFIRM_PAGE: return self.LIST_PAGE + elif page is self.UNDEFINE_PAGE: return self.LIST_PAGE + + def validate_input(self, page, errors): + if page is self.LIST_PAGE: + if self.get_selected_domain() is not None: + return True + else: + errors.append("You must first select a domain.") + elif page is self.CONFIRM_PAGE: + if self.__confirm_undefine.value(): + domain = self.get_selected_domain() + try: + self.get_libvirt().undefine_domain(domain) + return True + except Exception, error: + errors.append("Failed to undefine %s." % domain) + errors.append(str(error)) + else: + errors.append("You must confirm undefining the domain to proceed.") + return False + + def get_confirm_page(self, screen): + self.__confirm_undefine = Checkbox("Check here to confirm undefining %s." % self.get_selected_domain(), 0) + grid = Grid(1, 1) + grid.setField(self.__confirm_undefine, 0, 0) + return [grid] + + def get_undefine_page(self, screen): + grid = Grid(1, 1) + grid.setField(Label("%s has been undefined." % self.get_selected_domain()), 0, 0) + return [grid] + +def UndefineDomain(): + screen = UndefineDomainConfigScreen() + screen.start() diff --git a/nodeadmin/userworker.py b/nodeadmin/userworker.py new file mode 100644 index 0000000..167197b --- /dev/null +++ b/nodeadmin/userworker.py @@ -0,0 +1,38 @@ +# userworker.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +import libuser + +class UserWorker: + '''Provides APIs for creating, modifying and deleting user accounts.''' + def __init__(self): + self.__admin = libuser.admin() + + def create_user(self, username, password, other_group): + '''Creates a new user account with the provides username, + password. The user is also added to the optional group + if one is specified.''' + user = self.__admin.initUser(username) + user.set('pw_passwd', password) + self.__admin.addUser(user) + if other_group is not None: + group = self.__admin.lookupGroupByName(other_group) + if group is None: raise Exception("Invalid group specified: %s" % other_group) + user.add('pw_gid', group.get('pw_gid')[0]) + self.__admin.modifyUser(user) + diff --git a/nodeadmin/utils.py b/nodeadmin/utils.py new file mode 100644 index 0000000..55a838c --- /dev/null +++ b/nodeadmin/utils.py @@ -0,0 +1,25 @@ +# definedomain.py - Copyright (C) 2009 Red Hat, Inc. +# Written by Darryl L. Pierce +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +import logging + +logging.basicConfig(level=logging.DEBUG, + format='%(asctime)s %(levelname)-8s %(message)s', + datefmt='%a, %d %b %Y %H:%M:%S', + filename='/var/log/ovirt-nodeadmin.log', + filemode='w') diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index 12815c9..ee1942b 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -1,5 +1,7 @@ %define product_family oVirt Node %define beta Beta +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} + Summary: The oVirt Node daemons/scripts Name: ovirt-node @@ -21,6 +23,8 @@ Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig BuildRequires: libvirt-devel >= 0.5.1 BuildRequires: dbus-devel hal-devel +BuildRequires: python-devel +BuildRequires: python-setuptools Requires: libvirt >= 0.6.3 Requires: augeas >= 0.3.5 Requires: libvirt-qpid >= 0.2.14-3 @@ -44,6 +48,10 @@ Requires: nc Requires: grub Requires: /usr/sbin/crond Requires: anyterm +Requires: newt-python +Requires: libuser-python +Requires: dbus-python + ExclusiveArch: %{ix86} x86_64 %define app_root %{_datadir}/%{name} @@ -144,6 +152,7 @@ cd - %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/cron.d %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/cron.hourly %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/logrotate.d +%{__install} -d -m0755 %{buildroot}%{python_sitelib}/nodeadmin %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-config-boot %{buildroot}%{_sbindir} @@ -164,6 +173,22 @@ cd - %{__install} -p -m0755 scripts/persist %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/unpersist %{buildroot}%{_sbindir} +%{__install} -p -m0644 nodeadmin/__init__.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/configscreen.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/createdomain.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/createuser.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/definedomain.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/destroydomain.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/domainconfig.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/halworker.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/libvirtworker.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/userworker.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/listdomains.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0644 nodeadmin/mainmenu.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/nodeadmin.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/undefinedomain.py %{buildroot}%{python_sitelib}/nodeadmin +%{__install} -p -m0755 nodeadmin/utils.py %{buildroot}%{python_sitelib}/nodeadmin + # gptsync %{__install} -p -m0755 gptsync/gptsync %{buildroot}%{_sbindir} %{__install} -p -m0755 gptsync/showpart %{buildroot}%{_sbindir} @@ -182,6 +207,10 @@ cd - %{__install} -p -m0644 logrotate/ovirt-logrotate %{buildroot}%{_sysconfdir}/cron.d %{__install} -p -m0644 logrotate/ovirt-logrotate.conf %{buildroot}%{_sysconfdir}/logrotate.d +# install the admin tools +python nodeadmin/setup.py install --root %{buildroot} +# rm -rf %{buildroot}%{python_sitelib}/nodeadmin- at VERSION@* + echo "oVirt Node release %{version}-%{release}" > %{buildroot}%{_sysconfdir}/ovirt-release mkdir -p %{buildroot}/%{_sysconfdir}/default touch %{buildroot}/%{_sysconfdir}/default/ovirt @@ -325,7 +354,16 @@ fi %{_sbindir}/ovirt-awake %{_initrddir}/ovirt-functions %defattr(-,root,root,0644) +%{_bindir}/nodeadmin +%{_bindir}/definedom +%{_bindir}/createdom +%{_bindir}/destroydom +%{_bindir}/undefinedom +%{_bindir}/listdoms +%{_bindir}/createuser %{_sysconfdir}/collectd.conf.in +%{python_sitelib}/nodeadmin +%{python_sitelib}/nodeadmin- at VERSION@-py2.6.egg-info %config %attr(0644,root,root) %{_sysconfdir}/ovirt-release %config %attr(0644,root,root) %{_sysconfdir}/default/ovirt -- 1.6.2.5 From apevec at redhat.com Wed Sep 16 15:13:20 2009 From: apevec at redhat.com (Alan Pevec) Date: Wed, 16 Sep 2009 17:13:20 +0200 Subject: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] Message-ID: <4AB10090.7030902@redhat.com> Forwarding to the list for Jay or Scott to have a look. Ignazio, do you see any more details (traceback or something) in the rails log? -------------- next part -------------- An embedded message was scrubbed... From: ignazio.cassano at provincia.torino.it Subject: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares Date: Wed, 16 Sep 2009 16:48:47 +0200 Size: 4031 URL: From ignazio.cassano at provincia.torino.it Wed Sep 16 15:36:40 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Wed, 16 Sep 2009 17:36:40 +0200 Subject: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] In-Reply-To: <4AB10090.7030902@redhat.com> References: <4AB10090.7030902@redhat.com> Message-ID: <20090916173640.20gx87br5dzk0ws4@webmail.provincia.torino.it> When I try to start the vm , in rails.log the following is reported: Processing VmController#show (for 192.168.1.8 at 2009-09-16 17:35:32) [GET] Parameters: {"id"=>"3"} Rendering template within layouts/selection Rendering vm/show Completed in 71ms (View: 17, LDAP: 0, DB: 23) | 200 OK [http://192.168.1.8/ovirt/vm/show/3] Processing ResourcesController#vm_actions (for 192.168.1.8 at 2009-09-16 17:35:34) [POST] Parameters: {"id"=>"5", "vm_action"=>"start_vm", "vm_ids"=>"3"} ApplicationService::PartialSuccessError (start_vm failed for some VMs): app/services/vm_resource_pool_service.rb:102:in `svc_vm_actions' app/controllers/resources_controller.rb:94:in `vm_actions' Rendering template within layouts/confirmation Rendering resources/vm_actions Processing TreeController#return_filtered_list (for 192.168.1.8 at 2009-09-16 17:35:35) [POST] Parameters: {"item"=>["4-Smart Pools", "7-ovirt", "1-default", "5-test", "8-ovirt"]} Completed in 24ms (View: 2, LDAP: 0, DB: 44) | 200 OK [http://192.168.1.8/ovirt/tree/return_filtered_list] Processing TreeController#return_filtered_list (for 192.168.1.8 at 2009-09-16 17:35:50) [POST] Parameters: {"item"=>["4-Smart Pools", "7-ovirt", "1-default", "5-test", "8-ovirt"]} Completed in 29ms (View: 2, LDAP: 0, DB: 6) | 200 OK [http://192.168.1.8/ovirt/tree/return_filtered_list] ----- Messaggio da apevec at redhat.com --------- Data: Wed, 16 Sep 2009 17:13:20 +0200 Da: Alan Pevec Rispondi-A:Alan Pevec Oggetto: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] A: "ovirt-devel at redhat.com" > Forwarding to the list for Jay or Scott to have a look. > > Ignazio, do you see any more details (traceback or something) in the > rails log? ----- Fine del messaggio da apevec at redhat.com ----- From sseago at redhat.com Wed Sep 16 16:07:40 2009 From: sseago at redhat.com (Scott Seago) Date: Wed, 16 Sep 2009 12:07:40 -0400 Subject: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] In-Reply-To: <4AB10090.7030902@redhat.com> References: <4AB10090.7030902@redhat.com> Message-ID: <4AB10D4C.5010702@redhat.com> Alan Pevec wrote: > Forwarding to the list for Jay or Scott to have a look. > > Ignazio, do you see any more details (traceback or something) in the > rails log? > Unavailable action simply means that 'start vm' is not a valid action for that VM right now. If you go to the details pane for the VM you'll see that 'start' isn't in the actions list. What actions do appear there? What are the 'state' and 'pending state' values shown on the details pane? Is your host available (and showing up as available on the HW pool's hosts tab)? Scott > ------------------------------------------------------------------------ > > Subject: > Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares > From: > ignazio.cassano at provincia.torino.it > Date: > Wed, 16 Sep 2009 16:48:47 +0200 > To: > Alan Pevec > > To: > Alan Pevec > > > > Thank you Alan. > Now my note appears available on ovirt web interface. > I added a iscsi storage. > When I try to start a virtual machine , web intervace reports: > > "unavailable action" > > ----- Messaggio da apevec at redhat.com --------- > Data: Wed, 16 Sep 2009 12:23:11 +0200 > Da: Alan Pevec > Rispondi-A:Alan Pevec > Oggetto: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares > A: ignazio.cassano at provincia.torino.it > > >> ignazio.cassano at provincia.torino.it wrote: >>> Good Morning Alan, >>> you email means I can rebuild ovirt and resolve my problem on >>> Broadcom bnx2 ? >> >> Yes, I've just pushed the patch to 'next' git branch, pull it and >> rebuild the node image. >> >> Thanks, >> Alan > > > ----- Fine del messaggio da apevec at redhat.com ----- > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel > From jboggs at redhat.com Wed Sep 16 16:33:18 2009 From: jboggs at redhat.com (Joey Boggs) Date: Wed, 16 Sep 2009 12:33:18 -0400 Subject: [Ovirt-devel] [PATCH appliance] removed old / broken appliance implementation In-Reply-To: <1252522273-16638-2-git-send-email-mmorsi@redhat.com> References: <1252522273-16638-1-git-send-email-mmorsi@redhat.com> <1252522273-16638-2-git-send-email-mmorsi@redhat.com> Message-ID: <4AB1134E.3050705@redhat.com> Mohammed Morsi wrote: > --- > Makefile.am | 208 ------------------------------------------ > autobuild.sh | 117 ------------------------ > autogen.sh | 66 -------------- > configure.ac | 5 - > create-ovirt-appliance | 87 ------------------ > create-ovirt-network | 161 --------------------------------- > create-ovirt-nodes | 51 ----------- > get-ovirt-appliance | 115 ------------------------ > gettree.sh | 77 ---------------- > ovirt-appliance-functions | 219 --------------------------------------------- > ovirt-appliance.ks | 119 ------------------------ > ovirt-appliance.spec.in | 69 -------------- > 12 files changed, 0 insertions(+), 1294 deletions(-) > delete mode 100644 Makefile.am > delete mode 100755 autobuild.sh > delete mode 100755 autogen.sh > delete mode 100644 configure.ac > delete mode 100755 create-ovirt-appliance > delete mode 100755 create-ovirt-network > delete mode 100755 create-ovirt-nodes > delete mode 100755 get-ovirt-appliance > delete mode 100755 gettree.sh > delete mode 100644 ovirt-appliance-functions > delete mode 100644 ovirt-appliance.ks > delete mode 100644 ovirt-appliance.spec.in > > diff --git a/Makefile.am b/Makefile.am > deleted file mode 100644 > index bd40ef8..0000000 > --- a/Makefile.am > +++ /dev/null > @@ -1,208 +0,0 @@ > -# Copyright (C) 2008 Red Hat, Inc. > -# > -# This program is free software; you can redistribute it and/or modify > -# it under the terms of the GNU General Public License as published by > -# the Free Software Foundation; version 2 of the License. > -# > -# This program is distributed in the hope that it will be useful, > -# but WITHOUT ANY WARRANTY; without even the implied warranty of > -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > -# GNU General Public License for more details. > -# > -# You should have received a copy of the GNU General Public License > -# along with this program; if not, write to the Free Software > -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > -# MA 02110-1301, USA. A copy of the GNU General Public License is > -# also available at http://www.gnu.org/copyleft/gpl.html. > - > -OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache > -OVIRT_LOCAL_REPO ?= file://$(OVIRT_CACHE_DIR)/ovirt > -OVIRT_URL ?= http://ovirt.org/repos/ovirt > -PKG_FMT ?= tar > -SRC_FMT ?= tar > -DISK_FMT ?= qcow2 > -SUM ?= sha1sum > -APP_RAM ?= 1024 > -AUTH_KEYS ?= ~/.ssh/authorized_keys > - > -FEDORA_MIRROR = http://mirrors.fedoraproject.org/mirrorlist > -FEDORA_URL_DEF = http://download.fedoraproject.org/pub/fedora/linux > -CUR_RAWHIDE = 11 > - > -FEDORA = $(shell rpm --eval '%{fedora}') > -ARCH = $(shell rpm --eval '%{_arch}') > - > -NVR = $(PACKAGE)-$(VERSION)-$(ARCH) > - > -EXTRA_DIST = \ > - .gitignore \ > - create-$(PACKAGE) \ > - create-ovirt-network \ > - create-ovirt-nodes \ > - get-$(PACKAGE) \ > - $(PACKAGE)-functions \ > - gettree.sh \ > - $(PACKAGE).ks \ > - $(PACKAGE).spec \ > - $(PACKAGE).spec.in > - > -DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz \ > - $(NVR).* \ > - $(NVR).*.$(SUM) \ > - repos.ks ovirt-authorized_keys > - > -# For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT- > -# annotated rpm version strings. > -_ovirt_dev = \ > - $(shell grep -q '^[[:space:]]*Release:[[:space:]]*0' \ > - $(srcdir)/*.spec.in && echo 1 || :) > - > -git_head = $$(git log -1 --pretty=format:%h) > -GIT_RELEASE = $$(date --utc +%Y%m%d%H%M%S)git$(git_head) > -RPMDIR = $$(rpm --eval '%{_rpmdir}') > -RPM_FLAGS = --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)" > -RPM_FLAGS += $(if $(_ovirt_dev),--define "extra_release .$(GIT_RELEASE)") > -APP_TMP = $(OVIRT_CACHE_DIR)/$(PACKAGE)-$(ARCH)-tmp > -SRC_KS = $(APP_TMP)/src.ks > - > -repos.ks: > - ( \ > - if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \ > - FEDORA_REPO=rawhide ;\ > - FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/development/$(ARCH)/os,--mirrorlist=$(FEDORA_MIRROR)?repo=rawhide&arch=$(ARCH))" ;\ > - OVIRT_DISTRO=development ;\ > - else \ > - FEDORA_REPO=f$(FEDORA) ;\ > - FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/$(ARCH)/os,--mirrorlist=$(FEDORA_MIRROR)?repo=fedora-$(FEDORA)&arch=$(ARCH))" ;\ > - OVIRT_DISTRO=$(FEDORA) ;\ > - UPDATE_REPO_LINE="repo --name=$${FEDORA_REPO}-updates $(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/updates/$(FEDORA)/$(ARCH),--mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-f$(FEDORA)&arch=$(ARCH))" ;\ > - fi ;\ > - echo "repo --name=$${FEDORA_REPO} $${FEDORA_REPO_LOC}" > $@ ;\ > - echo "repo --name=ovirt-org --baseurl=$(OVIRT_URL)/$${OVIRT_DISTRO}/$(ARCH)" >> $@ ;\ > - echo "$${UPDATE_REPO_LINE}" >> $@ ;\ > - echo "repo --name=ovirt-local --baseurl=$(OVIRT_LOCAL_REPO)" >> $@ \ > - ) > - > -src.ks: repos.ks > - mkdir -p $(APP_TMP) > - ( \ > - cat repos.ks ;\ > - if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \ > - FEDORA_REPO=rawhide ;\ > - FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/development/source/SRPMS,--mirrorlist=$(FEDORA_MIRROR)?repo=rawhide-source&arch=source)" ;\ > - OVIRT_DISTRO=development ;\ > - else \ > - FEDORA_REPO=f$(FEDORA) ;\ > - FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/source/SRPMS,--mirrorlist=$(FEDORA_MIRROR)?repo=fedora-source-$(FEDORA)&arch=source)" ;\ > - OVIRT_DISTRO=$(FEDORA) ;\ > - UPDATE_REPO_LINE="repo --name=$${FEDORA_REPO}-updates-source $(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/updates/$(FEDORA)/SRPMS,--mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-source-f$(FEDORA)&arch=source)" ;\ > - fi ;\ > - echo "repo --name=$${FEDORA_REPO}-source $${FEDORA_REPO_LOC}" ;\ > - echo "repo --name=ovirt-org-source --baseurl=$(OVIRT_URL)/$${OVIRT_DISTRO}/src" ;\ > - echo "$${UPDATE_REPO_LINE}" ;\ > - echo "%packages --nobase" ;\ > - grep -v '^-' /usr/share/appliance-os/includes/base-pkgs.ks ;\ > - echo "ovirt-recipe" ;\ > - echo "lokkit" ;\ > - echo "%end" ;\ > - ) > $(SRC_KS) > - > -keys: > - if [ "$(_ovirt_dev)" = 1 -a -f $(AUTH_KEYS) ]; then \ > - cp -va $(AUTH_KEYS) ovirt-authorized_keys ;\ > - fi > - > -SELINUX_ENFORCING=$(shell /usr/sbin/getenforce) > -$(NVR).$(PKG_FMT): repos.ks keys > - mkdir -p $(APP_TMP)/tree > - mkdir -p $(OVIRT_CACHE_DIR)/yum-$(ARCH) > - ( \ > - case $(SELINUX_ENFORCING) in \ > - Enforcing) sudo /usr/sbin/setenforce Permissive ;; \ > - Permissive) ;; \ > - *) if ksflatten $(PACKAGE).ks 2>/dev/null \ > - | grep -q '^selinux --disabled'; then \ > - echo WARNING: SELinux disabled in kickstart ;\ > - else \ > - echo ERROR: SELinux enabled in kickstart, \ > - but disabled on the build machine ;\ > - exit 1 ;\ > - fi ;; \ > - esac ;\ > - if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \ > - FEDORA_TREE_URL="$(if $(FEDORA_URL),$(FEDORA_URL)/development/$(ARCH)/os,$(FEDORA_URL_DEF)/development/$(ARCH)/os)" ;\ > - else \ > - FEDORA_TREE_URL="$(if $(FEDORA_URL),$(FEDORA_URL)/releases/$(FEDORA)/Fedora/$(ARCH)/os,$(FEDORA_URL_DEF)/releases/$(FEDORA)/Fedora/$(ARCH)/os)" ;\ > - fi ;\ > - ./gettree.sh $${FEDORA_TREE_URL} $(APP_TMP)/tree ;\ > - ) > - > - mkdir -p scripts > - cp -a create-$(PACKAGE) create-ovirt-network create-ovirt-nodes \ > - get-$(PACKAGE) $(PACKAGE)-functions scripts > - > - ln -snf $(APP_TMP) tmp > - sudo su -c "export PATH=$(PATH):/sbin:/usr/sbin && \ > - appliance-creator --config $(PACKAGE).ks \ > - --name $(PACKAGE) -f $(DISK_FMT) -p $(PKG_FMT) -d -v \ > - --tmpdir='$(APP_TMP)' \ > - --cache='$(OVIRT_CACHE_DIR)/yum-$(ARCH)' \ > - --vmem=$(APP_RAM) \ > - -i scripts" > - sudo chown $${USER} $(PACKAGE).$(PKG_FMT) > - ( \ > - if [ $(SELINUX_ENFORCING) = Enforcing ]; then \ > - sudo /usr/sbin/setenforce Enforcing || exit 1 ;\ > - fi \ > - ) > - > - mv $(PACKAGE).$(PKG_FMT) $(NVR).$(PKG_FMT) > - rm -Rf scripts > - > -$(NVR).$(PKG_FMT).$(SUM): $(NVR).$(PKG_FMT) > - $(SUM) $(NVR).$(PKG_FMT) > $(NVR).$(PKG_FMT).$(SUM) > - > -appliance: $(NVR).$(PKG_FMT).$(SUM) > - > -PUNGI = $(APP_TMP)/tree/pungi > -source: src.ks > - @sudo rm -Rf $(PUNGI) > - @mkdir -p $(PUNGI) > - > - cd $(PUNGI) && \ > - sudo pungi -G --ver=$(PACKAGE) -c $(SRC_KS) \ > - --cachedir=$(OVIRT_CACHE_DIR)/yum-$(ARCH) > - if [ "$(SRC_FMT)" == "iso" ]; then \ > - cd $(PUNGI) && \ > - sudo pungi --sourceiso --ver=$(PACKAGE) -c $(SRC_KS) \ > - --cachedir=$(OVIRT_CACHE_DIR)/yum-$(ARCH) ;\ > - sudo mv $(PUNGI)/$(PACKAGE)/source/iso/Fedora-$(PACKAGE)-source.iso \ > - $(PWD)/$(PACKAGE)-source-$(VERSION).iso ;\ > - elif [ "$(SRC_FMT)" == "tar" ]; then \ > - cd $(PUNGI)/$(PACKAGE)/source && \ > - sudo tar cf ovirt-source.tar SRPMS ;\ > - sudo mv $(PUNGI)/$(PACKAGE)/source/ovirt-source.tar \ > - $(PWD)/$(PACKAGE)-source-$(VERSION).tar ;\ > - else \ > - echo "Invalid src format: $(SRC_FMT)" ;\ > - exit 1 ;\ > - fi > - sudo sudo chown -R $(USER) $(PWD)/$(PACKAGE)-source-$(VERSION).$(SRC_FMT) > - sudo sudo chown -R $(USER) $(PUNGI) > - $(SUM) $(PWD)/$(PACKAGE)-source-$(VERSION).$(SRC_FMT) \ > - > $(PACKAGE)-source-$(VERSION).$(SRC_FMT).$(SUM) > - > -rpms: dist appliance > - rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz > - > -srpms: dist > - rpmbuild $(RPM_FLAGS) -ts $(distdir).tar.gz > - > -publish: rpms > - mkdir -p $(OVIRT_CACHE_DIR) > - rsync -aq $(shell rpm --eval '%{_rpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/ > - rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src/ > - createrepo $(OVIRT_CACHE_DIR)/ovirt > - > -.PHONY: rpms publish srpms $(NVR).$(PKG_FMT).$(SUM) $(NVR).$(PKG_FMT) keys \ > - repos.ks src.ks source > diff --git a/autobuild.sh b/autobuild.sh > deleted file mode 100755 > index cdb8d62..0000000 > --- a/autobuild.sh > +++ /dev/null > @@ -1,117 +0,0 @@ > -#!/bin/sh > -#oVirt node image autobuild script > -# > -# Copyright (C) 2008 Red Hat, Inc. > -# > -# This program is free software; you can redistribute it and/or modify > -# it under the terms of the GNU General Public License as published by > -# the Free Software Foundation; version 2 of the License. > -# > -# This program is distributed in the hope that it will be useful, > -# but WITHOUT ANY WARRANTY; without even the implied warranty of > -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > -# GNU General Public License for more details. > -# > -# You should have received a copy of the GNU General Public License > -# along with this program; if not, write to the Free Software > -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > -# MA 02110-1301, USA. A copy of the GNU General Public License is > -# also available at http://www.gnu.org/copyleft/gpl.html. > - > -echo "Running oVirt Appliance Autobuild" > - > -set -e > -set -v > - > -test -f Makefile && make -k distclean || : > - > -# setup parameters to ssh to appliance > -SSHKEY=~/.ssh/id_autobuild > -remote_target="root at 192.168.50.2" > -ssh_cmd="ssh -i $SSHKEY -o StrictHostKeyChecking=no \ > - -o UserKnownHostsFile=/dev/null $remote_target" > -scp_cmd="scp -i $SSHKEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" > - > -# generate new ssh key if not found > -if [ ! -r $SSHKEY ]; then > - mkdir -p $(dirname "$SSHKEY") > - ssh-keygen -q -t rsa -N "" -f $SSHKEY > -fi > - > -# implant ssh key in appliance > -cat >> ovirt-appliance.ks << KS > -%post > -mkdir -p /root/.ssh > -chmod 700 /root/.ssh > -cat > /root/.ssh/authorized_keys << \EOF > -$(ssh-keygen -y -f $SSHKEY) > -EOF > -chmod 600 /root/.ssh/authorized_keys > -%end > -KS > - > -# move sshd to start last (after ovirt*first-run scripts) > -cat >> ovirt-appliance.ks << \KS > -%post > -rm -f /etc/rc3.d/S55sshd > -ln -s /etc/init.d/sshd /etc/rc3.d/S99sshd > -%end > -KS > - > -export OVIRT_LOCAL_REPO=file://$AUTOBUILD_PACKAGE_ROOT/rpm/RPMS > - > -./autogen.sh --prefix=$AUTOBUILD_INSTALL_ROOT > -make dist > -make appliance > - > -if [ -f /usr/bin/rpmbuild ]; then > - if [ -n "$AUTOBUILD_COUNTER" ]; then > - EXTRA_RELEASE=".auto$AUTOBUILD_COUNTER" > - else > - NOW=`date +"%s"` > - EXTRA_RELEASE=".$USER$NOW" > - fi > - > - rm -f $AUTOBUILD_PACKAGE_ROOT/rpm/RPMS/noarch/ovirt-appliance* > - > - rpmbuild --nodeps --define "extra_release $EXTRA_RELEASE" \ > - --define "ovirt_local_repo $OVIRT_LOCAL_REPO" \ > - -ta --clean *.tar.gz > -fi > - > -# if ovirt-appliance rpm is already installed, remove it > -(rpm -q ovirt-appliance && sudo rpm -e ovirt-appliance) || : > - > -# install ovirt-appliance, create appliance > -sudo rpm -ivh $AUTOBUILD_PACKAGE_ROOT/rpm/RPMS/noarch/ovirt-appliance*rpm > -sudo /usr/sbin/get-ovirt-appliance -l `pwd` -p tar > -sudo /usr/sbin/create-ovirt-network -f > -sudo /usr/sbin/create-ovirt-nodes > -sudo /usr/sbin/create-ovirt-appliance > -sudo virsh start ovirt-appliance > -sudo virsh start node3 > - > -# wait till ovirt-appliance is started > -for i in $(seq 1 60); do > - $ssh_cmd exit && break > - sleep 10 > -done > - > -# implant selenium test module (apache licensed) > -# into running appliance > -SELENIUM_RB=/var/selenium/selenium.rb > -if [ -f $SELENIUM_RB ]; then > - $scp_cmd $SELENIUM_RB $remote_target:/usr/share/ovirt-server/test/ > -else > - echo "$SELENIUM_RB not found, will not run interface tests" > -fi > - > -# run server tests > -echo "Running the server tests" > -for i in $(seq 1 10); do > - $ssh_cmd "curl -i http://management.priv.ovirt.org/ovirt/ | \ > - grep 'HTTP/1.1 200 OK'" && break > - sleep 10 > -done > - > -$ssh_cmd "cd /usr/share/ovirt-server && rake test" > diff --git a/autogen.sh b/autogen.sh > deleted file mode 100755 > index 6b0970f..0000000 > --- a/autogen.sh > +++ /dev/null > @@ -1,66 +0,0 @@ > -#!/bin/sh > -# Run this to generate configure and Makefile > - > -srcdir=`dirname $0` > -test -z "$srcdir" && srcdir=. > - > -THEDIR=`pwd` > -( > - cd $srcdir > - die=0 > - > - (autoconf --version) < /dev/null > /dev/null 2>&1 || { > - echo > - echo "You must have autoconf installed." > - echo "Download the appropriate package for your distribution," > - echo "or see http://www.gnu.org/software/autoconf" > - die=1 > - } > - > - # Require libtool only if one of of LT_INIT, > - # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac. > - grep -E '^[[:blank:]]*(LT_INIT|A[CM]_PROG_LIBTOOL)' configure.ac >/dev/null \ > - && { > - (libtool --version) < /dev/null > /dev/null 2>&1 || { > - echo > - echo "You must have libtool installed." > - echo "Download the appropriate package for your distribution," > - echo "or see http://www.gnu.org/software/libtool" > - die=1 > - } > - } > - > - (automake --version) < /dev/null > /dev/null 2>&1 || { > - echo > - die=1 > - echo "You must have automake installed." > - echo "Download the appropriate package for your distribution," > - echo "or see http://www.gnu.org/software/automake" > - } > - > - test $die = 1 && exit 1 > - > - test -f ovirt-appliance.spec.in || { > - echo "You must run this script in the top-level directory" > - exit 1 > - } > - > - if test -z "$*"; then > - echo "I am going to run ./configure with no arguments - if you wish " > - echo "to pass any to it, please specify them on the $0 command line." > - fi > - > - aclocal > - > - # Run autoheader only if needed > - grep '^[[:blank:]]*AC_CONFIG_HEADERS' configure.ac >/dev/null && autoheader > - > - automake --add-missing > - autoconf > - ./configure "$@" > -) > - > -if test "x$OBJ_DIR" != x; then > - mkdir -p "$OBJ_DIR" > - cd "$OBJ_DIR" > -fi > diff --git a/configure.ac b/configure.ac > deleted file mode 100644 > index 001ece9..0000000 > --- a/configure.ac > +++ /dev/null > @@ -1,5 +0,0 @@ > -AC_INIT([ovirt-appliance], [0.99], [ovirt-devel at redhat.com]) > -AM_INIT_AUTOMAKE([-Wall -Werror foreign tar-pax]) > - > -AC_CONFIG_FILES([Makefile ovirt-appliance.spec]) > -AC_OUTPUT > diff --git a/create-ovirt-appliance b/create-ovirt-appliance > deleted file mode 100755 > index 1a1529f..0000000 > --- a/create-ovirt-appliance > +++ /dev/null > @@ -1,87 +0,0 @@ > -#!/bin/bash > -# > -# Create oVirt Appliance > -# Copyright 2008 Red Hat, Inc. > -# Written by Perry Myers > -# > -# This program is free software; you can redistribute it and/or modify > -# it under the terms of the GNU General Public License as published by > -# the Free Software Foundation; version 2 of the License. > -# > -# This program is distributed in the hope that it will be useful, > -# but WITHOUT ANY WARRANTY; without even the implied warranty of > -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > -# GNU Library General Public License for more details. > -# > -# You should have received a copy of the GNU General Public License > -# along with this program; if not, write to the Free Software > -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. > - > -. $(dirname $0)/ovirt-appliance-functions > - > -usage() { > - case $# in 1) warn "$1"; try_h; exit 1;; esac > - cat < -Usage: $ME [-d image_dir] [-n name] [-c] [-f raw|qcow2] > - -d: directory to place virtual disk (default: $IMGDIR_DEFAULT) > - -n: appliance name (default: $NAME_DEFAULT) > - -c: open console when appliance is started > - -f: disk image format for appliance (default: $DISK_FMT_DEFAULT) > - -h: display this help and exit > -EOF > -} > - > -err=0 help=0 > -console=0 > -while getopts :d:n:cf:h c; do > - case $c in > - d) imgdir=$OPTARG;; > - n) name=$OPTARG;; > - c) console=1;; > - f) DISK_FMT=$OPTARG;; > - h) help=1;; > - '?') err=1; warn "invalid option: \`-$OPTARG'";; > - :) err=1; warn "missing argument to \`-$OPTARG' option";; > - *) err=1; warn "internal error: \`-$OPTARG' not handled";; > - esac > -done > -test $err = 1 && { try_h; exit 1; } > -test $help = 1 && { usage; exit 0; } > - > -do_checks > - > -if virsh dumpxml $name > /dev/null 2>&1 ; then > - # If the appliance is already defined, abort since rewriting the appliance > - # will change network settings that break the appliance. > - echo "$name is already a defined virtual machine." > - die > -fi > - > -mkdir -p $imgdir > - > -appdisk=$name/$name-sda.$DISK_FMT > -datadisk=$name/$name-sdb.$DISK_FMT > - > -test ! -r $imgdir/$appdisk && die "Disk image not found at $imgdir/$appdisk" > -test ! -r $imgdir/$datadisk && die "Disk image not found at $imgdir/$datadisk" > -virsh destroy $name > /dev/null 2>&1 > -virsh undefine $name > /dev/null 2>&1 > - > -virt-image -b $BRIDGENAME $imgdir/$name/$name.xml > -# FIXME: virt-image doesn't do virtio so we have to kill the appliance, edit > -# the libvirt xml and restart > -virsh destroy $name > /dev/null 2>&1 > -TMPXML=$(mktemp) || exit 1 > -BR_XML="" > -VNIC_XML="" > -# FIXME: virtio disks won't boot presently, need to look into this > -# -e "s/bus='ide'/bus='virtio'/" \ > -# -e "s/dev='hd\(.\)'/dev='vd\1'/" \ > -virsh dumpxml $name | sed -e "s^\($BR_XML\)^\1\n$VNIC_XML^" \ > - > $TMPXML && \ > - virsh define $TMPXML && \ > - rm -f $TMPXML > - > -if [ $console = 1 ]; then > - virsh start $name && virsh console $name > -fi > diff --git a/create-ovirt-network b/create-ovirt-network > deleted file mode 100755 > index 8fd3b88..0000000 > --- a/create-ovirt-network > +++ /dev/null > @@ -1,161 +0,0 @@ > -#!/bin/bash > - > -. $(dirname $0)/ovirt-appliance-functions > - > -usage() { > - case $# in 1) warn "$1"; try_h; exit 1;; esac > - cat < -Usage: $ME [-e eth] [-f] > - -e: ethernet device to use as bridge (i.e. eth1) > - -f: force install of networking > - -h: display this help and exit > -EOF > -} > - > -err=0 help=0 > -bridge= > -while getopts :e:fh c; do > - case $c in > - e) bridge=$OPTARG;; > - f) force=1;; > - h) help=1;; > - '?') err=1; warn "invalid option: \`-$OPTARG'";; > - :) err=1; warn "missing argument to \`-$OPTARG' option";; > - *) err=1; warn "internal error: \`-$OPTARG' not handled";; > - esac > -done > -test $err = 1 && { try_h; exit 1; } > -test $help = 1 && { usage; exit 0; } > - > -do_checks > -check_net > - > -cleanup_old_nets > - > -net_debug > - > -# If we're bridging to a physical network, run some checks to make sure the > -# choice of physical eth device is sane > -if [ -n "$bridge" ]; then > - # Check to see if the physical device is present > - ifconfig $bridge > /dev/null 2>&1 ; bridge_dev_present=$? > - test $bridge_dev_present != 0 \ > - && die "$bridge device not present, aborting!" > - > - # Check to see if the eth device is already tied to a non oVirt bridge > - attached_bridge=$(brctl show \ > - | awk -v BRIDGE=$bridge '$4~BRIDGE {print $1}') > - test -n "$attached_bridge" -a "$attached_bridge" != "$BRIDGENAME" \ > - && die "$bridge already attached to other bridge $attached_bridge" > - > - # Check to make sure that the system is not already using the interface > - if [[ $force != 1 && -f $NET_SCRIPTS/ifcfg-$bridge ]]; then > - echo "$NET_SCRIPTS/ifcfg-$bridge is present, are you sure you wish to" > - echo "overwrite this file? [y/N]? " > - read yesno > - > - if [ "$yesno" != "y" -a "$yesno" != "Y" ]; then > - exit 2 > - fi > - fi > -fi > - > -# Remove old bridge device if it exists > -sed -i "/# $BRIDGENAME/d" /etc/rc.d/rc.local > -old_bridge=$(brctl show \ > - | awk -v BRIDGENAME=$BRIDGENAME '$1==BRIDGENAME {print $4}') > -if [ -n "$old_bridge" ]; then > - echo "Removing old bridge $old_bridge" > - ifconfig $old_bridge down > - brctl delif $BRIDGENAME $old_bridge > - rm -f $NET_SCRIPTS/ifcfg-$old_bridge > -fi > - > -{ > -echo "Removing $BRIDGENAME" > -virsh net-destroy $BRIDGENAME > -virsh net-undefine $BRIDGENAME > -ifconfig $BRIDGENAME down > -brctl delbr $BRIDGENAME > -rm -fv $NET_SCRIPTS/ifcfg-$BRIDGENAME > -rm -fv /etc/sysconfig/iptables-$BRIDGENAME-filter > -rm -fv /etc/sysconfig/iptables-$BRIDGENAME-nat > -sed -i "/iptables-$BRIDGENAME/d" /etc/sysconfig/system-config-firewall > -lokkit --update > -echo "Done Removing $BRIDGENAME" > -} 2> /dev/null > - > -lokkit -s dns > - > -if [ -n "$bridge" ]; then > - # real external bridge, use distro networking scripts > - ifconfig $bridge down 2> /dev/null > - TMPAUG=$(mktemp) || exit 1 > - cat > $TMPAUG < -rm /files$NET_SCRIPTS/ifcfg-$bridge > -set /files$NET_SCRIPTS/ifcfg-$bridge/DEVICE $bridge > -set /files$NET_SCRIPTS/ifcfg-$bridge/ONBOOT yes > -set /files$NET_SCRIPTS/ifcfg-$bridge/BRIDGE $BRIDGENAME > -rm /files$NET_SCRIPTS/ifcfg-$BRIDGENAME > -set /files$NET_SCRIPTS/ifcfg-$BRIDGENAME/DEVICE $BRIDGENAME > -set /files$NET_SCRIPTS/ifcfg-$BRIDGENAME/BOOTPROTO static > -set /files$NET_SCRIPTS/ifcfg-$BRIDGENAME/ONBOOT y > -set /files$NET_SCRIPTS/ifcfg-$BRIDGENAME/TYPE Bridge > -set /files$NET_SCRIPTS/ifcfg-$BRIDGENAME/PEERNTP yes > -set /files$NET_SCRIPTS/ifcfg-$BRIDGENAME/IPADDR ${NETWORK%.*}.1 > -set /files$NET_SCRIPTS/ifcfg-$BRIDGENAME/NETMASK $NETMASK > -set /files$NET_SCRIPTS/ifcfg-$BRIDGENAME/DELAY 0 > -save > -EOF > - augtool < $TMPAUG > - ifup $BRIDGENAME > - ifup $bridge > - > - cat > /etc/sysconfig/iptables-$BRIDGENAME-filter < --A FORWARD -m physdev --physdev-is-bridged -j ACCEPT > --A FORWARD -d $NETWORK/$NETMASK -o $BRIDGENAME -m state --state RELATED,ESTABLISHED -j ACCEPT > --A FORWARD -s $NETWORK/$NETMASK -i $BRIDGENAME -j ACCEPT > --A FORWARD -i $BRIDGENAME -o $BRIDGENAME -j ACCEPT > -EOF > - > - cat > /etc/sysconfig/iptables-$BRIDGENAME-nat < --A POSTROUTING -s $NETWORK/$NETMASK -d ! $NETWORK/$NETMASK -j MASQUERADE > -EOF > - > - lokkit --custom-rules=ipv4:filter:/etc/sysconfig/iptables-$BRIDGENAME-filter > - lokkit --custom-rules=ipv4:nat:/etc/sysconfig/iptables-$BRIDGENAME-nat > -else > - # internal bridge only, use libvirt networking > - TMPXML=$(mktemp) || exit 1 > - gen_bridge > $TMPXML > - virsh net-define $TMPXML > - rm $TMPXML > - virsh net-start $BRIDGENAME > - virsh net-autostart $BRIDGENAME > -fi > - > -# Set up ip-forwarding > -sysctl -w net.ipv4.ip_forward=1 > -TMPAUG=$(mktemp) || exit 1 > -cat > $TMPAUG < -set /files/etc/sysctl.conf/net.ipv4.ip_forward 1 > -save > -EOF > -augtool < $TMPAUG > - > -# Set up dnsmasq on $BRIDGENAME just for DNS forwarding > -cat < /etc/dnsmasq.d/$BRIDGENAME.conf > -bind-interfaces > -interface=$BRIDGENAME > -except-interface=lo > -EOF > -if ! grep "^conf-dir=/etc/dnsmasq.d" /etc/dnsmasq.conf > /dev/null 2>&1 ; then > - echo "conf-dir=/etc/dnsmasq.d" >> /etc/dnsmasq.conf > -fi > -chkconfig dnsmasq on > -service dnsmasq restart > - > -service libvirtd restart > -wait_for_service 'virsh connect' 10 2 || exit 1 > - > -net_debug > diff --git a/create-ovirt-nodes b/create-ovirt-nodes > deleted file mode 100755 > index 0ac5fd0..0000000 > --- a/create-ovirt-nodes > +++ /dev/null > @@ -1,51 +0,0 @@ > -#!/bin/bash > -# > -# Create fake oVirt Nodes that PXE boot to the Appliance Server > -# Copyright 2008 Red Hat, Inc. > -# Written by Perry Myers > -# > -# This program is free software; you can redistribute it and/or modify > -# it under the terms of the GNU General Public License as published by > -# the Free Software Foundation; version 2 of the License. > -# > -# This program is distributed in the hope that it will be useful, > -# but WITHOUT ANY WARRANTY; without even the implied warranty of > -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > -# GNU Library General Public License for more details. > -# > -# You should have received a copy of the GNU General Public License > -# along with this program; if not, write to the Free Software > -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. > - > -. $(dirname $0)/ovirt-appliance-functions > - > -usage() { > - case $# in 1) warn "$1"; try_h; exit 1;; esac > - cat < -Usage: $ME [-d image_dir] > - -d: directory to place virtual disk (default: $IMGDIR_DEFAULT) > - -h: display this help and exit > -EOF > -} > - > -err=0 help=0 > -while getopts :dh c; do > - case $c in > - d) imgdir=$OPTARG;; > - h) help=1;; > - '?') err=1; warn "invalid option: \`-$OPTARG'";; > - :) err=1; warn "missing argument to \`-$OPTARG' option";; > - *) err=1; warn "internal error: \`-$OPTARG' not handled";; > - esac > -done > -test $err = 1 && { try_h; exit 1; } > -test $help = 1 && { usage; exit 0; } > - > -do_checks > - > -mkdir -p $imgdir > - > -# define the fake managed nodes we will use. > -for i in `seq 3 5` ; do > - gen_fake_managed_node $i > -done > diff --git a/get-ovirt-appliance b/get-ovirt-appliance > deleted file mode 100755 > index cafae24..0000000 > --- a/get-ovirt-appliance > +++ /dev/null > @@ -1,115 +0,0 @@ > -#!/bin/bash > -# > -# Install oVirt Appliance disk images from local directory or from > -# remote URL > -# Copyright 2008 Red Hat, Inc. > -# Written by Perry Myers > -# > -# This program is free software; you can redistribute it and/or modify > -# it under the terms of the GNU General Public License as published by > -# the Free Software Foundation; version 2 of the License. > -# > -# This program is distributed in the hope that it will be useful, > -# but WITHOUT ANY WARRANTY; without even the implied warranty of > -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > -# GNU Library General Public License for more details. > -# > -# You should have received a copy of the GNU General Public License > -# along with this program; if not, write to the Free Software > -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. > - > -. $(dirname $0)/ovirt-appliance-functions > - > -usage() { > - case $# in 1) warn "$1"; try_h; exit 1;; esac > - cat < -Usage: $ME [-d image_dir] [-n name] [-l appliance location] [-p tar|tar.gz|tar.bz2] [-f raw|qcow2] > - -d: directory to place virtual disk (default: $IMGDIR_DEFAULT) > - -n: appliance name (default: $NAME_DEFAULT) > - -l: directory or url to get appliance archive and checksum files (default: $OVIRT_URL) > - this can either be http:// url or relative/absolute path > - -p: package format for appliance (default: $PKG_FMT_DEFAULT) > - -f: disk image format for appliance (default: $DISK_FMT_DEFAULT) > - -h: display this help and exit > -EOF > -} > - > -err=0 help=0 > -app_loc=$OVIRT_URL > -while getopts :d:n:l:p:f:h c; do > - case $c in > - d) imgdir=$OPTARG;; > - n) name=$OPTARG;; > - l) app_loc=$OPTARG;; > - p) PKG_FMT=$OPTARG;; > - f) DISK_FMT=$OPTARG;; > - h) help=1;; > - '?') err=1; warn "invalid option: \`-$OPTARG'";; > - :) err=1; warn "missing argument to \`-$OPTARG' option";; > - *) err=1; warn "internal error: \`-$OPTARG' not handled";; > - esac > -done > -test $err = 1 && { try_h; exit 1; } > -test $help = 1 && { usage; exit 0; } > - > -do_checks > - > -pkgfile=$name-$version-$(uname -i).$PKG_FMT > -sumfile=$pkgfile.$SUM > - > -if echo $app_loc | grep "^http://" > /dev/null 2>&1 ; then > - echo "Using http at $app_loc to retrieve appliance" > - > - if verify_sum $pkgfile $sumfile ; then > - app_loc=$(pwd) > - else > - wget -c $app_loc/$sumfile || die "error downloading $app_loc/$sumfile" > - wget -c $app_loc/$pkgfile || die "error downloading $app_loc/$pkgfile" > - if verify_sum $pkgfile $sumfile ; then > - app_loc=$(pwd) > - else > - die "appliance files not available, aborting" > - fi > - fi > -else > - echo "Using local files in $app_loc for appliance" > - > - if [ -d $app_loc ]; then > - if ! verify_sum $app_loc/$pkgfile $app_loc/$sumfile ; then > - die "appliance files not available, aborting" > - fi > - elif [ -f $app_loc -a -f $app_loc.$SUM ]; then > - if ! verify_sum $app_loc $app_loc.$SUM ; then > - die "appliance files not available, aborting" > - fi > - fi > -fi > - > -mkdir -p $imgdir > - > -appdisk=$name/$name-sda.$DISK_FMT > -datadisk=$name/$name-sdb.$DISK_FMT > - > -case $PKG_FMT in > - tar.bz2) > - tar -jSxvf $app_loc/$pkgfile -C $imgdir > - ;; > - tar.gz) > - tar -zSxvf $app_loc/$pkgfile -C $imgdir > - ;; > - tar) > - tar -xSvf $app_loc/$pkgfile -C $imgdir > - ;; > - *) > - die "$PKG_FMT is unsupported" > - ;; > -esac > - > -test ! -r $imgdir/$appdisk && die "Disk image not found at $imgdir/$appdisk" > -test ! -r $imgdir/$datadisk && die "Disk image not found at $imgdir/$datadisk" > - > -virsh destroy $name > /dev/null 2>&1 > -virsh undefine $name > /dev/null 2>&1 > - > -echo "Appliance Disks installed to $imgdir" > -echo "Run create-ovirt-appliance to define and start the appliance" > diff --git a/gettree.sh b/gettree.sh > deleted file mode 100755 > index 477b4bf..0000000 > --- a/gettree.sh > +++ /dev/null > @@ -1,77 +0,0 @@ > -#!/bin/bash > - > -# gettree.sh > -# Fedora release URL - Fedora base URL > -# e.g. http://download.fedoraproject.org/pub/fedora/linux/releases/9/Fedora/x86_64/os > -# download minimal Fedora tree: .treeinfo stage2 initrd and kernel > - > -# Requires: wget > -# Requires: python-iniparse > -# Requires: createrepo > - > -# download $destination $URL [$alternative1 ...] > -# attempt to download from a list of URLs until it succeeds > -download() { > - local destination=$1 > - shift > - local files="$@" > - set +e > - rc=0 > - for f in $files; do > - case $f in > - file://*) cp "${f#file://}" "$destination" ;; > - *) wget --directory-prefix="$destination" \ > - --progress=dot:mega --continue "$f" ;; > - esac > - rc=$? > - if [ $rc == 0 ]; then > - printf "." > - break > - fi > - done > - set -e > - return $rc > -} > - > -if [[ $# < 2 ]]; then > - cat >&2 << EOF > -Usage: $(basename "$0") > -EOF > - exit 1 > -fi > - > -url=$1 > -dest=$2 > - > -printf "Downloading minimal Fedora install tree from $url" > -set -e > -download "$dest" $url/.treeinfo > -python -c 'from iniparse import INIConfig > -ini = INIConfig(open("'"$dest/"'.treeinfo")) > -family = ini.general.family > -version = ini.general.version > -arch = ini.general.arch > -kernel = ini["images-"+arch].kernel > -initrd = ini["images-"+arch].initrd > -stage2 = ini.stage2.mainimage > -print "%s %s %s %s %s %s" % (family, version, arch, kernel, initrd, stage2)' | \ > -( > -read os ver arch kernel initrd stage2 > -echo $os $ver $arch > "$dest/.treeinfo.ova" > -mkdir -p "$dest/Packages" > -download "$dest/Packages" "$url/Packages/basesystem-8.1-1.noarch.rpm" \ > - "$url/Packages/basesystem-10.0-1.noarch.rpm" > -download "$dest/Packages" "$url/Packages/kernel-headers-2.6.27.5-117.fc10.$arch.rpm" \ > - "$url/Packages/kernel-headers-2.6.28-3.fc11.$arch.rpm" > -createrepo "$dest" > -dir="$dest/$(dirname $stage2)" > -mkdir -p "$dir" > -download "$dir" "$url/$stage2" > -dir="$dest/$(dirname $kernel)" > -mkdir -p "$dir" > -download "$dir" "$url/$kernel" > -dir="$dest/$(dirname $initrd)" > -mkdir -p "$dir" > -download "$dir" "$url/$initrd" > -) > -echo "done" > diff --git a/ovirt-appliance-functions b/ovirt-appliance-functions > deleted file mode 100644 > index c1d9a15..0000000 > --- a/ovirt-appliance-functions > +++ /dev/null > @@ -1,219 +0,0 @@ > -# -*-Shell-script-*- > -# > -# Common functions for the oVirt Appliance scripts > -# Copyright 2008 Red Hat, Inc. > -# Written by Perry Myers > -# > -# This program is free software; you can redistribute it and/or modify > -# it under the terms of the GNU General Public License as published by > -# the Free Software Foundation; version 2 of the License. > -# > -# This program is distributed in the hope that it will be useful, > -# but WITHOUT ANY WARRANTY; without even the implied warranty of > -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > -# GNU Library General Public License for more details. > -# > -# You should have received a copy of the GNU General Public License > -# along with this program; if not, write to the Free Software > -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. > - > -PATH=$PATH:/sbin:/usr/sbin > - > -ME=$(basename "$0") > -warn() { printf '%s: %s\n' "$ME" "$*" >&2; } > -try_h() { printf "Try \`$ME -h' for more information.\n" >&2; } > -die() { warn "$@"; try_h; exit 1; } > - > -IMGDIR_DEFAULT=/var/lib/libvirt/images > -NAME_DEFAULT=ovirt-appliance > -NET_SCRIPTS=/etc/sysconfig/network-scripts > - > -BRIDGENAME=ovirtbr0 > -NETWORK=192.168.50.0 > -NETMASK=255.255.255.0 > - > -PKG_FMT_DEFAULT=tar.bz2 > -PKG_FMT=$PKG_FMT_DEFAULT > -SUM=sha1sum > - > -DISK_FMT_DEFAULT=qcow2 > -DISK_FMT=$DISK_FMT_DEFAULT > -OVIRT_URL=http://ovirt.org/download > - > -NODE_DISK_FMT=qcow2 > -NODE_DISK_SIZE=6144M > - > -imgdir=$IMGDIR_DEFAULT > -name=$NAME_DEFAULT > - > -force=0 > - > -do_checks() { > - # first, check to see we are root > - if [ $( id -u ) -ne 0 ]; then > - die "Must run as root" > - fi > - > - test "$PKG_FMT" = "tar" -o "$PKG_FMT" = "tar.gz" \ > - -o "$PKG_FMT" = "tar.bz2" \ > - || die "$PKG_FMT is not a supported package format" > - > - test "$DISK_FMT" = "qcow2" -o "$DISK_FMT" = "raw" \ > - || die "$DISK_FMT is not a supported disk format" > - > - # now make sure the packages we need are installed > - if [ -e /etc/redhat-release ]; then > - # We rely on RPM deps for this in Red Hat/Fedora systems > - CHECK=0 > - KVM_BINARY=/usr/bin/qemu-kvm > - version=$(rpm -q --qf '%{version}' ovirt-appliance) > - elif [ -e /etc/debian_version ]; then > - # Works in Ubuntu 8.04. Still needs testing in Debian > - PACKAGES="libvirt0 libvirt-bin kvm qemu" > - CHECK=$(dpkg -l $PACKAGES &> /dev/null; echo $?) > - KVM_BINARY=/usr/bin/kvm > - version=LATEST > - else > - die "Not a supported system" > - fi > - > - if [ $CHECK -ne 0 ]; then > - # one of the previous packages wasn't installed; bail out > - die "Must have the $PACKAGES packages installed" > - fi > - > - service iptables status > /dev/null 2>&1 \ > - || service iptables start > /dev/null 2>&1 > - chkconfig iptables on > - > - service libvirtd status > /dev/null 2>&1 \ > - || service libvirtd start > /dev/null 2>&1 > - chkconfig libvirtd on > -} > - > -check_net() { > - service NetworkManager status > /dev/null 2>&1 ; netman_status=$? > - if [ $netman_status -eq 0 ]; then > - if [ $force -ne 1 ]; then > - die "NetworkManager is running, disable and use standard network scripts before proceeding" > - elif [ -n "$bridge" ]; then > - echo "WARNING! NetworkManager running and bridge ($bridge) specified" > - echo "WARNING! This combination will most likely not work." > - fi > - fi > -} > - > -gen_bridge() { > - cat << EOF > - > - $BRIDGENAME > - > - > - > - > -EOF > -} > - > -gen_fake_managed_node() { > - local num=$1 > - local last_mac=$(( 54 + $num )) > - > - echo "Creating fake node$num..." > - virsh destroy node$num > /dev/null 2>&1 > - virsh undefine node$num > /dev/null 2>&1 > - rm -f $imgdir/node${i}-sda.$NODE_DISK_FMT > - qemu-img create -f $NODE_DISK_FMT $imgdir/node${i}-sda.$NODE_DISK_FMT \ > - $NODE_DISK_SIZE > - # FIXME: virt-install should be changed to have a --nostart parameter > - # that just defines the VM w/o starting it. > - virt-install --name=node$num --ram=512 --vcpus=1 \ > - --disk path=$imgdir/node${i}-sda.$NODE_DISK_FMT \ > - --network=bridge:$BRIDGENAME --mac=00:16:3e:12:34:$last_mac \ > - --vnc --accelerate --hvm --noautoconsole \ > - --os-type=linux --os-variant=fedora10 \ > - --force --noreboot --pxe > - virsh destroy node$num > /dev/null 2>&1 > - # FIXME: virt-install should be changed to allow network boot > - # to be a permanent selection > - TMPXML=$(mktemp) || exit 1 > - virsh dumpxml node$num | sed "s/boot dev='.*'/boot dev='network'/" > $TMPXML > - virsh define $TMPXML > - rm -f $TMPXML > - echo "node$num created" > -} > - > -net_debug() { > - # Some output for debugging problems > - echo "Currently active bridges:" > - echo "-------------------------" > - brctl show > - echo > - echo "Currently defined libvirt networks:" > - echo "-----------------------------------" > - virsh net-list --all > - echo > -} > - > -cleanup_old_apps() { > - # Cleanup to handle older version of script that used these domain names > - virsh destroy developer > - virsh undefine developer > - virsh destroy bundled > - virsh undefine bundled > -} > /dev/null 2>&1 > - > -cleanup_old_nets() { > - # Cleanup to handle older version of script that used these bridge names > - virsh net-destroy dummybridge > - virsh net-undefine dummybridge > - brctl delif eth1bridge eth1 > - virsh net-destroy eth1bridge > - virsh net-undefine eth1bridge > - old_bridge=$(brctl show \ > - | awk -v BRIDGENAME=ovirtbr '$1==BRIDGENAME {print $4}') > - if [ -n "$old_bridge" ]; then > - ifconfig $old_bridge down > - fi > - brctl delif ovirtbr $old_bridge > - virsh net-destroy ovirtbr > - virsh net-undefine ovirtbr > - sed -i "/# ovirtbr$/d" /etc/rc.d/rc.local > -} > /dev/null 2>&1 > - > -verify_sum() { > - local pkgfile=$1 > - local sumfile=$2 > - > - test ! -f $sumfile && { echo "$sumfile not found" ; return 1 ; } > - test ! -f $pkgfile && { echo "$pkgfile not found" ; return 1 ; } > - > - echo "performing checksum of $pkgfile" > - local actual_sum=$($SUM $pkgfile | awk '{print $1}') > - local expect_sum=$(awk '{print $1}' $sumfile) > - > - if [ "$actual_sum" = "$expect_sum" ]; then > - echo "checksum verified" > - return 0 > - else > - echo "checksum failed" > - return 1 > - fi > -} > - > -# wait_for_service 'test command' max_retries seconds_to_sleep_between_retries > -wait_for_service() { > - local testcmd=$1; shift > - local n_retries=$1; shift > - local sleep_seconds=$1; shift > - local total=$((n_retries*sleep_seconds)) > - > - while [ $n_retries -gt 0 ] > - do > - eval "$testcmd" > /dev/null 2>&1 && return 0 > - echo service not ready yet, retrying... > - n_retries=$((n_retries-1)) > - sleep $sleep_seconds > - done > - printf 'service not ready after %d seconds, giving up\n' $total 1>&2 > - return 1 > -} > diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks > deleted file mode 100644 > index 202babc..0000000 > --- a/ovirt-appliance.ks > +++ /dev/null > @@ -1,119 +0,0 @@ > -install > - > -lang en_US.UTF-8 > -keyboard us > -network --device=eth0 --bootproto=static --ip=192.168.50.2 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.50.1 --gateway=192.168.50.1 > -# Root password is 'ovirt' > -rootpw --iscrypted Xa8QeYfWrtscM > -firewall --disabled > -authconfig --enableshadow --enablemd5 > -selinux --disabled > -# NOTE: ntp/ntpdate need to stay in this list to ensure that time on the > -# appliance is correct prior to the ovirt-server-installer being run. Otherwise you > -# get Kerberos errors > -services --disabled=libvirtd,postgresql --enabled=network,tgtd,nfs,iptables,ntpdate,ntpd,ace,acpid > -timezone --utc UTC > -text > - > -bootloader --location=mbr --driveorder=sda,sdb --append="console=tty0 console=ttyS0,115200" > -zerombr > -clearpart --all --drives=sda,sdb > -part /boot --ondisk=sda --fstype=ext3 --size=100 > -part / --ondisk=sda --fstype=ext3 --size=5000 > -part swap --ondisk=sda --fstype=swap --size=512 > -part /mnt/data --ondisk=sdb --fstype=ext3 --size=20000 > -reboot > - > -%include repos.ks > - > -%packages --excludedocs --nobase > -%include /usr/share/appliance-os/includes/base-pkgs.ks > -openssh-clients > -openssh-server > -nfs-utils > -collectd > -collectd-rrdtool > -ipa-server > -ipa-admintools > -scsi-target-utils > -iscsi-initiator-utils > -augeas > -syslinux > -curl > -bind-utils > -libvirt-python > -rhpl > -cobbler > -# Stupid yum dep solver pulls in older 'qemu' to resolve > -# /usr/bin/qemu-img dep. This forces it to pick the new > -# qemu-img RPM. > -qemu-img > -ovirt-release > -ovirt-node-image > -ovirt-server > -ovirt-server-installer > -lokkit > - > -%post > - # cleanup rpmdb to allow non-matching host and chroot RPM versions > - rm -f /var/lib/rpm/__db* > - > - # set up serial console > - sed -i 's/hiddenmenu/hiddenmenu\nserial --unit=0 --speed=115200\nterminal --timeout=5 serial console/' /boot/grub/grub.conf > - > - # The ace stuff. > - mkdir /etc/sysconfig/ace > - echo ovirt-appliance >> /etc/sysconfig/ace/appliancename > -%end > - > -%post > - # Create initial manifests > - manifests=/tmp/manifests > - mkdir -p $manifests > - rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' | sort \ > - > $manifests/rpm-manifest.txt > - rpm -qa --qf '%{sourcerpm}\n' | sort -u > $manifests/srpm-manifest.txt > - du -akx --exclude=/var/cache/yum / > $manifests/file-manifest.txt > - du -x --exclude=/var/cache/yum / > $manifests/dir-manifest.txt > -%end > - > -%post --nochroot > - if [ -f "ovirt-authorized_keys" ]; then > - echo "Adding authorized_keys to Image" > - mkdir -p $INSTALL_ROOT/root/.ssh > - cp -v ovirt-authorized_keys $INSTALL_ROOT/root/.ssh/authorized_keys > - chown -R root:root $INSTALL_ROOT/root/.ssh > - chmod 755 $INSTALL_ROOT/root/.ssh > - chmod 644 $INSTALL_ROOT/root/.ssh/authorized_keys > - fi > - > - set -e > - cat tmp/tree/.treeinfo.ova | ( read os ver arch > - dest=$INSTALL_ROOT/var/www/cobbler/ks_mirror/$os-$ver-$arch > - printf "Importing $os-$ver-$arch ..." > - cp -a tmp/tree "$dest" > - ) > -%end > - > -%post > - # Create post-image processing manifests > - manifests=/tmp/manifests > - mkdir -p $manifests > - rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' | sort \ > - > $manifests/rpm-manifest-post.txt > - rpm -qa --qf '%{sourcerpm}\n' | sort -u > $manifests/srpm-manifest-post.txt > - du -akx --exclude=/var/cache/yum / > $manifests/file-manifest-post.txt > - du -x --exclude=/var/cache/yum / > $manifests/dir-manifest-post.txt > - > - ver=$(rpm -q --qf '%{version}' ovirt-server-installer) > - rel=$(rpm -q --qf '%{release}' ovirt-server-installer) > - arch=$(rpm -q --qf '%{arch}' ovirt-server-installer) > - echo "oVirt Appliance release $ver-$rel-$arch" > $manifests/ovirt-release > - tar -cvf ovirt-appliance-manifests-$ver-$rel.$arch.tar -C /tmp manifests > - rm -Rf $manifests > -%end > - > -%post --nochroot > - # Move manifest tar to build directory > - mv $INSTALL_ROOT/ovirt-appliance-manifests-*.tar . > -%end > diff --git a/ovirt-appliance.spec.in b/ovirt-appliance.spec.in > deleted file mode 100644 > index 8bb32f2..0000000 > --- a/ovirt-appliance.spec.in > +++ /dev/null > @@ -1,69 +0,0 @@ > -Summary: oVirt Appliance > -Name: ovirt-appliance > -Version: @VERSION@ > -Release: 0%{?dist}%{?extra_release} > -Source0: %{name}-%{version}.tar.gz > -License: GPLv2+ > -Group: Applications/System > -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot > -BuildArch: noarch > -URL: http://ovirt.org/ > -# FIXME: libvirt and kvm require ovirt specific patches presently due to > -# the fact that migration has not been fixed upstream. Once upstream migration > -# is fixed, these Requires should be fixed. > -Requires: libvirt >= 0.4.6-2 > -Requires: kvm >= 78-4 > -Requires: qemu-img > -Requires: augeas > -Requires: virt-viewer-plugin > -Requires: python-virtinst >= 0.400 > -Requires: wget > - > -%define app_root %{_datadir}/%{name} > - > -# disable debuginfo, makes no sense for appliance and it is created empty anyway > -%define debug_package %{nil} > - > -%description > -The oVirt Appliance scripts to install on a Fedora Host > - > -%prep > -%setup -q > - > -%build > - > -%install > -%{__rm} -rf %{buildroot} > -mkdir %{buildroot} > - > -%{__install} -d -m0755 %{buildroot}%{app_root} > -%{__install} -p -m0644 COPYING %{buildroot}%{app_root} > -%{__install} -d -m0755 %{buildroot}%{_sbindir} > -%{__install} -p -m0755 create-%{name} %{buildroot}%{_sbindir} > -%{__install} -p -m0755 create-ovirt-network %{buildroot}%{_sbindir} > -%{__install} -p -m0755 create-ovirt-nodes %{buildroot}%{_sbindir} > -%{__install} -p -m0755 get-%{name} %{buildroot}%{_sbindir} > -%{__install} -p -m0644 %{name}-functions %{buildroot}%{_sbindir} > - > -%clean > -%{__rm} -rf %{buildroot} > - > -%files > -%defattr(-,root,root,0644) > -%{app_root}/COPYING > -%defattr(-,root,root,0755) > -%{_sbindir}/create-%{name} > -%{_sbindir}/create-ovirt-network > -%{_sbindir}/create-ovirt-nodes > -%{_sbindir}/get-%{name} > -%defattr(-,root,root,0644) > -%{_sbindir}/%{name}-functions > - > -%changelog > -* Wed Nov 05 2008 Perry Myers 0.96 > -- Removed appliance building from rpm. RPM now just contains tools to > - download image and install it > -* Sun Sep 14 2008 Perry Myers 0.92-1 > -- Added Requires on libvirt/kvm > -* Fri Sep 05 2008 Perry Myers 0.92-1 > -- Initial build. > ack, works for me From jboggs at redhat.com Wed Sep 16 16:33:32 2009 From: jboggs at redhat.com (Joey Boggs) Date: Wed, 16 Sep 2009 12:33:32 -0400 Subject: [Ovirt-devel] [PATCH appliance] new ovirt appliance implementation using oVirt server installer In-Reply-To: <1252522273-16638-3-git-send-email-mmorsi@redhat.com> References: <1252522273-16638-1-git-send-email-mmorsi@redhat.com> <1252522273-16638-2-git-send-email-mmorsi@redhat.com> <1252522273-16638-3-git-send-email-mmorsi@redhat.com> Message-ID: <4AB1135C.4070700@redhat.com> Mohammed Morsi wrote: > - checkout appliance > - make rpms > - rpm -ivh ovirt-appliance.rpm > - /usr/sbin/ovirt-appliance-ctrl install > > The install process will take a while, after which you can > access the server by going to http://192.168.50.2/ovirt at > which you can boot and manage vms on your host. > --- > .gitignore | 17 +-- > Makefile.am | 56 +++++++ > autogen.sh | 66 ++++++++ > configure.ac | 11 ++ > data/appliance.ks | 82 ++++++++++ > data/ifcfg-breth0 | 4 + > data/network.xml | 9 + > ovirt-appliance.spec.in | 52 +++++++ > scripts/ovirt-appliance-ctrl | 56 +++++++ > scripts/ovirt-appliance-functions | 297 +++++++++++++++++++++++++++++++++++++ > 10 files changed, 639 insertions(+), 11 deletions(-) > create mode 100644 Makefile.am > create mode 100755 autogen.sh > create mode 100644 configure.ac > create mode 100644 data/appliance.ks > create mode 100644 data/ifcfg-breth0 > create mode 100644 data/network.xml > create mode 100644 ovirt-appliance.spec.in > create mode 100755 scripts/ovirt-appliance-ctrl > create mode 100644 scripts/ovirt-appliance-functions > > diff --git a/.gitignore b/.gitignore > index 1221087..5b4f7d7 100644 > --- a/.gitignore > +++ b/.gitignore > @@ -1,22 +1,17 @@ > -*~ > -INSTALL > Makefile > Makefile.in > aclocal.m4 > -autom4te.cache/ > +autom4te.cache > config.h > config.h.in > config.log > config.status > configure > +depcomp > install-sh > missing > -ovirt-appliance-manifests*.tar > -ovirt-appliance-*-*.tar* > -ovirt-appliance-*-*.tar.sha1sum > -ovirt-appliance-*.tar.gz > -ovirt-appliance.spec > -ovirt-authorized_keys > -repos.ks > stamp-h1 > -tmp > +ovirt-appliance*.gz > +ovirt-appliance.spec > +schema.rb > +log/ > diff --git a/Makefile.am b/Makefile.am > new file mode 100644 > index 0000000..7a104ce > --- /dev/null > +++ b/Makefile.am > @@ -0,0 +1,56 @@ > +# Copyright (C) 2008 Red Hat, Inc. > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache > + > +EXTRA_DIST = \ > + .gitignore \ > + ovirt-appliance.spec \ > + ovirt-appliance.spec.in \ > + scripts \ > + data > + > +DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz > + > +# For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT- > +# annotated rpm version strings. > +_ovirt_dev = \ > + $(shell grep -q '^[[:space:]]*Release:[[:space:]]*0' \ > + $(srcdir)/*.spec.in && echo 1 || :) > + > +git_head = $$(git log -1 --pretty=format:%h) > +GIT_RELEASE = $$(date --utc +%Y%m%d%H%M%S)git$(git_head) > +RPMDIR = $$(rpm --eval '%{_rpmdir}') > +RPM_FLAGS = --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)" > +RPM_FLAGS += $(if $(_ovirt_dev),--define "extra_release .$(GIT_RELEASE)") > + > +rpms: dist > + rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz > + > +srpms: dist > + rpmbuild $(RPM_FLAGS) -ts $(distdir).tar.gz > + > +publish: rpms > + mkdir -p $(OVIRT_CACHE_DIR) > + rsync -aq $(shell rpm --eval '%{_rpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/ > + rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src > + createrepo $(OVIRT_CACHE_DIR)/ovirt > + > +genlangs: > + cd src && rake updatepo && rake makemo > + > +.PHONY: rpms publish srpms genlangs > diff --git a/autogen.sh b/autogen.sh > new file mode 100755 > index 0000000..6b0970f > --- /dev/null > +++ b/autogen.sh > @@ -0,0 +1,66 @@ > +#!/bin/sh > +# Run this to generate configure and Makefile > + > +srcdir=`dirname $0` > +test -z "$srcdir" && srcdir=. > + > +THEDIR=`pwd` > +( > + cd $srcdir > + die=0 > + > + (autoconf --version) < /dev/null > /dev/null 2>&1 || { > + echo > + echo "You must have autoconf installed." > + echo "Download the appropriate package for your distribution," > + echo "or see http://www.gnu.org/software/autoconf" > + die=1 > + } > + > + # Require libtool only if one of of LT_INIT, > + # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac. > + grep -E '^[[:blank:]]*(LT_INIT|A[CM]_PROG_LIBTOOL)' configure.ac >/dev/null \ > + && { > + (libtool --version) < /dev/null > /dev/null 2>&1 || { > + echo > + echo "You must have libtool installed." > + echo "Download the appropriate package for your distribution," > + echo "or see http://www.gnu.org/software/libtool" > + die=1 > + } > + } > + > + (automake --version) < /dev/null > /dev/null 2>&1 || { > + echo > + die=1 > + echo "You must have automake installed." > + echo "Download the appropriate package for your distribution," > + echo "or see http://www.gnu.org/software/automake" > + } > + > + test $die = 1 && exit 1 > + > + test -f ovirt-appliance.spec.in || { > + echo "You must run this script in the top-level directory" > + exit 1 > + } > + > + if test -z "$*"; then > + echo "I am going to run ./configure with no arguments - if you wish " > + echo "to pass any to it, please specify them on the $0 command line." > + fi > + > + aclocal > + > + # Run autoheader only if needed > + grep '^[[:blank:]]*AC_CONFIG_HEADERS' configure.ac >/dev/null && autoheader > + > + automake --add-missing > + autoconf > + ./configure "$@" > +) > + > +if test "x$OBJ_DIR" != x; then > + mkdir -p "$OBJ_DIR" > + cd "$OBJ_DIR" > +fi > diff --git a/configure.ac b/configure.ac > new file mode 100644 > index 0000000..db3bc30 > --- /dev/null > +++ b/configure.ac > @@ -0,0 +1,11 @@ > +AC_INIT([ovirt-appliance], [0.101], [ovirt-devel at redhat.com]) > +AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability tar-pax]) > +AC_PROG_CC > +AC_CONFIG_HEADERS([config.h]) > + > +# If using gcc and default CFLAGS, enable some warnings. > +test x"$ac_ct_CC:$CFLAGS" = 'xgcc:-g -O2' \ > + && CFLAGS="$CFLAGS -Wshadow -Wall -Werror" > + > +AC_CONFIG_FILES([Makefile ovirt-appliance.spec]) > +AC_OUTPUT > diff --git a/data/appliance.ks b/data/appliance.ks > new file mode 100644 > index 0000000..39a821c > --- /dev/null > +++ b/data/appliance.ks > @@ -0,0 +1,82 @@ > +install > + > +lang en_US.UTF-8 > +keyboard us > + > +# setup two nics, one public, one on the private libvirt network we setup > +network --device=eth0 --bootproto=static --ip=192.168.50.2 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.50.1 > +network --device=eth1 --onboot=on > + > +# Root password is 'ovirt' > +rootpw --iscrypted Xa8QeYfWrtscM > + > +firewall --disabled > +authconfig --enableshadow --enablemd5 > +selinux --disabled > + > +# NOTE: ntp/ntpdate need to stay in this list to ensure that time on the > +# appliance is correct prior to the ovirt-server-installer being run. Otherwise you > +# get Kerberos errors > +services --disabled=libvirtd,postgresql --enabled=network,iptables,ntpdate,acpid,sshd > +timezone --utc UTC > +text > + > +bootloader --location=mbr > +clearpart --all --drives=sda > +part /boot --ondisk=sda --fstype=ext3 --size=100 > +part / --ondisk=sda --fstype=ext3 --size=10000 > +part swap --ondisk=sda --fstype=swap --size=512 > +reboot > + > +repo --name=f11 --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-11&arch=x86_64 > +repo --name=f11-updates --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f11&arch=x86_64 > +#repo --name=f11-rawhide --mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=rawhide&arch=x86_64 > +repo --name=ovirtorg --baseurl=http://ovirt.org/repos/ovirt/11/x86_64/ > +repo --name=ovirt --baseurl=file://OVIRT_REPO > + > +%packages --excludedocs --nobase > +%include /usr/share/appliance-os/includes/base-pkgs.ks > +ntpdate > +openssh-server > +openssh-clients > +ovirt-server > +ovirt-server-installer > +ovirt-node-image > +ovirt-node-image-pxe > +%end > + > +%post > +# setup automatic ssh login > +mkdir -p /root/.ssh > +chmod 700 /root/.ssh > +cat > /root/.ssh/authorized_keys << \EOF > +OVIRT_SSH_KEY > +EOF > +chmod 600 /root/.ssh/authorized_keys > + > +# setup the ovirt installer answers > +cat > /root/ovirt-installer-answers << \EOF > +y > +eth1 > +eth0 > +server.ovirt-appliance.com > +n > +n > +192.168.50 > +3 > +50 > +ovirt-appliance.com > + > +y > +n > +cobbler > +cobbler > +cobbler > +v23zj59an > +v23zj59an > +ovirt-appliance.com > +ovirt > +ovirt > +EOF > + > +%end > diff --git a/data/ifcfg-breth0 b/data/ifcfg-breth0 > new file mode 100644 > index 0000000..02955b2 > --- /dev/null > +++ b/data/ifcfg-breth0 > @@ -0,0 +1,4 @@ > +DEVICE=breth0 > +ONBOOT=yes > +TYPE=Bridge > +PEERNTP=yes > diff --git a/data/network.xml b/data/network.xml > new file mode 100644 > index 0000000..8bce0db > --- /dev/null > +++ b/data/network.xml > @@ -0,0 +1,9 @@ > + > + ovirt-appliance > + OVIRT_NETWORK_UUID > + > + > + > + > + > + > diff --git a/ovirt-appliance.spec.in b/ovirt-appliance.spec.in > new file mode 100644 > index 0000000..61bdc8d > --- /dev/null > +++ b/ovirt-appliance.spec.in > @@ -0,0 +1,52 @@ > +%define app_root %{_datadir}/%{name} > + > +Summary: oVirt Appliance > +Name: ovirt-appliance > +Version: @VERSION@ > +Release: 1%{?dist}%{?extra_release} > +Source0: %{name}-%{version}.tar.gz > +License: GPLv2+ > +Group: Applications/System > +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot > +BuildArch: noarch > +URL: http://ovirt.org/ > +#Requires: > + > +%description > +The oVirt Appliance scripts to install on a Fedora Host > + > +%prep > +%setup -q > + > +%build > + > +%install > +%{__rm} -rf %{buildroot} > +mkdir %{buildroot} > + > +%{__install} -d -m0755 %{buildroot}%{_sbindir} > +%{__install} -d -m0755 %{buildroot}%{app_root} > +%{__install} -d -m0755 %{buildroot}%{app_root}/backup > +%{__cp} -a scripts/* %{buildroot}%{app_root} > +%{__cp} -a data/* %{buildroot}%{app_root} > +%{__ln_s} %{app_root}/ovirt-appliance-ctrl %{buildroot}%{_sbindir}/ > + > +%clean > +%{__rm} -rf %{buildroot} > + > +%files > +%defattr(-,root,root,0755) > +%{app_root} > +%{_sbindir}/ovirt-appliance-ctrl > + > +%changelog > +* Wed Sep 02 2009 Mohammed Morsi 0.100-1 > +- Revamped entire appliance project to fix it bring it up > + to speed with the current implementation of oVirt > +* Wed Nov 05 2008 Perry Myers 0.96 > +- Removed appliance building from rpm. RPM now just contains tools to > + download image and install it > +* Sun Sep 14 2008 Perry Myers 0.92-1 > +- Added Requires on libvirt/kvm > +* Fri Sep 05 2008 Perry Myers 0.92-1 > +- Initial build. > diff --git a/scripts/ovirt-appliance-ctrl b/scripts/ovirt-appliance-ctrl > new file mode 100755 > index 0000000..2ac86c6 > --- /dev/null > +++ b/scripts/ovirt-appliance-ctrl > @@ -0,0 +1,56 @@ > +#!/bin/bash > +# Control script for the oVirt appliance. > +# > +# Use this to setup / install a server appliance running in a vm > +# and a node configuration on the baremetal host. > +# > +# This must be run as a super-user to be successful. > +# > +# Copyright (C) 2008 Red Hat, Inc. > +# Written by Mohammed Morsi > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +. /etc/init.d/functions > +. /usr/share/ovirt-appliance/ovirt-appliance-functions > + > +case "$1" in > + install) > + bootstrap_setup > + build_rpms # would like to make this step optional > + setup_network > + setup_server_ssh_access > + create_server_vm > + run_server_installer > + setup_server_env > + backup_node_env > + setup_node_env > + ;; > + uninstall) > + bootstrap_teardown > + destroy_server_vm > + destroy_network > + restore_node_env > + echo "reboot to complete the uninstall process" > + ;; > + *) > + echo "Usage: ovirt-appliance-ctrl {install|uninstall}" > + exit 1 > + ;; > +esac > + > +exit $RETVAL > + > diff --git a/scripts/ovirt-appliance-functions b/scripts/ovirt-appliance-functions > new file mode 100644 > index 0000000..3ed77fb > --- /dev/null > +++ b/scripts/ovirt-appliance-functions > @@ -0,0 +1,297 @@ > +#!/bin/bash > +# Function definitions part of the oVirt appliance setup utility > +# > +# Copyright (C) 2008 Red Hat, Inc. > +# Written by Mohammed Morsi > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +OVIRT_APPLIANCE_DIR="/usr/share/ovirt-appliance" > +OVIRT_APPLIANCE_BACKUP_DIR="$OVIRT_APPLIANCE_DIR/backup" > +OVIRT_APPLIANCE_WORKING_DIR="`mktemp -d`" > + > +# perform any common setup initialization routines > +bootstrap_setup() { > + unalias cp > + > + # set selinux to permissive mode > + /usr/sbin/setenforce 0 > + > + # make sure we aren't localhost so the server can lookup our hostname > + hostname="`hostname`" > + if [ "$hostname" == "localhost" -o "$hostname" == "localhost.localdomain" -o "$hostname" == "" ]; then > + echo "hostname cannot be localhost (server needs to be able to resolve it)" > + hostname host.ovirt-appliance.com > + cp -f /etc/sysconfig/network $OVIRT_APPLIANCE_BACKUP_DIR > + sed -i s/HOSTNAME.*$/HOSTNAME\=host\.ovirt-appliance\.com/g /etc/sysconfig/network > + hostname host.ovirt-appliance.com > + fi > + > + # install the oVirt release rpm if not present > + rpm -q ovirt-release || rpm -ivh http://ovirt.org/repos/ovirt/ovirt-release-LATEST.noarch.rpm > + > + # update our system to have the latest packages, install base packages > + yum install -y yum-fastestmirror libvirt > + yum update -y --enablerepo=ovirt > + > + # copy the files we will be modifying into the working dir > + cp -f $OVIRT_APPLIANCE_DIR/appliance.ks $OVIRT_APPLIANCE_WORKING_DIR/ > + cp -f $OVIRT_APPLIANCE_DIR/network.xml $OVIRT_APPLIANCE_WORKING_DIR/ > + cp -f $OVIRT_APPLIANCE_DIR/ifcfg-breth0 $OVIRT_APPLIANCE_WORKING_DIR/ > + > + # start up libvirt > + service libvirtd start > +} > + > +# perform any common teardown initialization routines > +bootstrap_teardown() { > + unalias cp > + > + # restore /etc/sysconfig/network if modified > + test -f $OVIRT_APPLIANCE_BACKUP_DIR/network && cp -f $OVIRT_APPLIANCE_BACKUP_DIR/network /etc/sysconfig/ > +} > + > +# build the neccessary oVirt rpms to install the appliance > +build_rpms() { > + # install dependencies > + yum install -y --enablerepo=ovirt \ > + git automake autoconf gcc rpm-build \ > + ruby ruby-devel rubygem-gettext rubygem-rake \ > + libvirt-devel dbus-devel hal-devel hardlink \ > + livecd-tools appliance-tools \ > + publican publican-ovirt > + > + ### checkout / build oVirt > + > + # create a build directory, and cd into it > + saved_dir=`pwd` > + OVIRT_CHECKOUT_DIR=`mktemp -d` > + cd $OVIRT_CHECKOUT_DIR > + > + # clone the release project > + git clone git://ovirt.org/ovirt-release release > + > + # setup the cache dir and make update and publish > + export OVIRT_CACHE_DIR=$(pwd)/cache > + OVIRT_REPO=$OVIRT_CACHE_DIR/ovirt > + make -f release/ovirt.mk update publish > + > + # restore working directory > + cd $saved_dir > + > + # swap in the correct local repo in the kickstart > + sed -i s~OVIRT_REPO~$OVIRT_REPO~g $OVIRT_APPLIANCE_WORKING_DIR/appliance.ks > +} > + > +# setup a libvirt network to act as the oVirt admin network > +setup_network() { > + # generate a network id and swap it into the network config > + sed -i s/OVIRT_NETWORK_UUID/`uuidgen`/g $OVIRT_APPLIANCE_WORKING_DIR/network.xml > + > + # write the network config to the appropriate place > + cp -f $OVIRT_APPLIANCE_WORKING_DIR/network.xml /etc/libvirt/qemu/networks/ovirt-appliance.xml > + > + # define and start the network via libvirt, set to autostart > + virsh net-define /etc/libvirt/qemu/networks/ovirt-appliance.xml > + virsh net-start ovirt-appliance > + virsh net-autostart ovirt-appliance > + > + # setup breth0 as its needed to start vms with a network > + # (backing the old config up first) > + test -f /etc/sysconfig/network-scripts/ifcfg-breth0 && \ > + cp -f /etc/sysconfig/network-scripts/ifcfg-breth0 $OVIRT_APPLIANCE_BACKUP_DIR/ifcfg-breth0.bak > + cp -f $OVIRT_APPLIANCE_WORKING_DIR/ifcfg-breth0 /etc/sysconfig/network-scripts/ > + ifup breth0 > +} > + > +# destroy / remove the network that was setup > +destroy_network() { > + # destroy, undefine, and un-autostart the network > + virsh net-destroy ovirt-appliance > + virsh net-undefine ovirt-appliance > + rm -f /etc/libvirt/qemu/networks/ovirt-appliance.xml > + > + # restore ifcfg-breth0 backup if neccessary > + test -f $OVIRT_APPLIANCE_BACKUP_DIR/ifcfg-breth0.bak && \ > + cp -f $OVIRT_APPLIANCE_BACKUP_DIR/ifcfg-breth0.bak /etc/sysconfig/network-scripts/ > +} > + > +# setup no-password ssh login for the server > +setup_server_ssh_access() { > + # create convenience env variables for the ssh params/cmds > + SSHKEY=~/.ssh/id_ovirt_appliance > + remote_target="root at 192.168.50.2" > + ssh_cmd="ssh -i $SSHKEY -o StrictHostKeyChecking=no \ > + -o UserKnownHostsFile=/dev/null $remote_target" > + scp_cmd="scp -i $SSHKEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" > + > + # generate new ssh key if not found > + if [ ! -r $SSHKEY ]; then > + mkdir -p $(dirname "$SSHKEY") > + ssh-keygen -q -t rsa -N "" -f $SSHKEY > + fi > + > + # implant ssh key into the server kickstart > + sed -i "s~OVIRT_SSH_KEY~`ssh-keygen -y -f $SSHKEY`~g" $OVIRT_APPLIANCE_WORKING_DIR/appliance.ks > +} > + > +# create and start the server vm > +create_server_vm() { > + # install dependencies > + yum install -y --enablerepo=ovirt \ > + appliance-os python-virtinst kvm > + > + > + # save the current dir, and enter the working dir > + saved_dir=`pwd` > + cd $OVIRT_APPLIANCE_WORKING_DIR > + > + # remove the appliance image if it exists > + test -d ovirt-appliance && rm -rf ovirt-appliance > + > + # create the appliance image > + appliance-creator --config appliance.ks --name ovirt-appliance \ > + -f raw --vmem=2048 -d -v > + > + # define / start the vm via libvirt, set to autostart > + virt-image --network=network:ovirt-appliance ovirt-appliance/ovirt-appliance.xml > + virsh define /etc/libvirt/qemu/ovirt-appliance.xml > + virsh autostart ovirt-appliance > + > + # restore the saved dir > + cd $saved_dir > + > + for i in $(seq 1 60); do > + $ssh_cmd exit && break > + sleep 10 > + done > +} > + > +# destroy the server vm that was setup > +destroy_server_vm() { > + # at some point, find a way to destroy the oVirt > + # managed vms as well > + virsh destroy ovirt-appliance > + virsh undefine ovirt-appliance > +} > + > +# run the oVirt server installation process on the server vm > +run_server_installer() { > + # run the actual installer w/ pre-specified answers (see kickstart) > + $ssh_cmd "ovirt-installer < /root/ovirt-installer-answers" > + > + # XXX for whatever reason ovirt-node-image-pxe isn't setting > + # up the pxe correctly for the node-image iso, just put this > + # here until we figure out why > + $ssh_cmd "cd /usr/share/ovirt-node-image/ && \ > + rm -rf tftpboot && \ > + livecd-iso-to-pxeboot ovirt-node-image.iso" > + > + # XXX another hack needed here to install the old fedora-ds-base > + # instead of the currently broken 389-ds-base > + # https://bugzilla.redhat.com/show_bug.cgi?id=518544 > + # http://ovirt.org/install-instructions.html#free-ipa-warning > + $ssh_cmd "yum install perl-Mozilla-LDAP nss-tools mozldap-tools lm_sensors-devel net-snmp-devel openssl-devel -y" > + $ssh_cmd "rpm -ivh http://kojipkgs.fedoraproject.org/packages/fedora-ds-base/1.2.0/4.fc11/x86_64/fedora-ds-base-1.2.0-4.fc11.x86_64.rpm" > + > + # run the ace portion of the installer, actuall performing the oVirt installation > + $ssh_cmd "ace -d install ovirt > /root/install.log" > +} > + > +# perform everything else needed to get the oVirt server > +# to work on a single machine install > +setup_server_env() { > + # set server resolv.conf to avoid an infinite loop. > + # set it to the server nameserver, followed by the > + # nameservers as defined in the host's resolv.conf > + nameservers=`grep nameserver /etc/resolv.conf` > + nameservers="nameserver 192.168.50.2 > +$nameservers" > + $ssh_cmd "echo '$nameservers' > /etc/resolv.conf" > + > + # prepend this hostname onto server's hosts and restart the dns service, > + # required for kerberos and other components that need to lookup the host > + $ssh_cmd "echo '192.168.50.1 `hostname`'|cat - /etc/hosts > /tmp/out && mv -f /tmp/out /etc/hosts" > + $ssh_cmd "service dnsmasq restart" > + > + # add priciples to the kerberos server allowing node access > + #$ssh_cmd /usr/bin/ovirt-add-host `hostname` /usr/share/ovirt-server/ovirt.keytab > + $ssh_cmd "echo 'addprinc -randkey libvirt/`hostname`@OVIRT-APPLIANCE.COM' | kadmin.local" > + $ssh_cmd "echo 'addprinc -randkey qpidd/`hostname`@OVIRT-APPLIANCE.COM' | kadmin.local" > + $ssh_cmd "echo 'ktadd -k /usr/share/ipa/html/`hostname`-libvirt.tab libvirt/`hostname`@OVIRT-APPLIANCE.COM' | kadmin.local" > + $ssh_cmd "echo 'ktadd -k /usr/share/ipa/html/`hostname`-libvirt.tab qpidd/`hostname`@OVIRT-APPLIANCE.COM' | kadmin.local" > +} > + > +# backup all config files modified by setup_node_env > +backup_node_env() { > + test -f /etc/resolv.conf && cp -f /etc/resolv.conf $OVIRT_APPLIANCE_BACKUP_DIR > + test -f /etc/krb5.conf && cp -f /etc/krb5.conf $OVIRT_APPLIANCE_BACKUP_DIR > + test -f /etc/libvirt/krb5.tab/ && cp -f /etc/libvirt/krb5.tab $OVIRT_APPLIANCE_BACKUP_DIR > + test -f /etc/sysconfig/libvirt-qpid && cp -f /etc/sysconfig/libvirt-qpid $OVIRT_APPLIANCE_BACKUP_DIR > + test -f /etc/sysconfig/matahari && cp -f /etc/sysconfig/matahari $OVIRT_APPLIANCE_BACKUP_DIR > +} > + > +# perform everything else needed to get the oVirt node/host > +# to work on a single machine install > +setup_node_env() { > + # install dependencies > + yum install -y --enablerepo=ovirt \ > + wget libvirt-qpid cyrus-sasl-gssapi > + # selinux-policy-doc \ > + > + # sync up our system time w/ the server's ntp server > + ntpdate 192.168.50.2 > + > + # prepend the ovirt server's dns nameserver onto the local resolv.conf, > + # so that we can perform the appliance domain lookups > + echo "nameserver 192.168.50.2"|cat - /etc/resolv.conf > /tmp/out && mv -f /tmp/out /etc/resolv.conf > + > + # grab the kerberos config > + wget -q --no-check-certificate http://192.168.50.2:80/ipa/config/krb5.ini -O /etc/krb5.conf > + > + # grab key/ticket off the server, and initialize kerberos w/ it > + $scp_cmd $remote_target:/usr/share/ipa/html/`hostname`-libvirt.tab /etc/libvirt/krb5.tab > + /usr/kerberos/bin/kinit -k -t /etc/libvirt/krb5.tab qpidd/`hostname` > + > + # setup the libvirt-qpid / matahari sysconfig > + echo "LIBVIRT_QPID_ARGS=\"--broker 192.168.50.2 --port 5672\"" >> /etc/sysconfig/libvirt-qpid > + echo "/usr/kerberos/bin/kinit -k -t /etc/libvirt/krb5.tab qpidd/`hostname`" >> /etc/sysconfig/libvirt-qpid > + echo "MATAHARI_ARGS=\"--broker 192.168.50.2 --port 5672\"" >> /etc/sysconfig/matahari > + echo "/usr/kerberos/bin/kinit -k -t /etc/libvirt/krb5.tab qpidd/`hostname`" >> /etc/sysconfig/matahari > + > + # restart libvirt and start libvirt-qpid > + service libvirtd restart > + service libvirt-qpid start > + > + # install matahari (XXX yum install it when it is availabe in the repos) > + rpm -q matahari || rpm -ivh http://kojipkgs.fedoraproject.org/packages/matahari/0.0.4/4.fc11/x86_64/matahari-0.0.4-4.fc11.x86_64.rpm > + > + # and start it > + sudo service matahari start > + > + # run ovirt awake to register us w/ the server > + #bash checkout/node/scripts/ovirt-awake start 192.168.50.2 12120 /etc/libvirt/krb5.tab > + > + # FIXME on reboot we need to setenforce 0, ifup breth0, resetup resolv.conf (on both server/node), start libvirt-qpid / matahari > +} > + > +restore_node_env(){ > + test -f $OVIRT_APPLIANCE_BACKUP_DIR/resolv.conf && cp -f $OVIRT_APPLIANCE_BACKUP_DIR/resolv.conf /etc > + test -f $OVIRT_APPLIANCE_BACKUP_DIR/krb5.conf && cp -f $OVIRT_APPLIANCE_BACKUP_DIR/krb5.conf /etc > + test -f $OVIRT_APPLIANCE_BACKUP_DIR/libvirt/krb5.tab/ && cp -f $OVIRT_APPLIANCE_BACKUP_DIR/krb5.tab /etc > + test -f $OVIRT_APPLIANCE_BACKUP_DIR/libvirt-qpid && cp -f $OVIRT_APPLIANCE_BACKUP_DIR/libvirt-qpid /etc/sysconfig > + test -f $OVIRT_APPLIANCE_BACKUP_DIR/matahari && cp -f $OVIRT_APPLIANCE_BACKUP_DIR/matahari /etc/sysconfig > +} > ack, works for me From laurent at open-minds.org Wed Sep 16 17:11:43 2009 From: laurent at open-minds.org (Laurent =?iso-8859-15?q?L=E9onard?=) Date: Wed, 16 Sep 2009 19:11:43 +0200 Subject: [Ovirt-devel] Links on website download section In-Reply-To: <200909151615.15810.laurent@open-minds.org> References: <200909151615.15810.laurent@open-minds.org> Message-ID: <200909161911.47829.laurent@open-minds.org> Le mardi 15 septembre 2009 ? 16:15, Laurent L?onard a ?crit?: > Hi, > > The links to oVirt Node ISO seems to be down on > http://www.ovirt.org/download.html Hi, Download links are still down... I will probably package oVirt for Debian but first I want to test it. Where can I download the oVirt Node ISO ? Thank you, -- Laurent L?onard -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part. URL: From mmorsi at redhat.com Wed Sep 16 17:23:35 2009 From: mmorsi at redhat.com (Mohammed Morsi) Date: Wed, 16 Sep 2009 13:23:35 -0400 Subject: [Ovirt-devel] Links on website download section In-Reply-To: <200909161911.47829.laurent@open-minds.org> References: <200909151615.15810.laurent@open-minds.org> <200909161911.47829.laurent@open-minds.org> Message-ID: <4AB11F17.8030705@redhat.com> Laurent L?onard wrote: > Le mardi 15 septembre 2009 ? 16:15, Laurent L?onard a ?crit : > >> Hi, >> >> The links to oVirt Node ISO seems to be down on >> http://www.ovirt.org/download.html >> > > Hi, > > Download links are still down... I will probably package oVirt for Debian but > first I want to test it. Where can I download the oVirt Node ISO ? > > Thank you, > > ------------------------------------------------------------------------ > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel > Hi Laurent, I'm also not fully sure of the status of the hosted node-image / node-image-pxe rpms right now, but they don't seem to be available in any of the repos. The only way around this that I know of right now is to build the rpms from source as instructed here http://www.ovirt.org/build-instructions.html or to get them from someone else (should work though I've never tried the latter case myself). I have a copies of the latest oVirt rpms locally (latest as in current development head, but most everything is working there anyways) and I can put them up somewhere for you if you want. Just ping me on irc (mmorsi) and we can work something out for the time being. Several people have raised this issue before, and it is something I want to get resolved, though unfortunately it is currently out of my control. Sorry for any inconveniences. -Mo From isaac.ng at royale-technologies.com Wed Sep 16 17:54:16 2009 From: isaac.ng at royale-technologies.com (Isaac Ng) Date: Thu, 17 Sep 2009 03:54:16 +1000 Subject: [Ovirt-devel] Links on website download section In-Reply-To: <4AB11F17.8030705@redhat.com> References: <200909151615.15810.laurent@open-minds.org> <200909161911.47829.laurent@open-minds.org> <4AB11F17.8030705@redhat.com> Message-ID: <687e8f9d0909161054u2c142298ncd31a7e49b857ec3@mail.gmail.com> Hi, I've manage to extract one out of http://ovirt.org/repos/ovirt/10/x86_64/ovirt-node-image-1.0.1-1.fc10.x86_64.rpm Not sure how outdated it is though. Cheers Isaac 2009/9/17 Mohammed Morsi > Laurent L?onard wrote: > > Le mardi 15 septembre 2009 ? 16:15, Laurent L?onard a ?crit : > > > >> Hi, > >> > >> The links to oVirt Node ISO seems to be down on > >> http://www.ovirt.org/download.html > >> > > > > Hi, > > > > Download links are still down... I will probably package oVirt for Debian > but > > first I want to test it. Where can I download the oVirt Node ISO ? > > > > Thank you, > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Ovirt-devel mailing list > > Ovirt-devel at redhat.com > > https://www.redhat.com/mailman/listinfo/ovirt-devel > > > Hi Laurent, > I'm also not fully sure of the status of the hosted node-image / > node-image-pxe rpms right now, but they don't seem to be available in > any of the repos. The only way around this that I know of right now is > to build the rpms from source as instructed here > http://www.ovirt.org/build-instructions.html or to get them from > someone else (should work though I've never tried the latter case > myself). I have a copies of the latest oVirt rpms locally (latest as in > current development head, but most everything is working there anyways) > and I can put them up somewhere for you if you want. Just ping me on irc > (mmorsi) and we can work something out for the time being. > > Several people have raised this issue before, and it is something I want > to get resolved, though unfortunately it is currently out of my control. > Sorry for any inconveniences. > > -Mo > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jboggs at redhat.com Wed Sep 16 18:21:13 2009 From: jboggs at redhat.com (Joey Boggs) Date: Wed, 16 Sep 2009 14:21:13 -0400 Subject: [Ovirt-devel] Re: [PATCH node-image] add livecd-iso-to-iscsi script to support iscsi root booting setup In-Reply-To: <1252982116-14011-1-git-send-email-jboggs@redhat.com> References: <1252982116-14011-1-git-send-email-jboggs@redhat.com> Message-ID: <4AB12C99.6060901@redhat.com> Joey Boggs wrote: > This enables the ability to take the ovirt-node-image iso and deploy it to an iscsi disk. It also provides a sample pxe configuration for booting based on the iscsi root device. Includes support for user/password as well as reverse chap user/password. > --- > Makefile.am | 1 + > livecd-iso-to-iscsi | 201 ++++++++++++++++++++++++++++++++++++++++++++++ > ovirt-node-image.spec.in | 2 + > 3 files changed, 204 insertions(+), 0 deletions(-) > create mode 100755 livecd-iso-to-iscsi > > diff --git a/Makefile.am b/Makefile.am > index a44ae49..306f49f 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -45,6 +45,7 @@ EXTRA_DIST = \ > $(PACKAGE).ks \ > create-ovirt-iso-nodes \ > edit-livecd \ > + livecd-iso-to-iscsi \ > livecd-setauth \ > livecd-rpms \ > README > diff --git a/livecd-iso-to-iscsi b/livecd-iso-to-iscsi > new file mode 100755 > index 0000000..fd3934d > --- /dev/null > +++ b/livecd-iso-to-iscsi > @@ -0,0 +1,201 @@ > +#!/usr/bin/python > +# Convert a live CD iso into iscsi root bootable format > +# iSCSI lun must be accessible via this script > +# Copyright 2009 Red Hat, Inc. > +# Written by Joey boggs > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU Library General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. > + > +from optparse import OptionParser > +from tempfile import mkdtemp > +import dbus > +import dbus.glib > +import sys > +import os > +import subprocess > +import shutil > + > +parser = OptionParser() > +parser.add_option("--iso", dest="iso", help="LiveCD iso filename") > +parser.add_option("--target", dest="target", help="iSCSI target ip address") > +parser.add_option("--targetname", dest="targetname", help="iSCSI target lun") > +parser.add_option("--targetport", dest="targetport", default="3260", help="iSCSI port number, defaults to 3260") > +parser.add_option("--user", dest="user", help="Target username(optional)") > +parser.add_option("--password", dest="password", help="Target password") > +parser.add_option("--reverse_user", dest="reverse_user", help="Reverse CHAP username(optional)") > +parser.add_option("--reverse_password", dest="reverse_password", help="Reverse CHAP password(optional)") > +parser.add_option("--disk", dest="disk", help="iSCSI disk device name") > +parser.add_option("--disk-label", dest="disk_label", default="ovirt-node-root", help="file system label") > + > +(options, args) = parser.parse_args() > + > +def fail(msg): > + print(msg) > + sys.exit(1) > + > +if os.geteuid () != 0: > + fail("You must run as root") > + > +if options.iso is None: > + fail("ERROR: iso file must be defined") > +else: > + options.iso = os.path.abspath(options.iso) > + > +if options.target is None: > + fail("ERROR: iscsi target must be defined") > + > +if options.targetname is None: > + fail("ERROR: iscsi targetname must be defined") > + > +if len(options.disk_label.strip()) > 15: > + fail("ERROR: disk label must be 14 characters or less") > + > +try: > + file = os.mkdir("tftpboot") > +except OSError, e: > + tftp_remove = raw_input("tftpboot directory exists, overwrite? (y/N)? ") > + if tftp_remove.lower() == "y": > + shutil.rmtree("tftpboot") > + os.mkdir("tftpboot") > + else: > + print "Aborting" > + sys.exit(1) > + > +if options.disk is None: > + print "Below are the detected disks, if the iscsi disk is not shown, please ensure you are logged into the correct target\n" > + bus = dbus.SystemBus () > + hal_obj = bus.get_object ('org.freedesktop.Hal', '/org/freedesktop/Hal/Manager') > + hal = dbus.Interface (hal_obj, 'org.freedesktop.Hal.Manager') > + udis = hal.FindDeviceByCapability ('storage') > + dev_dict = {} > + dev_count = 1 > + for udi in udis: > + dev_obj = bus.get_object ('org.freedesktop.Hal', udi) > + dev = dbus.Interface (dev_obj, 'org.freedesktop.Hal.Device') > + dev_bus=dev.GetProperty ('storage.bus') > + dev_name=dev.GetProperty ('block.device') > + dev_size=dev.GetProperty ('storage.size') > + dev_size=(dev_size/1024/1024) > + basename=os.path.basename(udi) > + if dev_bus == "scsi": > + print "%s. %s %sM %s \n" % (dev_count,dev_name,dev_size,basename) > + dev_dict[str(dev_count)] = dev_name > + dev_count = dev_count + 1 > + print "Enter Q to Quit" > + dev_choice = raw_input("Which device? ") > + while not dev_dict.has_key(dev_choice): > + if dev_choice.lower() == "q": > + print "Aborting" > + sys.exit(1) > + else: > + print "%s is an invalid choice" % dev_choice > + dev_choice = raw_input("Which device? ") > + options.disk = dev_dict[dev_choice] > + > +cont = raw_input("Creating file system on %s, do you wish to continue (y/N) " % options.disk) > +if cont.lower() != "y": > + print "Aborting" > + sys.exit(1) > + > +isomount = mkdtemp() > +isomount_ret = subprocess.call(["mount", "-o", "loop", options.iso, isomount]) > +if isomount_ret != 0: > + fail("Error mounting %s" % options.iso) > + > +kernel="%s/isolinux/vmlinuz0" % isomount > +initrd="%s/isolinux/initrd0.img" % isomount > +squashfs="%s/LiveOS/squashfs.img" % isomount > +ext3fs="tftpboot/squashfs-root/LiveOS/ext3fs.img" > +shutil.copy(kernel,"tftpboot") > +shutil.copy(initrd,"tftpboot") > + > +unsquash = subprocess.call(["unsquashfs", squashfs]) > + > +# workaround until bug is fixed with squashfs -d option > +shutil.move("squashfs-root","tftpboot/squashfs-root") > + > +print "Placing embedded file system on %s" % options.disk > +dd_cmd="dd if=%s of=%s" % (ext3fs,options.disk) > +copy_iscsi_ret = subprocess.call(dd_cmd, shell=True) > +if copy_iscsi_ret != 0: > + fail("Error copying to %s" % options.disk) > + > +umount_ret = subprocess.call(["umount", isomount]) > +if umount_ret != 0: > + fail("Error unmounting %s, continuing" % isomount) > +else: > + os.rmdir(isomount) > +shutil.rmtree("tftpboot/squashfs-root") > + > +pxe_template = """ > + > +# pxelinux configuration. > +DEFAULT pxeboot > +TIMEOUT 20 > +PROMPT 0 > +LABEL ovirt-node-iscsi > + KERNEL /vmlinuz0 > + APPEND initrd=/initrd0.img ro root=LABEL=%(disk_label)s netroot=iscsi:%(user)s%(password)s@%(target)s::%(target_port)s::%(target_name)s ip=eth0:dhcp > + ipappend 2 > +ONERROR LOCALBOOT 0 > +""" > + > +# insert empty values for unneeded variables in the pxe template > +if not options.user is None: > + options.user = options.user + ":" > +else: > + options.user = "" > + > +if not options.password is None: > + options.password = options.password + ":" > +else: > + options.password = "" > + > +if not options.reverse_user is None: > + options.reverse_user = options.reverse_user + ":" > +else: > + options.reverse_user = "" > + > +if not options.reverse_password is None: > + options.reverse_password = options.reverse_password + ":" > +else: > + options.reverse_password = "" > + > +os.mkdir("tftpboot/pxelinux.cfg") > +pxe_cfg = pxe_template % { > + "disk_label": options.disk_label, > + "target": options.target, > + "target_port": options.targetport, > + "target_name": options.targetname, > + "user": options.user, > + "password": options.password, > + "reverse_user": options.reverse_user, > + "reverse_password": options.reverse_password > + } > + > +pxe_conf = open("tftpboot/pxelinux.cfg/default", 'w') > +pxe_conf.write(pxe_cfg) > +pxe_conf.close() > + > +if os.path.exists("/usr/share/syslinux/pxelinux.0"): > + shutil.copy("/usr/share/syslinux/pxelinux.0","tftpboot") > +elif os.path.exists("/usr/lib/syslinux/pxelinux.0"): > + shutil.copy("/usr/lib/syslinux/pxelinux.0","tftpboot") > +else: > + print "Warning: You need to add pxelinux.0 to tftpboot/ subdirectory" > + > +print "Your iscsiroot has been setup on %s" % options.disk > +print "" > +print "Copy the tftpboot/ subdirectory to your tftpserver root directory" > +print "Set up your DHCP, TFTP and PXE server to serve /tftpboot/.../pxeboot.0" > diff --git a/ovirt-node-image.spec.in b/ovirt-node-image.spec.in > index e64f4de..1f8c31b 100644 > --- a/ovirt-node-image.spec.in > +++ b/ovirt-node-image.spec.in > @@ -65,6 +65,7 @@ mkdir %{buildroot} > %{__install} -d -m0755 %{buildroot}%{_sbindir} > %{__install} -p -m0755 create-ovirt-iso-nodes %{buildroot}%{_sbindir} > %{__install} -p -m0755 edit-livecd %{buildroot}%{_sbindir} > +%{__install} -p -m0755 livecd-iso-to-iscsi %{buildroot}%{_sbindir} > %{__install} -p -m0755 livecd-setauth %{buildroot}%{_sbindir} > %{__install} -p -m0755 livecd-rpms %{buildroot}%{_sbindir} > %{__tar} -xf %{image_manifests} -C %{buildroot}%{app_root} > @@ -94,6 +95,7 @@ cobbler sync > /dev/null 2>&1 || : > %defattr(0755,root,root,0755) > %{_sbindir}/create-ovirt-iso-nodes > %{_sbindir}/edit-livecd > +%{_sbindir}/livecd-iso-to-iscsi > %{_sbindir}/livecd-setauth > %{_sbindir}/livecd-rpms > > pushed per pmyers From apevec at redhat.com Wed Sep 16 20:18:59 2009 From: apevec at redhat.com (Alan Pevec) Date: Wed, 16 Sep 2009 22:18:59 +0200 Subject: [Ovirt-devel] Re: [PATCH node-image] Changed packages and dependencies so virt-manager-tui runs properly. In-Reply-To: <1253104522-21207-2-git-send-email-dpierce@redhat.com> References: <1253104522-21207-1-git-send-email-dpierce@redhat.com> <1253104522-21207-2-git-send-email-dpierce@redhat.com> Message-ID: <4AB14833.2030104@redhat.com> Darryl L. Pierce wrote: > diff --git a/common-post.ks b/common-post.ks > index 0c0a3f4..d0a52e9 100644 > --- a/common-post.ks > +++ b/common-post.ks > @@ -146,3 +146,10 @@ EOF > # Remove the default logrotate daily cron job > # since we run it every 10 minutes instead. > rm -f /etc/cron.daily/logrotate > + > +# add nodeadmin as a valid shell > +cat >> /etc/shells < +/usr/bin/nodeadmin > +EOF > + > +chsh -s /usr/bin/nodeadmin root This still fails: chsh: unconfined_u:unconfined_r:livecd_t:s0-s0:c0.c1023 is not authorized to change the shell of root You could use augeas: -chsh -s /usr/bin/nodeadmin root +augtool <<\EOF +set /files/etc/passwd/root/shell /usr/bin/nodeadmin +save +EOF But please add Shell option to nodeadmin first, as suggested by Joey. For now just leave bash as root's default shell, and change it to nodeadmin when there's Shell option. From apevec at redhat.com Wed Sep 16 21:17:30 2009 From: apevec at redhat.com (Alan Pevec) Date: Wed, 16 Sep 2009 23:17:30 +0200 Subject: [Ovirt-devel] Re: [PATCH node] Introduces the node-admin toolset. In-Reply-To: <1253107231-22460-2-git-send-email-dpierce@redhat.com> References: <1253107231-22460-1-git-send-email-dpierce@redhat.com> <1253107231-22460-2-git-send-email-dpierce@redhat.com> Message-ID: <4AB155EA.3090006@redhat.com> ACK as a followup patch, please add "Shell" option, if we want to use this as default root's shell From jboggs at redhat.com Thu Sep 17 01:58:50 2009 From: jboggs at redhat.com (Joey Boggs) Date: Wed, 16 Sep 2009 21:58:50 -0400 Subject: [Ovirt-devel] Re: [PATCH server] update installer exec items to single_exec where applicable In-Reply-To: <1250888115-27994-1-git-send-email-jboggs@redhat.com> References: <1250888115-27994-1-git-send-email-jboggs@redhat.com> Message-ID: <4AB197DA.9090001@redhat.com> Joey Boggs wrote: > Signed-off-by: Joey Boggs > --- > installer/modules/ovirt/manifests/freeipa.pp | 8 ++++---- > installer/modules/ovirt/manifests/postgres.pp | 12 ++++++------ > 2 files changed, 10 insertions(+), 10 deletions(-) > > diff --git a/installer/modules/ovirt/manifests/freeipa.pp b/installer/modules/ovirt/manifests/freeipa.pp > index e5de852..f91cd43 100644 > --- a/installer/modules/ovirt/manifests/freeipa.pp > +++ b/installer/modules/ovirt/manifests/freeipa.pp > @@ -29,12 +29,12 @@ class freeipa::bundled{ > command => "/bin/hostname $ipa_host", > } > > - exec {"set_kdc_defaults": > + single_exec {"set_kdc_defaults": > command => "/bin/sed -i '/\[kdcdefaults\]/a \ kdc_ports = 88' /usr/share/ipa/kdc.conf.template", > require => Package[ipa-server] > } > > - exec {"replace_line_returns": > + single_exec {"replace_line_returns": > command => "/bin/sed -i -e 's/^/#/' /etc/httpd/conf.d/ipa-rewrite.conf", > require => Single_Exec[ipa_server_install] > } > @@ -43,7 +43,7 @@ class freeipa::bundled{ > file => "/etc/httpd/conf.d/ipa.conf", > pattern => "^", > replacement => "", > - require => Exec[replace_line_returns] > + require => Single_exec[replace_line_returns] > } > > file_replacement{"ipa_proxy_config_2": > @@ -61,7 +61,7 @@ class freeipa::bundled{ > > single_exec {"ipa_server_install": > command => "/usr/sbin/ipa-server-install -r $realm_name -p '$freeipa_password' -P '$freeipa_password' -a '$freeipa_password' --hostname $ipa_host -u dirsrv -U", > - require => [Exec[set_kdc_defaults],Single_exec[dnsmasq_restart]] > + require => [Single_exec[set_kdc_defaults],Single_exec[dnsmasq_restart]] > } > > exec {"get_krb5_tkt": > diff --git a/installer/modules/ovirt/manifests/postgres.pp b/installer/modules/ovirt/manifests/postgres.pp > index 12b7764..42433ea 100644 > --- a/installer/modules/ovirt/manifests/postgres.pp > +++ b/installer/modules/ovirt/manifests/postgres.pp > @@ -41,18 +41,18 @@ class postgres::bundled{ > service {"postgresql" : > ensure => running, > enable => true, > - require => [Single_exec[initialize_db],Exec[postgres_add_localhost_trust],Exec[postgres_add_all_trust],Exec[postgres_add_ipv6_loopback_trust]], > + require => [Single_exec[initialize_db],Exec[postgres_add_localhost_trust],Single_exec[postgres_add_all_trust],Exec[postgres_add_ipv6_loopback_trust]], > hasstatus => true > } > > single_exec {"create_ovirt_db": > command => "/usr/bin/createdb ovirt -U postgres", > - require => [Exec[postgres_add_all_trust], Service[postgresql]] > + require => [Single_exec[postgres_add_all_trust], Service[postgresql]] > } > > single_exec {"create_ovirt_development_db": > command => "/usr/bin/createdb ovirt_development -U postgres", > - require => [Exec[postgres_add_all_trust], Service[postgresql]] > + require => [Single_exec[postgres_add_all_trust], Service[postgresql]] > } > > postgres_execute_command {"ovirt_db_create_role": > @@ -67,7 +67,7 @@ class postgres::bundled{ > require => Postgres_execute_command[ovirt_db_create_role] > } > > - exec {"postgres_add_all_trust": > + single_exec {"postgres_add_all_trust": > command => "/bin/echo 'local all all trust' > /var/lib/pgsql/data/pg_hba.conf", > require => Single_exec[initialize_db], > notify => Service[postgresql] > @@ -75,13 +75,13 @@ class postgres::bundled{ > > exec {"postgres_add_localhost_trust": > command => "/bin/echo 'host all all 127.0.0.1 255.255.255.0 trust' >> /var/lib/pgsql/data/pg_hba.conf", > - require => Exec[postgres_add_all_trust], > + require => Single_exec[postgres_add_all_trust], > notify => Service[postgresql] > } > > exec {"postgres_add_ipv6_loopback_trust": > command => "/bin/echo 'host all all ::1/128 trust' >> /var/lib/pgsql/data/pg_hba.conf", > - require => Exec[postgres_add_all_trust], > + require => Single_exec[postgres_add_all_trust], > notify => Service[postgresql] > } > > acked by mmorsi, pushed From apevec at gmail.com Thu Sep 17 07:19:28 2009 From: apevec at gmail.com (Alan Pevec) Date: Thu, 17 Sep 2009 09:19:28 +0200 Subject: [Ovirt-devel] Links on website download section In-Reply-To: <200909161911.47829.laurent@open-minds.org> References: <200909151615.15810.laurent@open-minds.org> <200909161911.47829.laurent@open-minds.org> Message-ID: <2be7262f0909170019q58e711a8vd1980413395ca574@mail.gmail.com> 2009/9/16 Laurent L?onard > Le mardi 15 septembre 2009 ? 16:15, Laurent L?onard a ?crit : > > Hi, > > > > The links to oVirt Node ISO seems to be down on > > http://www.ovirt.org/download.html > > Hi, > > Download links are still down... I will probably package oVirt for Debian > but > first I want to test it. Where can I download the oVirt Node ISO ? > I'll have new official 1.0.2 node image uploaded today. re. Debian package - do you mean to build node-image using debs instead of rpms? Image building is heavily based on Fedora-ish features like kickstart and livecd-creator, this will be significant effort to port to equivalent Debian tools. I'd suggest you start first by packaging dependencies like qpid, qmf, libvirt-qpid, matahari... Same for the ovir-server side: get its dependencies into Debian first, see Requires: lines in ovirt-server.spec http://git.et.redhat.com/?p=ovirt-server.git;a=blob;f=ovirt-server.spec.in;hb=HEAD -------------- next part -------------- An HTML attachment was scrubbed... URL: From ignazio.cassano at provincia.torino.it Thu Sep 17 08:07:10 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Thu, 17 Sep 2009 10:07:10 +0200 Subject: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] In-Reply-To: <4AB10D4C.5010702@redhat.com> References: <4AB10090.7030902@redhat.com> <4AB10D4C.5010702@redhat.com> Message-ID: <20090917100710.d152vh9otjkss8gc@webmail.provincia.torino.it> Hello, I think the problem in the node. In the web interface it appears available and enabled and I connect connet to it. In the node details the following appears: UUID: 444sdsds'' etc etc .... Cpus: 0 Speed: Mhz Memory: 31913 MB: X86_64 Hypervisor Type: Qemu Architecture VMS: NiCS: Bondings: My node has 6 Nics and 8 CPU. It is Dell R610 (it supports Intel VT-d) If I try to edit node, I cannot configure any NIC. Is that Right ? ----- Messaggio da sseago at redhat.com --------- Data: Wed, 16 Sep 2009 12:07:40 -0400 Da: Scott Seago Rispondi-A:Scott Seago Oggetto: Re: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] A: Alan Pevec Cc: "ovirt-devel at redhat.com" > Alan Pevec wrote: >> Forwarding to the list for Jay or Scott to have a look. >> >> Ignazio, do you see any more details (traceback or something) in >> the rails log? >> > Unavailable action simply means that 'start vm' is not a valid action > for that VM right now. If you go to the details pane for the VM you'll > see that 'start' isn't in the actions list. What actions do appear > there? What are the 'state' and 'pending state' values shown on the > details pane? Is your host available (and showing up as available on > the HW pool's hosts tab)? > > Scott > > >> ------------------------------------------------------------------------ >> >> Subject: >> Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares >> From: >> ignazio.cassano at provincia.torino.it >> Date: >> Wed, 16 Sep 2009 16:48:47 +0200 >> To: >> Alan Pevec >> >> To: >> Alan Pevec >> >> >> >> Thank you Alan. >> Now my note appears available on ovirt web interface. >> I added a iscsi storage. >> When I try to start a virtual machine , web intervace reports: >> >> "unavailable action" >> >> ----- Messaggio da apevec at redhat.com --------- >> Data: Wed, 16 Sep 2009 12:23:11 +0200 >> Da: Alan Pevec >> Rispondi-A:Alan Pevec >> Oggetto: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares >> A: ignazio.cassano at provincia.torino.it >> >> >>> ignazio.cassano at provincia.torino.it wrote: >>>> Good Morning Alan, >>>> you email means I can rebuild ovirt and resolve my problem on >>>> Broadcom bnx2 ? >>> >>> Yes, I've just pushed the patch to 'next' git branch, pull it and >>> rebuild the node image. >>> >>> Thanks, >>> Alan >> >> >> ----- Fine del messaggio da apevec at redhat.com ----- >> >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Ovirt-devel mailing list >> Ovirt-devel at redhat.com >> https://www.redhat.com/mailman/listinfo/ovirt-devel >> > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel ----- Fine del messaggio da sseago at redhat.com ----- From ignazio.cassano at provincia.torino.it Thu Sep 17 08:40:47 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Thu, 17 Sep 2009 10:40:47 +0200 Subject: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] In-Reply-To: <4AB10D4C.5010702@redhat.com> References: <4AB10090.7030902@redhat.com> <4AB10D4C.5010702@redhat.com> Message-ID: <20090917104047.t1vmlrq1r3ocsog8@webmail.provincia.torino.it> Hello again, on the node in /var/log/messages I read: Sep 17 08:22:59 node215 libvirtd: 08:22:59.316: error : storageVolumeLookupByName:1096 : internal error storage pool is not active Sep 17 08:22:59 node215 libvirtd: 08:22:59.317: error : storageVolumeLookupByName:1096 : internal error storage pool is not active Sep 17 08:22:59 node215 libvirtd: 08:22:59.317: error : storageVolumeLookupByName:1096 : internal error storage pool is not active Sep 17 08:22:59 node215 libvirtd: 08:22:59.321: error : storageVolumeLookupByName:1096 : internal error storage pool is not active Sep 17 08:22:59 node215 libvirtd: 08:22:59.363: error : storagePoolGetInfo:860 : invalid storage pool pointer in no storage pool with matching uuid Sep 17 08:22:59 node215 libvirt-qpid: Error: PoolWrap: Unable to get info of storage pool Subsystem storage: invalid storage pool pointer in no storage pool with matching uuid in PoolWrap.cpp:update:244 code: 46 Sep 17 08:22:59 node215 libvirtd: 08:22:59.406: error : storagePoolLookupByUUID:273 : Storage pool not found: no pool with matching uuid ----- Messaggio da sseago at redhat.com --------- Data: Wed, 16 Sep 2009 12:07:40 -0400 Da: Scott Seago Rispondi-A:Scott Seago Oggetto: Re: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] A: Alan Pevec Cc: "ovirt-devel at redhat.com" > Alan Pevec wrote: >> Forwarding to the list for Jay or Scott to have a look. >> >> Ignazio, do you see any more details (traceback or something) in >> the rails log? >> > Unavailable action simply means that 'start vm' is not a valid action > for that VM right now. If you go to the details pane for the VM you'll > see that 'start' isn't in the actions list. What actions do appear > there? What are the 'state' and 'pending state' values shown on the > details pane? Is your host available (and showing up as available on > the HW pool's hosts tab)? > > Scott > > >> ------------------------------------------------------------------------ >> >> Subject: >> Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares >> From: >> ignazio.cassano at provincia.torino.it >> Date: >> Wed, 16 Sep 2009 16:48:47 +0200 >> To: >> Alan Pevec >> >> To: >> Alan Pevec >> >> >> >> Thank you Alan. >> Now my note appears available on ovirt web interface. >> I added a iscsi storage. >> When I try to start a virtual machine , web intervace reports: >> >> "unavailable action" >> >> ----- Messaggio da apevec at redhat.com --------- >> Data: Wed, 16 Sep 2009 12:23:11 +0200 >> Da: Alan Pevec >> Rispondi-A:Alan Pevec >> Oggetto: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares >> A: ignazio.cassano at provincia.torino.it >> >> >>> ignazio.cassano at provincia.torino.it wrote: >>>> Good Morning Alan, >>>> you email means I can rebuild ovirt and resolve my problem on >>>> Broadcom bnx2 ? >>> >>> Yes, I've just pushed the patch to 'next' git branch, pull it and >>> rebuild the node image. >>> >>> Thanks, >>> Alan >> >> >> ----- Fine del messaggio da apevec at redhat.com ----- >> >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Ovirt-devel mailing list >> Ovirt-devel at redhat.com >> https://www.redhat.com/mailman/listinfo/ovirt-devel >> > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel ----- Fine del messaggio da sseago at redhat.com ----- From apevec at redhat.com Thu Sep 17 09:26:15 2009 From: apevec at redhat.com (Alan Pevec) Date: Thu, 17 Sep 2009 11:26:15 +0200 Subject: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] In-Reply-To: <20090917100710.d152vh9otjkss8gc@webmail.provincia.torino.it> References: <4AB10090.7030902@redhat.com> <4AB10D4C.5010702@redhat.com> <20090917100710.d152vh9otjkss8gc@webmail.provincia.torino.it> Message-ID: <4AB200B7.8020905@redhat.com> ignazio.cassano at provincia.torino.it wrote: > UUID: 444sdsds'' etc etc .... > Cpus: 0 > Speed: Mhz > Memory: 31913 MB: X86_64 > Hypervisor Type: Qemu > Architecture > VMS: > NiCS: > Bondings: > > My node has 6 Nics and 8 CPU. It is Dell R610 (it supports Intel VT-d) That looks like matahari didn't report CPUs and NICs correctly, does restarting matahari service on the node fixes it? From ignazio.cassano at provincia.torino.it Thu Sep 17 09:34:02 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Thu, 17 Sep 2009 11:34:02 +0200 Subject: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] In-Reply-To: <4AB200B7.8020905@redhat.com> References: <4AB10090.7030902@redhat.com> <4AB10D4C.5010702@redhat.com> <20090917100710.d152vh9otjkss8gc@webmail.provincia.torino.it> <4AB200B7.8020905@redhat.com> Message-ID: <20090917113402.zxy3468ix9ss4kk8@webmail.provincia.torino.it> Yes, it solves. Now I am started the VM but I cannot connect on the console using "Open Terminal". A browser windows is opened with the error: "the requested url /terminal/vmname/ was not found on thi server ----- Messaggio da apevec at redhat.com --------- Data: Thu, 17 Sep 2009 11:26:15 +0200 Da: Alan Pevec Rispondi-A:Alan Pevec Oggetto: Re: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] A: ignazio.cassano at provincia.torino.it Cc: Scott Seago , "ovirt-devel at redhat.com" > ignazio.cassano at provincia.torino.it wrote: >> UUID: 444sdsds'' etc etc .... >> Cpus: 0 >> Speed: Mhz >> Memory: 31913 MB: X86_64 >> Hypervisor Type: Qemu >> Architecture >> VMS: >> NiCS: >> Bondings: >> >> My node has 6 Nics and 8 CPU. It is Dell R610 (it supports Intel VT-d) > > That looks like matahari didn't report CPUs and NICs correctly, does > restarting matahari service on the node fixes it? ----- Fine del messaggio da apevec at redhat.com ----- From ignazio.cassano at provincia.torino.it Thu Sep 17 09:42:48 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Thu, 17 Sep 2009 11:42:48 +0200 Subject: [Ovirt-devel] VM boot from iso ? Message-ID: <20090917114248.3h7y4za20rpcwscs@webmail.provincia.torino.it> Good morning, I need to know if it possible to install a virtual machine booting it from an iso file (like cd boot). Am I obbligate to use cobbler ? Thanks and Regards From ignazio.cassano at provincia.torino.it Thu Sep 17 10:34:55 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Thu, 17 Sep 2009 12:34:55 +0200 Subject: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] In-Reply-To: <4AB200B7.8020905@redhat.com> References: <4AB10090.7030902@redhat.com> <4AB10D4C.5010702@redhat.com> <20090917100710.d152vh9otjkss8gc@webmail.provincia.torino.it> <4AB200B7.8020905@redhat.com> Message-ID: <20090917123455.chjdy3y0trpws8gw@webmail.provincia.torino.it> Hello again, I discovered the vm fails to start because the following error is displayed in taskomatic.log: ERROR Thu Sep 17 12:30:17 +0200 2009 (2067) Task action processing failed: RuntimeError: Error creating virtual machine: Error: Error creating new domain (virDomainCreate). Subsystem qemu: internal error unable to start guest: bind(unix:/var/lib/libvirt/qemu/ovirt2.monitor): Permission denied taskomatic.log:qemu: could not open monitor device 'unix:/var/lib/libvirt/qemu/ovirt2.monitor,server,nowait' ----- Messaggio da apevec at redhat.com --------- Data: Thu, 17 Sep 2009 11:26:15 +0200 Da: Alan Pevec Rispondi-A:Alan Pevec Oggetto: Re: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] A: ignazio.cassano at provincia.torino.it Cc: Scott Seago , "ovirt-devel at redhat.com" > ignazio.cassano at provincia.torino.it wrote: >> UUID: 444sdsds'' etc etc .... >> Cpus: 0 >> Speed: Mhz >> Memory: 31913 MB: X86_64 >> Hypervisor Type: Qemu >> Architecture >> VMS: >> NiCS: >> Bondings: >> >> My node has 6 Nics and 8 CPU. It is Dell R610 (it supports Intel VT-d) > > That looks like matahari didn't report CPUs and NICs correctly, does > restarting matahari service on the node fixes it? ----- Fine del messaggio da apevec at redhat.com ----- From apevec at redhat.com Thu Sep 17 10:51:41 2009 From: apevec at redhat.com (Alan Pevec) Date: Thu, 17 Sep 2009 12:51:41 +0200 Subject: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] In-Reply-To: <20090917123455.chjdy3y0trpws8gw@webmail.provincia.torino.it> References: <4AB10090.7030902@redhat.com> <4AB10D4C.5010702@redhat.com> <20090917100710.d152vh9otjkss8gc@webmail.provincia.torino.it> <4AB200B7.8020905@redhat.com> <20090917123455.chjdy3y0trpws8gw@webmail.provincia.torino.it> Message-ID: <4AB214BD.6070003@redhat.com> ignazio.cassano at provincia.torino.it wrote: > Hello again, > I discovered the vm fails to start because the following error is displayed > in taskomatic.log: > ERROR Thu Sep 17 12:30:17 +0200 2009 (2067) Task action processing > failed: RuntimeError: Error creating virtual machine: Error: Error > creating new domain (virDomainCreate). Subsystem qemu: internal error > unable to start guest: bind(unix:/var/lib/libvirt/qemu/ovirt2.monitor): > Permission denied > taskomatic.log:qemu: could not open monitor device > 'unix:/var/lib/libvirt/qemu/ovirt2.monitor,server,nowait' Please check rpm -qi selinux-policy on the Node This selinux issue should be fixed by selinux-policy-3.6.12-82.1ovirt.fc11 which I've uploaded yesterday to ovirt.org repo From ignazio.cassano at provincia.torino.it Thu Sep 17 11:43:46 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Thu, 17 Sep 2009 13:43:46 +0200 Subject: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] In-Reply-To: <4AB214BD.6070003@redhat.com> References: <4AB10090.7030902@redhat.com> <4AB10D4C.5010702@redhat.com> <20090917100710.d152vh9otjkss8gc@webmail.provincia.torino.it> <4AB200B7.8020905@redhat.com> <20090917123455.chjdy3y0trpws8gw@webmail.provincia.torino.it> <4AB214BD.6070003@redhat.com> Message-ID: <20090917134346.50aifp4v6uiokckc@webmail.provincia.torino.it> OK Installing what you suggested the vm starts. "Remote Desktops" appears in detail but to connect I need a virt viewer plugin. Where can I download it ? ----- Messaggio da apevec at redhat.com --------- Data: Thu, 17 Sep 2009 12:51:41 +0200 Da: Alan Pevec Rispondi-A:Alan Pevec Oggetto: Re: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] A: ignazio.cassano at provincia.torino.it Cc: Scott Seago , "ovirt-devel at redhat.com" > ignazio.cassano at provincia.torino.it wrote: >> Hello again, >> I discovered the vm fails to start because the following error is displayed >> in taskomatic.log: >> ERROR Thu Sep 17 12:30:17 +0200 2009 (2067) Task action processing >> failed: RuntimeError: Error creating virtual machine: Error: Error >> creating new domain (virDomainCreate). Subsystem qemu: internal >> error unable to start guest: >> bind(unix:/var/lib/libvirt/qemu/ovirt2.monitor): Permission denied >> taskomatic.log:qemu: could not open monitor device >> 'unix:/var/lib/libvirt/qemu/ovirt2.monitor,server,nowait' > > Please check rpm -qi selinux-policy on the Node > This selinux issue should be fixed by > selinux-policy-3.6.12-82.1ovirt.fc11 which I've uploaded yesterday to > ovirt.org repo ----- Fine del messaggio da apevec at redhat.com ----- From jguiditt at redhat.com Thu Sep 17 13:07:30 2009 From: jguiditt at redhat.com (Jason Guiditta) Date: Thu, 17 Sep 2009 09:07:30 -0400 Subject: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] In-Reply-To: <20090917134346.50aifp4v6uiokckc@webmail.provincia.torino.it> References: <4AB10090.7030902@redhat.com> <4AB10D4C.5010702@redhat.com> <20090917100710.d152vh9otjkss8gc@webmail.provincia.torino.it> <4AB200B7.8020905@redhat.com> <20090917123455.chjdy3y0trpws8gw@webmail.provincia.torino.it> <4AB214BD.6070003@redhat.com> <20090917134346.50aifp4v6uiokckc@webmail.provincia.torino.it> Message-ID: <1253192850.3247.0.camel@lenovo> On Thu, 2009-09-17 at 13:43 +0200, ignazio.cassano at provincia.torino.it wrote: > OK > Installing what you suggested the vm starts. > "Remote Desktops" appears in detail but to connect I need a virt > viewer plugin. > Where can I download it ? you can yum install ovirt-viewer from the ovirt repo From jguiditt at redhat.com Thu Sep 17 13:10:20 2009 From: jguiditt at redhat.com (Jason Guiditta) Date: Thu, 17 Sep 2009 09:10:20 -0400 Subject: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] In-Reply-To: <4AB200B7.8020905@redhat.com> References: <4AB10090.7030902@redhat.com> <4AB10D4C.5010702@redhat.com> <20090917100710.d152vh9otjkss8gc@webmail.provincia.torino.it> <4AB200B7.8020905@redhat.com> Message-ID: <1253193020.3247.3.camel@lenovo> On Thu, 2009-09-17 at 11:26 +0200, Alan Pevec wrote: > ignazio.cassano at provincia.torino.it wrote: > > UUID: 444sdsds'' etc etc .... > > Cpus: 0 > > Speed: Mhz > > Memory: 31913 MB: X86_64 > > Hypervisor Type: Qemu > > Architecture > > VMS: > > NiCS: > > Bondings: > > > > My node has 6 Nics and 8 CPU. It is Dell R610 (it supports Intel VT-d) > > That looks like matahari didn't report CPUs and NICs correctly, does restarting matahari service on the node fixes it? Someone else hit the same thing on irc yesterday, we think it is a regression in qpid. Solution was being discussed when I signed off for the day, but the old workaround can be found here if you want to try reinstating it on your checkout: https://www.redhat.com/archives/ovirt-devel/2009-July/msg00331.html From ignazio.cassano at provincia.torino.it Thu Sep 17 13:22:05 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Thu, 17 Sep 2009 15:22:05 +0200 Subject: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] In-Reply-To: <1253193020.3247.3.camel@lenovo> References: <4AB10090.7030902@redhat.com> <4AB10D4C.5010702@redhat.com> <20090917100710.d152vh9otjkss8gc@webmail.provincia.torino.it> <4AB200B7.8020905@redhat.com> <1253193020.3247.3.camel@lenovo> Message-ID: <20090917152205.4lsa3r6y1dogcgcg@webmail.provincia.torino.it> Tnanks. Solved restarting matahari on node ----- Messaggio da jguiditt at redhat.com --------- Data: Thu, 17 Sep 2009 09:10:20 -0400 Da: Jason Guiditta Rispondi-A:Jason Guiditta Oggetto: Re: [Fwd: Re: [Ovirt-devel] [PATCH node-image] keep NIC and HBA firmwares] A: Alan Pevec Cc: ignazio.cassano at provincia.torino.it, "ovirt-devel at redhat.com" > On Thu, 2009-09-17 at 11:26 +0200, Alan Pevec wrote: >> ignazio.cassano at provincia.torino.it wrote: >> > UUID: 444sdsds'' etc etc .... >> > Cpus: 0 >> > Speed: Mhz >> > Memory: 31913 MB: X86_64 >> > Hypervisor Type: Qemu >> > Architecture >> > VMS: >> > NiCS: >> > Bondings: >> > >> > My node has 6 Nics and 8 CPU. It is Dell R610 (it supports Intel VT-d) >> >> That looks like matahari didn't report CPUs and NICs correctly, >> does restarting matahari service on the node fixes it? > Someone else hit the same thing on irc yesterday, we think it is a > regression in qpid. Solution was being discussed when I signed off for > the day, but the old workaround can be found here if you want to try > reinstating it on your checkout: > https://www.redhat.com/archives/ovirt-devel/2009-July/msg00331.html > > ----- Fine del messaggio da jguiditt at redhat.com ----- From dpierce at redhat.com Thu Sep 17 14:09:38 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 17 Sep 2009 10:09:38 -0400 Subject: [Ovirt-devel] Re: [PATCH node] Introduces the node-admin toolset. In-Reply-To: <4AB155EA.3090006@redhat.com> References: <1253107231-22460-1-git-send-email-dpierce@redhat.com> <1253107231-22460-2-git-send-email-dpierce@redhat.com> <4AB155EA.3090006@redhat.com> Message-ID: <20090917140938.GB5812@mcpierce-laptop.rdu.redhat.com> On Wed, Sep 16, 2009 at 11:17:30PM +0200, Alan Pevec wrote: > ACK > > as a followup patch, please add "Shell" option, if we want to use this as default root's shell Pushed. Thank you. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Virtual Machine Management - http://www.ovirt.org/ Is fearr Gaeilge bhriste n? B?arla cliste. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: From dpierce at redhat.com Thu Sep 17 14:12:41 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 17 Sep 2009 10:12:41 -0400 Subject: [Ovirt-devel] New push candidate with feedback from apevec... Message-ID: <1253196762-7933-1-git-send-email-dpierce@redhat.com> This patch removes the attempt at setting nodeadmin to be root's shell. From dpierce at redhat.com Thu Sep 17 14:12:42 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 17 Sep 2009 10:12:42 -0400 Subject: [Ovirt-devel] [PATCH node-image] Changed packages and dependencies so virt-manager-tui runs properly. In-Reply-To: <1253196762-7933-1-git-send-email-dpierce@redhat.com> References: <1253196762-7933-1-git-send-email-dpierce@redhat.com> Message-ID: <1253196762-7933-2-git-send-email-dpierce@redhat.com> Signed-off-by: Darryl L. Pierce --- common-blacklist.ks | 4 ++-- common-install.ks | 2 +- common-pkgs.ks | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common-blacklist.ks b/common-blacklist.ks index 39d4156..6a03f1f 100644 --- a/common-blacklist.ks +++ b/common-blacklist.ks @@ -8,14 +8,14 @@ echo "Removing excess RPMs" # However, this is just an install-time dependency; we can remove # it afterwards, which we do here RPMS="system-config-firewall-tui system-config-network-tui rhpl \ - rpm-python dbus-python kudzu newt-python newt libsemanage-python" + rpm-python kudzu libsemanage-python" RPMS="$RPMS kpartx mkinitrd isomd5sum dmraid checkpolicy" # Remove additional RPMs forcefully RPMS="$RPMS gamin pm-utils kbd usermode vbetool ConsoleKit hdparm \ efibootmgr linux-atm-libs fedora-release-notes \ - slang psmisc cryptsetup-luks pciutils mtools syslinux \ + psmisc cryptsetup-luks pciutils mtools syslinux \ wireless-tools radeontool libicu gnupg2 \ fedora-logos" diff --git a/common-install.ks b/common-install.ks index 2a7fbb7..9bcdaa3 100644 --- a/common-install.ks +++ b/common-install.ks @@ -4,7 +4,7 @@ timezone --utc UTC auth --useshadow --enablemd5 selinux --enforcing firewall --disabled -part / --size 600 --fstype ext2 +part / --size 650 --fstype ext2 services --enabled=auditd,ntpd,ntpdate,collectd,iptables,network,rsyslog,libvirt-qpid # This requires a new fixed version of livecd-creator to honor the --append settings. bootloader --timeout=30 --append="console=tty0 console=ttyS0,115200n8" diff --git a/common-pkgs.ks b/common-pkgs.ks index 6f0af6e..094e9cb 100644 --- a/common-pkgs.ks +++ b/common-pkgs.ks @@ -20,6 +20,7 @@ vim-minimal sudo python python-libs +python-setuptools db4 vconfig python-virtinst @@ -37,6 +38,7 @@ pciutils numactl file lsof +newt-python /usr/bin/kvmtrace #remove -audit-libs-python -- 1.6.2.5 From apevec at redhat.com Thu Sep 17 14:15:30 2009 From: apevec at redhat.com (Alan Pevec) Date: Thu, 17 Sep 2009 16:15:30 +0200 Subject: [Ovirt-devel] Re: [PATCH node-image] Changed packages and dependencies so virt-manager-tui runs properly. In-Reply-To: <1253196762-7933-2-git-send-email-dpierce@redhat.com> References: <1253196762-7933-1-git-send-email-dpierce@redhat.com> <1253196762-7933-2-git-send-email-dpierce@redhat.com> Message-ID: <4AB24482.7020009@redhat.com> ACK From ignazio.cassano at provincia.torino.it Thu Sep 17 14:26:59 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Thu, 17 Sep 2009 16:26:59 +0200 Subject: [Ovirt-devel] Ovirt web user mgmt Message-ID: <20090917162659.a1tnwhqeaobo8400@webmail.provincia.torino.it> Good morning, is it possible to assign passwords to users created by ovirt web management interface ? Thanks From ignazio.cassano at provincia.torino.it Thu Sep 17 14:34:26 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Thu, 17 Sep 2009 16:34:26 +0200 Subject: [Ovirt-devel] adding a user Message-ID: <20090917163426.kmmjbq7gvhe040kk@webmail.provincia.torino.it> Good morning, I' d like to know how add users to ovirt mgmt interface. Thanks From dpierce at redhat.com Thu Sep 17 15:05:10 2009 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 17 Sep 2009 11:05:10 -0400 Subject: [Ovirt-devel] Re: [PATCH node-image] Changed packages and dependencies so virt-manager-tui runs properly. In-Reply-To: <4AB24482.7020009@redhat.com> References: <1253196762-7933-1-git-send-email-dpierce@redhat.com> <1253196762-7933-2-git-send-email-dpierce@redhat.com> <4AB24482.7020009@redhat.com> Message-ID: <20090917150510.GC5812@mcpierce-laptop.rdu.redhat.com> On Thu, Sep 17, 2009 at 04:15:30PM +0200, Alan Pevec wrote: > ACK Thanks. This is pushed upstream. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Virtual Machine Management - http://www.ovirt.org/ Is fearr Gaeilge bhriste n? B?arla cliste. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: From dhuff at redhat.com Thu Sep 17 20:38:00 2009 From: dhuff at redhat.com (David Huff) Date: Thu, 17 Sep 2009 16:38:00 -0400 Subject: [Ovirt-devel] RFC: edit-livecd.py Message-ID: <4AB29E28.50407@redhat.com> This script replaces the existing script in ovirt-node-image to edit live cds. I am Looking for comments/feedback before I send to livecd-list for possible inclusion into Livecd-tools. -D -------------- next part -------------- A non-text attachment was scrubbed... Name: edit-livecd.py Type: text/x-python Size: 11863 bytes Desc: not available URL: From mmorsi at redhat.com Thu Sep 17 22:08:18 2009 From: mmorsi at redhat.com (Mohammed Morsi) Date: Thu, 17 Sep 2009 18:08:18 -0400 Subject: [Ovirt-devel] [PATCH server] oVirt server single network installer Message-ID: <1253225298-24068-1-git-send-email-mmorsi@redhat.com> Updates the installer to handle the scenario in which the guest and admin networks are the same by using an alternative httpd conf. Verified to work (eg oVirt managed vms are bootable) on the oVirt appliance so far. --- conf/ovirt-server.conf | 88 -------------------- installer/bin/ovirt-installer | 11 +-- installer/modules/ovirt/manifests/ovirt.pp | 29 ++----- .../ovirt/templates/ovirt-httpd-seperate.conf.erb | 88 ++++++++++++++++++++ .../ovirt/templates/ovirt-httpd-single.conf.erb | 77 +++++++++++++++++ ovirt-server.spec.in | 3 - 6 files changed, 178 insertions(+), 118 deletions(-) delete mode 100644 conf/ovirt-server.conf create mode 100644 installer/modules/ovirt/templates/ovirt-httpd-seperate.conf.erb create mode 100644 installer/modules/ovirt/templates/ovirt-httpd-single.conf.erb diff --git a/conf/ovirt-server.conf b/conf/ovirt-server.conf deleted file mode 100644 index e4ebd5b..0000000 --- a/conf/ovirt-server.conf +++ /dev/null @@ -1,88 +0,0 @@ -NameVirtualHost GuestNetIpAddress:80 - - - RewriteEngine on - RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L] - - - -NameVirtualHost GuestNetIpAddress:443 -NameVirtualHost AdminNetIpAddress:80 - - - - NSSEngine on - NSSCipherSuite +rsa_rc4_128_md5,+rsa_rc4_128_sha,+rsa_3des_sha,-rsa_des_sha,-rsa_rc4_40_md5,-rsa_rc2_40_md5,-rsa_null_md5,-rsa_null_sha,+fips_3des_sha,-fips_des_sha,-fortezza,-fortezza_rc4_128_sha,-fortezza_null,-rsa_des_56_sha,-rsa_rc4_56_sha,+rsa_aes_128_sha,+rsa_aes_256_sha - NSSProtocol SSLv3,TLSv1 - NSSNickname Server-Cert - NSSCertificateDatabase /etc/httpd/alias - - ErrorLog /etc/httpd/logs/error_log - TransferLog /etc/httpd/logs/access_log - LogLevel warn - - RewriteEngine On - RewriteMap vmnodes prg:/usr/bin/ovirt-vm2node - RewriteRule ^/terminal/(.+)/anyterm-module$ http://${vmnodes:$1}:81/anyterm-module [P] - RewriteRule ^/terminal/(.+)/(.*\.(html|js|css|gif))*$ http://127.0.0.1/terminal/$2 [P,NE] - - ProxyPass /ovirt http://AdminNodeFQDN/ovirt retry=3 - ProxyPassReverse /ovirt http://AdminNodeFQDN/ovirt - - - - - ServerAlias AdminNodeFQDN - ServerName AdminNodeFQDN:80 - - ErrorLog /etc/httpd/logs/error_log - TransferLog /etc/httpd/logs/access_log - LogLevel warn - - ProxyRequests Off - - - AuthType Kerberos - AuthName "Kerberos Login" - KrbMethodNegotiate on - KrbMethodK5Passwd on - KrbServiceName HTTP - Krb5KeyTab /etc/httpd/conf/ipa.keytab - KrbSaveCredentials on - Require valid-user - ErrorDocument 401 /ovirt/errors/401.html - ErrorDocument 404 /ovirt/errors/404.html - ErrorDocument 500 /ovirt/errors/500.html - RewriteEngine on - Order deny,allow - Allow from all - - # We create a subrequest to find REMOTE_USER. Don't do this for every - # subrequest too (slow and huge logs result) - RewriteCond %{IS_SUBREQ}% false - RewriteRule .* - [E=RU:%{LA-U:REMOTE_USER}] - RequestHeader set X-Forwarded-User %{RU}e - RequestHeader set X-Forwarded-Keytab %{KRB5CCNAME}e - - # RequestHeader unset Authorization - - -Alias /ovirt/stylesheets "/usr/share/ovirt-server/public/stylesheets" -Alias /ovirt/images "/usr/share/ovirt-server/public/images" -Alias /ovirt/errors "/usr/share/ovirt-server/public/" - -ProxyPass /ovirt/images ! -ProxyPass /ovirt/stylesheets ! -ProxyPass /ovirt/errors ! -ProxyPass /ovirt http://localhost:3000/ovirt -ProxyPassReverse /ovirt http://localhost:3000/ovirt -ProxyPassReverse /ovirt/images ! -ProxyPassReverse /ovirt/stylesheets ! -ProxyPassReverse /ovirt/errors ! - - - -Alias /terminal /usr/share/ovirt-anyterm - - DirectoryIndex anyterm.html - diff --git a/installer/bin/ovirt-installer b/installer/bin/ovirt-installer index a38ea83..5d6350f 100755 --- a/installer/bin/ovirt-installer +++ b/installer/bin/ovirt-installer @@ -172,13 +172,11 @@ else end end -guest_httpd_dev = prompt_for_interface("Enter the interface for the Guest network:", interfaces, :default => "eth0") +guest_dev = prompt_for_interface("Enter the interface for the Guest network:", interfaces, :default => "eth0") admin_dev = prompt_for_interface("Enter the interface for the Admin network (this may be the same as the Guest network interface):", interfaces, :default => "eth0") -#FIXME: correctly configure separate networks. -#For now, define admin and guest networks to be the same -guest_dev = admin_dev -#sep_networks = (guest_dev == admin_dev) ? "n" : "y" +# different scenarios for 1 & 2 networks +seperate_networks = (guest_dev == admin_dev) ? "n" : "y" ovirt_host = prompt_for_answer("Enter the hostname of the oVirt management server (example: management.example.com):", :regex => IP_OR_FQDN) ipa_host = ovirt_host @@ -193,7 +191,6 @@ File.open('/etc/resolv.conf').each_line{ |line| otherwise select \"n\" and a dns server will be configured during the install', RED) %>") dns_servers = prompt_yes_no("Use this systems's dns servers?") -guest_httpd_ipaddr = interfaces[guest_httpd_dev] guest_ipaddr = interfaces[guest_dev] admin_ipaddr = interfaces[admin_dev] @@ -276,9 +273,9 @@ firewall::setup{'setup': firewall_rule{"ssh": destination_port => "22"} #DNS Configuration -$guest_httpd_ipaddr = '<%= guest_httpd_ipaddr %>' $guest_ipaddr = '<%= guest_ipaddr %>' $admin_ipaddr = '<%= admin_ipaddr %>' +$seperate_networks = '<%= seperate_networks %>' $ovirt_host = '<%= ovirt_host %>' $ipa_host = '<%= ipa_host %>' diff --git a/installer/modules/ovirt/manifests/ovirt.pp b/installer/modules/ovirt/manifests/ovirt.pp index b018a00..18a14c9 100644 --- a/installer/modules/ovirt/manifests/ovirt.pp +++ b/installer/modules/ovirt/manifests/ovirt.pp @@ -20,26 +20,15 @@ class ovirt::setup { - file_replacement{"ovirt_httpd_config_change_guest_net": - file => "/etc/httpd/conf.d/ovirt-server.conf", - pattern => "GuestNetIpAddress", - replacement => "$guest_httpd_ipaddr", - require => Package[ovirt-server] - } - - file_replacement{"ovirt_httpd_config_change_admin_net": - file => "/etc/httpd/conf.d/ovirt-server.conf", - pattern => "AdminNetIpAddress", - replacement => "$admin_ipaddr", - require => Package[ovirt-server] - } - - file_replacement{"ovirt_httpd_config_change_server_fqdn": - file => "/etc/httpd/conf.d/ovirt-server.conf", - pattern => "AdminNodeFQDN", - replacement => "$ovirt_host", - require => Package[ovirt-server] - } + file {"/etc/httpd/conf.d/ovirt-server.conf": + content => $seperate_networks ? { + y => template("ovirt/ovirt-httpd-seperate.conf.erb"), + n => template("ovirt/ovirt-httpd-single.conf.erb") + }, + mode => 644, + notify => Service[httpd], + require => [Package[ovirt-server], Package[httpd]] + } package {"ovirt-server": ensure => installed, diff --git a/installer/modules/ovirt/templates/ovirt-httpd-seperate.conf.erb b/installer/modules/ovirt/templates/ovirt-httpd-seperate.conf.erb new file mode 100644 index 0000000..f91016e --- /dev/null +++ b/installer/modules/ovirt/templates/ovirt-httpd-seperate.conf.erb @@ -0,0 +1,88 @@ +NameVirtualHost <%= guest_ipaddr %>:80 +:80> + + RewriteEngine on + RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L] + + + +NameVirtualHost <%= guest_ipaddr %>:443 +NameVirtualHost <%= admin_ipaddr %>:80 + +:443> + + NSSEngine on + NSSCipherSuite +rsa_rc4_128_md5,+rsa_rc4_128_sha,+rsa_3des_sha,-rsa_des_sha,-rsa_rc4_40_md5,-rsa_rc2_40_md5,-rsa_null_md5,-rsa_null_sha,+fips_3des_sha,-fips_des_sha,-fortezza,-fortezza_rc4_128_sha,-fortezza_null,-rsa_des_56_sha,-rsa_rc4_56_sha,+rsa_aes_128_sha,+rsa_aes_256_sha + NSSProtocol SSLv3,TLSv1 + NSSNickname Server-Cert + NSSCertificateDatabase /etc/httpd/alias + + ErrorLog /etc/httpd/logs/error_log + TransferLog /etc/httpd/logs/access_log + LogLevel warn + + RewriteEngine On + RewriteMap vmnodes prg:/usr/bin/ovirt-vm2node + RewriteRule ^/terminal/(.+)/anyterm-module$ http://${vmnodes:$1}:81/anyterm-module [P] + RewriteRule ^/terminal/(.+)/(.*\.(html|js|css|gif))*$ http://127.0.0.1/terminal/$2 [P,NE] + + ProxyPass /ovirt http://<%= ovirt_host %>/ovirt retry=3 + ProxyPassReverse /ovirt http://<%= ovirt_host %>/ovirt + + +:80> + + ServerAlias <%= ovirt_host %> + ServerName <%= ovirt_host %>:80 + + ErrorLog /etc/httpd/logs/error_log + TransferLog /etc/httpd/logs/access_log + LogLevel warn + + ProxyRequests Off + + + AuthType Kerberos + AuthName "Kerberos Login" + KrbMethodNegotiate on + KrbMethodK5Passwd on + KrbServiceName HTTP + Krb5KeyTab /etc/httpd/conf/ipa.keytab + KrbSaveCredentials on + Require valid-user + ErrorDocument 401 /ovirt/errors/401.html + ErrorDocument 404 /ovirt/errors/404.html + ErrorDocument 500 /ovirt/errors/500.html + RewriteEngine on + Order deny,allow + Allow from all + + # We create a subrequest to find REMOTE_USER. Don't do this for every + # subrequest too (slow and huge logs result) + RewriteCond %{IS_SUBREQ}% false + RewriteRule .* - [E=RU:%{LA-U:REMOTE_USER}] + RequestHeader set X-Forwarded-User %{RU}e + RequestHeader set X-Forwarded-Keytab %{KRB5CCNAME}e + + # RequestHeader unset Authorization + + +Alias /ovirt/stylesheets "/usr/share/ovirt-server/public/stylesheets" +Alias /ovirt/images "/usr/share/ovirt-server/public/images" +Alias /ovirt/errors "/usr/share/ovirt-server/public/" + +ProxyPass /ovirt/images ! +ProxyPass /ovirt/stylesheets ! +ProxyPass /ovirt/errors ! +ProxyPass /ovirt http://localhost:3000/ovirt +ProxyPassReverse /ovirt http://localhost:3000/ovirt +ProxyPassReverse /ovirt/images ! +ProxyPassReverse /ovirt/stylesheets ! +ProxyPassReverse /ovirt/errors ! + + + +Alias /terminal /usr/share/ovirt-anyterm + + DirectoryIndex anyterm.html + diff --git a/installer/modules/ovirt/templates/ovirt-httpd-single.conf.erb b/installer/modules/ovirt/templates/ovirt-httpd-single.conf.erb new file mode 100644 index 0000000..47cc606 --- /dev/null +++ b/installer/modules/ovirt/templates/ovirt-httpd-single.conf.erb @@ -0,0 +1,77 @@ +NameVirtualHost <%= guest_ipaddr %>:80 +:80> + + RewriteEngine on + RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L] + + + +NameVirtualHost <%= guest_ipaddr %>:443 + +:443> + + ProxyRequests Off + + ServerAlias <%= ovirt_host %> + ServerName <%= ovirt_host %>:443 + + NSSEngine on + NSSCipherSuite +rsa_rc4_128_md5,+rsa_rc4_128_sha,+rsa_3des_sha,-rsa_des_sha,-rsa_rc4_40_md5,-rsa_rc2_40_md5,-rsa_null_md5,-rsa_null_sha,+fips_3des_sha,-fips_des_sha,-fortezza,-fortezza_rc4_128_sha,-fortezza_null,-rsa_des_56_sha,-rsa_rc4_56_sha,+rsa_aes_128_sha,+rsa_aes_256_sha + NSSProtocol SSLv3,TLSv1 + NSSNickname Server-Cert + NSSCertificateDatabase /etc/httpd/alias + + ErrorLog /etc/httpd/logs/error_log + TransferLog /etc/httpd/logs/access_log + LogLevel debug + + RewriteEngine On + RewriteMap vmnodes prg:/usr/bin/ovirt-vm2node + RewriteRule ^/terminal/(.+)/anyterm-module$ http://${vmnodes:$1}:81/anyterm-module [P] + RewriteRule ^/terminal/(.+)/(.*\.(html|js|css|gif))*$ http://127.0.0.1/terminal/$2 [P,NE] + + + AuthType Kerberos + AuthName "Kerberos Login" + KrbMethodNegotiate on + KrbMethodK5Passwd on + KrbServiceName HTTP + Krb5KeyTab /etc/httpd/conf/ipa.keytab + KrbSaveCredentials on + Require valid-user + ErrorDocument 401 /ovirt/errors/401.html + ErrorDocument 404 /ovirt/errors/404.html + ErrorDocument 500 /ovirt/errors/500.html + RewriteEngine on + Order deny,allow + Allow from all + + # We create a subrequest to find REMOTE_USER. Don't do this for every + # subrequest too (slow and huge logs result) + RewriteCond %{IS_SUBREQ}% false + RewriteRule .* - [E=RU:%{LA-U:REMOTE_USER}] + RequestHeader set X-Forwarded-User %{RU}e + RequestHeader set X-Forwarded-Keytab %{KRB5CCNAME}e + + # RequestHeader unset Authorization + + + Alias /ovirt/stylesheets "/usr/share/ovirt-server/public/stylesheets" + Alias /ovirt/images "/usr/share/ovirt-server/public/images" + Alias /ovirt/errors "/usr/share/ovirt-server/public/" + + ProxyPass /ovirt/images ! + ProxyPass /ovirt/stylesheets ! + ProxyPass /ovirt/errors ! + ProxyPass /ovirt http://localhost:3000/ovirt + ProxyPassReverse /ovirt http://localhost:3000/ovirt + ProxyPassReverse /ovirt/images ! + ProxyPassReverse /ovirt/stylesheets ! + ProxyPassReverse /ovirt/errors ! + + + +Alias /terminal /usr/share/ovirt-anyterm + + DirectoryIndex anyterm.html + diff --git a/ovirt-server.spec.in b/ovirt-server.spec.in index 0715690..ad5ace1 100644 --- a/ovirt-server.spec.in +++ b/ovirt-server.spec.in @@ -86,7 +86,6 @@ mkdir %{buildroot} %{__install} -d -m0755 %{buildroot}%{_sbindir} %{__install} -d -m0755 %{buildroot}%{_initrddir} %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/sysconfig -%{__install} -d -m0755 %{buildroot}%{_sysconfdir}/httpd/conf.d %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/%{name} %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/%{name}/db %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/logrotate.d @@ -105,7 +104,6 @@ touch %{buildroot}%{_localstatedir}/log/%{name}/mongrel.log touch %{buildroot}%{_localstatedir}/log/%{name}/rails.log touch %{buildroot}%{_localstatedir}/log/%{name}/taskomatic.log touch %{buildroot}%{_localstatedir}/log/%{name}/db-omatic.log -%{__install} -p -m0644 %{pbuild}/conf/%{name}.conf %{buildroot}%{_sysconfdir}/httpd/conf.d %{__install} -p -m0644 %{pbuild}/conf/%{name}.crontab %{buildroot}%{_sysconfdir}/cron.d/%{name} %{__install} -p -m0644 %{pbuild}/conf/%{name}.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name} @@ -240,7 +238,6 @@ fi %config(noreplace) %{_sysconfdir}/sysconfig/ovirt-mongrel-rails %config(noreplace) %{_sysconfdir}/sysconfig/ovirt-rails %config(noreplace) %{_sysconfdir}/sysconfig/ovirt-vnc-proxy -%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf %doc README AUTHORS COPYING %attr(-, ovirt, ovirt) %{_localstatedir}/lib/%{name} %attr(-, ovirt, ovirt) %{_localstatedir}/run/%{name} -- 1.6.0.6 From apevec at redhat.com Thu Sep 17 22:44:08 2009 From: apevec at redhat.com (Alan Pevec) Date: Fri, 18 Sep 2009 00:44:08 +0200 Subject: [Ovirt-devel] [PATCH node-image] enable NFS for storing libvirt image Message-ID: <1253227448-12416-1-git-send-email-apevec@redhat.com> turn on SELinux boolean virt_use_nfs --- common-post.ks | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/common-post.ks b/common-post.ks index 0c0a3f4..688ba9d 100644 --- a/common-post.ks +++ b/common-post.ks @@ -132,6 +132,11 @@ chmod 700 /root/.ssh # fix iSCSI/LVM startup issue sed -i 's/node\.session\.initial_login_retry_max.*/node.session.initial_login_retry_max = 60/' /etc/iscsi/iscsid.conf +# enable NFS for storing libvirt image +cat >> /etc/rc.d/rc.local <> /root/.bashrc < References: <200909151615.15810.laurent@open-minds.org> <200909161911.47829.laurent@open-minds.org> <2be7262f0909170019q58e711a8vd1980413395ca574@mail.gmail.com> Message-ID: <2be7262f0909171629md7e4e80u4bbf83de0d757523@mail.gmail.com> 2009/9/17 Alan Pevec > > 2009/9/16 Laurent L?onard >> >> Le mardi 15 septembre 2009 ? 16:15, Laurent L?onard a ?crit?: >> > Hi, >> > >> > The links to oVirt Node ISO seems to be down on >> > http://www.ovirt.org/download.html >> >> Hi, >> >> Download links are still down... I will probably package oVirt for Debian but >> first I want to test it. Where can I download the oVirt Node ISO ? > ovirt-node-image-1.0.2-1.fc11.x86_64.iso uploaded and links on the download page updated. I've also uploaded F11 ovirt-server build (http://koji.fedoraproject.org/koji/buildinfo?buildID=126875) to ovirt.org repo, so that --enablerepo=rawhide (which might pull in more than just ovirt-server) is not needed. You need to have /etc/yum.repos.d/ovirt.repo and run yum with --enablerepo=ovirt instead. Alan From jguiditt at redhat.com Fri Sep 18 14:44:15 2009 From: jguiditt at redhat.com (Jason Guiditta) Date: Fri, 18 Sep 2009 10:44:15 -0400 Subject: [Ovirt-devel] adding a user In-Reply-To: <20090917163426.kmmjbq7gvhe040kk@webmail.provincia.torino.it> References: <20090917163426.kmmjbq7gvhe040kk@webmail.provincia.torino.it> Message-ID: <1253285055.3242.5.camel@lenovo> On Thu, 2009-09-17 at 16:34 +0200, ignazio.cassano at provincia.torino.it wrote: > Good morning, > I' d like to know how add users to ovirt mgmt interface. > Thanks Users are not created directly w/in the ovirt wui, they are managed by ipa, so you would add them there with ipa-adduser command. Then in oVirt, you can assign them to whatever pools you like (logged in as a user who can do this, of course- ovirtadmin in default install). There have been sporadic synching issues with openldap (what we use to talk to freeipa), so if the user doesnt show up in ui, you may need to restart the webapp. -j From jboggs at redhat.com Fri Sep 18 16:16:12 2009 From: jboggs at redhat.com (Joey Boggs) Date: Fri, 18 Sep 2009 12:16:12 -0400 Subject: [Ovirt-devel] Re: [PATCH node-image] readonly rootfs setup In-Reply-To: <1251825414-2229-1-git-send-email-jboggs@redhat.com> References: <1251825414-2229-1-git-send-email-jboggs@redhat.com> Message-ID: <4AB3B24C.5060502@redhat.com> Joey Boggs wrote: > This completes the read only rootfs, all needed writable directories are in the tmpfs. > > Signed-off-by: Joey Boggs > --- > common-post.ks | 12 ++++++++++++ > ovirt-node-image.ks | 1 + > 2 files changed, 13 insertions(+), 0 deletions(-) > > diff --git a/common-post.ks b/common-post.ks > index 0c0a3f4..44a0270 100644 > --- a/common-post.ks > +++ b/common-post.ks > @@ -146,3 +146,15 @@ EOF > # Remove the default logrotate daily cron job > # since we run it every 10 minutes instead. > rm -f /etc/cron.daily/logrotate > + > +# comment out /etc/* entries in rwtab to prevent overlapping mounts > +sed -i '/^files \/etc*/ s/^/#/' /etc/rwtab > +cat > /etc/rwtab.d/ovirt < +files /etc > +files /var/cache/libvirt > +files /var/cache/hald > +files /var/empty/sshd/etc/localtime > +files /var/lib/dbus > +files /var/lib/libvirt > +empty /mnt > +EOF > diff --git a/ovirt-node-image.ks b/ovirt-node-image.ks > index 802b6a5..6b9e2ac 100644 > --- a/ovirt-node-image.ks > +++ b/ovirt-node-image.ks > @@ -19,6 +19,7 @@ augtool <<\EOF > set /files/etc/sysconfig/readonly-root/TEMPORARY_STATE NOT_OVIRT_FIRSTBOOT > set /files/etc/sysconfig/readonly-root/STATE_LABEL CONFIG > set /files/etc/sysconfig/readonly-root/STATE_MOUNT /config > +set /files/etc/sysconfig/readonly-root/READONLY yes > save > EOF > # use persistent state unless firstboot is forced > pushed per pmyers/apevec From jboggs at redhat.com Mon Sep 21 00:46:23 2009 From: jboggs at redhat.com (Joey Boggs) Date: Sun, 20 Sep 2009 20:46:23 -0400 Subject: [Ovirt-devel] RFC: edit-livecd.py In-Reply-To: <4AB29E28.50407@redhat.com> References: <4AB29E28.50407@redhat.com> Message-ID: <4AB6CCDF.9000307@redhat.com> David Huff wrote: > This script replaces the existing script in ovirt-node-image to edit > live cds. I am Looking for comments/feedback before I send to > livecd-list for possible inclusion into Livecd-tools. > > -D > > ------------------------------------------------------------------------ > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel Need to add a default for the --output option otherwise you'll run into this error. Traceback (most recent call last): File "edit-livecd.py", line 320, in sys.exit(main()) File "edit-livecd.py", line 309, in main editor.package(options.output) File "/usr/lib/python2.6/site-packages/imgcreate/creator.py", line 761, in package os.path.join(destdir, f)) File "/usr/lib64/python2.6/posixpath.py", line 67, in join elif path == '' or path.endswith('/'): AttributeError: 'NoneType' object has no attribute 'endswith' From ignazio.cassano at provincia.torino.it Tue Sep 22 09:46:44 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Tue, 22 Sep 2009 11:46:44 +0200 Subject: [Ovirt-devel] node resources are not reported Message-ID: <20090922114644.wwujbpl8kgmww884@webmail.provincia.torino.it> Good morning, I have just built ovirt on fedora 11. No error are displayed during installation. I booted a phisical node and it appears on the web interface as enabled and available but resources (CPUS, NICS etc) are not reported. I restarted matahari daemon on the node but resources don't appear in any case. How can I solve the above issue ? Another question ... When node boots up it creates automatically a bridge on admin network. On my node I have also a network interface on storage network and a network interface on guest network. How can I configure interface on storage network (I thing I must assign am ip address to it etc etc)? Many thanks & Regards Ignazio From ignazio.cassano at provincia.torino.it Tue Sep 22 13:38:33 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Tue, 22 Sep 2009 15:38:33 +0200 Subject: [Ovirt-devel] ovirt node 1.0.3 nfs error Message-ID: <20090922153833.8bdynqysboao4kkc@webmail.provincia.torino.it> Good Morning, I have successfully deployed Ovirt manager and 1 node (1.03 version). All networks interfaces work fine. When I try to configure a NFS storage, the web interface gives a timeout agent error and on the node in /var/log/messages I read the following lines: FATAL: Error inserting nfsd (/lib/modules/2.6.30.5-43.fc11.x86_64/kernel/fs/nfsd/nfsd.ko): Unknown symbol in module, or unknown parameter (see dmesg) FATAL: Error running install command for nfsd Starting NFS services: exportfs: can't open /var/lib/nfs/rmtab for reading in dmesg: nfsd: Unknown symbol exportfs_decode_fh nfsd: Unknown symbol exportfs_encode_fh nfsd: Unknown symbol exportfs_decode_fh nfsd: Unknown symbol exportfs_encode_fh From ignazio.cassano at provincia.torino.it Tue Sep 22 15:09:17 2009 From: ignazio.cassano at provincia.torino.it (ignazio.cassano at provincia.torino.it) Date: Tue, 22 Sep 2009 17:09:17 +0200 Subject: [Ovirt-devel] ovirt node 1.0.3 iscsi errors Message-ID: <20090922170917.46ivtr8esdfk08kw@webmail.provincia.torino.it> Good Morning, I have successfully deployed Ovirt manager and 1 node (1.03 version). All networks interfaces work fine. I configure an ISCSI storage . When I start a VM on the web management interface displays the following error: Unable to find volume /dev/disk/by-id/iscsi-12939393 ecc ecc I logged on the node and the path is present and it is a link to a valid iscsi disk. From jim at meyering.net Tue Sep 22 15:24:36 2009 From: jim at meyering.net (Jim Meyering) Date: Tue, 22 Sep 2009 17:24:36 +0200 Subject: [Ovirt-devel] new git hook to be installed Message-ID: <87bpl3ator.fsf@meyering.net> We've all wanted to be able to tweak a few server-side settings, without having to find/ask/wait for someone do something manually on the server. With this change to ovirt's "update" hook, you can now do just that by pushing a specially formed tag to the remote repository. (once this hook is installed) If that tag meets several criteria, the "update" hook will run the command you choose. Of course, security is important here. We don't allow arbitrary commands, but only those specified explicitly by some server repository administrator. See the examples in the comments below. >From f9c6f5c09c963392d0e04fa626ad7255ad4be734 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 22 Sep 2009 17:17:24 +0200 Subject: [PATCH release] update hook: allow people to change server-side git config --- git-hook/update | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 59 insertions(+), 0 deletions(-) diff --git a/git-hook/update b/git-hook/update index ed76bd2..f98a403 100755 --- a/git-hook/update +++ b/git-hook/update @@ -41,6 +41,45 @@ # When this boolean is true, you may not push a merge commit to BRANCH_NAME. # By default, you may. # +# --------------------------------------------------------------------- +# Allow people to change server-side git config in very specific ways. +# To enable this, on the server, you must do something like the following, +# +# git config hooks.server.config-changing.valid-commands \ +# 'git config hooks.allowbadwhitespace true +# git config hooks.allowbadwhitespace false +# git config hooks.denypush.branch.master master-branch-owner at example.com +# git config --unset hooks.denypush.branch.master' +# +# where the git config variable, hooks.server.config-changing.valid-commands, +# contains the list of commands that are allowed, one per line. +# +# CAUTION: nothing about this hook code enforces the restriction that +# only "git config ..." commands be run automatically. +# That restriction comes solely from the list above. +# +# Then, when someone with a cloned repository wants to make the hook +# run one of those commands *on* *the* *server*, that user must push +# a tag whose name starts with "git-control-" and whose one-line message +# matches exactly one of the listed commands. +# +# For example, to temporarily allow someone to push a bad-whitespace +# commit, with the settings implied above, you might do this: +# +# first_commit=$(git log --reverse --pretty=%H |head -1) +# git tag -m 'git config hooks.allowbadwhitespace true' \ +# git-control-$(date +%F-%H-%M-%S.%N) $first_commit +# +# Note that we're not tagging HEAD, but rather the very first commit +# in the repository, in an attempt not to clutter up gitk/gitweb +# displays with these rarely-interesting tag names. +# +# Then, to reenable that hook, do this (nearly the same, except s/true/false/): +# +# first_commit=$(git log --reverse --pretty=%H |head -1) +# git tag -m 'git config hooks.allowbadwhitespace false' \ +# git-control-$(date +%F-%H-%M-%S.%N) $first_commit +# --------------------------------------------------------------------- # --- Command line refname="$1" @@ -109,6 +148,26 @@ case "$refname","$newrev_type" in fi ;; refs/tags/*,tag) + case $refname in + refs/tags/git-control-*) + cmd=$(git cat-file -p $newrev|tail -n+6) + git config hooks.server.config-changing.valid-commands | + (while read v_cmd; do + if test "x$cmd" = "x$v_cmd"; then + echo Running cmd: "$v_cmd" + eval "$v_cmd" + match=1 + exit 0 # found a match + fi + done + exit 1 # signal failure to match + ) + if test $? = 1; then + echo "*** unrecognized directive: $cmd" >&2 + exit 1 + fi + ;; + esac # annotated tag if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 then -- 1.6.5.rc1.220.g6de7f From jim at meyering.net Tue Sep 22 16:16:39 2009 From: jim at meyering.net (Jim Meyering) Date: Tue, 22 Sep 2009 18:16:39 +0200 Subject: [Ovirt-devel] new git hook to be installed In-Reply-To: <87bpl3ator.fsf@meyering.net> (Jim Meyering's message of "Tue, 22 Sep 2009 17:24:36 +0200") References: <87bpl3ator.fsf@meyering.net> Message-ID: <8763bbara0.fsf@meyering.net> Jim Meyering wrote: > We've all wanted to be able to tweak a few server-side settings, > without having to find/ask/wait for someone do something manually > on the server. With this change to ovirt's "update" hook, > you can now do just that by pushing a specially formed tag to > the remote repository. (once this hook is installed) If that tag meets > several criteria, the "update" hook will run the command you choose. > > Of course, security is important here. We don't allow arbitrary > commands, but only those specified explicitly by some server > repository administrator. See the examples in the comments below. ... > Date: Tue, 22 Sep 2009 17:17:24 +0200 > Subject: [PATCH release] update hook: allow people to change server-side git config FYI, here's the script I used to test this: (depends on having "update" or similar named update-hook in the current directory) #!/bin/bash # a git hook that will modify server-side config mkdir .j (cd .j git init git config hooks.server.config-changing.valid-commands \ 'git config hooks.allowbadwhitespace true git config hooks.allowbadwhitespace false git config hooks.denypush.branch.master master-branch-owner at example.com git config --unset hooks.denypush.branch.master' touch k git add k git commit -m. -a git config core.bare true echo foo > .git/description cp -a ../update-hook .git/hooks/update ) lock_cmd='git config hooks.denypush.branch.master master-branch-owner at example.com' unlock_cmd='git config --unset hooks.denypush.branch.master' server_config_change() { cmd=$1 first_commit=$(git log --reverse --pretty=%H |head -1) tag_name=git-control-$(date +%F-%H-%M-%S.%N) git tag -m "$cmd" $tag_name $first_commit git push origin tag $tag_name } lock_repo() { server_config_change "$lock_cmd"; } unlock_repo() { server_config_change "$unlock_cmd"; } git clone .j .j2 (cd .j2 first_commit=$(git log --reverse --pretty=%H |head -1) echo a >> k; git commit -m'log msg 1 *************' -a lock_repo echo a >> k; git commit -m'log msg 2 *************' -a unlock_repo git checkout -b br echo on-branch >> k; git commit -m'log msg on-br *********' -a lock_repo git push --tags git push --all ) From mmorsi at redhat.com Tue Sep 22 16:31:45 2009 From: mmorsi at redhat.com (Mohammed Morsi) Date: Tue, 22 Sep 2009 12:31:45 -0400 Subject: [Ovirt-devel] [PATCH server] small formatting fix to host details pane Message-ID: <1253637105-8018-1-git-send-email-mmorsi@redhat.com> currently host detail pane labels / data fields are not matched correctly and nics/bondings/vms shouldn't appear on multiple lines. fixes this. --- src/app/views/host/show.rhtml | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/views/host/show.rhtml b/src/app/views/host/show.rhtml index ddc6481..49ac4c1 100644 --- a/src/app/views/host/show.rhtml +++ b/src/app/views/host/show.rhtml @@ -62,13 +62,13 @@ <%=h @host.arch %>
<%=h @host.hypervisor_type %>
<%=h @host.status_str %>
+ <%= @host.vms.collect{|x| x.uuid }.join(" ") %>
<%= @host.nics.collect{ |n| n.interface_name.to_s + " " + n.mac + (n.network.nil? ? "" : " " + n.network.name) - }.join("
") + }.join(" ") %>
- <%= @host.bondings.collect { |n| n.name }.join("
") %>
- <%= @host.vms.collect{|x| x.uuid }.join("
") %>
+ <%= @host.bondings.collect { |n| n.name }.join(" ") %>