From aclement at linagora.com Mon May 3 14:26:23 2010 From: aclement at linagora.com (Arthur =?iso-8859-1?q?Cl=E9ment?=) Date: Mon, 3 May 2010 16:26:23 +0200 Subject: [Ovirt-devel] ovirt-node-tools : internal RH repos Message-ID: <201005031626.23887.aclement@linagora.com> Hi, ovirt-node-tools provides two kickstarts with internal RH url, It might be better with public mirrors. http://ovirt.org/repos/ovirt/13/x86_64/ovirt-node-tools-1.9.1-1.fc12.noarch.rpm In /usr/share/ovirt-node-tools/ : #grep -R fedora.devel * ovirt-node-recipe.ks:repo --name="f12" --baseurl=http://download.fedora.devel.redhat.com/pub/fedora/linux/releases/12/Everything/x86_64/os ovirt-node-recipe.ks:repo --name="f12-updates" --baseurl=http://download.fedora.devel.redhat.com/pub/fedora/linux/updates/12/x86_64 repos.ks:repo --name=f12 --baseurl=http://download.fedora.devel.redhat.com/pub/fedora/linux/releases/12/Everything/x86_64/os repos.ks:repo --name=f12-updates --baseurl=http://download.fedora.devel.redhat.com/pub/fedora/linux/updates/12/x86_64 PS : Where are the sources of ovirt-node-tools ? -- Arthur CLEMENT Linagora Paris From mburns at redhat.com Mon May 3 14:41:09 2010 From: mburns at redhat.com (Mike Burns) Date: Mon, 03 May 2010 10:41:09 -0400 Subject: [Ovirt-devel] ovirt-node-tools : internal RH repos In-Reply-To: <201005031626.23887.aclement@linagora.com> References: <201005031626.23887.aclement@linagora.com> Message-ID: <1272897669.3596.3904.camel@localhost.localdomain> On Mon, 2010-05-03 at 16:26 +0200, Arthur Cl?ment wrote: > Hi, > > ovirt-node-tools provides two kickstarts with internal RH url, It might be better with public mirrors. > http://ovirt.org/repos/ovirt/13/x86_64/ovirt-node-tools-1.9.1-1.fc12.noarch.rpm > > In /usr/share/ovirt-node-tools/ : > #grep -R fedora.devel * > ovirt-node-recipe.ks:repo --name="f12" --baseurl=http://download.fedora.devel.redhat.com/pub/fedora/linux/releases/12/Everything/x86_64/os > ovirt-node-recipe.ks:repo --name="f12-updates" --baseurl=http://download.fedora.devel.redhat.com/pub/fedora/linux/updates/12/x86_64 > repos.ks:repo --name=f12 --baseurl=http://download.fedora.devel.redhat.com/pub/fedora/linux/releases/12/Everything/x86_64/os > repos.ks:repo --name=f12-updates --baseurl=http://download.fedora.devel.redhat.com/pub/fedora/linux/updates/12/x86_64 > > > PS : Where are the sources of ovirt-node-tools ? > > > ovirt-node-tools is a subpackage of ovirt-node. The content is generated from the recipe subdirectory. My latest build (using autobuild at 10 AM EDT today) shows $ grep repo ovirt-node-recipe.ks repo --name="f12" --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-12&arch=x86_64 repo --name="f12-updates" --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f12&arch=x86_64 repo --name="ovirt" --baseurl=http://ovirt.org/repos/ovirt/12/x86_64 The next release/build of ovirt-node should fix this. Mike From dpierce at redhat.com Mon May 3 14:46:10 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Mon, 3 May 2010 10:46:10 -0400 Subject: [Ovirt-devel] Refactored with feedback Message-ID: <1272897971-19058-1-git-send-email-dpierce@redhat.com> Fixed the syntax error apevec found. From dpierce at redhat.com Mon May 3 14:46:11 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Mon, 3 May 2010 10:46:11 -0400 Subject: [Ovirt-devel] [PATCH server] Fixed the configuration setup to be more complete. In-Reply-To: <1272897971-19058-1-git-send-email-dpierce@redhat.com> References: <1272897971-19058-1-git-send-email-dpierce@redhat.com> Message-ID: <1272897971-19058-2-git-send-email-dpierce@redhat.com> It now checks to ensure that the following dependencies are installed on the system: * Ruby * Ruby development libraries * Rake * Ruby gem command Signed-off-by: Darryl L. Pierce --- configure.ac | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/configure.ac b/configure.ac index 02f4050..a315c5e 100644 --- a/configure.ac +++ b/configure.ac @@ -7,5 +7,13 @@ AC_CONFIG_HEADERS([config.h]) test x"$ac_ct_CC:$CFLAGS" = 'xgcc:-g -O2' \ && CFLAGS="$CFLAGS -Wshadow -Wall -Werror" +AC_CHECK_PROGS(RUBY, ruby rake gem) + +if test x"$RUBY" = x ; then + AC_MSG_ERROR([Missing ruby development programs.]) +fi + +AC_CHECK_LIB(ruby, main, , AC_MSG_ERROR([Cannot find development libraries.])) + AC_CONFIG_FILES([Makefile ovirt-server.spec]) AC_OUTPUT -- 1.7.0.1 From imain at redhat.com Tue May 4 06:24:42 2010 From: imain at redhat.com (Ian Main) Date: Mon, 03 May 2010 23:24:42 -0700 Subject: [Ovirt-devel] [Matahari] [PATCH matahari] Created the NetworkDevice agent. In-Reply-To: <1272314985-12608-2-git-send-email-dpierce@redhat.com> References: <1272314985-12608-1-git-send-email-dpierce@redhat.com> <1272314985-12608-2-git-send-email-dpierce@redhat.com> Message-ID: <1272954282.2631.57.camel@localhost.localdomain> On Mon, 2010-04-26 at 16:49 -0400, Darryl L. Pierce wrote: > Created a new class to represent network interface devices, named > NetworkDeviceAgent. > > Removed the NICWrapper class, as well as the final vestiges of HAL > dependencies. > > Signed-off-by: Darryl L. Pierce ACK From apevec at gmail.com Tue May 4 08:34:26 2010 From: apevec at gmail.com (Alan Pevec) Date: Tue, 4 May 2010 10:34:26 +0200 Subject: [Ovirt-devel] [PATCH server] Fixed the configuration setup to be more complete. In-Reply-To: <1272897971-19058-2-git-send-email-dpierce@redhat.com> References: <1272897971-19058-1-git-send-email-dpierce@redhat.com> <1272897971-19058-2-git-send-email-dpierce@redhat.com> Message-ID: ACK From dpierce at redhat.com Tue May 4 13:18:53 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Tue, 4 May 2010 09:18:53 -0400 Subject: [Ovirt-devel] [Matahari] [PATCH matahari] Created the NetworkDevice agent. In-Reply-To: <1272954282.2631.57.camel@localhost.localdomain> References: <1272314985-12608-1-git-send-email-dpierce@redhat.com> <1272314985-12608-2-git-send-email-dpierce@redhat.com> <1272954282.2631.57.camel@localhost.localdomain> Message-ID: <20100504131853.GA3611@mcpierce-desktop.usersys.redhat.com> On Mon, May 03, 2010 at 11:24:42PM -0700, Ian Main wrote: > On Mon, 2010-04-26 at 16:49 -0400, Darryl L. Pierce wrote: > > Created a new class to represent network interface devices, named > > NetworkDeviceAgent. > > > > Removed the NICWrapper class, as well as the final vestiges of HAL > > dependencies. > > > > Signed-off-by: Darryl L. Pierce > > ACK Thank you. This is pushed upstream now. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From dpierce at redhat.com Tue May 4 13:33:23 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Tue, 4 May 2010 09:33:23 -0400 Subject: [Ovirt-devel] [PATCH server] Fixed the configuration setup to be more complete. In-Reply-To: References: <1272897971-19058-1-git-send-email-dpierce@redhat.com> <1272897971-19058-2-git-send-email-dpierce@redhat.com> Message-ID: <20100504133323.GB3611@mcpierce-desktop.usersys.redhat.com> On Tue, May 04, 2010 at 10:34:26AM +0200, Alan Pevec wrote: > ACK Thank you. This is pushed upstream. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From aclement at linagora.com Tue May 4 15:41:39 2010 From: aclement at linagora.com (=?UTF-8?q?Arthur=20Cl=C3=A9ment?=) Date: Tue, 4 May 2010 17:41:39 +0200 Subject: [Ovirt-devel] [PATCH server] Update qpidd package name for f13 Message-ID: <1272987699-4549-1-git-send-email-aclement@linagora.com> From: Arthur CLEMENT Signed-off-by: Arthur CLEMENT --- installer/modules/ovirt/manifests/ovirt.pp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/installer/modules/ovirt/manifests/ovirt.pp b/installer/modules/ovirt/manifests/ovirt.pp index 18a14c9..87ed864 100644 --- a/installer/modules/ovirt/manifests/ovirt.pp +++ b/installer/modules/ovirt/manifests/ovirt.pp @@ -43,7 +43,7 @@ class ovirt::setup { ensure => installed; } - package {"qpidd": + package {"qpid-cpp-server": ensure => installed; } @@ -176,7 +176,7 @@ class ovirt::setup { service {"qpidd" : enable => true, ensure => running, - require => Package[qpidd] + require => Package[qpid-cpp-server] } service {"collectd" : -- 1.7.0.1 From apevec at redhat.com Tue May 4 22:27:31 2010 From: apevec at redhat.com (Alan Pevec) Date: Wed, 5 May 2010 00:27:31 +0200 Subject: [Ovirt-devel] [PATCH node] save all not-parsed boot parameters Message-ID: <1273012051-12343-1-git-send-email-apevec@redhat.com> not just console= This is to allow vendor-specific boot parameters to survive when the image is installed to disk. Signed-off-by: Alan Pevec --- scripts/ovirt-early | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/ovirt-early b/scripts/ovirt-early index 4b85102..c17ea74 100755 --- a/scripts/ovirt-early +++ b/scripts/ovirt-early @@ -426,13 +426,13 @@ start_ovirt_early () { i=${i#collectd=} eval $(printf $i|awk -F: '{print "collectd_server="$1; print "collectd_port="$2;}') ;; - console=*) - bootparams="$bootparams $i" - ;; ovirt_early=*) i=${i#ovirt_early=} ovirt_early=$(echo $i|tr ",:;" " ") ;; + *) + bootparams="$bootparams $i" + ;; esac done -- 1.6.0.6 From dpierce at redhat.com Wed May 5 12:58:00 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 5 May 2010 08:58:00 -0400 Subject: [Ovirt-devel] [PATCH server] Update qpidd package name for f13 In-Reply-To: <1272987699-4549-1-git-send-email-aclement@linagora.com> References: <1272987699-4549-1-git-send-email-aclement@linagora.com> Message-ID: <20100505125800.GF3611@mcpierce-desktop.usersys.redhat.com> On Tue, May 04, 2010 at 05:41:39PM +0200, Arthur Cl?ment wrote: > From: Arthur CLEMENT > > > Signed-off-by: Arthur CLEMENT > --- > installer/modules/ovirt/manifests/ovirt.pp | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/installer/modules/ovirt/manifests/ovirt.pp b/installer/modules/ovirt/manifests/ovirt.pp > index 18a14c9..87ed864 100644 > --- a/installer/modules/ovirt/manifests/ovirt.pp > +++ b/installer/modules/ovirt/manifests/ovirt.pp > @@ -43,7 +43,7 @@ class ovirt::setup { > ensure => installed; > } > > - package {"qpidd": > + package {"qpid-cpp-server": > ensure => installed; > } > > @@ -176,7 +176,7 @@ class ovirt::setup { > service {"qpidd" : > enable => true, > ensure => running, > - require => Package[qpidd] > + require => Package[qpid-cpp-server] > } > > service {"collectd" : > -- > 1.7.0.1 ACK and pushed. Though this might cause some issues on F12 unless we can alias the package. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From aclement at linagora.com Wed May 5 15:41:41 2010 From: aclement at linagora.com (=?UTF-8?q?Arthur=20Cl=C3=A9ment?=) Date: Wed, 5 May 2010 17:41:41 +0200 Subject: [Ovirt-devel] [PATCH server] Upgrade rails gem version for F13 Message-ID: <1273074101-20866-1-git-send-email-aclement@linagora.com> From: root Signed-off-by: Arthur Cl?ment --- src/config/environment.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/config/environment.rb b/src/config/environment.rb index 9c1a9fa..ca6ed03 100644 --- a/src/config/environment.rb +++ b/src/config/environment.rb @@ -20,7 +20,7 @@ # Be sure to restart your web server when you modify this file. # Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION +RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') -- 1.7.0.1 From aclement at linagora.com Wed May 5 16:34:06 2010 From: aclement at linagora.com (=?UTF-8?q?Arthur=20Cl=C3=A9ment?=) Date: Wed, 5 May 2010 18:34:06 +0200 Subject: [Ovirt-devel] [PATCH server] Ensure httpd is running for cobbler-import (F13) Message-ID: <1273077246-4858-1-git-send-email-aclement@linagora.com> From: root Signed-off-by: Arthur Cl?ment --- installer/modules/ovirt/manifests/cobbler.pp | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/installer/modules/ovirt/manifests/cobbler.pp b/installer/modules/ovirt/manifests/cobbler.pp index e9c239e..61305dd 100644 --- a/installer/modules/ovirt/manifests/cobbler.pp +++ b/installer/modules/ovirt/manifests/cobbler.pp @@ -119,7 +119,7 @@ class cobbler::bundled { single_exec {"cobbler-import": command => "/usr/sbin/cobbler-import >> /var/log/cobbler-import.log 2>&1", require => [File["/usr/sbin/cobbler-import"], - Service["cobblerd"],Package[ovirt-node-image-pxe],Package[livecd-tools]] + Service["cobblerd"],Service["httpd"],Package[ovirt-node-image-pxe],Package[livecd-tools]] } file_replacement{"settings_auth_module": file => "/etc/cobbler/settings", -- 1.7.0.1 From dpierce at redhat.com Thu May 6 17:17:19 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 6 May 2010 13:17:19 -0400 Subject: [Ovirt-devel] [PATCH server] Upgrade rails gem version for F13 In-Reply-To: <1273074101-20866-1-git-send-email-aclement@linagora.com> References: <1273074101-20866-1-git-send-email-aclement@linagora.com> Message-ID: <20100506171719.GK3611@mcpierce-desktop.usersys.redhat.com> On Wed, May 05, 2010 at 05:41:41PM +0200, Arthur Cl?ment wrote: > From: root > > > Signed-off-by: Arthur Cl?ment > --- > src/config/environment.rb | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/src/config/environment.rb b/src/config/environment.rb > index 9c1a9fa..ca6ed03 100644 > --- a/src/config/environment.rb > +++ b/src/config/environment.rb > @@ -20,7 +20,7 @@ > # Be sure to restart your web server when you modify this file. > > # Specifies gem version of Rails to use when vendor/rails is not present > -RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION > +RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION > > # Bootstrap the Rails environment, frameworks, and default configuration > require File.join(File.dirname(__FILE__), 'boot') > -- > 1.7.0.1 > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel ACK, and pushed. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From dpierce at redhat.com Thu May 6 17:18:49 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 6 May 2010 13:18:49 -0400 Subject: [Ovirt-devel] [PATCH server] Ensure httpd is running for cobbler-import (F13) In-Reply-To: <1273077246-4858-1-git-send-email-aclement@linagora.com> References: <1273077246-4858-1-git-send-email-aclement@linagora.com> Message-ID: <20100506171849.GL3611@mcpierce-desktop.usersys.redhat.com> On Wed, May 05, 2010 at 06:34:06PM +0200, Arthur Cl?ment wrote: > From: root > > > Signed-off-by: Arthur Cl?ment > --- > installer/modules/ovirt/manifests/cobbler.pp | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/installer/modules/ovirt/manifests/cobbler.pp b/installer/modules/ovirt/manifests/cobbler.pp > index e9c239e..61305dd 100644 > --- a/installer/modules/ovirt/manifests/cobbler.pp > +++ b/installer/modules/ovirt/manifests/cobbler.pp > @@ -119,7 +119,7 @@ class cobbler::bundled { > single_exec {"cobbler-import": > command => "/usr/sbin/cobbler-import >> /var/log/cobbler-import.log 2>&1", > require => [File["/usr/sbin/cobbler-import"], > - Service["cobblerd"],Package[ovirt-node-image-pxe],Package[livecd-tools]] > + Service["cobblerd"],Service["httpd"],Package[ovirt-node-image-pxe],Package[livecd-tools]] > } > file_replacement{"settings_auth_module": > file => "/etc/cobbler/settings", > -- > 1.7.0.1 > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel ACK and pushed. Thank you. :) -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From jboggs at redhat.com Mon May 10 15:06:39 2010 From: jboggs at redhat.com (Joey Boggs) Date: Mon, 10 May 2010 11:06:39 -0400 Subject: [Ovirt-devel] [PATCH] enables ability for a common shared root Message-ID: <1273503999-13046-1-git-send-email-jboggs@redhat.com> Rebased against latest commits, and quotes all drive variables --- scripts/ovirt-config-boot | 13 ++++++- scripts/ovirt-config-storage | 87 ++++++++++++++++++++++++++--------------- 2 files changed, 67 insertions(+), 33 deletions(-) diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot index 72bcd9b..9593905 100755 --- a/scripts/ovirt-config-boot +++ b/scripts/ovirt-config-boot @@ -29,6 +29,12 @@ ovirt_boot_setup() { local disk2 local partN=-1 log "installing the image." + + if [ "$OVIRT_ROOT_INSTALL" == "n" ]; then + log "done." + return + fi + local found_boot=false if findfs LABEL=Boot 2>&1 >/dev/null ; then found_boot=true @@ -213,7 +219,12 @@ if [ -z "$doreboot" ]; then fi start_log -ovirt_boot_setup "$live" "$bootparams" +if [ "$OVIRT_ROOT_INSTALL" =="n" ]; then + log "done." + return +else + ovirt_boot_setup "$live" "$bootparams" +fi rc=$? if [ $rc -eq 0 -a "$doreboot" = "yes" ]; then disable_firstboot diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index ce9707c..9b37035 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -358,6 +358,22 @@ do_configure() printf "\n\nPlease select the disk to use for the Root.\n\n" ROOTDRIVE=$(get_dev_name) || return 0 get_drive_size "$ROOTDRIVE" ROOTDRIVESPACE + if ask_yes_or_no "Will Root be shared with other nodes ([Y]es/[N]o)?"; then + OVIRT_SHARED_ROOT="y" + if ask_yes_or_no "Partition and install Root?"; then + OVIRT_ROOT_INSTALL="y" + else + OVIRT_ROOT_INSTALL="n" + fi + else + OVIRT_SHARED_ROOT="n" + OVIRT_ROOT_INSTALL="y" + fi + + augtool < This patch fixes both local installation and iscsi installation issues --- scripts/ovirt-config-boot | 10 ++++++---- scripts/ovirt-config-networking | 8 +++++--- scripts/ovirt-config-storage | 17 ++++++++++++++++- scripts/ovirt-functions | 27 ++++++++++++++++++--------- 4 files changed, 45 insertions(+), 17 deletions(-) diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot index 9593905..15066f7 100755 --- a/scripts/ovirt-config-boot +++ b/scripts/ovirt-config-boot @@ -40,7 +40,7 @@ ovirt_boot_setup() { found_boot=true grub_dev_label=Boot elif findfs LABEL=Root 2>&1 >/dev/null ; then - found_boot=true + found_boot=false grub_dev_label=Root fi if $found_boot; then @@ -62,8 +62,8 @@ ovirt_boot_setup() { grub_dev_label="RootBackup" fi - # check that /boot mounted ok and find partition number for GRUB - get_part_info $(readlink -f $(findfs LABEL=$grub_dev_label 2>/dev/null)) disk partN + # check that /boot mounted ok and find partition number for GRUB, $4 is to allow 0 as a partition number for grub + get_part_info $(readlink -f $(findfs LABEL=$grub_dev_label 2>/dev/null)) disk partN y rc=$? if [ $rc -ne 0 -o $partN -lt 0 ]; then log "unable to determine Root partition" @@ -228,7 +228,9 @@ fi rc=$? if [ $rc -eq 0 -a "$doreboot" = "yes" ]; then disable_firstboot - ovirt_store_firstboot_config + if [ "$OVIRT_ISCSI_ENABLED" != "y" ]; then + ovirt_store_firstboot_config + fi stop_log reboot diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 4d412ac..810d0e0 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -24,10 +24,12 @@ CONFIGURED_NIC="" VLAN_ID="" VL_ROOT="" +if [[ -z "$ROOTDRIVE" && "$OVIRT_ISCSI_ENABLED" != "y" ]]; then # if local storage is not configured, then exit the script -if ! is_local_storage_configured; then - printf "Local storage must be configured prior to configuring the management interface.\n\n" - exit 99 + if [[ ! is_local_storage_configured && "$OVIRT_ISCSI_NETWORKING" != "y" ]] ; then + printf "Local storage must be configured prior to configuring the management interface.\n\n" + exit 99 + fi fi # $1 - the variable name to set diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index 9b37035..df36752 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -642,7 +642,7 @@ perform_partitioning() parted "$BOOTDRIVE" -s "mklabel ${LABEL_TYPE}" parted "$BOOTDRIVE" -s "mkpartfs primary ext2 0M ${boot_size_si}M" reread_partitions "$BOOTDRIVE" - partboot="$BOOTDRIVE1" + partboot="${BOOTDRIVE}1" if [ ! -e "$partboot" ]; then partboot="${BOOTDRIVE}p1" fi @@ -817,11 +817,26 @@ do_confirm() else return fi + # store networking config since it was created before storage was established for iscsi targets + if [ "$OVIRT_ISCSI_NETWORKING" == "y" ]; then + ovirt_store_config \ + /etc/sysconfig/network-scripts/ifcfg* \ + /etc/ntp.conf + fi done } do_iscsi_target() { +if ! network_up ; then + printf "Networking must be configured prior to configuring an iscsi target.\n\n" + # allow network config without setting up storage first + augtool < References: <1273504788-13282-1-git-send-email-jboggs@redhat.com> Message-ID: <4BE824FF.8090803@redhat.com> On 05/10/2010 11:19 AM, Joey Boggs wrote: > This patch fixes both local installation and iscsi installation issues > --- > scripts/ovirt-config-boot | 10 ++++++---- > scripts/ovirt-config-networking | 8 +++++--- > scripts/ovirt-config-storage | 17 ++++++++++++++++- > scripts/ovirt-functions | 27 ++++++++++++++++++--------- > 4 files changed, 45 insertions(+), 17 deletions(-) > > diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot > index 9593905..15066f7 100755 > --- a/scripts/ovirt-config-boot > +++ b/scripts/ovirt-config-boot > @@ -40,7 +40,7 @@ ovirt_boot_setup() { > found_boot=true > grub_dev_label=Boot > elif findfs LABEL=Root 2>&1>/dev/null ; then > - found_boot=true > + found_boot=false > grub_dev_label=Root > fi > if $found_boot; then > @@ -62,8 +62,8 @@ ovirt_boot_setup() { > grub_dev_label="RootBackup" > fi > > - # check that /boot mounted ok and find partition number for GRUB > - get_part_info $(readlink -f $(findfs LABEL=$grub_dev_label 2>/dev/null)) disk partN > + # check that /boot mounted ok and find partition number for GRUB, $4 is to allow 0 as a partition number for grub > + get_part_info $(readlink -f $(findfs LABEL=$grub_dev_label 2>/dev/null)) disk partN y > rc=$? > if [ $rc -ne 0 -o $partN -lt 0 ]; then > log "unable to determine Root partition" > @@ -228,7 +228,9 @@ fi > rc=$? > if [ $rc -eq 0 -a "$doreboot" = "yes" ]; then > disable_firstboot > - ovirt_store_firstboot_config > + if [ "$OVIRT_ISCSI_ENABLED" != "y" ]; then > + ovirt_store_firstboot_config > + fi > stop_log > > reboot > diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking > index 4d412ac..810d0e0 100755 > --- a/scripts/ovirt-config-networking > +++ b/scripts/ovirt-config-networking > @@ -24,10 +24,12 @@ CONFIGURED_NIC="" > VLAN_ID="" > VL_ROOT="" > > +if [[ -z "$ROOTDRIVE"&& "$OVIRT_ISCSI_ENABLED" != "y" ]]; then > # if local storage is not configured, then exit the script > -if ! is_local_storage_configured; then > - printf "Local storage must be configured prior to configuring the management interface.\n\n" > - exit 99 > + if [[ ! is_local_storage_configured&& "$OVIRT_ISCSI_NETWORKING" != "y" ]] ; then > + printf "Local storage must be configured prior to configuring the management interface.\n\n" > + exit 99 > + fi > fi > > # $1 - the variable name to set > diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage > index 9b37035..df36752 100755 > --- a/scripts/ovirt-config-storage > +++ b/scripts/ovirt-config-storage > @@ -642,7 +642,7 @@ perform_partitioning() > parted "$BOOTDRIVE" -s "mklabel ${LABEL_TYPE}" > parted "$BOOTDRIVE" -s "mkpartfs primary ext2 0M ${boot_size_si}M" > reread_partitions "$BOOTDRIVE" > - partboot="$BOOTDRIVE1" > + partboot="${BOOTDRIVE}1" > if [ ! -e "$partboot" ]; then > partboot="${BOOTDRIVE}p1" > fi > @@ -817,11 +817,26 @@ do_confirm() > else > return > fi > + # store networking config since it was created before storage was established for iscsi targets > + if [ "$OVIRT_ISCSI_NETWORKING" == "y" ]; then > + ovirt_store_config \ > + /etc/sysconfig/network-scripts/ifcfg* \ > + /etc/ntp.conf > + fi > done > } > > do_iscsi_target() > { > +if ! network_up ; then > + printf "Networking must be configured prior to configuring an iscsi target.\n\n" > + # allow network config without setting up storage first > + augtool< +set /files/etc/default/ovirt/OVIRT_ISCSI_NETWORK_CONFIG y > +EOF > + exit 99 > +fi > + > while true; do > OPTIONS="\"Target IP\" \"Target Port\"" #\"CHAP Username\" \"CHAP Password\"" > printf "\nPress Enter to leave option blank or Q to quit (default Target Port is 3260)\n" > diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions > index b0255ce..73deaa2 100644 > --- a/scripts/ovirt-functions > +++ b/scripts/ovirt-functions > @@ -326,7 +326,7 @@ mount_boot() { > return 0 > fi > mkdir -p /boot > - mount LABEL=Root /boot > + mount LABEL=Boot /boot > } > # stop any service which keeps /var/log busy > # keep the list of services > @@ -865,23 +865,32 @@ get_part_info() { > local drive_in="$1" > local dev_var=$2 > local part_var=$3 > + local grub_dev=$4 > local devname_1 devname2 part_number > local rc=0 > > - eval $(readlink -f "$drive_in" |awk {' > - print "devname_1=" substr($1,1,length($1)-1); > - print "devname_2=" substr($1,1,length($1)-2); > - part_number=substr($1,length($1),1); > - print "part_number=" part_number; > - }') > + if [ -z "$grub_dev" ]; then > + eval $(readlink -f "$drive_in" |awk {' > + print "devname_1=" substr($1,1,length($1)-1); > + print "devname_2=" substr($1,1,length($1)-2); > + part_number=substr($1,length($1),1); > + print "part_number=" part_number; > + }') > + else > + eval $(readlink -f "$drive_in" |awk {' > + print "devname_1=" substr($1,1,length($1)-1); > + print "devname_2=" substr($1,1,length($1)-2); > + part_number=substr($1,length($1),1); part_number--; > + print "part_number=" part_number; > + }') > + fi > rc=$? > > - if [[ "part_number" -lt 1 ]]; then > + if [[ "$part_number" -lt 1&& "$grub_dev" != "y" ]]; then > log "Partition number was invalid" > return 2 > fi > > - > if [ -e ${devname_1} ]; then > eval "${dev_var}"="${devname_1}" > elif [ -e ${devname_2} ]; then > This one is over a month old and without it prevents local installation. I'll push this later today if there's no negative feedback From aclement at linagora.com Mon May 10 16:29:33 2010 From: aclement at linagora.com (Arthur =?iso-8859-1?q?Cl=E9ment?=) Date: Mon, 10 May 2010 18:29:33 +0200 Subject: [Ovirt-devel] Rails/mongrel/httpd issue - F13, rails 2.3.5 Message-ID: <201005101829.33165.aclement@linagora.com> Hi, I have an issue with mongrel and rails. I add -B option(debug) to mongrel_rails in /etc/init.d/mongrel-rails but it didn't display more logs : http://ovirt.pastebin.com/N5v94cTu This is the page I get when I try to reach the ovirt web interface, I see the html tags (kerberos auth is working) : You are being redirected. and logs : ==> rails.log <== Processing DashboardController#index (for 10.75.128.51 at 2010-05-10 10:37:25) [GET] Redirected to http://ovirt.admin.virt.par.lng/ovirt/login/login Filter chain halted as [:is_logged_in] rendered_or_redirected. Completed in 5ms (DB: 28) | 302 Found [http://ovirt.admin.virt.par.lng/ovirt/] ==> mongrel.log <== Mon May 10 10:37:25 +0200 2010: Error calling Dispatcher.dispatch # /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:108:in `send_cookies' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:136:in `out' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/http_response.rb:65:in `start' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:135:in `out' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:81:in `process' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:159:in `process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in `each' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in `process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `new' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `new' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:282:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:281:in `each' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:281:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 /usr/bin/mongrel_rails:19:in `load' /usr/bin/mongrel_rails:19 gems list : http://ovirt.pastebin.com/B5s3cpKy I'm looking for any clue. -- Arthur CLEMENT Linagora Paris From dpierce at redhat.com Mon May 10 17:39:28 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Mon, 10 May 2010 13:39:28 -0400 Subject: [Ovirt-devel] [PATCH node] RESEND: fix iscsi installation problems In-Reply-To: <4BE824FF.8090803@redhat.com> References: <1273504788-13282-1-git-send-email-jboggs@redhat.com> <4BE824FF.8090803@redhat.com> Message-ID: <20100510173928.GD22394@mcpierce-desktop.usersys.redhat.com> On Mon, May 10, 2010 at 11:23:43AM -0400, Joey Boggs wrote: > On 05/10/2010 11:19 AM, Joey Boggs wrote: > >This patch fixes both local installation and iscsi installation issues > >--- > > scripts/ovirt-config-boot | 10 ++++++---- > > scripts/ovirt-config-networking | 8 +++++--- > > scripts/ovirt-config-storage | 17 ++++++++++++++++- > > scripts/ovirt-functions | 27 ++++++++++++++++++--------- > > 4 files changed, 45 insertions(+), 17 deletions(-) > > > >diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot > >index 9593905..15066f7 100755 > >--- a/scripts/ovirt-config-boot > >+++ b/scripts/ovirt-config-boot > >@@ -40,7 +40,7 @@ ovirt_boot_setup() { > > found_boot=true > > grub_dev_label=Boot > > elif findfs LABEL=Root 2>&1>/dev/null ; then > >- found_boot=true > >+ found_boot=false > > grub_dev_label=Root > > fi > > if $found_boot; then > >@@ -62,8 +62,8 @@ ovirt_boot_setup() { > > grub_dev_label="RootBackup" > > fi > > > >- # check that /boot mounted ok and find partition number for GRUB > >- get_part_info $(readlink -f $(findfs LABEL=$grub_dev_label 2>/dev/null)) disk partN > >+ # check that /boot mounted ok and find partition number for GRUB, $4 is to allow 0 as a partition number for grub > >+ get_part_info $(readlink -f $(findfs LABEL=$grub_dev_label 2>/dev/null)) disk partN y > > rc=$? > > if [ $rc -ne 0 -o $partN -lt 0 ]; then > > log "unable to determine Root partition" > >@@ -228,7 +228,9 @@ fi > > rc=$? > > if [ $rc -eq 0 -a "$doreboot" = "yes" ]; then > > disable_firstboot > >- ovirt_store_firstboot_config > >+ if [ "$OVIRT_ISCSI_ENABLED" != "y" ]; then > >+ ovirt_store_firstboot_config > >+ fi > > stop_log > > > > reboot > >diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking > >index 4d412ac..810d0e0 100755 > >--- a/scripts/ovirt-config-networking > >+++ b/scripts/ovirt-config-networking > >@@ -24,10 +24,12 @@ CONFIGURED_NIC="" > > VLAN_ID="" > > VL_ROOT="" > > > >+if [[ -z "$ROOTDRIVE"&& "$OVIRT_ISCSI_ENABLED" != "y" ]]; then > > # if local storage is not configured, then exit the script > >-if ! is_local_storage_configured; then > >- printf "Local storage must be configured prior to configuring the management interface.\n\n" > >- exit 99 > >+ if [[ ! is_local_storage_configured&& "$OVIRT_ISCSI_NETWORKING" != "y" ]] ; then > >+ printf "Local storage must be configured prior to configuring the management interface.\n\n" > >+ exit 99 > >+ fi > > fi > > > > # $1 - the variable name to set > >diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage > >index 9b37035..df36752 100755 > >--- a/scripts/ovirt-config-storage > >+++ b/scripts/ovirt-config-storage > >@@ -642,7 +642,7 @@ perform_partitioning() > > parted "$BOOTDRIVE" -s "mklabel ${LABEL_TYPE}" > > parted "$BOOTDRIVE" -s "mkpartfs primary ext2 0M ${boot_size_si}M" > > reread_partitions "$BOOTDRIVE" > >- partboot="$BOOTDRIVE1" > >+ partboot="${BOOTDRIVE}1" > > if [ ! -e "$partboot" ]; then > > partboot="${BOOTDRIVE}p1" > > fi > >@@ -817,11 +817,26 @@ do_confirm() > > else > > return > > fi > >+ # store networking config since it was created before storage was established for iscsi targets > >+ if [ "$OVIRT_ISCSI_NETWORKING" == "y" ]; then > >+ ovirt_store_config \ > >+ /etc/sysconfig/network-scripts/ifcfg* \ > >+ /etc/ntp.conf > >+ fi > > done > > } > > > > do_iscsi_target() > > { > >+if ! network_up ; then > >+ printf "Networking must be configured prior to configuring an iscsi target.\n\n" > >+ # allow network config without setting up storage first > >+ augtool< >+set /files/etc/default/ovirt/OVIRT_ISCSI_NETWORK_CONFIG y > >+EOF > >+ exit 99 > >+fi > >+ > > while true; do > > OPTIONS="\"Target IP\" \"Target Port\"" #\"CHAP Username\" \"CHAP Password\"" > > printf "\nPress Enter to leave option blank or Q to quit (default Target Port is 3260)\n" > >diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions > >index b0255ce..73deaa2 100644 > >--- a/scripts/ovirt-functions > >+++ b/scripts/ovirt-functions > >@@ -326,7 +326,7 @@ mount_boot() { > > return 0 > > fi > > mkdir -p /boot > >- mount LABEL=Root /boot > >+ mount LABEL=Boot /boot > > } > > # stop any service which keeps /var/log busy > > # keep the list of services > >@@ -865,23 +865,32 @@ get_part_info() { > > local drive_in="$1" > > local dev_var=$2 > > local part_var=$3 > >+ local grub_dev=$4 > > local devname_1 devname2 part_number > > local rc=0 > > > >- eval $(readlink -f "$drive_in" |awk {' > >- print "devname_1=" substr($1,1,length($1)-1); > >- print "devname_2=" substr($1,1,length($1)-2); > >- part_number=substr($1,length($1),1); > >- print "part_number=" part_number; > >- }') > >+ if [ -z "$grub_dev" ]; then > >+ eval $(readlink -f "$drive_in" |awk {' > >+ print "devname_1=" substr($1,1,length($1)-1); > >+ print "devname_2=" substr($1,1,length($1)-2); > >+ part_number=substr($1,length($1),1); > >+ print "part_number=" part_number; > >+ }') > >+ else > >+ eval $(readlink -f "$drive_in" |awk {' > >+ print "devname_1=" substr($1,1,length($1)-1); > >+ print "devname_2=" substr($1,1,length($1)-2); > >+ part_number=substr($1,length($1),1); part_number--; > >+ print "part_number=" part_number; > >+ }') > >+ fi > > rc=$? > > > >- if [[ "part_number" -lt 1 ]]; then > >+ if [[ "$part_number" -lt 1&& "$grub_dev" != "y" ]]; then There should be a space here + if [[ "$part_number" -lt 1 && "$grub_dev" != "y" ]]; then > > log "Partition number was invalid" > > return 2 > > fi > > > >- > > if [ -e ${devname_1} ]; then > > eval "${dev_var}"="${devname_1}" > > elif [ -e ${devname_2} ]; then > This one is over a month old and without it prevents local > installation. I'll push this later today if there's no negative > feedback > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel Otherwise, based on reading the patch it looks fine. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From jboggs at redhat.com Mon May 10 17:49:38 2010 From: jboggs at redhat.com (Joey Boggs) Date: Mon, 10 May 2010 13:49:38 -0400 Subject: [Ovirt-devel] [PATCH node] RESEND: fix iscsi installation problems In-Reply-To: <20100510173928.GD22394@mcpierce-desktop.usersys.redhat.com> References: <1273504788-13282-1-git-send-email-jboggs@redhat.com> <4BE824FF.8090803@redhat.com> <20100510173928.GD22394@mcpierce-desktop.usersys.redhat.com> Message-ID: <4BE84732.1030508@redhat.com> On 05/10/2010 01:39 PM, Darryl L. Pierce wrote: > On Mon, May 10, 2010 at 11:23:43AM -0400, Joey Boggs wrote: > >> On 05/10/2010 11:19 AM, Joey Boggs wrote: >> >>> This patch fixes both local installation and iscsi installation issues >>> --- >>> scripts/ovirt-config-boot | 10 ++++++---- >>> scripts/ovirt-config-networking | 8 +++++--- >>> scripts/ovirt-config-storage | 17 ++++++++++++++++- >>> scripts/ovirt-functions | 27 ++++++++++++++++++--------- >>> 4 files changed, 45 insertions(+), 17 deletions(-) >>> >>> diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot >>> index 9593905..15066f7 100755 >>> --- a/scripts/ovirt-config-boot >>> +++ b/scripts/ovirt-config-boot >>> @@ -40,7 +40,7 @@ ovirt_boot_setup() { >>> found_boot=true >>> grub_dev_label=Boot >>> elif findfs LABEL=Root 2>&1>/dev/null ; then >>> - found_boot=true >>> + found_boot=false >>> grub_dev_label=Root >>> fi >>> if $found_boot; then >>> @@ -62,8 +62,8 @@ ovirt_boot_setup() { >>> grub_dev_label="RootBackup" >>> fi >>> >>> - # check that /boot mounted ok and find partition number for GRUB >>> - get_part_info $(readlink -f $(findfs LABEL=$grub_dev_label 2>/dev/null)) disk partN >>> + # check that /boot mounted ok and find partition number for GRUB, $4 is to allow 0 as a partition number for grub >>> + get_part_info $(readlink -f $(findfs LABEL=$grub_dev_label 2>/dev/null)) disk partN y >>> rc=$? >>> if [ $rc -ne 0 -o $partN -lt 0 ]; then >>> log "unable to determine Root partition" >>> @@ -228,7 +228,9 @@ fi >>> rc=$? >>> if [ $rc -eq 0 -a "$doreboot" = "yes" ]; then >>> disable_firstboot >>> - ovirt_store_firstboot_config >>> + if [ "$OVIRT_ISCSI_ENABLED" != "y" ]; then >>> + ovirt_store_firstboot_config >>> + fi >>> stop_log >>> >>> reboot >>> diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking >>> index 4d412ac..810d0e0 100755 >>> --- a/scripts/ovirt-config-networking >>> +++ b/scripts/ovirt-config-networking >>> @@ -24,10 +24,12 @@ CONFIGURED_NIC="" >>> VLAN_ID="" >>> VL_ROOT="" >>> >>> +if [[ -z "$ROOTDRIVE"&& "$OVIRT_ISCSI_ENABLED" != "y" ]]; then >>> # if local storage is not configured, then exit the script >>> -if ! is_local_storage_configured; then >>> - printf "Local storage must be configured prior to configuring the management interface.\n\n" >>> - exit 99 >>> + if [[ ! is_local_storage_configured&& "$OVIRT_ISCSI_NETWORKING" != "y" ]] ; then >>> + printf "Local storage must be configured prior to configuring the management interface.\n\n" >>> + exit 99 >>> + fi >>> fi >>> >>> # $1 - the variable name to set >>> diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage >>> index 9b37035..df36752 100755 >>> --- a/scripts/ovirt-config-storage >>> +++ b/scripts/ovirt-config-storage >>> @@ -642,7 +642,7 @@ perform_partitioning() >>> parted "$BOOTDRIVE" -s "mklabel ${LABEL_TYPE}" >>> parted "$BOOTDRIVE" -s "mkpartfs primary ext2 0M ${boot_size_si}M" >>> reread_partitions "$BOOTDRIVE" >>> - partboot="$BOOTDRIVE1" >>> + partboot="${BOOTDRIVE}1" >>> if [ ! -e "$partboot" ]; then >>> partboot="${BOOTDRIVE}p1" >>> fi >>> @@ -817,11 +817,26 @@ do_confirm() >>> else >>> return >>> fi >>> + # store networking config since it was created before storage was established for iscsi targets >>> + if [ "$OVIRT_ISCSI_NETWORKING" == "y" ]; then >>> + ovirt_store_config \ >>> + /etc/sysconfig/network-scripts/ifcfg* \ >>> + /etc/ntp.conf >>> + fi >>> done >>> } >>> >>> do_iscsi_target() >>> { >>> +if ! network_up ; then >>> + printf "Networking must be configured prior to configuring an iscsi target.\n\n" >>> + # allow network config without setting up storage first >>> + augtool<>> +set /files/etc/default/ovirt/OVIRT_ISCSI_NETWORK_CONFIG y >>> +EOF >>> + exit 99 >>> +fi >>> + >>> while true; do >>> OPTIONS="\"Target IP\" \"Target Port\"" #\"CHAP Username\" \"CHAP Password\"" >>> printf "\nPress Enter to leave option blank or Q to quit (default Target Port is 3260)\n" >>> diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions >>> index b0255ce..73deaa2 100644 >>> --- a/scripts/ovirt-functions >>> +++ b/scripts/ovirt-functions >>> @@ -326,7 +326,7 @@ mount_boot() { >>> return 0 >>> fi >>> mkdir -p /boot >>> - mount LABEL=Root /boot >>> + mount LABEL=Boot /boot >>> } >>> # stop any service which keeps /var/log busy >>> # keep the list of services >>> @@ -865,23 +865,32 @@ get_part_info() { >>> local drive_in="$1" >>> local dev_var=$2 >>> local part_var=$3 >>> + local grub_dev=$4 >>> local devname_1 devname2 part_number >>> local rc=0 >>> >>> - eval $(readlink -f "$drive_in" |awk {' >>> - print "devname_1=" substr($1,1,length($1)-1); >>> - print "devname_2=" substr($1,1,length($1)-2); >>> - part_number=substr($1,length($1),1); >>> - print "part_number=" part_number; >>> - }') >>> + if [ -z "$grub_dev" ]; then >>> + eval $(readlink -f "$drive_in" |awk {' >>> + print "devname_1=" substr($1,1,length($1)-1); >>> + print "devname_2=" substr($1,1,length($1)-2); >>> + part_number=substr($1,length($1),1); >>> + print "part_number=" part_number; >>> + }') >>> + else >>> + eval $(readlink -f "$drive_in" |awk {' >>> + print "devname_1=" substr($1,1,length($1)-1); >>> + print "devname_2=" substr($1,1,length($1)-2); >>> + part_number=substr($1,length($1),1); part_number--; >>> + print "part_number=" part_number; >>> + }') >>> + fi >>> rc=$? >>> >>> - if [[ "part_number" -lt 1 ]]; then >>> + if [[ "$part_number" -lt 1&& "$grub_dev" != "y" ]]; then >>> > There should be a space here > > + if [[ "$part_number" -lt 1&& "$grub_dev" != "y" ]]; then > > >>> log "Partition number was invalid" >>> return 2 >>> fi >>> >>> - >>> if [ -e ${devname_1} ]; then >>> eval "${dev_var}"="${devname_1}" >>> elif [ -e ${devname_2} ]; then >>> >> This one is over a month old and without it prevents local >> installation. I'll push this later today if there's no negative >> feedback >> >> _______________________________________________ >> Ovirt-devel mailing list >> Ovirt-devel at redhat.com >> https://www.redhat.com/mailman/listinfo/ovirt-devel >> > Otherwise, based on reading the patch it looks fine. > > pushed, git-send-email mustve mangled it, space was there in the local patchfile From matinata at br.ibm.com Tue May 11 20:04:01 2010 From: matinata at br.ibm.com (Ricardo Marin Matinata) Date: Tue, 11 May 2010 17:04:01 -0300 Subject: [Ovirt-devel] [PATCH node] save all not-parsed boot parameters In-Reply-To: <1273012051-12343-1-git-send-email-apevec@redhat.com> References: <1273012051-12343-1-git-send-email-apevec@redhat.com> Message-ID: <1273608241.15193.20.camel@localhost> I think this patch is really useful, specially towards automated PXE installations. I do have, however, one comment below with regard to escaping typical boot parameters, not intended to be passed-on to the final installed node... On Wed, 2010-05-05 at 00:27 +0200, Alan Pevec wrote: > not just console= > This is to allow vendor-specific boot parameters to survive when the > image is installed to disk. > > Signed-off-by: Alan Pevec > --- > scripts/ovirt-early | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/scripts/ovirt-early b/scripts/ovirt-early > index 4b85102..c17ea74 100755 > --- a/scripts/ovirt-early > +++ b/scripts/ovirt-early > @@ -426,13 +426,13 @@ start_ovirt_early () { > i=${i#collectd=} > eval $(printf $i|awk -F: '{print "collectd_server="$1; print "collectd_port="$2;}') > ;; > - console=*) > - bootparams="$bootparams $i" > - ;; > ovirt_early=*) > i=${i#ovirt_early=} > ovirt_early=$(echo $i|tr ",:;" " ") > ;; + root=*|BOOT_IMAGE=*|rootfstype=*|initrd=*|check|rootflags=*|ro| linux|liveimg) + ;; > + *) > + bootparams="$bootparams $i" > + ;; > esac > done > -- Ricardo Marin Matinata Linux Technology Center IBM Brazil | Hortolandia | SP matinata br ibm com From apevec at redhat.com Tue May 11 20:10:55 2010 From: apevec at redhat.com (Alan Pevec) Date: Tue, 11 May 2010 22:10:55 +0200 Subject: [Ovirt-devel] [PATCH node] save all not-parsed boot parameters In-Reply-To: <1273608241.15193.20.camel@localhost> References: <1273012051-12343-1-git-send-email-apevec@redhat.com> <1273608241.15193.20.camel@localhost> Message-ID: <4BE9B9CF.20301@redhat.com> Ricardo Marin Matinata wrote: > + root=*|BOOT_IMAGE=*|rootfstype=*|initrd=*|check|rootflags=*|ro| > linux|liveimg) > + ;; Thanks, I'll include that. From apevec at redhat.com Wed May 12 20:02:19 2010 From: apevec at redhat.com (Alan Pevec) Date: Wed, 12 May 2010 22:02:19 +0200 Subject: [Ovirt-devel] [PATCH node] save all not-parsed boot parameters In-Reply-To: <1273012051-12343-1-git-send-email-apevec@redhat.com> References: <1273012051-12343-1-git-send-email-apevec@redhat.com> Message-ID: <1273694539-21539-1-git-send-email-apevec@redhat.com> not just console=*, excluding image related parameters (rootfs,initrd...) This is to allow vendor-specific boot parameters to survive when the image is installed. Signed-off-by: Alan Pevec --- scripts/ovirt-early | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/ovirt-early b/scripts/ovirt-early index 4b85102..c2186f8 100755 --- a/scripts/ovirt-early +++ b/scripts/ovirt-early @@ -426,13 +426,16 @@ start_ovirt_early () { i=${i#collectd=} eval $(printf $i|awk -F: '{print "collectd_server="$1; print "collectd_port="$2;}') ;; - console=*) - bootparams="$bootparams $i" - ;; ovirt_early=*) i=${i#ovirt_early=} ovirt_early=$(echo $i|tr ",:;" " ") ;; + BOOT_IMAGE=* | initrd=* | check | linux | liveimg | \ + root=* | rootfstype=* | rootflags=* | ro) + ;; + *) + bootparams="$bootparams $i" + ;; esac done -- 1.6.0.6 From dpierce at redhat.com Thu May 13 15:05:06 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 13 May 2010 11:05:06 -0400 Subject: [Ovirt-devel] [PATCH] Replace the HAL calls with udev/systool calls. Message-ID: <1273763106-20873-1-git-send-email-dpierce@redhat.com> HAL has been deprecated, and this patch removes all HAL specific calls from the configuration scripts. HAL is still present in the Python scripts, but will be removed in a different patch. Signed-off-by: Darryl L. Pierce --- ChangeLog | 3 + configure.ac | 2 - ovirt-node.spec.in | 1 - scripts/ovirt-config-networking | 18 ++++---- scripts/ovirt-config-storage | 99 ++++++++++++++------------------------- 5 files changed, 48 insertions(+), 75 deletions(-) diff --git a/ChangeLog b/ChangeLog index 49d57ad..b57763a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ CHANGELOG ========= +Version 1.9.3: + * Removed HAL dependencies from the firstboot scripts. + Version 1.9.2: * Fixed the autoconf setup to cover more prerequisites. diff --git a/configure.ac b/configure.ac index abe97cc..18cf789 100644 --- a/configure.ac +++ b/configure.ac @@ -10,9 +10,7 @@ fi # TODO need a way to check for python-setuptools -AC_CHECK_LIB(dbus-1, main, , AC_MSG_ERROR([Cannot find DBus development libraries.])) AC_CHECK_LIB(virt, main, , AC_MSG_ERROR([Cannot find libvirt development libraries.])) -AC_CHECK_LIB(hal, main, , AC_MSG_ERROR([Cannot find HAL development libraries.])) AC_CHECK_LIB(python2.6, main, , AC_MSG_ERROR([Cannot find python development libraries.])) AC_CONFIG_HEADERS([config.h]) diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index 28d8719..45de24c 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -17,7 +17,6 @@ URL: http://www.ovirt.org/ 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 diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 4d412ac..1cfc2db 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -460,16 +460,16 @@ set ${ntproot}/keys /etc/ntp/keys\n\ function setup_menu { NICS="" - udi_list=$(hal-find-by-capability --capability net.80203) - if [ -n "$udi_list" ]; then - for d in $udi_list; do - if [[ ! "$(hal-get-property --udi $d --key net.physical_device)" =~ computer ]]; then - NICS="$NICS $(hal-get-property --udi "$d" --key net.interface)" - fi - done - fi + nics=$(ls -bd /sys/class/net/*) + for nic in $nics; do + nic=$(basename $nic) + address=$(systool -c net -d $nic -A address | awk '/address\ += "(.*)"/ { print $3; }') + if [[ ! "$address" =~ '00:00:00:00' ]]; then + NICS="$NICS $nic" + fi + done - # Add virtio NICs that were possibly not detected by hal + # Add virtio NICs that were possibly not detected by other means NICS="$(ifconfig -a | awk '/Ethernet/ {print $1}'|xargs)" NICS=$(echo $NICS | tr ' ' '\n' | sort -u | xargs) diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index ce9707c..5b2c1e9 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -111,41 +111,11 @@ get_drive_size() local drive="$1" local space_var="$2" - local size= - local udi=$(hal-find-by-property --key block.device --string "$drive") - # if more than one UDI was found then iterate over them to find the base device - if [[ "${udi}" =~ \$ ]]; then - udi=$(echo "$udi" | sed 's/\$/ /g') - for found in ${udi}; do - if [[ "false" == $(hal-get-property --udi "$found" --key block.is_volume) ]]; then - udi="$found" - break - fi - done - fi - if [ -z "$udi" ]; then - # If hal didn't find the device, it could be a virtio block device - # or a multipath device - # In this case, use sfdisk -s to get the size - size=$(sfdisk -s "$drive" 2>/dev/null) - if [ -z "$size" ]; then - size=0 - fi - size=$(echo "scale=0; $size * 1024" | bc -l) - else - size=$(hal-get-property --udi "$udi" --key storage.size) - if [[ "${size}" == "0" ]]; then - # disk is probably hot-swappable, use different HAL key - # but first check that it is removeable media and that media is present - if [[ "true" == "$(hal-get-property --udi "$udi" --key storage.removable.media_available)" ]]; then - size=$(hal-get-property --udi "$udi" --key storage.removable.media_size) - fi - fi - fi + local size=$(sfdisk -s $drive) + size=$(echo "scale=0; $size / 1024" | bc -l) - size=$(echo "scale=0; $size / (1024 * 1024)" | bc -l) echo "$drive ($size MB)" - test -z "$udi" || echo "Disk Identifier: $(basename "$udi")" + echo "Disk Identifier: $drive" if [ -n "$space_var" ]; then eval $space_var="$size" fi @@ -210,8 +180,10 @@ check_partition_sizes() printf "\n" printf "There appears to already be an installation on another device:\n" for device in $devices; do - udi=$(hal-find-by-property --key block.device --string $device) - printf "\t$device ($(basename "$udi"))\n" + local uuid + + get_uuid $device uuid + printf "\t$device ${uuid}\n" done printf "We cannot proceed until either device is removed from the system\n" printf "or until the HostVG volume group is removed.\n" @@ -260,40 +232,19 @@ manual_input() # Sample output: /dev/sda get_dev_name() { - local udi_list=$(hal-find-by-capability --capability storage) local byid_list=$(find /dev/disk/by-id -mindepth 1 -not -name '*-part*' 2>/dev/null) - if test -z "$udi_list" -a -z "$byid_list"; then - warn "ERROR: no usable storage devices detected" - return 1 - fi + local devices="" - local d devices sizes - for d in $udi_list; do - local drive_type=$(hal-get-property --udi "$d" --key storage.drive_type) - test "X$drive_type" = Xdisk || continue - local block_dev=$(hal-get-property --udi "$d" --key block.device) - # Must start with a '/'. - case "$block_dev" in - *' '*) - # we use space as separator - warn "block device name '$block_dev' contains space; skipping"; - continue;; - /*) ;; - *) warn "block device name $block_dev doesn't start with '/';" \ - " skipping"; continue;; - esac - test -z "$devices" \ - && devices="$block_dev" \ - || devices="$devices $block_dev" + for drive in $(ls -db /sys/block/[hsv]d*); do + drive="/dev/$(basename $drive)" + test -z "$devices" && devices="$drive" || devices="$devices $drive" done + d="" for d in $byid_list; do devices="$devices $(readlink -f "$d")"; done - # FIXME: workaround for detecting virtio block devices - devices="$devices $(ls /dev/vd? 2> /dev/null | xargs)" - # FIXME: workaround for detecting cciss devices for dev in $(ls /dev/cciss 2>/dev/null); do if [[ ! "$dev" =~ p[0-9]+\$ ]]; then @@ -518,6 +469,26 @@ EOF return ${is_negative-0} } +# Retrieves the UUID for the specified device. +# $1 - the device +# $2 - the variable to be set +get_uuid() +{ + local device=${1-} + local envvar=${2-} + local rootname + + if [[ "$device" =~ "^.*[0-9]?$" ]]; then + rootname="${device:0:${#device}-1}" + fi + local uuid=$( + udevadm info --path=/sys/block/$rootname/$device --query=property | + awk '/ID_FS_UUID=/ { match($0, "ID_FS_UUID=(.*)", data); print data[1]; }' + ) + + eval $envvar="$uuid" +} + #Check for an existing HostVG on any device on the system. # Return 0 if then is a HostVG found, unless only one found is on $1 # Return 1 if no HostVG found or only found on $1 @@ -537,10 +508,12 @@ check_existing_hostvg() printf "\n" printf "There appears to already be an installation on another device:\n" for device in $devices; do + local uuid + get_multipath_devices ${device%p[0-9]} sd_dev sd_dev=$(echo "$sd_dev" | awk '{print $1}') - udi=$(hal-find-by-property --key block.device --string /dev/${sd_dev}) - printf "\t$device ($(basename "$udi"))\n" + get_uuid $sd_dev uuid + printf "\t$device ($uuid)\n" done printf "The installation cannot proceed until the device is removed\n" printf "from the system of the HostVG volume group is removed.\n" -- 1.6.6.1 From dpierce at redhat.com Thu May 13 15:12:37 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 13 May 2010 11:12:37 -0400 Subject: [Ovirt-devel] Non-functional replacement... Message-ID: <1273763558-21304-1-git-send-email-dpierce@redhat.com> This patch just includes the repo name in the subject. From dpierce at redhat.com Thu May 13 15:12:38 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 13 May 2010 11:12:38 -0400 Subject: [Ovirt-devel] [PATCH node] Replace the HAL calls with udev/systool calls. In-Reply-To: <1273763558-21304-1-git-send-email-dpierce@redhat.com> References: <1273763558-21304-1-git-send-email-dpierce@redhat.com> Message-ID: <1273763558-21304-2-git-send-email-dpierce@redhat.com> HAL has been deprecated, and this patch removes all HAL specific calls from the configuration scripts. HAL is still present in the Python scripts, but will be removed in a different patch. Signed-off-by: Darryl L. Pierce --- ChangeLog | 3 + configure.ac | 2 - ovirt-node.spec.in | 1 - scripts/ovirt-config-networking | 18 ++++---- scripts/ovirt-config-storage | 99 ++++++++++++++------------------------- 5 files changed, 48 insertions(+), 75 deletions(-) diff --git a/ChangeLog b/ChangeLog index 49d57ad..b57763a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ CHANGELOG ========= +Version 1.9.3: + * Removed HAL dependencies from the firstboot scripts. + Version 1.9.2: * Fixed the autoconf setup to cover more prerequisites. diff --git a/configure.ac b/configure.ac index abe97cc..18cf789 100644 --- a/configure.ac +++ b/configure.ac @@ -10,9 +10,7 @@ fi # TODO need a way to check for python-setuptools -AC_CHECK_LIB(dbus-1, main, , AC_MSG_ERROR([Cannot find DBus development libraries.])) AC_CHECK_LIB(virt, main, , AC_MSG_ERROR([Cannot find libvirt development libraries.])) -AC_CHECK_LIB(hal, main, , AC_MSG_ERROR([Cannot find HAL development libraries.])) AC_CHECK_LIB(python2.6, main, , AC_MSG_ERROR([Cannot find python development libraries.])) AC_CONFIG_HEADERS([config.h]) diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index 28d8719..45de24c 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -17,7 +17,6 @@ URL: http://www.ovirt.org/ 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 diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 4d412ac..1cfc2db 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -460,16 +460,16 @@ set ${ntproot}/keys /etc/ntp/keys\n\ function setup_menu { NICS="" - udi_list=$(hal-find-by-capability --capability net.80203) - if [ -n "$udi_list" ]; then - for d in $udi_list; do - if [[ ! "$(hal-get-property --udi $d --key net.physical_device)" =~ computer ]]; then - NICS="$NICS $(hal-get-property --udi "$d" --key net.interface)" - fi - done - fi + nics=$(ls -bd /sys/class/net/*) + for nic in $nics; do + nic=$(basename $nic) + address=$(systool -c net -d $nic -A address | awk '/address\ += "(.*)"/ { print $3; }') + if [[ ! "$address" =~ '00:00:00:00' ]]; then + NICS="$NICS $nic" + fi + done - # Add virtio NICs that were possibly not detected by hal + # Add virtio NICs that were possibly not detected by other means NICS="$(ifconfig -a | awk '/Ethernet/ {print $1}'|xargs)" NICS=$(echo $NICS | tr ' ' '\n' | sort -u | xargs) diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index ce9707c..5b2c1e9 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -111,41 +111,11 @@ get_drive_size() local drive="$1" local space_var="$2" - local size= - local udi=$(hal-find-by-property --key block.device --string "$drive") - # if more than one UDI was found then iterate over them to find the base device - if [[ "${udi}" =~ \$ ]]; then - udi=$(echo "$udi" | sed 's/\$/ /g') - for found in ${udi}; do - if [[ "false" == $(hal-get-property --udi "$found" --key block.is_volume) ]]; then - udi="$found" - break - fi - done - fi - if [ -z "$udi" ]; then - # If hal didn't find the device, it could be a virtio block device - # or a multipath device - # In this case, use sfdisk -s to get the size - size=$(sfdisk -s "$drive" 2>/dev/null) - if [ -z "$size" ]; then - size=0 - fi - size=$(echo "scale=0; $size * 1024" | bc -l) - else - size=$(hal-get-property --udi "$udi" --key storage.size) - if [[ "${size}" == "0" ]]; then - # disk is probably hot-swappable, use different HAL key - # but first check that it is removeable media and that media is present - if [[ "true" == "$(hal-get-property --udi "$udi" --key storage.removable.media_available)" ]]; then - size=$(hal-get-property --udi "$udi" --key storage.removable.media_size) - fi - fi - fi + local size=$(sfdisk -s $drive) + size=$(echo "scale=0; $size / 1024" | bc -l) - size=$(echo "scale=0; $size / (1024 * 1024)" | bc -l) echo "$drive ($size MB)" - test -z "$udi" || echo "Disk Identifier: $(basename "$udi")" + echo "Disk Identifier: $drive" if [ -n "$space_var" ]; then eval $space_var="$size" fi @@ -210,8 +180,10 @@ check_partition_sizes() printf "\n" printf "There appears to already be an installation on another device:\n" for device in $devices; do - udi=$(hal-find-by-property --key block.device --string $device) - printf "\t$device ($(basename "$udi"))\n" + local uuid + + get_uuid $device uuid + printf "\t$device ${uuid}\n" done printf "We cannot proceed until either device is removed from the system\n" printf "or until the HostVG volume group is removed.\n" @@ -260,40 +232,19 @@ manual_input() # Sample output: /dev/sda get_dev_name() { - local udi_list=$(hal-find-by-capability --capability storage) local byid_list=$(find /dev/disk/by-id -mindepth 1 -not -name '*-part*' 2>/dev/null) - if test -z "$udi_list" -a -z "$byid_list"; then - warn "ERROR: no usable storage devices detected" - return 1 - fi + local devices="" - local d devices sizes - for d in $udi_list; do - local drive_type=$(hal-get-property --udi "$d" --key storage.drive_type) - test "X$drive_type" = Xdisk || continue - local block_dev=$(hal-get-property --udi "$d" --key block.device) - # Must start with a '/'. - case "$block_dev" in - *' '*) - # we use space as separator - warn "block device name '$block_dev' contains space; skipping"; - continue;; - /*) ;; - *) warn "block device name $block_dev doesn't start with '/';" \ - " skipping"; continue;; - esac - test -z "$devices" \ - && devices="$block_dev" \ - || devices="$devices $block_dev" + for drive in $(ls -db /sys/block/[hsv]d*); do + drive="/dev/$(basename $drive)" + test -z "$devices" && devices="$drive" || devices="$devices $drive" done + d="" for d in $byid_list; do devices="$devices $(readlink -f "$d")"; done - # FIXME: workaround for detecting virtio block devices - devices="$devices $(ls /dev/vd? 2> /dev/null | xargs)" - # FIXME: workaround for detecting cciss devices for dev in $(ls /dev/cciss 2>/dev/null); do if [[ ! "$dev" =~ p[0-9]+\$ ]]; then @@ -518,6 +469,26 @@ EOF return ${is_negative-0} } +# Retrieves the UUID for the specified device. +# $1 - the device +# $2 - the variable to be set +get_uuid() +{ + local device=${1-} + local envvar=${2-} + local rootname + + if [[ "$device" =~ "^.*[0-9]?$" ]]; then + rootname="${device:0:${#device}-1}" + fi + local uuid=$( + udevadm info --path=/sys/block/$rootname/$device --query=property | + awk '/ID_FS_UUID=/ { match($0, "ID_FS_UUID=(.*)", data); print data[1]; }' + ) + + eval $envvar="$uuid" +} + #Check for an existing HostVG on any device on the system. # Return 0 if then is a HostVG found, unless only one found is on $1 # Return 1 if no HostVG found or only found on $1 @@ -537,10 +508,12 @@ check_existing_hostvg() printf "\n" printf "There appears to already be an installation on another device:\n" for device in $devices; do + local uuid + get_multipath_devices ${device%p[0-9]} sd_dev sd_dev=$(echo "$sd_dev" | awk '{print $1}') - udi=$(hal-find-by-property --key block.device --string /dev/${sd_dev}) - printf "\t$device ($(basename "$udi"))\n" + get_uuid $sd_dev uuid + printf "\t$device ($uuid)\n" done printf "The installation cannot proceed until the device is removed\n" printf "from the system of the HostVG volume group is removed.\n" -- 1.6.6.1 From jboggs at redhat.com Thu May 13 19:57:37 2010 From: jboggs at redhat.com (Joey Boggs) Date: Thu, 13 May 2010 15:57:37 -0400 Subject: [Ovirt-devel] [PATCH node] Replace the HAL calls with udev/systool calls. In-Reply-To: <1273763558-21304-2-git-send-email-dpierce@redhat.com> References: <1273763558-21304-1-git-send-email-dpierce@redhat.com> <1273763558-21304-2-git-send-email-dpierce@redhat.com> Message-ID: <4BEC59B1.7040503@redhat.com> On 05/13/2010 11:12 AM, Darryl L. Pierce wrote: > HAL has been deprecated, and this patch removes all HAL specific calls > from the configuration scripts. > > HAL is still present in the Python scripts, but will be removed in a > different patch. > > Signed-off-by: Darryl L. Pierce > --- > ChangeLog | 3 + > configure.ac | 2 - > ovirt-node.spec.in | 1 - > scripts/ovirt-config-networking | 18 ++++---- > scripts/ovirt-config-storage | 99 ++++++++++++++------------------------- > 5 files changed, 48 insertions(+), 75 deletions(-) > > diff --git a/ChangeLog b/ChangeLog > index 49d57ad..b57763a 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1,6 +1,9 @@ > CHANGELOG > ========= > > +Version 1.9.3: > + * Removed HAL dependencies from the firstboot scripts. > + > Version 1.9.2: > * Fixed the autoconf setup to cover more prerequisites. > > diff --git a/configure.ac b/configure.ac > index abe97cc..18cf789 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -10,9 +10,7 @@ fi > > # TODO need a way to check for python-setuptools > > -AC_CHECK_LIB(dbus-1, main, , AC_MSG_ERROR([Cannot find DBus development libraries.])) > AC_CHECK_LIB(virt, main, , AC_MSG_ERROR([Cannot find libvirt development libraries.])) > -AC_CHECK_LIB(hal, main, , AC_MSG_ERROR([Cannot find HAL development libraries.])) > AC_CHECK_LIB(python2.6, main, , AC_MSG_ERROR([Cannot find python development libraries.])) > > AC_CONFIG_HEADERS([config.h]) > diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in > index 28d8719..45de24c 100644 > --- a/ovirt-node.spec.in > +++ b/ovirt-node.spec.in > @@ -17,7 +17,6 @@ URL: http://www.ovirt.org/ > 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 > diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking > index 4d412ac..1cfc2db 100755 > --- a/scripts/ovirt-config-networking > +++ b/scripts/ovirt-config-networking > @@ -460,16 +460,16 @@ set ${ntproot}/keys /etc/ntp/keys\n\ > function setup_menu > { > NICS="" > - udi_list=$(hal-find-by-capability --capability net.80203) > - if [ -n "$udi_list" ]; then > - for d in $udi_list; do > - if [[ ! "$(hal-get-property --udi $d --key net.physical_device)" =~ computer ]]; then > - NICS="$NICS $(hal-get-property --udi "$d" --key net.interface)" > - fi > - done > - fi > + nics=$(ls -bd /sys/class/net/*) > + for nic in $nics; do > + nic=$(basename $nic) > + address=$(systool -c net -d $nic -A address | awk '/address\ += "(.*)"/ { print $3; }') > + if [[ ! "$address" =~ '00:00:00:00' ]]; then > + NICS="$NICS $nic" > + fi > + done > > - # Add virtio NICs that were possibly not detected by hal > + # Add virtio NICs that were possibly not detected by other means > NICS="$(ifconfig -a | awk '/Ethernet/ {print $1}'|xargs)" > NICS=$(echo $NICS | tr ' ' '\n' | sort -u | xargs) > > diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage > index ce9707c..5b2c1e9 100755 > --- a/scripts/ovirt-config-storage > +++ b/scripts/ovirt-config-storage > @@ -111,41 +111,11 @@ get_drive_size() > local drive="$1" > local space_var="$2" > > - local size= > - local udi=$(hal-find-by-property --key block.device --string "$drive") > - # if more than one UDI was found then iterate over them to find the base device > - if [[ "${udi}" =~ \$ ]]; then > - udi=$(echo "$udi" | sed 's/\$/ /g') > - for found in ${udi}; do > - if [[ "false" == $(hal-get-property --udi "$found" --key block.is_volume) ]]; then > - udi="$found" > - break > - fi > - done > - fi > - if [ -z "$udi" ]; then > - # If hal didn't find the device, it could be a virtio block device > - # or a multipath device > - # In this case, use sfdisk -s to get the size > - size=$(sfdisk -s "$drive" 2>/dev/null) > - if [ -z "$size" ]; then > - size=0 > - fi > - size=$(echo "scale=0; $size * 1024" | bc -l) > - else > - size=$(hal-get-property --udi "$udi" --key storage.size) > - if [[ "${size}" == "0" ]]; then > - # disk is probably hot-swappable, use different HAL key > - # but first check that it is removeable media and that media is present > - if [[ "true" == "$(hal-get-property --udi "$udi" --key storage.removable.media_available)" ]]; then > - size=$(hal-get-property --udi "$udi" --key storage.removable.media_size) > - fi > - fi > - fi > + local size=$(sfdisk -s $drive) > + size=$(echo "scale=0; $size / 1024" | bc -l) > > - size=$(echo "scale=0; $size / (1024 * 1024)" | bc -l) > echo "$drive ($size MB)" > - test -z "$udi" || echo "Disk Identifier: $(basename "$udi")" > + echo "Disk Identifier: $drive" > if [ -n "$space_var" ]; then > eval $space_var="$size" > fi > @@ -210,8 +180,10 @@ check_partition_sizes() > printf "\n" > printf "There appears to already be an installation on another device:\n" > for device in $devices; do > - udi=$(hal-find-by-property --key block.device --string $device) > - printf "\t$device ($(basename "$udi"))\n" > + local uuid > + > + get_uuid $device uuid > + printf "\t$device ${uuid}\n" > done > printf "We cannot proceed until either device is removed from the system\n" > printf "or until the HostVG volume group is removed.\n" > @@ -260,40 +232,19 @@ manual_input() > # Sample output: /dev/sda > get_dev_name() > { > - local udi_list=$(hal-find-by-capability --capability storage) > local byid_list=$(find /dev/disk/by-id -mindepth 1 -not -name '*-part*' 2>/dev/null) > - if test -z "$udi_list" -a -z "$byid_list"; then > - warn "ERROR: no usable storage devices detected" > - return 1 > - fi > + local devices="" > > - local d devices sizes > - for d in $udi_list; do > - local drive_type=$(hal-get-property --udi "$d" --key storage.drive_type) > - test "X$drive_type" = Xdisk || continue > - local block_dev=$(hal-get-property --udi "$d" --key block.device) > - # Must start with a '/'. > - case "$block_dev" in > - *' '*) > - # we use space as separator > - warn "block device name '$block_dev' contains space; skipping"; > - continue;; > - /*) ;; > - *) warn "block device name $block_dev doesn't start with '/';" \ > - " skipping"; continue;; > - esac > - test -z "$devices" \ > -&& devices="$block_dev" \ > - || devices="$devices $block_dev" > + for drive in $(ls -db /sys/block/[hsv]d*); do > + drive="/dev/$(basename $drive)" > + test -z "$devices"&& devices="$drive" || devices="$devices $drive" > done > + > d="" > for d in $byid_list; do > devices="$devices $(readlink -f "$d")"; > done > > - # FIXME: workaround for detecting virtio block devices > - devices="$devices $(ls /dev/vd? 2> /dev/null | xargs)" > - > # FIXME: workaround for detecting cciss devices > for dev in $(ls /dev/cciss 2>/dev/null); do > if [[ ! "$dev" =~ p[0-9]+\$ ]]; then > @@ -518,6 +469,26 @@ EOF > return ${is_negative-0} > } > > +# Retrieves the UUID for the specified device. > +# $1 - the device > +# $2 - the variable to be set > +get_uuid() > +{ > + local device=${1-} > + local envvar=${2-} > + local rootname > + > + if [[ "$device" =~ "^.*[0-9]?$" ]]; then > + rootname="${device:0:${#device}-1}" > + fi > + local uuid=$( > + udevadm info --path=/sys/block/$rootname/$device --query=property | > + awk '/ID_FS_UUID=/ { match($0, "ID_FS_UUID=(.*)", data); print data[1]; }' > + ) > + > + eval $envvar="$uuid" > +} > + > #Check for an existing HostVG on any device on the system. > # Return 0 if then is a HostVG found, unless only one found is on $1 > # Return 1 if no HostVG found or only found on $1 > @@ -537,10 +508,12 @@ check_existing_hostvg() > printf "\n" > printf "There appears to already be an installation on another device:\n" > for device in $devices; do > + local uuid > + > get_multipath_devices ${device%p[0-9]} sd_dev > sd_dev=$(echo "$sd_dev" | awk '{print $1}') > - udi=$(hal-find-by-property --key block.device --string /dev/${sd_dev}) > - printf "\t$device ($(basename "$udi"))\n" > + get_uuid $sd_dev uuid > + printf "\t$device ($uuid)\n" > done > printf "The installation cannot proceed until the device is removed\n" > printf "from the system of the HostVG volume group is removed.\n" > ACK, only issue was the dm-X devices showing up in the device list From dpierce at redhat.com Thu May 13 21:05:45 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 13 May 2010 17:05:45 -0400 Subject: [Ovirt-devel] [PATCH matahari] Moving QMF functionality into a transport layer. Message-ID: <1273784745-19846-1-git-send-email-dpierce@redhat.com> This is the first step towards separating the APIs from the means by which they are carried between the remote and local system. Added a few new classes and types: * HostTransport - defines a type for talking to the Host * Host - the public contract for the host APIs * HostAgent - the QMF transport layer Signed-off-by: Darryl L. Pierce --- .gitignore | 2 +- src/Makefile.am | 8 +++- src/host.cpp | 133 +++++++++++++++++++---------------------------- src/host.h | 62 ++++++++++++++-------- src/host_transport.cpp | 33 ++++++++++++ src/host_transport.h | 37 +++++++++++++ src/hostimpl.cpp | 135 ++++++++++++++++++++++++++++++++++++++++++++++++ src/hostimpl.h | 47 +++++++++++++++++ src/main.cpp | 8 ++- src/qmf/hostagent.cpp | 87 +++++++++++++++++++++++++++++++ src/qmf/hostagent.h | 55 +++++++++++++++++++ 11 files changed, 502 insertions(+), 105 deletions(-) create mode 100644 src/host_transport.cpp create mode 100644 src/host_transport.h create mode 100644 src/hostimpl.cpp create mode 100644 src/hostimpl.h create mode 100644 src/qmf/hostagent.cpp create mode 100644 src/qmf/hostagent.h diff --git a/.gitignore b/.gitignore index ad6d70b..8e12062 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,4 @@ stamp-h1 *~ src/matahari -src/qmf +src/qmf/com diff --git a/src/Makefile.am b/src/Makefile.am index aed9e19..530abd7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,6 +18,10 @@ nodist_matahari_SOURCES = $(generated_file_list) $(first) matahari_SOURCES = \ host.cpp \ host.h \ + host_transport.cpp \ + host_transport.h \ + hostimpl.cpp \ + hostimpl.h \ linux_platform.cpp \ linux_platform.h \ main.cpp \ @@ -26,7 +30,9 @@ matahari_SOURCES = \ platform.cpp \ platform.h \ processors.cpp \ - processors.h + processors.h \ + qmf/hostagent.cpp \ + qmf/hostagent.h $(generated_file_list): $(generated_file_list) diff --git a/src/host.cpp b/src/host.cpp index 34d4550..e755ffa 100644 --- a/src/host.cpp +++ b/src/host.cpp @@ -17,103 +17,78 @@ * also available at http://www.gnu.org/copyleft/gpl.html. */ -#include - -#include -#include -#include -#include - #include "host.h" -#include "platform.h" -#include "qmf/com/redhat/matahari/Host.h" -using namespace qpid::management; using namespace std; -using qpid::management::Manageable; -namespace _qmf = qmf::com::redhat::matahari; - void -HostAgent::setup(ManagementAgent* agent) +Host::set_uuid(const string uuid) { - management_object = new _qmf::Host(agent, this); - agent->addObject(management_object); - - // discover the aspects of the host - processors.setup(agent, this); - networkdevices = Platform::instance()->get_network_devices(); - - for(vector::iterator iter = networkdevices.begin(); - iter != networkdevices.end(); - iter++) - { - iter->setup(agent, this); - } + _uuid = uuid; +} - struct utsname details; - string uuid = "Unknown"; - string hostname = "Unknown"; - string hypervisor = "Unknown"; - string architecture = "None"; - unsigned long memory = 0; - bool beeping = false; +string +Host:: get_uuid() const +{ + return _uuid; +} - ifstream input("/var/lib/dbus/machine-id"); +void +Host::set_hostname(const string hostname) +{ + _hostname = hostname; +} - if(input.is_open()) - { - getline(input, uuid); - input.close(); - } +string +Host::get_hostname() const +{ + return _hostname; +} - if(!uname(&details)) - { - hostname = string(details.nodename); - architecture = string(details.machine); - } - else - { - throw runtime_error("Unable to retrieve system details"); - } +void +Host::set_hypervisor(const string hypervisor) +{ + _hypervisor = hypervisor; +} - virConnectPtr lvconn = virConnectOpenReadOnly(NULL); +string +Host::get_hypervisor() const +{ + return _hypervisor; +} - if(lvconn) - { - hypervisor = string(virConnectGetType(lvconn)); - virConnectClose(lvconn); - } +void +Host::set_architecture(const string architecture) +{ + _architecture = architecture; +} - struct sysinfo sysinf; - if(!sysinfo(&sysinf)) - { - memory = sysinf.totalram / 1024L; - } - else - { - throw runtime_error("Unable to retrieve system memory details."); - } +string +Host::get_architecture() const +{ + return _architecture; +} - cout << "memory: " << memory << endl; +void +Host::set_memory(const unsigned int memory) +{ + _memory = memory; +} - management_object->set_uuid(uuid); - management_object->set_hostname(hostname); - management_object->set_hypervisor(hypervisor); - management_object->set_arch(architecture); - management_object->set_memory(memory); - management_object->set_beeping(beeping); +unsigned int +Host::get_memory() const +{ + return _memory; } void -HostAgent::update(void) +Host::set_beeping(const bool beeping) { - processors.update(); + _beeping = beeping; +} - for(vector::iterator iter = networkdevices.begin(); - iter != networkdevices.end(); - iter++) - { - iter->update(); - } +bool +Host::is_beeping() const +{ + return _beeping; } diff --git a/src/host.h b/src/host.h index d2da776..b2a4a30 100644 --- a/src/host.h +++ b/src/host.h @@ -20,39 +20,57 @@ * also available at http://www.gnu.org/copyleft/gpl.html. */ -#include -#include -#include +#include -#include "qmf/com/redhat/matahari/Host.h" - -#include "networkdevice.h" -#include "processors.h" - -using namespace qpid::management; using namespace std; -using qpid::management::Manageable; +/* + HeartbeatListener defines a type which receives notification + when a heartbeat event occurs. + */ +class HeartbeatListener +{ + public: + virtual void heartbeat() = 0; +}; -class HostAgent : public Manageable +/* + Host represents the public contract for the set of host APIs. + */ +class Host { private: - qmf::com::redhat::matahari::Host* management_object; - ProcessorsAgent processors; - vector networkdevices; + string _uuid; + string _hostname; + string _hypervisor; + string _architecture; + unsigned int _memory; + bool _beeping; public: - HostAgent() {} - virtual ~HostAgent() {} + void set_uuid(const string uuid); + string get_uuid() const; + + void set_hostname(const string hostname); + string get_hostname() const; + + void set_hypervisor(const string hypervisor); + string get_hypervisor() const; + + void set_architecture(const string architecture); + string get_architecture() const; - ManagementObject* GetManagementObject(void) const { return management_object; } + void set_memory(const unsigned int memory); + unsigned int get_memory() const; - void setup(ManagementAgent* agent); - void update(void); + void set_beeping(const bool beeping); + bool is_beeping() const; - // agent methods - void shutdown(void); - void reboot(void); + virtual void identify(const int iterations) = 0; + virtual void subscribe_to_heartbeat(const HeartbeatListener& listener) = 0; + virtual void unsubscribe_from_heartbeat(const HeartbeatListener& listener) = 0; + virtual void shutdown() = 0; + virtual void reboot() = 0; }; #endif // __HOST_H diff --git a/src/host_transport.cpp b/src/host_transport.cpp new file mode 100644 index 0000000..ab89912 --- /dev/null +++ b/src/host_transport.cpp @@ -0,0 +1,33 @@ +/* host_transport.cpp - Copyright (C) 2009 Red Hat, Inc. + * Written by Arjun Roy + * + * 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. + */ + +#include "host_transport.h" + +void +HostTransport::addHostTransport(HostTransport* nextTransport) +{ + if(!_nextTransport) + { + _nextTransport = nextTransport; + } + else + { + this->_nextTransport->addHostTransport(nextTransport); + } +} diff --git a/src/host_transport.h b/src/host_transport.h new file mode 100644 index 0000000..a4019ad --- /dev/null +++ b/src/host_transport.h @@ -0,0 +1,37 @@ +#ifndef __HOST_TRANSPORT_H +#define __HOST_TRANSPORT_H + +/* host_transport.h - Copyright (C) 2009 Red Hat, Inc. + * Written by Arjun Roy + * + * 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. + */ + +/* + HostTransport represents a type that handles transporting data to and from + an instance of Host. + */ +class HostTransport +{ + private: + HostTransport* _nextTransport; + + public: + // Sets a reference to the next listener in a chain. + void addHostTransport(HostTransport* next); +}; + +#endif diff --git a/src/hostimpl.cpp b/src/hostimpl.cpp new file mode 100644 index 0000000..bb976b7 --- /dev/null +++ b/src/hostimpl.cpp @@ -0,0 +1,135 @@ +/* hostimpl.cpp - Copyright (C) 2009 Red Hat, Inc. + * Written by Arjun Roy + * + * 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. + */ + +#include +#include + +#include +#include +#include + +#include "hostimpl.h" +#include "platform.h" + +using namespace std; + +HostImpl::HostImpl() +{ + struct utsname details; + this->set_uuid(string("Unknown")); + this->set_hostname(string("Unknown")); + this->set_hypervisor(string("Unknown")); + this->set_architecture(string("None")); + this->set_memory(0); + this->set_beeping(false); + + std::ifstream input("/var/lib/dbus/machine-id"); + + if(input.is_open()) + { + string uuid; + + getline(input, uuid); + input.close(); + this->set_uuid(uuid); + } + + if(!uname(&details)) + { + this->set_hostname(string(details.nodename)); + this->set_architecture(string(details.machine)); + } + else + { + throw runtime_error("Unable to retrieve system details"); + } + + virConnectPtr lvconn = virConnectOpenReadOnly(NULL); + + if(lvconn) + { + this->set_hypervisor(string(virConnectGetType(lvconn))); + virConnectClose(lvconn); + } + + struct sysinfo sysinf; + if(!sysinfo(&sysinf)) + { + this->set_memory(sysinf.totalram / 1024L); + } + else + { + throw runtime_error("Unable to retrieve system memory details."); + } +} + +void +HostImpl::setup(ManagementAgent* agent, HostAgent* host) +{ + // discover the aspects of the host + processors.setup(agent, host); + networkdevices = Platform::instance()->get_network_devices(); + + for(vector::iterator iter = networkdevices.begin(); + iter != networkdevices.end(); + iter++) + { + iter->setup(agent, host); + } +} + +void +HostImpl::update() +{ + processors.update(); + + for(vector::iterator iter = networkdevices.begin(); + iter != networkdevices.end(); + iter++) + { + iter->update(); + } +} + +void +HostImpl::identify(const int iterations) +{ +} + +void +HostImpl:: subscribe_to_heartbeat(const HeartbeatListener& listener) +{ +} + +void +HostImpl::unsubscribe_from_heartbeat(const HeartbeatListener& listener) +{ +} + +void +HostImpl::shutdown() +{ + // TODO implement an actual shutdown function +} + +void +HostImpl::reboot() +{ + // TODO implement an actual reboot function +} diff --git a/src/hostimpl.h b/src/hostimpl.h new file mode 100644 index 0000000..f5a4e47 --- /dev/null +++ b/src/hostimpl.h @@ -0,0 +1,47 @@ +#ifndef __HOSTIMPL_H +#define __HOSTIMPL_H + +/* hostimpl.h - Copyright (C) 2009 Red Hat, Inc. + * Written by Arjun Roy + * + * 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. + */ + +#include "host.h" +#include "qmf/hostagent.h" +#include "processors.h" +#include "networkdevice.h" + +class HostImpl : public Host +{ + private: + ProcessorsAgent processors; + vector networkdevices; + public: + HostImpl(); + virtual ~HostImpl() {} + + void setup(ManagementAgent* agent, HostAgent* host); + void update(); + + virtual void identify(const int iterations); + virtual void subscribe_to_heartbeat(const HeartbeatListener& listener); + virtual void unsubscribe_from_heartbeat(const HeartbeatListener& listener); + virtual void shutdown(); + virtual void reboot(); +}; + +#endif diff --git a/src/main.cpp b/src/main.cpp index 5ab3ac2..05b5ad6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,6 +32,8 @@ #include #include "host.h" +#include "hostimpl.h" + #include "qmf/com/redhat/matahari/Package.h" using namespace qpid::management; @@ -76,7 +78,8 @@ main(int argc, char **argv) ConnectionSettings settings; ManagementAgent *agent; - HostAgent host; + HostImpl host; + HostAgent hostAgent(&host); struct option opt[] = { {"help", no_argument, NULL, 'h'}, @@ -178,7 +181,8 @@ main(int argc, char **argv) agent->init(settings, 5, false, ".magentdata"); // Get the info and post it to the broker - host.setup(agent); + hostAgent.setup(agent); + host.setup(agent, &hostAgent); while(1) { diff --git a/src/qmf/hostagent.cpp b/src/qmf/hostagent.cpp new file mode 100644 index 0000000..644679f --- /dev/null +++ b/src/qmf/hostagent.cpp @@ -0,0 +1,87 @@ +/* hostagent.cpp - Copyright (C) 2009 Red Hat, Inc. + * Written by Arjun Roy + * + * 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. + */ + +#include "hostagent.h" +#include + +namespace _qmf = qmf::com::redhat::matahari; + +HostAgent::HostAgent(Host* host) + :_host(host) +{} + +void +HostAgent::setup(ManagementAgent* agent) +{ + _management_object = new _qmf::Host(agent, this); + agent->addObject(_management_object); + + _management_object->set_uuid(_host->get_uuid()); + _management_object->set_hostname(_host->get_hostname()); + _management_object->set_hypervisor(_host->get_hypervisor()); + _management_object->set_arch(_host->get_architecture()); + _management_object->set_memory(_host->get_memory()); + _management_object->set_beeping(_host->is_beeping()); +} + +Manageable::status_t +HostAgent::ManagementMethod(uint32_t method, Args& arguments, string& text) +{ + switch(method) + { + case _qmf::Host::METHOD_SHUTDOWN: + _host->shutdown(); + return Manageable::STATUS_OK; + case _qmf::Host::METHOD_REBOOT: + _host->reboot(); + return Manageable::STATUS_OK; + } + + return Manageable::STATUS_NOT_IMPLEMENTED; +} + +void +HostAgent::identify(const int iterations) +{ + // TODO +} + +void +HostAgent::subscribe_to_heartbeat(const HeartbeatListener& listener) +{ + // TODO +} + +void +HostAgent::unsubscribe_from_heartbeat(const HeartbeatListener& listener) +{ + // TODO +} + +void +HostAgent::shutdown() +{ + _host->shutdown(); +} + +void +HostAgent::reboot() +{ + _host->reboot(); +} diff --git a/src/qmf/hostagent.h b/src/qmf/hostagent.h new file mode 100644 index 0000000..1262e42 --- /dev/null +++ b/src/qmf/hostagent.h @@ -0,0 +1,55 @@ +#ifndef __HOSTAGENT_H +#define __HOSTAGENT_H + +/* hostagent.h - Copyright (C) 2009 Red Hat, Inc. + * Written by Arjun Roy + * + * 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. + */ + +#include + +#include "host.h" +#include "host_transport.h" + +#include "qmf/com/redhat/matahari/Host.h" + +using namespace qpid::management; + +class HostAgent : public Manageable, public Host, public HostTransport, public HeartbeatListener +{ + private: + qmf::com::redhat::matahari::Host* _management_object; + Host* _host; + + public: + HostAgent(Host* host); + virtual ~HostAgent() {} + + void setup(ManagementAgent* agent); + ManagementObject* GetManagementObject() const { return _management_object; } + status_t ManagementMethod(uint32_t method, Args& arguments, string& text); + + virtual void identify(const int iterations); + virtual void subscribe_to_heartbeat(const HeartbeatListener& listener); + virtual void unsubscribe_from_heartbeat(const HeartbeatListener& listener); + virtual void shutdown(); + virtual void reboot(); + + virtual void heartbeat() {} +}; + +#endif -- 1.6.6.1 From mburns at redhat.com Fri May 14 18:51:18 2010 From: mburns at redhat.com (Mike Burns) Date: Fri, 14 May 2010 14:51:18 -0400 Subject: [Ovirt-devel] [PATCH node] Fix autobuild to use just build ovirt-node rpms Message-ID: <1273863078-22105-1-git-send-email-mburns@redhat.com> Need to recreate the repo information in autobuild so that the rpms just generated get included in the iso build. Signed-off-by: Mike Burns --- autobuild.sh | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/autobuild.sh b/autobuild.sh index 92b3d32..a27a7ff 100755 --- a/autobuild.sh +++ b/autobuild.sh @@ -45,6 +45,11 @@ if [ -f /usr/bin/rpmbuild ]; then rpmbuild --nodeps --define "extra_release $EXTRA_RELEASE" -ta --clean *.tar.gz fi +# regenerate repo so iso uses new ovirt-node rpms +cd ${AUTOBUILD_PACKAGE_ROOT}/rpm/RPMS +createrepo . +cd - + #make iso cd recipe make \ -- 1.6.6.1 From mburns at redhat.com Fri May 14 18:57:30 2010 From: mburns at redhat.com (Mike Burns) Date: Fri, 14 May 2010 14:57:30 -0400 Subject: [Ovirt-devel] [PATCH node] Fix autobuild to use just build ovirt-node rpms In-Reply-To: <1273863078-22105-1-git-send-email-mburns@redhat.com> References: <1273863078-22105-1-git-send-email-mburns@redhat.com> Message-ID: <1273863450.3429.1.camel@localhost.localdomain> Please disregard, new version coming shortly... On Fri, 2010-05-14 at 14:51 -0400, Mike Burns wrote: > Need to recreate the repo information in autobuild so that the > rpms just generated get included in the iso build. > > Signed-off-by: Mike Burns > --- > autobuild.sh | 5 +++++ > 1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/autobuild.sh b/autobuild.sh > index 92b3d32..a27a7ff 100755 > --- a/autobuild.sh > +++ b/autobuild.sh > @@ -45,6 +45,11 @@ if [ -f /usr/bin/rpmbuild ]; then > rpmbuild --nodeps --define "extra_release $EXTRA_RELEASE" -ta --clean *.tar.gz > fi > > +# regenerate repo so iso uses new ovirt-node rpms > +cd ${AUTOBUILD_PACKAGE_ROOT}/rpm/RPMS > +createrepo . > +cd - > + > #make iso > cd recipe > make \ From mburns at redhat.com Fri May 14 18:58:16 2010 From: mburns at redhat.com (Mike Burns) Date: Fri, 14 May 2010 14:58:16 -0400 Subject: [Ovirt-devel] [PATCH node] Fix autobuild to use just built ovirt-node rpms Message-ID: <1273863496-22627-1-git-send-email-mburns@redhat.com> Need to recreate the repo information in autobuild so that the rpms just generated get included in the iso build. Signed-off-by: Mike Burns --- autobuild.sh | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/autobuild.sh b/autobuild.sh index 92b3d32..668547b 100755 --- a/autobuild.sh +++ b/autobuild.sh @@ -45,6 +45,9 @@ if [ -f /usr/bin/rpmbuild ]; then rpmbuild --nodeps --define "extra_release $EXTRA_RELEASE" -ta --clean *.tar.gz fi +# regenerate repo so iso uses new ovirt-node rpms +createrepo ${AUTOBUILD_PACKAGE_ROOT}/rpm/RPMS + #make iso cd recipe make \ -- 1.6.6.1 From apevec at gmail.com Fri May 14 19:12:00 2010 From: apevec at gmail.com (Alan Pevec) Date: Fri, 14 May 2010 21:12:00 +0200 Subject: [Ovirt-devel] [PATCH node] Fix autobuild to use just built ovirt-node rpms In-Reply-To: <1273863496-22627-1-git-send-email-mburns@redhat.com> References: <1273863496-22627-1-git-send-email-mburns@redhat.com> Message-ID: ACK From dpierce at redhat.com Fri May 14 19:29:44 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 14 May 2010 15:29:44 -0400 Subject: [Ovirt-devel] Replacement patch... Message-ID: <1273865385-4292-1-git-send-email-dpierce@redhat.com> This one incorporates feedback from mburns and apevec to ensure that all multipath devices are excluded in the list of available drives. Only drives with an identified bus are included in the list now. From dpierce at redhat.com Fri May 14 19:29:45 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 14 May 2010 15:29:45 -0400 Subject: [Ovirt-devel] [PATCH node] Replace the HAL calls with udev/systool calls. In-Reply-To: <1273865385-4292-1-git-send-email-dpierce@redhat.com> References: <1273865385-4292-1-git-send-email-dpierce@redhat.com> Message-ID: <1273865385-4292-2-git-send-email-dpierce@redhat.com> HAL has been deprecated, and this patch removes all HAL specific calls from the configuration scripts. HAL is still present in the Python scripts, but will be removed in a different patch. Signed-off-by: Darryl L. Pierce --- ChangeLog | 3 + configure.ac | 2 - ovirt-node.spec.in | 1 - scripts/ovirt-config-networking | 18 +++--- scripts/ovirt-config-storage | 105 +++++++++++++++------------------------ 5 files changed, 53 insertions(+), 76 deletions(-) diff --git a/ChangeLog b/ChangeLog index 49d57ad..b57763a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ CHANGELOG ========= +Version 1.9.3: + * Removed HAL dependencies from the firstboot scripts. + Version 1.9.2: * Fixed the autoconf setup to cover more prerequisites. diff --git a/configure.ac b/configure.ac index abe97cc..18cf789 100644 --- a/configure.ac +++ b/configure.ac @@ -10,9 +10,7 @@ fi # TODO need a way to check for python-setuptools -AC_CHECK_LIB(dbus-1, main, , AC_MSG_ERROR([Cannot find DBus development libraries.])) AC_CHECK_LIB(virt, main, , AC_MSG_ERROR([Cannot find libvirt development libraries.])) -AC_CHECK_LIB(hal, main, , AC_MSG_ERROR([Cannot find HAL development libraries.])) AC_CHECK_LIB(python2.6, main, , AC_MSG_ERROR([Cannot find python development libraries.])) AC_CONFIG_HEADERS([config.h]) diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index 28d8719..45de24c 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -17,7 +17,6 @@ URL: http://www.ovirt.org/ 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 diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 4d412ac..1cfc2db 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -460,16 +460,16 @@ set ${ntproot}/keys /etc/ntp/keys\n\ function setup_menu { NICS="" - udi_list=$(hal-find-by-capability --capability net.80203) - if [ -n "$udi_list" ]; then - for d in $udi_list; do - if [[ ! "$(hal-get-property --udi $d --key net.physical_device)" =~ computer ]]; then - NICS="$NICS $(hal-get-property --udi "$d" --key net.interface)" - fi - done - fi + nics=$(ls -bd /sys/class/net/*) + for nic in $nics; do + nic=$(basename $nic) + address=$(systool -c net -d $nic -A address | awk '/address\ += "(.*)"/ { print $3; }') + if [[ ! "$address" =~ '00:00:00:00' ]]; then + NICS="$NICS $nic" + fi + done - # Add virtio NICs that were possibly not detected by hal + # Add virtio NICs that were possibly not detected by other means NICS="$(ifconfig -a | awk '/Ethernet/ {print $1}'|xargs)" NICS=$(echo $NICS | tr ' ' '\n' | sort -u | xargs) diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index ce9707c..54941a7 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -111,41 +111,11 @@ get_drive_size() local drive="$1" local space_var="$2" - local size= - local udi=$(hal-find-by-property --key block.device --string "$drive") - # if more than one UDI was found then iterate over them to find the base device - if [[ "${udi}" =~ \$ ]]; then - udi=$(echo "$udi" | sed 's/\$/ /g') - for found in ${udi}; do - if [[ "false" == $(hal-get-property --udi "$found" --key block.is_volume) ]]; then - udi="$found" - break - fi - done - fi - if [ -z "$udi" ]; then - # If hal didn't find the device, it could be a virtio block device - # or a multipath device - # In this case, use sfdisk -s to get the size - size=$(sfdisk -s "$drive" 2>/dev/null) - if [ -z "$size" ]; then - size=0 - fi - size=$(echo "scale=0; $size * 1024" | bc -l) - else - size=$(hal-get-property --udi "$udi" --key storage.size) - if [[ "${size}" == "0" ]]; then - # disk is probably hot-swappable, use different HAL key - # but first check that it is removeable media and that media is present - if [[ "true" == "$(hal-get-property --udi "$udi" --key storage.removable.media_available)" ]]; then - size=$(hal-get-property --udi "$udi" --key storage.removable.media_size) - fi - fi - fi + local size=$(sfdisk -s $drive) + size=$(echo "scale=0; $size / 1024" | bc -l) - size=$(echo "scale=0; $size / (1024 * 1024)" | bc -l) echo "$drive ($size MB)" - test -z "$udi" || echo "Disk Identifier: $(basename "$udi")" + echo "Disk Identifier: $drive" if [ -n "$space_var" ]; then eval $space_var="$size" fi @@ -210,8 +180,10 @@ check_partition_sizes() printf "\n" printf "There appears to already be an installation on another device:\n" for device in $devices; do - udi=$(hal-find-by-property --key block.device --string $device) - printf "\t$device ($(basename "$udi"))\n" + local uuid + + get_uuid $device uuid + printf "\t$device ${uuid}\n" done printf "We cannot proceed until either device is removed from the system\n" printf "or until the HostVG volume group is removed.\n" @@ -260,40 +232,23 @@ manual_input() # Sample output: /dev/sda get_dev_name() { - local udi_list=$(hal-find-by-capability --capability storage) local byid_list=$(find /dev/disk/by-id -mindepth 1 -not -name '*-part*' 2>/dev/null) - if test -z "$udi_list" -a -z "$byid_list"; then - warn "ERROR: no usable storage devices detected" - return 1 - fi + local devices="" - local d devices sizes - for d in $udi_list; do - local drive_type=$(hal-get-property --udi "$d" --key storage.drive_type) - test "X$drive_type" = Xdisk || continue - local block_dev=$(hal-get-property --udi "$d" --key block.device) - # Must start with a '/'. - case "$block_dev" in - *' '*) - # we use space as separator - warn "block device name '$block_dev' contains space; skipping"; - continue;; - /*) ;; - *) warn "block device name $block_dev doesn't start with '/';" \ - " skipping"; continue;; - esac - test -z "$devices" \ - && devices="$block_dev" \ - || devices="$devices $block_dev" + for drive in $(ls -db /sys/block/[hsv]d*); do + drive="/dev/$(basename $drive)" + test -z "$devices" && devices="$drive" || devices="$devices $drive" done + d="" for d in $byid_list; do - devices="$devices $(readlink -f "$d")"; + local devicename=$(readlink -f $d) + local bus=$(udevadm info --path=/sys/block/$(basename $devicename) --query=property | awk '/^ID_BUS=/ { print $1 }') + if [ -n "$bus" ]; then + devices="$devices $devicename" + fi done - # FIXME: workaround for detecting virtio block devices - devices="$devices $(ls /dev/vd? 2> /dev/null | xargs)" - # FIXME: workaround for detecting cciss devices for dev in $(ls /dev/cciss 2>/dev/null); do if [[ ! "$dev" =~ p[0-9]+\$ ]]; then @@ -518,6 +473,26 @@ EOF return ${is_negative-0} } +# Retrieves the UUID for the specified device. +# $1 - the device +# $2 - the variable to be set +get_uuid() +{ + local device=${1-} + local envvar=${2-} + local rootname + + if [[ "$device" =~ "^.*[0-9]?$" ]]; then + rootname="${device:0:${#device}-1}" + fi + local uuid=$( + udevadm info --path=/sys/block/$rootname/$device --query=property | + awk '/ID_FS_UUID=/ { match($0, "ID_FS_UUID=(.*)", data); print data[1]; }' + ) + + eval $envvar="$uuid" +} + #Check for an existing HostVG on any device on the system. # Return 0 if then is a HostVG found, unless only one found is on $1 # Return 1 if no HostVG found or only found on $1 @@ -537,10 +512,12 @@ check_existing_hostvg() printf "\n" printf "There appears to already be an installation on another device:\n" for device in $devices; do + local uuid + get_multipath_devices ${device%p[0-9]} sd_dev sd_dev=$(echo "$sd_dev" | awk '{print $1}') - udi=$(hal-find-by-property --key block.device --string /dev/${sd_dev}) - printf "\t$device ($(basename "$udi"))\n" + get_uuid $sd_dev uuid + printf "\t$device ($uuid)\n" done printf "The installation cannot proceed until the device is removed\n" printf "from the system of the HostVG volume group is removed.\n" -- 1.6.6.1 From mburns at redhat.com Fri May 14 20:04:54 2010 From: mburns at redhat.com (Mike Burns) Date: Fri, 14 May 2010 16:04:54 -0400 Subject: [Ovirt-devel] [PATCH node] Replace the HAL calls with udev/systool calls. In-Reply-To: <1273865385-4292-2-git-send-email-dpierce@redhat.com> References: <1273865385-4292-1-git-send-email-dpierce@redhat.com> <1273865385-4292-2-git-send-email-dpierce@redhat.com> Message-ID: <1273867494.3429.13.camel@localhost.localdomain> On Fri, 2010-05-14 at 15:29 -0400, Darryl L. Pierce wrote: > HAL has been deprecated, and this patch removes all HAL specific calls > from the configuration scripts. > > HAL is still present in the Python scripts, but will be removed in a > different patch. > > Signed-off-by: Darryl L. Pierce > --- > ChangeLog | 3 + > configure.ac | 2 - > ovirt-node.spec.in | 1 - > scripts/ovirt-config-networking | 18 +++--- > scripts/ovirt-config-storage | 105 +++++++++++++++------------------------ > 5 files changed, 53 insertions(+), 76 deletions(-) > > diff --git a/ChangeLog b/ChangeLog > index 49d57ad..b57763a 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1,6 +1,9 @@ > CHANGELOG > ========= > > +Version 1.9.3: > + * Removed HAL dependencies from the firstboot scripts. > + > Version 1.9.2: > * Fixed the autoconf setup to cover more prerequisites. > > diff --git a/configure.ac b/configure.ac > index abe97cc..18cf789 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -10,9 +10,7 @@ fi > > # TODO need a way to check for python-setuptools > > -AC_CHECK_LIB(dbus-1, main, , AC_MSG_ERROR([Cannot find DBus development libraries.])) > AC_CHECK_LIB(virt, main, , AC_MSG_ERROR([Cannot find libvirt development libraries.])) > -AC_CHECK_LIB(hal, main, , AC_MSG_ERROR([Cannot find HAL development libraries.])) > AC_CHECK_LIB(python2.6, main, , AC_MSG_ERROR([Cannot find python development libraries.])) > > AC_CONFIG_HEADERS([config.h]) > diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in > index 28d8719..45de24c 100644 > --- a/ovirt-node.spec.in > +++ b/ovirt-node.spec.in > @@ -17,7 +17,6 @@ URL: http://www.ovirt.org/ > 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 > diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking > index 4d412ac..1cfc2db 100755 > --- a/scripts/ovirt-config-networking > +++ b/scripts/ovirt-config-networking > @@ -460,16 +460,16 @@ set ${ntproot}/keys /etc/ntp/keys\n\ > function setup_menu > { > NICS="" > - udi_list=$(hal-find-by-capability --capability net.80203) > - if [ -n "$udi_list" ]; then > - for d in $udi_list; do > - if [[ ! "$(hal-get-property --udi $d --key net.physical_device)" =~ computer ]]; then > - NICS="$NICS $(hal-get-property --udi "$d" --key net.interface)" > - fi > - done > - fi > + nics=$(ls -bd /sys/class/net/*) > + for nic in $nics; do > + nic=$(basename $nic) > + address=$(systool -c net -d $nic -A address | awk '/address\ += "(.*)"/ { print $3; }') > + if [[ ! "$address" =~ '00:00:00:00' ]]; then > + NICS="$NICS $nic" > + fi > + done > > - # Add virtio NICs that were possibly not detected by hal > + # Add virtio NICs that were possibly not detected by other means > NICS="$(ifconfig -a | awk '/Ethernet/ {print $1}'|xargs)" > NICS=$(echo $NICS | tr ' ' '\n' | sort -u | xargs) > > diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage > index ce9707c..54941a7 100755 > --- a/scripts/ovirt-config-storage > +++ b/scripts/ovirt-config-storage > @@ -111,41 +111,11 @@ get_drive_size() > local drive="$1" > local space_var="$2" > > - local size= > - local udi=$(hal-find-by-property --key block.device --string "$drive") > - # if more than one UDI was found then iterate over them to find the base device > - if [[ "${udi}" =~ \$ ]]; then > - udi=$(echo "$udi" | sed 's/\$/ /g') > - for found in ${udi}; do > - if [[ "false" == $(hal-get-property --udi "$found" --key block.is_volume) ]]; then > - udi="$found" > - break > - fi > - done > - fi > - if [ -z "$udi" ]; then > - # If hal didn't find the device, it could be a virtio block device > - # or a multipath device > - # In this case, use sfdisk -s to get the size > - size=$(sfdisk -s "$drive" 2>/dev/null) > - if [ -z "$size" ]; then > - size=0 > - fi > - size=$(echo "scale=0; $size * 1024" | bc -l) > - else > - size=$(hal-get-property --udi "$udi" --key storage.size) > - if [[ "${size}" == "0" ]]; then > - # disk is probably hot-swappable, use different HAL key > - # but first check that it is removeable media and that media is present > - if [[ "true" == "$(hal-get-property --udi "$udi" --key storage.removable.media_available)" ]]; then > - size=$(hal-get-property --udi "$udi" --key storage.removable.media_size) > - fi > - fi > - fi > + local size=$(sfdisk -s $drive) > + size=$(echo "scale=0; $size / 1024" | bc -l) > > - size=$(echo "scale=0; $size / (1024 * 1024)" | bc -l) > echo "$drive ($size MB)" > - test -z "$udi" || echo "Disk Identifier: $(basename "$udi")" > + echo "Disk Identifier: $drive" > if [ -n "$space_var" ]; then > eval $space_var="$size" > fi > @@ -210,8 +180,10 @@ check_partition_sizes() > printf "\n" > printf "There appears to already be an installation on another device:\n" > for device in $devices; do > - udi=$(hal-find-by-property --key block.device --string $device) > - printf "\t$device ($(basename "$udi"))\n" > + local uuid > + > + get_uuid $device uuid > + printf "\t$device ${uuid}\n" > done > printf "We cannot proceed until either device is removed from the system\n" > printf "or until the HostVG volume group is removed.\n" > @@ -260,40 +232,23 @@ manual_input() > # Sample output: /dev/sda > get_dev_name() > { > - local udi_list=$(hal-find-by-capability --capability storage) > local byid_list=$(find /dev/disk/by-id -mindepth 1 -not -name '*-part*' 2>/dev/null) > - if test -z "$udi_list" -a -z "$byid_list"; then > - warn "ERROR: no usable storage devices detected" > - return 1 > - fi > + local devices="" > > - local d devices sizes > - for d in $udi_list; do > - local drive_type=$(hal-get-property --udi "$d" --key storage.drive_type) > - test "X$drive_type" = Xdisk || continue > - local block_dev=$(hal-get-property --udi "$d" --key block.device) > - # Must start with a '/'. > - case "$block_dev" in > - *' '*) > - # we use space as separator > - warn "block device name '$block_dev' contains space; skipping"; > - continue;; > - /*) ;; > - *) warn "block device name $block_dev doesn't start with '/';" \ > - " skipping"; continue;; > - esac > - test -z "$devices" \ > - && devices="$block_dev" \ > - || devices="$devices $block_dev" > + for drive in $(ls -db /sys/block/[hsv]d*); do > + drive="/dev/$(basename $drive)" > + test -z "$devices" && devices="$drive" || devices="$devices $drive" > done > + > d="" > for d in $byid_list; do > - devices="$devices $(readlink -f "$d")"; > + local devicename=$(readlink -f $d) > + local bus=$(udevadm info --path=/sys/block/$(basename $devicename) --query=property | awk '/^ID_BUS=/ { print $1 }') > + if [ -n "$bus" ]; then > + devices="$devices $devicename" > + fi > done > > - # FIXME: workaround for detecting virtio block devices > - devices="$devices $(ls /dev/vd? 2> /dev/null | xargs)" > - > # FIXME: workaround for detecting cciss devices > for dev in $(ls /dev/cciss 2>/dev/null); do > if [[ ! "$dev" =~ p[0-9]+\$ ]]; then > @@ -518,6 +473,26 @@ EOF > return ${is_negative-0} > } > > +# Retrieves the UUID for the specified device. > +# $1 - the device > +# $2 - the variable to be set > +get_uuid() > +{ > + local device=${1-} > + local envvar=${2-} > + local rootname > + > + if [[ "$device" =~ "^.*[0-9]?$" ]]; then > + rootname="${device:0:${#device}-1}" > + fi > + local uuid=$( > + udevadm info --path=/sys/block/$rootname/$device --query=property | > + awk '/ID_FS_UUID=/ { match($0, "ID_FS_UUID=(.*)", data); print data[1]; }' > + ) > + > + eval $envvar="$uuid" > +} > + > #Check for an existing HostVG on any device on the system. > # Return 0 if then is a HostVG found, unless only one found is on $1 > # Return 1 if no HostVG found or only found on $1 > @@ -537,10 +512,12 @@ check_existing_hostvg() > printf "\n" > printf "There appears to already be an installation on another device:\n" > for device in $devices; do > + local uuid > + > get_multipath_devices ${device%p[0-9]} sd_dev > sd_dev=$(echo "$sd_dev" | awk '{print $1}') > - udi=$(hal-find-by-property --key block.device --string /dev/${sd_dev}) > - printf "\t$device ($(basename "$udi"))\n" > + get_uuid $sd_dev uuid > + printf "\t$device ($uuid)\n" > done > printf "The installation cannot proceed until the device is removed\n" > printf "from the system of the HostVG volume group is removed.\n" We need one additional change. diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index 137c729..ddfd57a 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage -59,7 +59,7 @@ get_multipath_devices() { | sed 's/ /\n/g' | grep [0-9]:[0-9] ) local device="" - for dep in "$deps" + for dep in $deps do local device="" get_sd_name "$dep" device If we don't do this, then the filtering of /dev/sdX devices that are part of a multipath device doesn't work correctly. Ack with ^^ change Mike From mburns at redhat.com Fri May 14 20:05:50 2010 From: mburns at redhat.com (Mike Burns) Date: Fri, 14 May 2010 16:05:50 -0400 Subject: [Ovirt-devel] Replacement patch... In-Reply-To: <1273865385-4292-1-git-send-email-dpierce@redhat.com> References: <1273865385-4292-1-git-send-email-dpierce@redhat.com> Message-ID: <1273867550.3429.14.camel@localhost.localdomain> On Fri, 2010-05-14 at 15:29 -0400, Darryl L. Pierce wrote: > This one incorporates feedback from mburns and apevec to ensure > that all multipath devices are excluded in the list of available > drives. > Just to be clear, we want to exclude device mapper devices (dm-*), not multipath devices. Multipath devices will still remain in the list. > Only drives with an identified bus are included in the list now. > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel From dpierce at redhat.com Fri May 14 20:11:59 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 14 May 2010 16:11:59 -0400 Subject: [Ovirt-devel] Replacement patch... In-Reply-To: <1273867550.3429.14.camel@localhost.localdomain> References: <1273865385-4292-1-git-send-email-dpierce@redhat.com> <1273867550.3429.14.camel@localhost.localdomain> Message-ID: <20100514201159.GA22442@mcpierce-desktop.usersys.redhat.com> On Fri, May 14, 2010 at 04:05:50PM -0400, Mike Burns wrote: > On Fri, 2010-05-14 at 15:29 -0400, Darryl L. Pierce wrote: > > This one incorporates feedback from mburns and apevec to ensure > > that all multipath devices are excluded in the list of available > > drives. > > > Just to be clear, we want to exclude device mapper devices (dm-*), not > multipath devices. Multipath devices will still remain in the list. Yeah, my bad terminology. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From geoff at starbiz.com.au Sat May 15 00:21:38 2010 From: geoff at starbiz.com.au (Geoff O'Callaghan) Date: Sat, 15 May 2010 10:21:38 +1000 Subject: [Ovirt-devel] a couple of questions Message-ID: <4BEDE912.3040406@starbiz.com.au> Hi There, I've only recently joined so please excuse me if I'm asking the bleeding obvious :-) Q1. I've seen a few patches go by in the last couple of days but only 1 get into the ovirt git next branch. Are they going somewhere else as I'd love to test them? Q2. I did a build of the ovirt git next branch and created the ovirt-node-iso to test and I noticed that it had an unexpected result related to thinking that my single standard local sata drive was part of a multipath configuration. This was due to a null /etc/multipath.conf file which is created specifically as part of the node/recipe/common-post.ks What is the plan in this area? Will multipath enablement be forced or as an option to enable it on the ovirt-config-storage menu? Q3. If I change common-post.ks to add a /etc/multipath.conf with a blacklist of '*' it then correctly identifies my local drive for the install - however, when doing the storage allocation it gets the sizes wrong so there is a calculation bug somewhere. I didn't see it in bugzilla so it's either a new bug or something wrong with my specific setup or both :) Is it something someone has noticed? Yes I realize that was actually 4 questions :) Cheers Geoff From mburns at redhat.com Sat May 15 01:47:59 2010 From: mburns at redhat.com (Mike Burns) Date: Fri, 14 May 2010 21:47:59 -0400 Subject: [Ovirt-devel] a couple of questions In-Reply-To: <4BEDE912.3040406@starbiz.com.au> References: <4BEDE912.3040406@starbiz.com.au> Message-ID: <1273888079.29447.10.camel@localhost.localdomain> On Sat, 2010-05-15 at 10:21 +1000, Geoff O'Callaghan wrote: > Hi There, > > I've only recently joined so please excuse me if I'm asking the bleeding > obvious :-) > > Q1. > > I've seen a few patches go by in the last couple of days but only 1 get > into the ovirt git next branch. Are they going somewhere else as I'd > love to test them? Generally patches get posted to the list and get pushed to the next branch once they are acked. > > Q2. > > I did a build of the ovirt git next branch and created the > ovirt-node-iso to test and I noticed that it had an unexpected result > related to thinking that my single standard local sata drive was part > of a multipath configuration. This was due to a null > /etc/multipath.conf file which is created specifically as part of the > node/recipe/common-post.ks > > What is the plan in this area? Will multipath enablement be forced or > as an option to enable it on the ovirt-config-storage menu? Multipath is the default for all devices that have wwids. As of now, there is no plan to change this. The decision to use multipath for all devices if possible makes the setup much cleaner and doesn't introduce any negatives that I see. It might be possible to make it configurable, but I don't think that it's trivial to do so. > > > Q3. > > If I change common-post.ks to add a /etc/multipath.conf with a blacklist > of '*' it then correctly identifies my local drive for the install - > however, when doing the storage allocation it gets the sizes wrong so > there is a calculation bug somewhere. I didn't see it in bugzilla so > it's either a new bug or something wrong with my specific setup or both > :) Is it something someone has noticed? I haven't noticed any calculation errors recently, though I admit that I haven't looked that closely recently. When using multipath, do you see the same issue? Can you provide the ovirt.log file from the install that shows the incorrect size? Thanks Mike > > Yes I realize that was actually 4 questions :) > > Cheers > Geoff > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel From apevec at gmail.com Sun May 16 18:35:06 2010 From: apevec at gmail.com (Alan Pevec) Date: Sun, 16 May 2010 20:35:06 +0200 Subject: [Ovirt-devel] [PATCH node] save all not-parsed boot parameters In-Reply-To: <1273694539-21539-1-git-send-email-apevec@redhat.com> References: <1273012051-12343-1-git-send-email-apevec@redhat.com> <1273694539-21539-1-git-send-email-apevec@redhat.com> Message-ID: On Wed, May 12, 2010 at 10:02 PM, Alan Pevec wrote: > + ? ? ? ? ? ?BOOT_IMAGE=* | initrd=* | check | linux | liveimg | \ > + ? ? ? ? ? ?root=* | rootfstype=* | rootflags=* | ro) one more to exclude: rescue > + ? ? ? ? ? ?;; > + ? ? ? ? ? ?*) > + ? ? ? ? ? ?bootparams="$bootparams $i" > + ? ? ? ? ? ?;; From apevec at gmail.com Mon May 17 10:50:50 2010 From: apevec at gmail.com (Alan Pevec) Date: Mon, 17 May 2010 12:50:50 +0200 Subject: [Ovirt-devel] [PATCH node] save all not-parsed boot parameters In-Reply-To: References: <1273012051-12343-1-git-send-email-apevec@redhat.com> <1273694539-21539-1-git-send-email-apevec@redhat.com> Message-ID: On Sun, May 16, 2010 at 8:35 PM, Alan Pevec wrote: > On Wed, May 12, 2010 at 10:02 PM, Alan Pevec wrote: >> + ? ? ? ? ? ?BOOT_IMAGE=* | initrd=* | check | linux | liveimg | \ >> + ? ? ? ? ? ?root=* | rootfstype=* | rootflags=* | ro) > > one more to exclude: rescue ignore me, this is parameter is parsed so it won't reach here! From dpierce at redhat.com Mon May 17 11:46:49 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Mon, 17 May 2010 07:46:49 -0400 Subject: [Ovirt-devel] a couple of questions In-Reply-To: <4BEDE912.3040406@starbiz.com.au> References: <4BEDE912.3040406@starbiz.com.au> Message-ID: <20100517114649.GD22442@mcpierce-desktop.usersys.redhat.com> On Sat, May 15, 2010 at 10:21:38AM +1000, Geoff O'Callaghan wrote: > Hi There, > > I've only recently joined so please excuse me if I'm asking the > bleeding obvious :-) > > Q1. > > I've seen a few patches go by in the last couple of days but only 1 > get into the ovirt git next branch. Are they going somewhere else > as I'd love to test them? You can see all patches submitted in the ovirt-devel mailing archives: https://www.redhat.com/archives/ovirt-devel/ -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From aclement at linagora.com Tue May 18 09:36:04 2010 From: aclement at linagora.com (Arthur =?iso-8859-1?q?Cl=E9ment?=) Date: Tue, 18 May 2010 11:36:04 +0200 Subject: [Ovirt-devel] Rails/mongrel/httpd issue - F13, rails 2.3.5 In-Reply-To: <201005101829.33165.aclement@linagora.com> References: <201005101829.33165.aclement@linagora.com> Message-ID: <201005181136.04908.aclement@linagora.com> Hi Thanks a colleague (Patrick Guiran), we found the trick to solve the problem. Here is the patch to apply from the mongrel root directory : ==================================== --- lib/mongrel/cgi.rb 2010-05-18 11:20:47.414269158 +0200 +++ lib/mongrel/cgi.rb 2010-05-18 11:20:09.328271509 +0200 @@ -105,7 +105,8 @@ when Hash cookie.each_value {|c| to['Set-Cookie'] = c.to_s} else - to['Set-Cookie'] = options['cookie'].to_s + # patched by pguiran at linagora.com (18/05/10) + to['Set-Cookie'] = cookie.to_s end @head.delete('cookie') ==================================== After some search, we found that this bug is corrected on the mongrel trunk, and was written by "Evan Weaver", on march 2008, and commited by "Matt Aimonetti", on march 2009. Here is the link of the commit : http://github.com/fauna/mongrel/commit/7c9d988d4de2e08d67f95ca209196427fd89c9af our bugs is designed as the bug #16: - Close #16, XXX needs audit! (CGIWrapper "options" attr_reader has no corresponding @options variable). Regards, Arthur On lundi 10 mai 2010 18:29:33 Arthur Cl?ment wrote: > Hi, > > I have an issue with mongrel and rails. I add -B option(debug) to > mongrel_rails in /etc/init.d/mongrel-rails but it didn't display more logs > : http://ovirt.pastebin.com/N5v94cTu > > > This is the page I get when I try to reach the ovirt web interface, I see > the html tags (kerberos auth is working) : > > You are being href="http://ovirt.admin.virt.par.lng/ovirt/login/login">redirected. body> > > > and logs : > > > ==> rails.log <== > > > Processing DashboardController#index (for 10.75.128.51 at 2010-05-10 > 10:37:25) [GET] Redirected to > http://ovirt.admin.virt.par.lng/ovirt/login/login > Filter chain halted as [:is_logged_in] rendered_or_redirected. > Completed in 5ms (DB: 28) | 302 Found > [http://ovirt.admin.virt.par.lng/ovirt/] > > ==> mongrel.log <== > Mon May 10 10:37:25 +0200 2010: Error calling Dispatcher.dispatch > # > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:108:in > `send_cookies' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:136:in > `out' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/http_response > .rb:65:in `start' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:135:in > `out' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:81:i > n `process' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:159:in > `process_client' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in > `each' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in > `process_client' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in > `run' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in > `initialize' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in > `new' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in > `run' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in > `initialize' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in > `new' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in > `run' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator. > rb:282:in `run' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator. > rb:281:in `each' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator. > rb:281:in `run' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run' > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:21 > 2:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 > /usr/bin/mongrel_rails:19:in `load' > /usr/bin/mongrel_rails:19 > > > > gems list : http://ovirt.pastebin.com/B5s3cpKy > > > I'm looking for any clue. -- Arthur CLEMENT Linagora Paris From geoff at starbiz.com.au Tue May 18 09:39:51 2010 From: geoff at starbiz.com.au (Geoff O'Callaghan) Date: Tue, 18 May 2010 19:39:51 +1000 Subject: [Ovirt-devel] a couple of questions In-Reply-To: <1273888079.29447.10.camel@localhost.localdomain> References: <4BEDE912.3040406@starbiz.com.au> <1273888079.29447.10.camel@localhost.localdomain> Message-ID: <4BF26067.5090704@starbiz.com.au> On 15/05/10 11:47, Mike Burns wrote: > On Sat, 2010-05-15 at 10:21 +1000, Geoff O'Callaghan wrote: >> Hi There, >> [snip] >> Q2. >> >> I did a build of the ovirt git next branch and created the >> ovirt-node-iso to test and I noticed that it had an unexpected result >> related to thinking that my single standard local sata drive was part >> of a multipath configuration. This was due to a null >> /etc/multipath.conf file which is created specifically as part of the >> node/recipe/common-post.ks >> >> What is the plan in this area? Will multipath enablement be forced or >> as an option to enable it on the ovirt-config-storage menu? > > Multipath is the default for all devices that have wwids. As of now, > there is no plan to change this. The decision to use multipath for all > devices if possible makes the setup much cleaner and doesn't introduce > any negatives that I see. It might be possible to make it configurable, > but I don't think that it's trivial to do so. ok, that's fine and is probably a wise choice given the environment ovirt is likely to find itself :) Anyway, the problem with my system is definitely related to how the multipath device gets set up as you can see in the attached log. >> >> >> Q3. >> >> If I change common-post.ks to add a /etc/multipath.conf with a blacklist >> of '*' it then correctly identifies my local drive for the install - >> however, when doing the storage allocation it gets the sizes wrong so >> there is a calculation bug somewhere. I didn't see it in bugzilla so >> it's either a new bug or something wrong with my specific setup or both >> :) Is it something someone has noticed? > > I haven't noticed any calculation errors recently, though I admit that I > haven't looked that closely recently. When using multipath, do you see > the same issue? > > Can you provide the ovirt.log file from the install that shows the > incorrect size? The incorrect size came when I had a multipath.conf file that blacklisted '*'. In the case of the ovirt.log file attached I am running a vanilla build from the git next branch. As you can see from the log it makes a bit of a mess of it. To supplement the log I have: [root at localhost ~]# multipath -ll 1ATA WDC WD1200JB-00FUA0 WD-WCAES102461 dm-1 ATA,WDC WD1200JB-00F size=112G features='0' hwhandler='0' wp=rw `-+- policy='round-robin 0' prio=1 status=active `- 6:0:0:0 sda 8:0 active ready running [root at localhost ~]# dmsetup ls --target=multipath 1ATA WDC WD1200JB-00FUA0 WD-WCAES1024619 (253, 1) and attached as log.txt I have the output of a bash -x ovirt-config-storage ps. sorry about the delay getting back to you - hopefully you can spot the problem. -------------- next part -------------- A non-text attachment was scrubbed... Name: ovirt.log Type: text/x-log Size: 5512 bytes Desc: not available URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: log.txt URL: From mburns at redhat.com Tue May 18 11:59:13 2010 From: mburns at redhat.com (Mike Burns) Date: Tue, 18 May 2010 07:59:13 -0400 Subject: [Ovirt-devel] a couple of questions In-Reply-To: <4BF26067.5090704@starbiz.com.au> References: <4BEDE912.3040406@starbiz.com.au> <1273888079.29447.10.camel@localhost.localdomain> <4BF26067.5090704@starbiz.com.au> Message-ID: <1274183953.29447.46.camel@localhost.localdomain> On Tue, 2010-05-18 at 19:39 +1000, Geoff O'Callaghan wrote: > On 15/05/10 11:47, Mike Burns wrote: > > On Sat, 2010-05-15 at 10:21 +1000, Geoff O'Callaghan wrote: > >> Hi There, > >> > > [snip] > > >> Q2. > >> > >> I did a build of the ovirt git next branch and created the > >> ovirt-node-iso to test and I noticed that it had an unexpected result > >> related to thinking that my single standard local sata drive was part > >> of a multipath configuration. This was due to a null > >> /etc/multipath.conf file which is created specifically as part of the > >> node/recipe/common-post.ks > >> > >> What is the plan in this area? Will multipath enablement be forced or > >> as an option to enable it on the ovirt-config-storage menu? > > > > Multipath is the default for all devices that have wwids. As of now, > > there is no plan to change this. The decision to use multipath for all > > devices if possible makes the setup much cleaner and doesn't introduce > > any negatives that I see. It might be possible to make it configurable, > > but I don't think that it's trivial to do so. > > ok, that's fine and is probably a wise choice given the environment > ovirt is likely to find itself :) > > Anyway, the problem with my system is definitely related to how the > multipath device gets set up as you can see in the attached log. Yes, we have a bug in the code that figures out multipath devices. It seems that some devices end up providing a wwid that contains spaces which breaks the code. I hope to have a fix posted today. Instead of picking up "/dev/mapper/1ATA WDC WD1200JB-00FUA0 WD-WCAES102461" we instead got: "/dev/mapper/1ATA" > > >> > >> > >> Q3. > >> > >> If I change common-post.ks to add a /etc/multipath.conf with a blacklist > >> of '*' it then correctly identifies my local drive for the install - > >> however, when doing the storage allocation it gets the sizes wrong so > >> there is a calculation bug somewhere. I didn't see it in bugzilla so > >> it's either a new bug or something wrong with my specific setup or both > >> :) Is it something someone has noticed? > > > > I haven't noticed any calculation errors recently, though I admit that I > > haven't looked that closely recently. When using multipath, do you see > > the same issue? > > > > Can you provide the ovirt.log file from the install that shows the > > incorrect size? > > The incorrect size came when I had a multipath.conf file that > blacklisted '*'. > > In the case of the ovirt.log file attached I am running a vanilla build > from the git next branch. > > As you can see from the log it makes a bit of a mess of it. To > supplement the log I have: > > [root at localhost ~]# multipath -ll > 1ATA WDC WD1200JB-00FUA0 WD-WCAES102461 dm-1 > ATA,WDC WD1200JB-00F > size=112G features='0' hwhandler='0' wp=rw > `-+- policy='round-robin 0' prio=1 status=active > `- 6:0:0:0 sda 8:0 active ready running > > [root at localhost ~]# dmsetup ls --target=multipath > 1ATA WDC WD1200JB-00FUA0 WD-WCAES1024619 (253, 1) > > and attached as log.txt I have the output of a bash -x ovirt-config-storage > > ps. sorry about the delay getting back to you - hopefully you can spot > the problem. It looks like neither log was for incorrect space issue. Both of them show a multipath device being detected. It also looks like it determined that /dev/sda was 114473 MB which is approx 112 GB. This is the same value that mutlipath output above shows. I did notice a few of these messages: WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util sfdisk doesn't support GPT. Use GNU Parted. I'll look into those as well. Mike > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel From clement.arthur at gmail.com Tue May 18 12:56:09 2010 From: clement.arthur at gmail.com (Arthur =?iso-8859-1?q?Cl=E9ment?=) Date: Tue, 18 May 2010 14:56:09 +0200 Subject: [Ovirt-devel] Rails/mongrel/httpd issue - F13, rails 2.3.5 In-Reply-To: <201005181136.04908.aclement@linagora.com> References: <201005101829.33165.aclement@linagora.com> <201005181136.04908.aclement@linagora.com> Message-ID: <201005181456.10056.clement.arthur@gmail.com> Bug report : https://bugzilla.redhat.com/show_bug.cgi?id=593277 On mardi 18 mai 2010 11:36:04 Arthur Cl?ment wrote: > Hi > > Thanks a colleague (Patrick Guiran), we found the trick to solve the > problem. Here is the patch to apply from the mongrel root directory : > ==================================== > --- lib/mongrel/cgi.rb 2010-05-18 11:20:47.414269158 +0200 > +++ lib/mongrel/cgi.rb 2010-05-18 11:20:09.328271509 +0200 > @@ -105,7 +105,8 @@ > when Hash > cookie.each_value {|c| to['Set-Cookie'] = c.to_s} > else > - to['Set-Cookie'] = options['cookie'].to_s > + # patched by pguiran at linagora.com (18/05/10) > + to['Set-Cookie'] = cookie.to_s > end > > @head.delete('cookie') > ==================================== > > After some search, we found that this bug is corrected on the mongrel > trunk, and was written by "Evan Weaver", on march 2008, and commited by > "Matt Aimonetti", on march 2009. > Here is the link of the commit : > http://github.com/fauna/mongrel/commit/7c9d988d4de2e08d67f95ca209196427fd89 > c9af > > our bugs is designed as the bug #16: > - Close #16, XXX needs audit! (CGIWrapper "options" attr_reader has no > corresponding @options variable). > > > Regards, > > Arthur > > On lundi 10 mai 2010 18:29:33 Arthur Cl?ment wrote: > > Hi, > > > > I have an issue with mongrel and rails. I add -B option(debug) to > > mongrel_rails in /etc/init.d/mongrel-rails but it didn't display more > > logs > > > > : http://ovirt.pastebin.com/N5v94cTu > > > > This is the page I get when I try to reach the ovirt web interface, I see > > the html tags (kerberos auth is working) : > > > > You are being > href="http://ovirt.admin.virt.par.lng/ovirt/login/login">redirected.< > > / body> > > > > > > and logs : > > > > > > ==> rails.log <== > > > > > > Processing DashboardController#index (for 10.75.128.51 at 2010-05-10 > > 10:37:25) [GET] Redirected to > > http://ovirt.admin.virt.par.lng/ovirt/login/login > > Filter chain halted as [:is_logged_in] rendered_or_redirected. > > Completed in 5ms (DB: 28) | 302 Found > > [http://ovirt.admin.virt.par.lng/ovirt/] > > > > ==> mongrel.log <== > > Mon May 10 10:37:25 +0200 2010: Error calling Dispatcher.dispatch > > # > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:108:i > > n `send_cookies' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:136:i > > n `out' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/http_respons > > e .rb:65:in `start' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:135:i > > n `out' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:81: > > i n `process' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:159:in > > `process_client' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in > > `each' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in > > `process_client' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in > > `run' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in > > `initialize' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in > > `new' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in > > `run' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in > > `initialize' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in > > `new' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in > > `run' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator > > . rb:282:in `run' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator > > . rb:281:in `each' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator > > . rb:281:in `run' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:2 > > 1 2:in `run' > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 > > /usr/bin/mongrel_rails:19:in `load' > > /usr/bin/mongrel_rails:19 > > > > > > > > gems list : http://ovirt.pastebin.com/B5s3cpKy > > > > > > I'm looking for any clue. From dpierce at redhat.com Tue May 18 17:25:03 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Tue, 18 May 2010 13:25:03 -0400 Subject: [Ovirt-devel] Rails/mongrel/httpd issue - F13, rails 2.3.5 In-Reply-To: <201005181136.04908.aclement@linagora.com> References: <201005101829.33165.aclement@linagora.com> <201005181136.04908.aclement@linagora.com> Message-ID: <20100518172503.GP22442@mcpierce-desktop.usersys.redhat.com> On Tue, May 18, 2010 at 11:36:04AM +0200, Arthur Cl?ment wrote: > Hi > > Thanks a colleague (Patrick Guiran), we found the trick to solve the problem. > Here is the patch to apply from the mongrel root directory : > ==================================== > --- lib/mongrel/cgi.rb 2010-05-18 11:20:47.414269158 +0200 > +++ lib/mongrel/cgi.rb 2010-05-18 11:20:09.328271509 +0200 > @@ -105,7 +105,8 @@ > when Hash > cookie.each_value {|c| to['Set-Cookie'] = c.to_s} > else > - to['Set-Cookie'] = options['cookie'].to_s > + # patched by pguiran at linagora.com (18/05/10) > + to['Set-Cookie'] = cookie.to_s > end > > @head.delete('cookie') > ==================================== > > After some search, we found that this bug is corrected on the mongrel trunk, > and was written by "Evan Weaver", on march 2008, and commited by "Matt > Aimonetti", on march 2009. > Here is the link of the commit : > http://github.com/fauna/mongrel/commit/7c9d988d4de2e08d67f95ca209196427fd89c9af > > our bugs is designed as the bug #16: > - Close #16, XXX needs audit! (CGIWrapper "options" attr_reader has no > corresponding @options variable). If this was fixed so long ago (two years ago fixed, over a year ago committed) do we know why it's not available in the distribution? Can you open a new BZ or else add a comment to an exist BZ to get the package maintainer to release an update? -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From dpierce at redhat.com Tue May 18 20:20:17 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Tue, 18 May 2010 16:20:17 -0400 Subject: [Ovirt-devel] Replacement patch... Message-ID: <1274214018-17481-1-git-send-email-dpierce@redhat.com> This patch supercedes the previous patch. It uses an event listener model rather than peer object notifications. From dpierce at redhat.com Tue May 18 20:20:18 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Tue, 18 May 2010 16:20:18 -0400 Subject: [Ovirt-devel] [PATCH matahari] Moving QMF functionality into a transport layer. In-Reply-To: <1274214018-17481-1-git-send-email-dpierce@redhat.com> References: <1274214018-17481-1-git-send-email-dpierce@redhat.com> Message-ID: <1274214018-17481-2-git-send-email-dpierce@redhat.com> This is the first step towards separating the APIs from the means by which they are carried between the remote and local system. A new type, HostListener, defines a type that receives notifications when the Host fires off an event. A new type, ProcessorsListener, defines a type that receives notifications when Processors updates itself. Signed-off-by: Darryl L. Pierce --- .gitignore | 2 +- src/Makefile.am | 8 ++- src/host.cpp | 156 +++++++++++++++++++++++++++++------------- src/host.h | 56 ++++++++++------ src/hostlistener.h | 33 +++++++++ src/main.cpp | 11 +++- src/processors.cpp | 44 ++++++++---- src/processors.h | 31 +++------ src/processorslistener.h | 29 ++++++++ src/qmf/hostagent.cpp | 68 +++++++++++++++++++ src/qmf/hostagent.h | 51 ++++++++++++++ src/qmf/processorsagent.cpp | 49 ++++++++++++++ src/qmf/processorsagent.h | 50 ++++++++++++++ 13 files changed, 480 insertions(+), 108 deletions(-) create mode 100644 src/hostlistener.h create mode 100644 src/processorslistener.h create mode 100644 src/qmf/hostagent.cpp create mode 100644 src/qmf/hostagent.h create mode 100644 src/qmf/processorsagent.cpp create mode 100644 src/qmf/processorsagent.h diff --git a/.gitignore b/.gitignore index ad6d70b..8e12062 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,4 @@ stamp-h1 *~ src/matahari -src/qmf +src/qmf/com diff --git a/src/Makefile.am b/src/Makefile.am index aed9e19..498ee72 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,6 +18,7 @@ nodist_matahari_SOURCES = $(generated_file_list) $(first) matahari_SOURCES = \ host.cpp \ host.h \ + hostlistener.h \ linux_platform.cpp \ linux_platform.h \ main.cpp \ @@ -26,7 +27,12 @@ matahari_SOURCES = \ platform.cpp \ platform.h \ processors.cpp \ - processors.h + processors.h \ + processorslistener.h \ + qmf/hostagent.cpp \ + qmf/hostagent.h \ + qmf/processorsagent.cpp \ + qmf/processorsagent.h $(generated_file_list): $(generated_file_list) diff --git a/src/host.cpp b/src/host.cpp index 34d4550..29b84ec 100644 --- a/src/host.cpp +++ b/src/host.cpp @@ -17,60 +17,43 @@ * also available at http://www.gnu.org/copyleft/gpl.html. */ -#include +#include "host.h" +#include "platform.h" +#include #include -#include +#include +#include #include #include -#include "host.h" -#include "platform.h" -#include "qmf/com/redhat/matahari/Host.h" - -using namespace qpid::management; using namespace std; -using qpid::management::Manageable; -namespace _qmf = qmf::com::redhat::matahari; - -void -HostAgent::setup(ManagementAgent* agent) +Host::Host() { - management_object = new _qmf::Host(agent, this); - agent->addObject(management_object); - - // discover the aspects of the host - processors.setup(agent, this); - networkdevices = Platform::instance()->get_network_devices(); - - for(vector::iterator iter = networkdevices.begin(); - iter != networkdevices.end(); - iter++) - { - iter->setup(agent, this); - } - struct utsname details; - string uuid = "Unknown"; - string hostname = "Unknown"; - string hypervisor = "Unknown"; - string architecture = "None"; - unsigned long memory = 0; - bool beeping = false; + this->_uuid = string("Unknown"); + this->_hostname = string("Unknown"); + this->_hypervisor = string("Unknown"); + this->_architecture = string("None"); + this->_memory = 0; + this->_beeping = false; - ifstream input("/var/lib/dbus/machine-id"); + std::ifstream input("/var/lib/dbus/machine-id"); if(input.is_open()) { + string uuid; + getline(input, uuid); input.close(); + this->_uuid = uuid; } if(!uname(&details)) { - hostname = string(details.nodename); - architecture = string(details.machine); + this->_hostname = string(details.nodename); + this->_architecture = string(details.machine); } else { @@ -81,39 +64,116 @@ HostAgent::setup(ManagementAgent* agent) if(lvconn) { - hypervisor = string(virConnectGetType(lvconn)); + this->_hypervisor = string(virConnectGetType(lvconn)); virConnectClose(lvconn); } struct sysinfo sysinf; if(!sysinfo(&sysinf)) { - memory = sysinf.totalram / 1024L; + this->_memory = sysinf.totalram / 1024L; } else { throw runtime_error("Unable to retrieve system memory details."); } +} - cout << "memory: " << memory << endl; +/* +void +Host::setup(ManagementAgent* agent, HostAgent* hostAgent) +{ + // discover the aspects of the host + _processors.setup(agent, hostAgent); + _networkdevices = Platform::instance()->get_network_devices(); - management_object->set_uuid(uuid); - management_object->set_hostname(hostname); - management_object->set_hypervisor(hypervisor); - management_object->set_arch(architecture); - management_object->set_memory(memory); - management_object->set_beeping(beeping); + for(vector::iterator iter = _networkdevices.begin(); + iter != _networkdevices.end(); + iter++) + { + iter->setup(agent, hostAgent); + } } +*/ void -HostAgent::update(void) +Host::update() { - processors.update(); + _processors.update(); - for(vector::iterator iter = networkdevices.begin(); - iter != networkdevices.end(); + for(vector::iterator iter = _networkdevices.begin(); + iter != _networkdevices.end(); iter++) { iter->update(); } } + +void +Host::addHostListener(HostListener* listener) +{ + _listeners.insert(listener); +} + +void +Host::removeHostListener(HostListener* listener) +{ + _listeners.erase(listener); +} + +Processors& +Host::getProcessors() +{ + return _processors; +} + +string +Host:: getUUID() const +{ + return _uuid; +} + +string +Host::getHostname() const +{ + return _hostname; +} + +string +Host::getHypervisor() const +{ + return _hypervisor; +} + +string +Host::getArchitecture() const +{ + return _architecture; +} + +unsigned int +Host::getMemory() const +{ + return _memory; +} + +bool +Host::isBeeping() const +{ + return _beeping; +} + +void +Host::identify(const int iterations) +{ +} + +void +Host::shutdown() +{ +} + +void +Host::reboot() +{ +} diff --git a/src/host.h b/src/host.h index d2da776..bcb8c12 100644 --- a/src/host.h +++ b/src/host.h @@ -20,39 +20,53 @@ * also available at http://www.gnu.org/copyleft/gpl.html. */ -#include -#include -#include +#include +#include -#include "qmf/com/redhat/matahari/Host.h" - -#include "networkdevice.h" +#include "hostlistener.h" #include "processors.h" +#include "networkdevice.h" -using namespace qpid::management; using namespace std; -using qpid::management::Manageable; - -class HostAgent : public Manageable +/* + Host represents the public contract for the set of host APIs. + */ +class Host { private: - qmf::com::redhat::matahari::Host* management_object; - ProcessorsAgent processors; - vector networkdevices; + string _uuid; + string _hostname; + string _hypervisor; + string _architecture; + unsigned int _memory; + bool _beeping; + + Processors _processors; + vector _networkdevices; + set _listeners; public: - HostAgent() {} - virtual ~HostAgent() {} + Host(); + virtual ~Host() {} + + void update(); + + void addHostListener(HostListener*); + void removeHostListener(HostListener*); - ManagementObject* GetManagementObject(void) const { return management_object; } + Processors& getProcessors(); - void setup(ManagementAgent* agent); - void update(void); + string getUUID() const; + string getHostname() const; + string getHypervisor() const; + string getArchitecture() const; + unsigned int getMemory() const; - // agent methods - void shutdown(void); - void reboot(void); + bool isBeeping() const; + void identify(const int iterations); + void shutdown(); + void reboot(); }; #endif // __HOST_H diff --git a/src/hostlistener.h b/src/hostlistener.h new file mode 100644 index 0000000..298e51d --- /dev/null +++ b/src/hostlistener.h @@ -0,0 +1,33 @@ +#ifndef __HOSTLISTENER_H +#define __HOSTLISTENER_H + +/* hostlistener.h - Copyright (C) 2009 Red Hat, Inc. + * Written by Darryl 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. + */ + +/* + HostListener defines a type which receives notification + whenever a Host event occurs. + */ +class HostListener +{ + public: + virtual void heartbeat(unsigned long timestamp) = 0; +}; + +#endif diff --git a/src/main.cpp b/src/main.cpp index 5ab3ac2..f45353a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,6 +32,10 @@ #include #include "host.h" + +#include "qmf/hostagent.h" +#include "qmf/processorsagent.h" + #include "qmf/com/redhat/matahari/Package.h" using namespace qpid::management; @@ -76,7 +80,9 @@ main(int argc, char **argv) ConnectionSettings settings; ManagementAgent *agent; - HostAgent host; + Host host; + HostAgent hostAgent(host); + ProcessorsAgent processorsAgent(host.getProcessors());; struct option opt[] = { {"help", no_argument, NULL, 'h'}, @@ -178,7 +184,8 @@ main(int argc, char **argv) agent->init(settings, 5, false, ".magentdata"); // Get the info and post it to the broker - host.setup(agent); + hostAgent.setup(agent); + processorsAgent.setup(agent, &hostAgent); while(1) { diff --git a/src/processors.cpp b/src/processors.cpp index 13c492d..1850aba 100644 --- a/src/processors.cpp +++ b/src/processors.cpp @@ -20,30 +20,44 @@ #include "processors.h" #include "platform.h" -using namespace std; -namespace _qmf = qmf::com::redhat::matahari; +void +Processors::addProcessorsListener(ProcessorsListener* listener) +{ + _listeners.insert(listener); +} void -ProcessorsAgent::setup(ManagementAgent* agent, Manageable* parent) +Processors::removeProcessorsListener(ProcessorsListener* listener) { - // setup the management object - management_object = new _qmf::Processors(agent, this, parent); - agent->addObject(management_object); + _listeners.erase(listener); +} - Platform* platform = Platform::instance(); +void +Processors::update() +{ + for(set::iterator iter = _listeners.begin(); + iter != _listeners.end(); + iter++) + { + (*iter)->updated(); + } +} - management_object->set_model(platform->get_processor_model()); - management_object->set_cores(platform->get_number_of_cores()); +string +Processors::getModel() const +{ + return Platform::instance()->get_processor_model(); } -void -ProcessorsAgent::update(void) const + +unsigned int +Processors::getNumberOfCores() const { - update_load_averages(); + return Platform::instance()->get_number_of_cores(); } -void -ProcessorsAgent::update_load_averages(void) const +float +Processors::getLoadAverage() const { - management_object->set_load_average(Platform::instance()->get_load_average()); + return Platform::instance()->get_load_average(); } diff --git a/src/processors.h b/src/processors.h index e681453..e69a6ee 100644 --- a/src/processors.h +++ b/src/processors.h @@ -20,36 +20,27 @@ * also available at http://www.gnu.org/copyleft/gpl.html. */ -#include -#include -#include -#include +#include +#include -#include "qmf/com/redhat/matahari/Processors.h" +#include "processorslistener.h" -using namespace qpid::management; using namespace std; -using qpid::management::Manageable; - -class ProcessorsAgent : public Manageable +class Processors { private: - qmf::com::redhat::matahari::Processors* management_object; + set _listeners; public: - ProcessorsAgent() {} - virtual ~ProcessorsAgent() {} - - ManagementObject* GetManagementObject(void) const { return management_object; } + void addProcessorsListener(ProcessorsListener* listener); + void removeProcessorsListener(ProcessorsListener* listener); - void setup(ManagementAgent* agent, Manageable* parent); + void update(); - void update(void) const; - - private: - // agent methods - void update_load_averages(void) const; + string getModel() const; + unsigned int getNumberOfCores() const; + float getLoadAverage() const; }; #endif diff --git a/src/processorslistener.h b/src/processorslistener.h new file mode 100644 index 0000000..d6818c8 --- /dev/null +++ b/src/processorslistener.h @@ -0,0 +1,29 @@ +#ifndef __PROCESSORSLISTENER_H +#define __PROCESSORSLISTENER_H + +/* processorslistener.h - Copyright (C) 2009 Red Hat, Inc. + * Written by Darryl 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. + */ + +class ProcessorsListener +{ + public: + virtual void updated() = 0; +}; + +#endif diff --git a/src/qmf/hostagent.cpp b/src/qmf/hostagent.cpp new file mode 100644 index 0000000..9807f65 --- /dev/null +++ b/src/qmf/hostagent.cpp @@ -0,0 +1,68 @@ +/* hostagent.cpp - Copyright (C) 2009 Red Hat, Inc. + * Written by Arjun Roy + * + * 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. + */ + +#include "hostagent.h" +#include + +namespace _qmf = qmf::com::redhat::matahari; + +HostAgent::HostAgent(Host& host) + :_host(host) +{ + this->_host.addHostListener(this); +} + +HostAgent::~HostAgent() +{ +} + +void +HostAgent::setup(ManagementAgent* agent) +{ + _management_object = new _qmf::Host(agent, this); + agent->addObject(_management_object); + + _management_object->set_uuid(_host.getUUID()); + _management_object->set_hostname(_host.getHostname()); + _management_object->set_hypervisor(_host.getHypervisor()); + _management_object->set_arch(_host.getArchitecture()); + _management_object->set_memory(_host.getMemory()); + _management_object->set_beeping(_host.isBeeping()); +} + +Manageable::status_t +HostAgent::ManagementMethod(uint32_t method, Args& arguments, string& text) +{ + switch(method) + { + case _qmf::Host::METHOD_SHUTDOWN: + _host.shutdown(); + return Manageable::STATUS_OK; + case _qmf::Host::METHOD_REBOOT: + _host.reboot(); + return Manageable::STATUS_OK; + } + + return Manageable::STATUS_NOT_IMPLEMENTED; +} + +void +HostAgent::heartbeat(unsigned long timestamp) +{ +} diff --git a/src/qmf/hostagent.h b/src/qmf/hostagent.h new file mode 100644 index 0000000..6d2f2a0 --- /dev/null +++ b/src/qmf/hostagent.h @@ -0,0 +1,51 @@ +#ifndef __HOSTAGENT_H +#define __HOSTAGENT_H + +/* hostagent.h - Copyright (C) 2009 Red Hat, Inc. + * Written by Arjun Roy + * + * 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. + */ + +#include +#include + +#include "host.h" +#include "hostlistener.h" + +#include "qmf/com/redhat/matahari/Host.h" + +using namespace qpid::management; +using namespace std; + +class HostAgent : public Manageable, public HostListener +{ + private: + qmf::com::redhat::matahari::Host* _management_object; + Host& _host; + + public: + HostAgent(Host& host); + virtual ~HostAgent(); + + void setup(ManagementAgent* agent); + ManagementObject* GetManagementObject() const { return _management_object; } + status_t ManagementMethod(uint32_t method, Args& arguments, string& text); + + virtual void heartbeat(unsigned long timestamp); +}; + +#endif diff --git a/src/qmf/processorsagent.cpp b/src/qmf/processorsagent.cpp new file mode 100644 index 0000000..c1703de --- /dev/null +++ b/src/qmf/processorsagent.cpp @@ -0,0 +1,49 @@ +/* processorsagent.cpp - Copyright (C) 2009 Red Hat, Inc. + * Written by Arjun Roy + * + * 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. + */ + +#include "processorsagent.h" +#include + +namespace _qmf = qmf::com::redhat::matahari; + +ProcessorsAgent::ProcessorsAgent(Processors& processors) + :_processors(processors) +{ + processors.addProcessorsListener(this); +} + +ProcessorsAgent::~ProcessorsAgent() +{ +} + +void +ProcessorsAgent::setup(ManagementAgent* agent, HostAgent* parent) +{ + _management_object = new _qmf::Processors(agent, this, parent); + agent->addObject(_management_object); + + _management_object->set_model(this->_processors.getModel()); + _management_object->set_cores(this->_processors.getNumberOfCores()); +} + +void +ProcessorsAgent::updated() +{ + _management_object->set_load_average(this->_processors.getLoadAverage()); +} diff --git a/src/qmf/processorsagent.h b/src/qmf/processorsagent.h new file mode 100644 index 0000000..1d814d4 --- /dev/null +++ b/src/qmf/processorsagent.h @@ -0,0 +1,50 @@ +#ifndef __PROCESSORSAGENT_H +#define __PROCESSORSAGENT_H + +/* processoragent.h - Copyright (C) 2010 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. + */ + +#include +#include + +#include "processors.h" +#include "processorslistener.h" +#include "qmf/com/redhat/matahari/Processors.h" +#include "qmf/hostagent.h" + +using namespace qpid::management; + +class ProcessorsAgent : public Manageable, public ProcessorsListener +{ + private: + qmf::com::redhat::matahari::Processors* _management_object; + + Processors& _processors; + + public: + ProcessorsAgent(Processors& processors); + virtual ~ProcessorsAgent(); + + void setup(ManagementAgent* agent, HostAgent* parent); + ManagementObject* GetManagementObject(void) const { return _management_object; } + + virtual void updated(); +}; + +#endif -- 1.6.6.1 From aclement at linagora.com Wed May 19 05:57:22 2010 From: aclement at linagora.com (Arthur =?iso-8859-15?q?Cl=E9ment?=) Date: Wed, 19 May 2010 07:57:22 +0200 Subject: [Ovirt-devel] Rails/mongrel/httpd issue - F13, rails 2.3.5 In-Reply-To: <20100518172503.GP22442@mcpierce-desktop.usersys.redhat.com> References: <201005101829.33165.aclement@linagora.com> <201005181136.04908.aclement@linagora.com> <20100518172503.GP22442@mcpierce-desktop.usersys.redhat.com> Message-ID: <201005190757.22938.aclement@linagora.com> On mardi 18 mai 2010 19:25:03 Darryl L. Pierce wrote: > On Tue, May 18, 2010 at 11:36:04AM +0200, Arthur Cl?ment wrote: > > Hi > > > > Thanks a colleague (Patrick Guiran), we found the trick to solve the > > problem. Here is the patch to apply from the mongrel root directory : > > ==================================== > > --- lib/mongrel/cgi.rb 2010-05-18 11:20:47.414269158 +0200 > > +++ lib/mongrel/cgi.rb 2010-05-18 11:20:09.328271509 +0200 > > @@ -105,7 +105,8 @@ > > > > when Hash > > > > cookie.each_value {|c| to['Set-Cookie'] = c.to_s} > > > > else > > > > - to['Set-Cookie'] = options['cookie'].to_s > > + # patched by pguiran at linagora.com (18/05/10) > > + to['Set-Cookie'] = cookie.to_s > > > > end > > > > @head.delete('cookie') > > > > ==================================== > > > > After some search, we found that this bug is corrected on the mongrel > > trunk, and was written by "Evan Weaver", on march 2008, and commited by > > "Matt Aimonetti", on march 2009. > > Here is the link of the commit : > > http://github.com/fauna/mongrel/commit/7c9d988d4de2e08d67f95ca209196427fd > > 89c9af > > > > our bugs is designed as the bug #16: > > - Close #16, XXX needs audit! (CGIWrapper "options" attr_reader has no > > corresponding @options variable). > > If this was fixed so long ago (two years ago fixed, over a year ago > committed) do we know why it's not available in the distribution? Can > you open a new BZ or else add a comment to an exist BZ to get the > package maintainer to release an update? Mongrel 1.1.5 is the last stable release, or at least it's the last available tarball. There were newer versions but only released via gem, so I don't think the maintainer "forgot" this package. From geoff at starbiz.com.au Wed May 19 09:55:50 2010 From: geoff at starbiz.com.au (Geoff O'Callaghan) Date: Wed, 19 May 2010 19:55:50 +1000 Subject: [Ovirt-devel] a couple of questions In-Reply-To: <1274183953.29447.46.camel@localhost.localdomain> References: <4BEDE912.3040406@starbiz.com.au> <1273888079.29447.10.camel@localhost.localdomain> <4BF26067.5090704@starbiz.com.au> <1274183953.29447.46.camel@localhost.localdomain> Message-ID: <4BF3B5A6.50509@starbiz.com.au> On 18/05/10 21:59, Mike Burns wrote: [snip] > > It looks like neither log was for incorrect space issue. Both of them > show a multipath device being detected. It also looks like it > determined that /dev/sda was 114473 MB which is approx 112 GB. This is > the same value that mutlipath output above shows. > Yeah sorry I was having a bad hair day. I was getting the space calculation problem when I was running with a multipath.conf that blacklisted everything. Since that wasn't the strategic direction I gave up on it and thought i'd instead send the problem I was having with the wwid with embedded spaces. Of course I forgot to say that :) I could try to reproduce the problem if you like by adding back the blacklist '*', but i'd much prefer to move forward than sideways :) > I did notice a few of these messages: > > WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util > sfdisk doesn't support GPT. Use GNU Parted. > > I'll look into those as well. > Thanks. Cheers Geoff From dpierce at redhat.com Wed May 19 12:18:27 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 19 May 2010 08:18:27 -0400 Subject: [Ovirt-devel] Squashed commits... Message-ID: <1274271508-29705-1-git-send-email-dpierce@redhat.com> Refactoring the previous patch ended up creating two deltas. This patch pushes them both together into a single commit. From dpierce at redhat.com Wed May 19 12:18:28 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 19 May 2010 08:18:28 -0400 Subject: [Ovirt-devel] [PATCH matahari] Moving QMF functionality into a transport layer. In-Reply-To: <1274271508-29705-1-git-send-email-dpierce@redhat.com> References: <1274271508-29705-1-git-send-email-dpierce@redhat.com> Message-ID: <1274271508-29705-2-git-send-email-dpierce@redhat.com> This is the first step towards separating the APIs from the means by which they are carried between the remote and local system. A new type, HostListener, defines a type that receives notifications when the Host fires off an event. A new type, ProcessorsListener, defines a type that receives notifications when Processors updates itself. Signed-off-by: Darryl L. Pierce --- .gitignore | 2 +- src/Makefile.am | 8 ++- src/host.cpp | 156 +++++++++++++++++++++++++++++------------- src/host.h | 56 ++++++++++------ src/hostlistener.h | 33 +++++++++ src/main.cpp | 11 +++- src/processors.cpp | 44 ++++++++---- src/processors.h | 31 +++------ src/processorslistener.h | 29 ++++++++ src/qmf/hostagent.cpp | 68 +++++++++++++++++++ src/qmf/hostagent.h | 51 ++++++++++++++ src/qmf/processorsagent.cpp | 49 ++++++++++++++ src/qmf/processorsagent.h | 50 ++++++++++++++ 13 files changed, 480 insertions(+), 108 deletions(-) create mode 100644 src/hostlistener.h create mode 100644 src/processorslistener.h create mode 100644 src/qmf/hostagent.cpp create mode 100644 src/qmf/hostagent.h create mode 100644 src/qmf/processorsagent.cpp create mode 100644 src/qmf/processorsagent.h diff --git a/.gitignore b/.gitignore index ad6d70b..8e12062 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,4 @@ stamp-h1 *~ src/matahari -src/qmf +src/qmf/com diff --git a/src/Makefile.am b/src/Makefile.am index aed9e19..498ee72 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,6 +18,7 @@ nodist_matahari_SOURCES = $(generated_file_list) $(first) matahari_SOURCES = \ host.cpp \ host.h \ + hostlistener.h \ linux_platform.cpp \ linux_platform.h \ main.cpp \ @@ -26,7 +27,12 @@ matahari_SOURCES = \ platform.cpp \ platform.h \ processors.cpp \ - processors.h + processors.h \ + processorslistener.h \ + qmf/hostagent.cpp \ + qmf/hostagent.h \ + qmf/processorsagent.cpp \ + qmf/processorsagent.h $(generated_file_list): $(generated_file_list) diff --git a/src/host.cpp b/src/host.cpp index 34d4550..29b84ec 100644 --- a/src/host.cpp +++ b/src/host.cpp @@ -17,60 +17,43 @@ * also available at http://www.gnu.org/copyleft/gpl.html. */ -#include +#include "host.h" +#include "platform.h" +#include #include -#include +#include +#include #include #include -#include "host.h" -#include "platform.h" -#include "qmf/com/redhat/matahari/Host.h" - -using namespace qpid::management; using namespace std; -using qpid::management::Manageable; -namespace _qmf = qmf::com::redhat::matahari; - -void -HostAgent::setup(ManagementAgent* agent) +Host::Host() { - management_object = new _qmf::Host(agent, this); - agent->addObject(management_object); - - // discover the aspects of the host - processors.setup(agent, this); - networkdevices = Platform::instance()->get_network_devices(); - - for(vector::iterator iter = networkdevices.begin(); - iter != networkdevices.end(); - iter++) - { - iter->setup(agent, this); - } - struct utsname details; - string uuid = "Unknown"; - string hostname = "Unknown"; - string hypervisor = "Unknown"; - string architecture = "None"; - unsigned long memory = 0; - bool beeping = false; + this->_uuid = string("Unknown"); + this->_hostname = string("Unknown"); + this->_hypervisor = string("Unknown"); + this->_architecture = string("None"); + this->_memory = 0; + this->_beeping = false; - ifstream input("/var/lib/dbus/machine-id"); + std::ifstream input("/var/lib/dbus/machine-id"); if(input.is_open()) { + string uuid; + getline(input, uuid); input.close(); + this->_uuid = uuid; } if(!uname(&details)) { - hostname = string(details.nodename); - architecture = string(details.machine); + this->_hostname = string(details.nodename); + this->_architecture = string(details.machine); } else { @@ -81,39 +64,116 @@ HostAgent::setup(ManagementAgent* agent) if(lvconn) { - hypervisor = string(virConnectGetType(lvconn)); + this->_hypervisor = string(virConnectGetType(lvconn)); virConnectClose(lvconn); } struct sysinfo sysinf; if(!sysinfo(&sysinf)) { - memory = sysinf.totalram / 1024L; + this->_memory = sysinf.totalram / 1024L; } else { throw runtime_error("Unable to retrieve system memory details."); } +} - cout << "memory: " << memory << endl; +/* +void +Host::setup(ManagementAgent* agent, HostAgent* hostAgent) +{ + // discover the aspects of the host + _processors.setup(agent, hostAgent); + _networkdevices = Platform::instance()->get_network_devices(); - management_object->set_uuid(uuid); - management_object->set_hostname(hostname); - management_object->set_hypervisor(hypervisor); - management_object->set_arch(architecture); - management_object->set_memory(memory); - management_object->set_beeping(beeping); + for(vector::iterator iter = _networkdevices.begin(); + iter != _networkdevices.end(); + iter++) + { + iter->setup(agent, hostAgent); + } } +*/ void -HostAgent::update(void) +Host::update() { - processors.update(); + _processors.update(); - for(vector::iterator iter = networkdevices.begin(); - iter != networkdevices.end(); + for(vector::iterator iter = _networkdevices.begin(); + iter != _networkdevices.end(); iter++) { iter->update(); } } + +void +Host::addHostListener(HostListener* listener) +{ + _listeners.insert(listener); +} + +void +Host::removeHostListener(HostListener* listener) +{ + _listeners.erase(listener); +} + +Processors& +Host::getProcessors() +{ + return _processors; +} + +string +Host:: getUUID() const +{ + return _uuid; +} + +string +Host::getHostname() const +{ + return _hostname; +} + +string +Host::getHypervisor() const +{ + return _hypervisor; +} + +string +Host::getArchitecture() const +{ + return _architecture; +} + +unsigned int +Host::getMemory() const +{ + return _memory; +} + +bool +Host::isBeeping() const +{ + return _beeping; +} + +void +Host::identify(const int iterations) +{ +} + +void +Host::shutdown() +{ +} + +void +Host::reboot() +{ +} diff --git a/src/host.h b/src/host.h index d2da776..bcb8c12 100644 --- a/src/host.h +++ b/src/host.h @@ -20,39 +20,53 @@ * also available at http://www.gnu.org/copyleft/gpl.html. */ -#include -#include -#include +#include +#include -#include "qmf/com/redhat/matahari/Host.h" - -#include "networkdevice.h" +#include "hostlistener.h" #include "processors.h" +#include "networkdevice.h" -using namespace qpid::management; using namespace std; -using qpid::management::Manageable; - -class HostAgent : public Manageable +/* + Host represents the public contract for the set of host APIs. + */ +class Host { private: - qmf::com::redhat::matahari::Host* management_object; - ProcessorsAgent processors; - vector networkdevices; + string _uuid; + string _hostname; + string _hypervisor; + string _architecture; + unsigned int _memory; + bool _beeping; + + Processors _processors; + vector _networkdevices; + set _listeners; public: - HostAgent() {} - virtual ~HostAgent() {} + Host(); + virtual ~Host() {} + + void update(); + + void addHostListener(HostListener*); + void removeHostListener(HostListener*); - ManagementObject* GetManagementObject(void) const { return management_object; } + Processors& getProcessors(); - void setup(ManagementAgent* agent); - void update(void); + string getUUID() const; + string getHostname() const; + string getHypervisor() const; + string getArchitecture() const; + unsigned int getMemory() const; - // agent methods - void shutdown(void); - void reboot(void); + bool isBeeping() const; + void identify(const int iterations); + void shutdown(); + void reboot(); }; #endif // __HOST_H diff --git a/src/hostlistener.h b/src/hostlistener.h new file mode 100644 index 0000000..298e51d --- /dev/null +++ b/src/hostlistener.h @@ -0,0 +1,33 @@ +#ifndef __HOSTLISTENER_H +#define __HOSTLISTENER_H + +/* hostlistener.h - Copyright (C) 2009 Red Hat, Inc. + * Written by Darryl 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. + */ + +/* + HostListener defines a type which receives notification + whenever a Host event occurs. + */ +class HostListener +{ + public: + virtual void heartbeat(unsigned long timestamp) = 0; +}; + +#endif diff --git a/src/main.cpp b/src/main.cpp index 5ab3ac2..f45353a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,6 +32,10 @@ #include #include "host.h" + +#include "qmf/hostagent.h" +#include "qmf/processorsagent.h" + #include "qmf/com/redhat/matahari/Package.h" using namespace qpid::management; @@ -76,7 +80,9 @@ main(int argc, char **argv) ConnectionSettings settings; ManagementAgent *agent; - HostAgent host; + Host host; + HostAgent hostAgent(host); + ProcessorsAgent processorsAgent(host.getProcessors());; struct option opt[] = { {"help", no_argument, NULL, 'h'}, @@ -178,7 +184,8 @@ main(int argc, char **argv) agent->init(settings, 5, false, ".magentdata"); // Get the info and post it to the broker - host.setup(agent); + hostAgent.setup(agent); + processorsAgent.setup(agent, &hostAgent); while(1) { diff --git a/src/processors.cpp b/src/processors.cpp index 13c492d..1850aba 100644 --- a/src/processors.cpp +++ b/src/processors.cpp @@ -20,30 +20,44 @@ #include "processors.h" #include "platform.h" -using namespace std; -namespace _qmf = qmf::com::redhat::matahari; +void +Processors::addProcessorsListener(ProcessorsListener* listener) +{ + _listeners.insert(listener); +} void -ProcessorsAgent::setup(ManagementAgent* agent, Manageable* parent) +Processors::removeProcessorsListener(ProcessorsListener* listener) { - // setup the management object - management_object = new _qmf::Processors(agent, this, parent); - agent->addObject(management_object); + _listeners.erase(listener); +} - Platform* platform = Platform::instance(); +void +Processors::update() +{ + for(set::iterator iter = _listeners.begin(); + iter != _listeners.end(); + iter++) + { + (*iter)->updated(); + } +} - management_object->set_model(platform->get_processor_model()); - management_object->set_cores(platform->get_number_of_cores()); +string +Processors::getModel() const +{ + return Platform::instance()->get_processor_model(); } -void -ProcessorsAgent::update(void) const + +unsigned int +Processors::getNumberOfCores() const { - update_load_averages(); + return Platform::instance()->get_number_of_cores(); } -void -ProcessorsAgent::update_load_averages(void) const +float +Processors::getLoadAverage() const { - management_object->set_load_average(Platform::instance()->get_load_average()); + return Platform::instance()->get_load_average(); } diff --git a/src/processors.h b/src/processors.h index e681453..e69a6ee 100644 --- a/src/processors.h +++ b/src/processors.h @@ -20,36 +20,27 @@ * also available at http://www.gnu.org/copyleft/gpl.html. */ -#include -#include -#include -#include +#include +#include -#include "qmf/com/redhat/matahari/Processors.h" +#include "processorslistener.h" -using namespace qpid::management; using namespace std; -using qpid::management::Manageable; - -class ProcessorsAgent : public Manageable +class Processors { private: - qmf::com::redhat::matahari::Processors* management_object; + set _listeners; public: - ProcessorsAgent() {} - virtual ~ProcessorsAgent() {} - - ManagementObject* GetManagementObject(void) const { return management_object; } + void addProcessorsListener(ProcessorsListener* listener); + void removeProcessorsListener(ProcessorsListener* listener); - void setup(ManagementAgent* agent, Manageable* parent); + void update(); - void update(void) const; - - private: - // agent methods - void update_load_averages(void) const; + string getModel() const; + unsigned int getNumberOfCores() const; + float getLoadAverage() const; }; #endif diff --git a/src/processorslistener.h b/src/processorslistener.h new file mode 100644 index 0000000..d6818c8 --- /dev/null +++ b/src/processorslistener.h @@ -0,0 +1,29 @@ +#ifndef __PROCESSORSLISTENER_H +#define __PROCESSORSLISTENER_H + +/* processorslistener.h - Copyright (C) 2009 Red Hat, Inc. + * Written by Darryl 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. + */ + +class ProcessorsListener +{ + public: + virtual void updated() = 0; +}; + +#endif diff --git a/src/qmf/hostagent.cpp b/src/qmf/hostagent.cpp new file mode 100644 index 0000000..9807f65 --- /dev/null +++ b/src/qmf/hostagent.cpp @@ -0,0 +1,68 @@ +/* hostagent.cpp - Copyright (C) 2009 Red Hat, Inc. + * Written by Arjun Roy + * + * 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. + */ + +#include "hostagent.h" +#include + +namespace _qmf = qmf::com::redhat::matahari; + +HostAgent::HostAgent(Host& host) + :_host(host) +{ + this->_host.addHostListener(this); +} + +HostAgent::~HostAgent() +{ +} + +void +HostAgent::setup(ManagementAgent* agent) +{ + _management_object = new _qmf::Host(agent, this); + agent->addObject(_management_object); + + _management_object->set_uuid(_host.getUUID()); + _management_object->set_hostname(_host.getHostname()); + _management_object->set_hypervisor(_host.getHypervisor()); + _management_object->set_arch(_host.getArchitecture()); + _management_object->set_memory(_host.getMemory()); + _management_object->set_beeping(_host.isBeeping()); +} + +Manageable::status_t +HostAgent::ManagementMethod(uint32_t method, Args& arguments, string& text) +{ + switch(method) + { + case _qmf::Host::METHOD_SHUTDOWN: + _host.shutdown(); + return Manageable::STATUS_OK; + case _qmf::Host::METHOD_REBOOT: + _host.reboot(); + return Manageable::STATUS_OK; + } + + return Manageable::STATUS_NOT_IMPLEMENTED; +} + +void +HostAgent::heartbeat(unsigned long timestamp) +{ +} diff --git a/src/qmf/hostagent.h b/src/qmf/hostagent.h new file mode 100644 index 0000000..6d2f2a0 --- /dev/null +++ b/src/qmf/hostagent.h @@ -0,0 +1,51 @@ +#ifndef __HOSTAGENT_H +#define __HOSTAGENT_H + +/* hostagent.h - Copyright (C) 2009 Red Hat, Inc. + * Written by Arjun Roy + * + * 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. + */ + +#include +#include + +#include "host.h" +#include "hostlistener.h" + +#include "qmf/com/redhat/matahari/Host.h" + +using namespace qpid::management; +using namespace std; + +class HostAgent : public Manageable, public HostListener +{ + private: + qmf::com::redhat::matahari::Host* _management_object; + Host& _host; + + public: + HostAgent(Host& host); + virtual ~HostAgent(); + + void setup(ManagementAgent* agent); + ManagementObject* GetManagementObject() const { return _management_object; } + status_t ManagementMethod(uint32_t method, Args& arguments, string& text); + + virtual void heartbeat(unsigned long timestamp); +}; + +#endif diff --git a/src/qmf/processorsagent.cpp b/src/qmf/processorsagent.cpp new file mode 100644 index 0000000..c1703de --- /dev/null +++ b/src/qmf/processorsagent.cpp @@ -0,0 +1,49 @@ +/* processorsagent.cpp - Copyright (C) 2009 Red Hat, Inc. + * Written by Arjun Roy + * + * 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. + */ + +#include "processorsagent.h" +#include + +namespace _qmf = qmf::com::redhat::matahari; + +ProcessorsAgent::ProcessorsAgent(Processors& processors) + :_processors(processors) +{ + processors.addProcessorsListener(this); +} + +ProcessorsAgent::~ProcessorsAgent() +{ +} + +void +ProcessorsAgent::setup(ManagementAgent* agent, HostAgent* parent) +{ + _management_object = new _qmf::Processors(agent, this, parent); + agent->addObject(_management_object); + + _management_object->set_model(this->_processors.getModel()); + _management_object->set_cores(this->_processors.getNumberOfCores()); +} + +void +ProcessorsAgent::updated() +{ + _management_object->set_load_average(this->_processors.getLoadAverage()); +} diff --git a/src/qmf/processorsagent.h b/src/qmf/processorsagent.h new file mode 100644 index 0000000..1d814d4 --- /dev/null +++ b/src/qmf/processorsagent.h @@ -0,0 +1,50 @@ +#ifndef __PROCESSORSAGENT_H +#define __PROCESSORSAGENT_H + +/* processoragent.h - Copyright (C) 2010 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. + */ + +#include +#include + +#include "processors.h" +#include "processorslistener.h" +#include "qmf/com/redhat/matahari/Processors.h" +#include "qmf/hostagent.h" + +using namespace qpid::management; + +class ProcessorsAgent : public Manageable, public ProcessorsListener +{ + private: + qmf::com::redhat::matahari::Processors* _management_object; + + Processors& _processors; + + public: + ProcessorsAgent(Processors& processors); + virtual ~ProcessorsAgent(); + + void setup(ManagementAgent* agent, HostAgent* parent); + ManagementObject* GetManagementObject(void) const { return _management_object; } + + virtual void updated(); +}; + +#endif -- 1.6.6.1 From dpierce at redhat.com Wed May 19 21:00:12 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 19 May 2010 17:00:12 -0400 Subject: [Ovirt-devel] [PATCH matahari] Moved the follow platform details to the Platform class to keep the details abstract and platform-independent: Message-ID: <1274302812-21691-1-git-send-email-dpierce@redhat.com> * UUID * hostname * hardware architecture * total system memory * hypervisor Signed-off-by: Darryl L. Pierce --- src/host.cpp | 61 ++++------------------------------------------- src/linux_platform.cpp | 58 +++++++++++++++++++++++++++++++++++++++++---- src/platform.h | 37 ++++++++++++++++++++++++---- 3 files changed, 90 insertions(+), 66 deletions(-) diff --git a/src/host.cpp b/src/host.cpp index 34d4550..b9b4a7f 100644 --- a/src/host.cpp +++ b/src/host.cpp @@ -19,10 +19,7 @@ #include -#include #include -#include -#include #include "host.h" #include "platform.h" @@ -51,58 +48,12 @@ HostAgent::setup(ManagementAgent* agent) iter->setup(agent, this); } - struct utsname details; - string uuid = "Unknown"; - string hostname = "Unknown"; - string hypervisor = "Unknown"; - string architecture = "None"; - unsigned long memory = 0; - bool beeping = false; - - ifstream input("/var/lib/dbus/machine-id"); - - if(input.is_open()) - { - getline(input, uuid); - input.close(); - } - - if(!uname(&details)) - { - hostname = string(details.nodename); - architecture = string(details.machine); - } - else - { - throw runtime_error("Unable to retrieve system details"); - } - - virConnectPtr lvconn = virConnectOpenReadOnly(NULL); - - if(lvconn) - { - hypervisor = string(virConnectGetType(lvconn)); - virConnectClose(lvconn); - } - - struct sysinfo sysinf; - if(!sysinfo(&sysinf)) - { - memory = sysinf.totalram / 1024L; - } - else - { - throw runtime_error("Unable to retrieve system memory details."); - } - - cout << "memory: " << memory << endl; - - management_object->set_uuid(uuid); - management_object->set_hostname(hostname); - management_object->set_hypervisor(hypervisor); - management_object->set_arch(architecture); - management_object->set_memory(memory); - management_object->set_beeping(beeping); + management_object->set_uuid(Platform::instance()->getUUID()); + management_object->set_hostname(Platform::instance()->getHostname()); + management_object->set_hypervisor(Platform::instance()->getHypervisor()); + management_object->set_arch(Platform::instance()->getArchitecture()); + management_object->set_memory(Platform::instance()->getMemory()); + management_object->set_beeping(false); } void diff --git a/src/linux_platform.cpp b/src/linux_platform.cpp index fbcfdb9..805f071 100644 --- a/src/linux_platform.cpp +++ b/src/linux_platform.cpp @@ -21,11 +21,14 @@ #include #include #include +#include #include #include #include #include #include +#include +#include // TODO remove this wrapper once rhbz#583747 is fixed extern "C" { @@ -39,6 +42,50 @@ LinuxPlatform::LinuxPlatform() int core_count = 0; string model = "unknown"; + string uuid; + ifstream* input; + + input = new ifstream("/var/lib/dbus/machine-id"); + + if(input->is_open()) + { + getline(*input, uuid); + input->close(); + this->setUUID(uuid); + } + input->close(); + delete input; + + struct utsname details; + + if(!uname(&details)) + { + this->setHostname(string(details.nodename)); + this->setArchitecture(string(details.machine)); + } + else + { + throw runtime_error("Unable to retrieve system details"); + } + + virConnectPtr lvconn = virConnectOpenReadOnly(NULL); + + if(lvconn) + { + this->setHypervisor(string(virConnectGetType(lvconn))); + virConnectClose(lvconn); + } + + struct sysinfo sysinf; + if(!sysinfo(&sysinf)) + { + this->setMemory(sysinf.totalram / 1024L); + } + else + { + throw runtime_error("Unable to retrieve system memory details."); + } + struct udev* udev = udev_new(); struct udev_enumerate* enumerator = udev_enumerate_new(udev); @@ -58,8 +105,8 @@ LinuxPlatform::LinuxPlatform() udev_enumerate_unref(enumerator); udev_unref(udev); - ifstream input("/proc/cpuinfo"); - if(input.is_open()) + input = new ifstream("/proc/cpuinfo"); + if(input->is_open()) { string regexstr = "(.*\\S)\\s*:\\s*(\\S.*)"; int expected = 3; @@ -73,11 +120,11 @@ LinuxPlatform::LinuxPlatform() regex = pcre_compile(regexstr.c_str(), 0, &pcre_error, &pcre_error_offset, NULL); if(!regex) { throw runtime_error("Unable to compile regular expression."); } - while(!input.eof() && !done) + while(!input->eof() && !done) { string line; - getline(input, line); + getline(*input, line); int match = pcre_exec(regex, NULL, line.c_str(), line.length(), 0, PCRE_NOTEMPTY,found, expected * 3); @@ -104,7 +151,8 @@ LinuxPlatform::LinuxPlatform() } } } - input.close(); + input->close(); + delete input; } } diff --git a/src/platform.h b/src/platform.h index 54fbe37..1a976a6 100644 --- a/src/platform.h +++ b/src/platform.h @@ -37,25 +37,50 @@ class Platform private: static Platform* _instance; - string processor_model; - unsigned int number_of_cores; + string _uuid; + string _hostname; + string _architecture; + string _hypervisor; + unsigned long _memory; + string _processor_model; + unsigned int _number_of_cores; protected: Platform() {} virtual~ Platform() {} - void set_processor_model(const string model) { processor_model = model; } - void set_number_of_cores(const int number) { number_of_cores = number; } + void setUUID(const string uuid) { _uuid = uuid; } + void setHostname(const string hostname) { _hostname = hostname; } + void setArchitecture(const string arch) { _architecture = arch; } + void setHypervisor(const string hypervisor) { _hypervisor = hypervisor; } + void setMemory(const unsigned long memory) { _memory = memory; } + void set_processor_model(const string model) { _processor_model = model; } + void set_number_of_cores(const int number) { _number_of_cores = number; } public: // the singleton instance static Platform* instance(); + // returns the UUID for the installation + string getUUID() const { return _uuid; } + + // returns the fully qualified hostname + string getHostname() const { return _hostname; } + + // returns the system architecture + string getArchitecture() const { return _architecture; } + + // returns the hypervisor + string getHypervisor() const { return _hypervisor; } + + // returns the total system memory + unsigned long getMemory() const { return _memory; } + // returns text describing the processor model. - string get_processor_model() const { return processor_model; } + string get_processor_model() const { return _processor_model; } // returns the number of cores in the processor. - int get_number_of_cores() const { return number_of_cores; } + int get_number_of_cores() const { return _number_of_cores; } // returns the load average for the platform virtual double get_load_average() const = 0; -- 1.6.6.1 From apevec at redhat.com Thu May 20 17:45:04 2010 From: apevec at redhat.com (Alan Pevec) Date: Thu, 20 May 2010 19:45:04 +0200 Subject: [Ovirt-devel] [PATCH node] check if root password is expired In-Reply-To: <1267737850-12275-1-git-send-email-apevec@redhat.com> References: <1267737850-12275-1-git-send-email-apevec@redhat.com> Message-ID: <1274377504-7082-1-git-send-email-apevec@redhat.com> this might be upon reboot in case of automated installed with rootpw parameter Unpersist temprorarily /etc/shaddow to let passwd work and persist upon successful login. Signed-off-by: Alan Pevec --- scripts/ovirt-early | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/ovirt-early b/scripts/ovirt-early index 4b85102..1c15792 100755 --- a/scripts/ovirt-early +++ b/scripts/ovirt-early @@ -478,11 +478,16 @@ start_ovirt_early () { if [ -n "$rootpw" ]; then log "Setting temporary root password: $rootpw" unmount_config /etc/passwd /etc/shadow - /usr/sbin/usermod -p $rootpw root + /usr/sbin/usermod -p "$rootpw" root chage -d 0 root + fi + # check if root password is expired, this might be upon reboot + # in case of automated installed with rootpw parameter! + if LC_ALL=C chage -l root | grep -q "password must be changed"; then + unmount_config /etc/passwd /etc/shadow # PAM will force password change at first login # so make sure we persist it after a successful login - cat >> /root/.bash_profile << EOF + cat >> /etc/profile << EOF # added by ovirt-early persist /etc/passwd /etc/shadow EOF -- 1.6.0.6 From dpierce at redhat.com Fri May 21 18:24:12 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 21 May 2010 14:24:12 -0400 Subject: [Ovirt-devel] [Matahari] [PATCH matahari] Moving QMF functionality into a transport layer. In-Reply-To: References: <1274271508-29705-1-git-send-email-dpierce@redhat.com> <1274271508-29705-2-git-send-email-dpierce@redhat.com> Message-ID: <20100521182412.GE24466@mcpierce-desktop.usersys.redhat.com> On Fri, May 21, 2010 at 07:56:15PM +0200, Andrew Beekhof wrote: > ACK. > Further modifications might become themselves when we try to merge the > virtio version, but this is a good start and I don't see any reason to > delay merging it. Thank you. This is now pushed into the repo. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From matinata at br.ibm.com Fri May 21 21:34:16 2010 From: matinata at br.ibm.com (Ricardo Marin Matinata) Date: Fri, 21 May 2010 18:34:16 -0300 Subject: [Ovirt-devel] [PATCH node] check if root password is expired In-Reply-To: <1274377504-7082-1-git-send-email-apevec@redhat.com> References: <1267737850-12275-1-git-send-email-apevec@redhat.com> <1274377504-7082-1-git-send-email-apevec@redhat.com> Message-ID: <1274477656.10094.9.camel@localhost> On Thu, 2010-05-20 at 19:45 +0200, Alan Pevec wrote: > this might be upon reboot in case of automated installed > with rootpw parameter > Unpersist temprorarily /etc/shaddow to let passwd work and persist > upon successful login. The patch seems to work fine, as far as what it proposes to do - assure one can login into the node, after a completely automated PXE installation for standalone mode. However, on a not so related problem, for those using password based authentication, there's still the problem on passwd not working after the node is properly installed, unless you explicitly umount /etc/shadow. Has anybody thought on options on how to cope with this ? That is, preserving the simple behavior of "passwd" ? > > Signed-off-by: Alan Pevec > --- > scripts/ovirt-early | 9 +++++++-- > 1 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/scripts/ovirt-early b/scripts/ovirt-early > index 4b85102..1c15792 100755 > --- a/scripts/ovirt-early > +++ b/scripts/ovirt-early > @@ -478,11 +478,16 @@ start_ovirt_early () { > if [ -n "$rootpw" ]; then > log "Setting temporary root password: $rootpw" > unmount_config /etc/passwd /etc/shadow > - /usr/sbin/usermod -p $rootpw root > + /usr/sbin/usermod -p "$rootpw" root > chage -d 0 root > + fi > + # check if root password is expired, this might be upon reboot > + # in case of automated installed with rootpw parameter! > + if LC_ALL=C chage -l root | grep -q "password must be changed"; then > + unmount_config /etc/passwd /etc/shadow > # PAM will force password change at first login > # so make sure we persist it after a successful login > - cat >> /root/.bash_profile << EOF > + cat >> /etc/profile << EOF > # added by ovirt-early > persist /etc/passwd /etc/shadow > EOF -- Ricardo Marin Matinata Linux Technology Center IBM Brazil | Hortolandia | SP matinata br ibm com From apevec at redhat.com Fri May 21 21:56:22 2010 From: apevec at redhat.com (Alan Pevec) Date: Fri, 21 May 2010 23:56:22 +0200 Subject: [Ovirt-devel] [PATCH node] check if root password is expired In-Reply-To: <1274477656.10094.9.camel@localhost> References: <1267737850-12275-1-git-send-email-apevec@redhat.com> <1274377504-7082-1-git-send-email-apevec@redhat.com> <1274477656.10094.9.camel@localhost> Message-ID: <4BF70186.7040609@redhat.com> Ricardo Marin Matinata wrote: > However, on a not so related problem, for those using password based > authentication, there's still the problem on passwd not working after > the node is properly installed, unless you explicitly > umount /etc/shadow. Has anybody thought on options on how to cope with > this ? That is, preserving the simple behavior of "passwd" ? you either point users to use ovirt-config-password or, for shell users, provide an alias: passwd () { unpersist /etc/shadow /usr/bin/passwd persist /etc/shadow } From dpierce at redhat.com Mon May 24 12:33:14 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Mon, 24 May 2010 08:33:14 -0400 Subject: [Ovirt-devel] [PATCH matahari] Moves the CPU properties into the Host API space. Message-ID: <1274704394-4308-1-git-send-email-dpierce@redhat.com> There was no valid reason to keep this set of APIs in their own agent and class, so those have been eliminated. A new HostListener method, HostListener::updated(), was added. It is via this method that the Host will notify all transports that the load average statistic is updated on the host. Signed-off-by: Darryl L. Pierce --- src/Makefile.am | 11 +------ src/host.cpp | 33 +++++++++++++++++----- src/host.h | 10 ++++--- src/hostlistener.h | 1 + src/linux_platform.cpp | 10 +++--- src/linux_platform.h | 2 +- src/main.cpp | 3 -- src/platform.h | 18 +++++------- src/processors.cpp | 63 ------------------------------------------- src/processors.h | 46 ------------------------------- src/processorslistener.h | 29 ------------------- src/qmf/hostagent.cpp | 9 ++++++ src/qmf/hostagent.h | 1 + src/qmf/processorsagent.cpp | 49 --------------------------------- src/qmf/processorsagent.h | 50 ---------------------------------- src/schema.xml | 16 +++++------ 16 files changed, 64 insertions(+), 287 deletions(-) delete mode 100644 src/processors.cpp delete mode 100644 src/processors.h delete mode 100644 src/processorslistener.h delete mode 100644 src/qmf/processorsagent.cpp delete mode 100644 src/qmf/processorsagent.h diff --git a/src/Makefile.am b/src/Makefile.am index 498ee72..7daea07 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,9 +9,7 @@ generated_file_list = \ qmf/com/redhat/matahari/NetworkDevice.cpp \ qmf/com/redhat/matahari/NetworkDevice.h \ qmf/com/redhat/matahari/Package.cpp \ - qmf/com/redhat/matahari/Package.h \ - qmf/com/redhat/matahari/Processors.cpp \ - qmf/com/redhat/matahari/Processors.h + qmf/com/redhat/matahari/Package.h nodist_matahari_SOURCES = $(generated_file_list) $(first) @@ -26,13 +24,8 @@ matahari_SOURCES = \ networkdevice.h \ platform.cpp \ platform.h \ - processors.cpp \ - processors.h \ - processorslistener.h \ qmf/hostagent.cpp \ - qmf/hostagent.h \ - qmf/processorsagent.cpp \ - qmf/processorsagent.h + qmf/hostagent.h $(generated_file_list): $(generated_file_list) diff --git a/src/host.cpp b/src/host.cpp index 29b84ec..6d9a1fe 100644 --- a/src/host.cpp +++ b/src/host.cpp @@ -99,14 +99,19 @@ Host::setup(ManagementAgent* agent, HostAgent* hostAgent) void Host::update() { - _processors.update(); - for(vector::iterator iter = _networkdevices.begin(); iter != _networkdevices.end(); iter++) { iter->update(); } + + for(set::iterator iter = _listeners.begin(); + iter != _listeners.end(); + iter++) + { + (*iter)->updated(); + } } void @@ -121,12 +126,6 @@ Host::removeHostListener(HostListener* listener) _listeners.erase(listener); } -Processors& -Host::getProcessors() -{ - return _processors; -} - string Host:: getUUID() const { @@ -163,6 +162,24 @@ Host::isBeeping() const return _beeping; } +string +Host::getCPUModel() const +{ + return Platform::instance()->getCPUModel(); +} + +unsigned int +Host::getNumberOfCPUCores() const +{ + return Platform::instance()->getNumberOfCPUCores(); +} + +double +Host::getLoadAverage() const +{ + return Platform::instance()->getLoadAverage(); +} + void Host::identify(const int iterations) { diff --git a/src/host.h b/src/host.h index bcb8c12..f21c86c 100644 --- a/src/host.h +++ b/src/host.h @@ -24,7 +24,6 @@ #include #include "hostlistener.h" -#include "processors.h" #include "networkdevice.h" using namespace std; @@ -42,7 +41,6 @@ class Host unsigned int _memory; bool _beeping; - Processors _processors; vector _networkdevices; set _listeners; @@ -55,14 +53,18 @@ class Host void addHostListener(HostListener*); void removeHostListener(HostListener*); - Processors& getProcessors(); - + // general host properties string getUUID() const; string getHostname() const; string getHypervisor() const; string getArchitecture() const; unsigned int getMemory() const; + // CPU properties + string getCPUModel() const; + unsigned int getNumberOfCPUCores() const; + double getLoadAverage() const; + bool isBeeping() const; void identify(const int iterations); void shutdown(); diff --git a/src/hostlistener.h b/src/hostlistener.h index 298e51d..0d09594 100644 --- a/src/hostlistener.h +++ b/src/hostlistener.h @@ -27,6 +27,7 @@ class HostListener { public: + virtual void updated() = 0; virtual void heartbeat(unsigned long timestamp) = 0; }; diff --git a/src/linux_platform.cpp b/src/linux_platform.cpp index fbcfdb9..b05a327 100644 --- a/src/linux_platform.cpp +++ b/src/linux_platform.cpp @@ -36,7 +36,7 @@ extern "C" { LinuxPlatform::LinuxPlatform() { - int core_count = 0; + int cpu_count = 0; string model = "unknown"; struct udev* udev = udev_new(); @@ -50,9 +50,9 @@ LinuxPlatform::LinuxPlatform() udev_list_entry_foreach(entry, entries) { - core_count++; + cpu_count++; } - set_number_of_cores(core_count); + setNumberOfCPUCores(cpu_count); } udev_enumerate_unref(enumerator); @@ -100,7 +100,7 @@ LinuxPlatform::LinuxPlatform() } else { - if(name == "model name") set_processor_model(value); + if(name == "model name") setCPUModel(value); } } } @@ -109,7 +109,7 @@ LinuxPlatform::LinuxPlatform() } double -LinuxPlatform::get_load_average() const +LinuxPlatform::getLoadAverage() const { double load_average; ifstream input; diff --git a/src/linux_platform.h b/src/linux_platform.h index 095bc08..a66cbe4 100644 --- a/src/linux_platform.h +++ b/src/linux_platform.h @@ -32,7 +32,7 @@ class LinuxPlatform : public Platform LinuxPlatform(); virtual ~LinuxPlatform() {} - virtual double get_load_average() const; + virtual double getLoadAverage() const; virtual vector get_network_devices() const; }; diff --git a/src/main.cpp b/src/main.cpp index f45353a..3ab4147 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,7 +34,6 @@ #include "host.h" #include "qmf/hostagent.h" -#include "qmf/processorsagent.h" #include "qmf/com/redhat/matahari/Package.h" @@ -82,7 +81,6 @@ main(int argc, char **argv) ManagementAgent *agent; Host host; HostAgent hostAgent(host); - ProcessorsAgent processorsAgent(host.getProcessors());; struct option opt[] = { {"help", no_argument, NULL, 'h'}, @@ -185,7 +183,6 @@ main(int argc, char **argv) // Get the info and post it to the broker hostAgent.setup(agent); - processorsAgent.setup(agent, &hostAgent); while(1) { diff --git a/src/platform.h b/src/platform.h index 54fbe37..ba70378 100644 --- a/src/platform.h +++ b/src/platform.h @@ -37,28 +37,24 @@ class Platform private: static Platform* _instance; - string processor_model; - unsigned int number_of_cores; + string _cpu_model; + unsigned int _cpu_cores; protected: Platform() {} virtual~ Platform() {} - void set_processor_model(const string model) { processor_model = model; } - void set_number_of_cores(const int number) { number_of_cores = number; } + void setCPUModel(const string model) { _cpu_model = model; } + void setNumberOfCPUCores(const int cores) { _cpu_cores = cores; } public: // the singleton instance static Platform* instance(); - // returns text describing the processor model. - string get_processor_model() const { return processor_model; } + string getCPUModel() const { return _cpu_model; } + unsigned int getNumberOfCPUCores() const { return _cpu_cores; } - // returns the number of cores in the processor. - int get_number_of_cores() const { return number_of_cores; } - - // returns the load average for the platform - virtual double get_load_average() const = 0; + virtual double getLoadAverage() const = 0; // returns the list of network devices for this platform virtual vector get_network_devices() const = 0; diff --git a/src/processors.cpp b/src/processors.cpp deleted file mode 100644 index 1850aba..0000000 --- a/src/processors.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* processor.cpp - Copyright (C) 2010 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. - */ - -#include "processors.h" -#include "platform.h" - -void -Processors::addProcessorsListener(ProcessorsListener* listener) -{ - _listeners.insert(listener); -} - -void -Processors::removeProcessorsListener(ProcessorsListener* listener) -{ - _listeners.erase(listener); -} - -void -Processors::update() -{ - for(set::iterator iter = _listeners.begin(); - iter != _listeners.end(); - iter++) - { - (*iter)->updated(); - } -} - -string -Processors::getModel() const -{ - return Platform::instance()->get_processor_model(); -} - - -unsigned int -Processors::getNumberOfCores() const -{ - return Platform::instance()->get_number_of_cores(); -} - -float -Processors::getLoadAverage() const -{ - return Platform::instance()->get_load_average(); -} diff --git a/src/processors.h b/src/processors.h deleted file mode 100644 index e69a6ee..0000000 --- a/src/processors.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef __PROCESSORS_H -#define __PROCESSORS_H - -/* processor.h - Copyright (C) 2010 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. - */ - -#include -#include - -#include "processorslistener.h" - -using namespace std; - -class Processors -{ - private: - set _listeners; - - public: - void addProcessorsListener(ProcessorsListener* listener); - void removeProcessorsListener(ProcessorsListener* listener); - - void update(); - - string getModel() const; - unsigned int getNumberOfCores() const; - float getLoadAverage() const; -}; - -#endif diff --git a/src/processorslistener.h b/src/processorslistener.h deleted file mode 100644 index d6818c8..0000000 --- a/src/processorslistener.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __PROCESSORSLISTENER_H -#define __PROCESSORSLISTENER_H - -/* processorslistener.h - Copyright (C) 2009 Red Hat, Inc. - * Written by Darryl 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. - */ - -class ProcessorsListener -{ - public: - virtual void updated() = 0; -}; - -#endif diff --git a/src/qmf/hostagent.cpp b/src/qmf/hostagent.cpp index 9807f65..1baac73 100644 --- a/src/qmf/hostagent.cpp +++ b/src/qmf/hostagent.cpp @@ -44,6 +44,9 @@ HostAgent::setup(ManagementAgent* agent) _management_object->set_arch(_host.getArchitecture()); _management_object->set_memory(_host.getMemory()); _management_object->set_beeping(_host.isBeeping()); + + _management_object->set_cpu_model(_host.getCPUModel()); + _management_object->set_cpu_cores(_host.getNumberOfCPUCores()); } Manageable::status_t @@ -63,6 +66,12 @@ HostAgent::ManagementMethod(uint32_t method, Args& arguments, string& text) } void +HostAgent::updated() +{ + _management_object->set_load_average(_host.getLoadAverage()); +} + +void HostAgent::heartbeat(unsigned long timestamp) { } diff --git a/src/qmf/hostagent.h b/src/qmf/hostagent.h index 6d2f2a0..9d01f2c 100644 --- a/src/qmf/hostagent.h +++ b/src/qmf/hostagent.h @@ -45,6 +45,7 @@ class HostAgent : public Manageable, public HostListener ManagementObject* GetManagementObject() const { return _management_object; } status_t ManagementMethod(uint32_t method, Args& arguments, string& text); + virtual void updated(); virtual void heartbeat(unsigned long timestamp); }; diff --git a/src/qmf/processorsagent.cpp b/src/qmf/processorsagent.cpp deleted file mode 100644 index c1703de..0000000 --- a/src/qmf/processorsagent.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* processorsagent.cpp - Copyright (C) 2009 Red Hat, Inc. - * Written by Arjun Roy - * - * 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. - */ - -#include "processorsagent.h" -#include - -namespace _qmf = qmf::com::redhat::matahari; - -ProcessorsAgent::ProcessorsAgent(Processors& processors) - :_processors(processors) -{ - processors.addProcessorsListener(this); -} - -ProcessorsAgent::~ProcessorsAgent() -{ -} - -void -ProcessorsAgent::setup(ManagementAgent* agent, HostAgent* parent) -{ - _management_object = new _qmf::Processors(agent, this, parent); - agent->addObject(_management_object); - - _management_object->set_model(this->_processors.getModel()); - _management_object->set_cores(this->_processors.getNumberOfCores()); -} - -void -ProcessorsAgent::updated() -{ - _management_object->set_load_average(this->_processors.getLoadAverage()); -} diff --git a/src/qmf/processorsagent.h b/src/qmf/processorsagent.h deleted file mode 100644 index 1d814d4..0000000 --- a/src/qmf/processorsagent.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef __PROCESSORSAGENT_H -#define __PROCESSORSAGENT_H - -/* processoragent.h - Copyright (C) 2010 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. - */ - -#include -#include - -#include "processors.h" -#include "processorslistener.h" -#include "qmf/com/redhat/matahari/Processors.h" -#include "qmf/hostagent.h" - -using namespace qpid::management; - -class ProcessorsAgent : public Manageable, public ProcessorsListener -{ - private: - qmf::com::redhat::matahari::Processors* _management_object; - - Processors& _processors; - - public: - ProcessorsAgent(Processors& processors); - virtual ~ProcessorsAgent(); - - void setup(ManagementAgent* agent, HostAgent* parent); - ManagementObject* GetManagementObject(void) const { return _management_object; } - - virtual void updated(); -}; - -#endif diff --git a/src/schema.xml b/src/schema.xml index 206e39b..fd83ac1 100644 --- a/src/schema.xml +++ b/src/schema.xml @@ -2,6 +2,7 @@ + @@ -9,20 +10,17 @@ + + + + + + - - - - - - - - - -- 1.6.6.1 From dpierce at redhat.com Tue May 25 14:54:52 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Tue, 25 May 2010 10:54:52 -0400 Subject: [Ovirt-devel] [PATCH matahari] QMF-based heartbeats. Message-ID: <1274799292-7807-1-git-send-email-dpierce@redhat.com> This code allows heartbeat events to be raised on the QMF transport. Signed-off-by: Darryl L. Pierce --- src/Makefile.am | 2 ++ src/host.cpp | 23 ++++++++--------------- src/qmf/hostagent.cpp | 5 ++++- src/qmf/hostagent.h | 7 +++++-- src/schema.xml | 6 ++++++ 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 498ee72..d830031 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,6 +5,8 @@ sbin_PROGRAMS = matahari first = qmf/com/redhat/matahari/Host.cpp generated_file_list = \ + qmf/com/redhat/matahari/EventHeartbeat.cpp \ + qmf/com/redhat/matahari/EventHeartbeat.h \ qmf/com/redhat/matahari/Host.h \ qmf/com/redhat/matahari/NetworkDevice.cpp \ qmf/com/redhat/matahari/NetworkDevice.h \ diff --git a/src/host.cpp b/src/host.cpp index 29b84ec..9b2ad29 100644 --- a/src/host.cpp +++ b/src/host.cpp @@ -79,33 +79,26 @@ Host::Host() } } -/* void -Host::setup(ManagementAgent* agent, HostAgent* hostAgent) +Host::update() { - // discover the aspects of the host - _processors.setup(agent, hostAgent); - _networkdevices = Platform::instance()->get_network_devices(); + _processors.update(); for(vector::iterator iter = _networkdevices.begin(); iter != _networkdevices.end(); iter++) { - iter->setup(agent, hostAgent); + iter->update(); } -} -*/ -void -Host::update() -{ - _processors.update(); + time_t __time; + time(&__time); - for(vector::iterator iter = _networkdevices.begin(); - iter != _networkdevices.end(); + for(set::iterator iter = _listeners.begin(); + iter != _listeners.end(); iter++) { - iter->update(); + (*iter)->heartbeat((unsigned long)__time); } } diff --git a/src/qmf/hostagent.cpp b/src/qmf/hostagent.cpp index 9807f65..7376f69 100644 --- a/src/qmf/hostagent.cpp +++ b/src/qmf/hostagent.cpp @@ -20,7 +20,7 @@ #include "hostagent.h" #include -namespace _qmf = qmf::com::redhat::matahari; +#include "qmf/com/redhat/matahari/EventHeartbeat.h" HostAgent::HostAgent(Host& host) :_host(host) @@ -35,6 +35,8 @@ HostAgent::~HostAgent() void HostAgent::setup(ManagementAgent* agent) { + this->_agent = agent; + _management_object = new _qmf::Host(agent, this); agent->addObject(_management_object); @@ -65,4 +67,5 @@ HostAgent::ManagementMethod(uint32_t method, Args& arguments, string& text) void HostAgent::heartbeat(unsigned long timestamp) { + this->_agent->raiseEvent(_qmf::EventHeartbeat(timestamp)); } diff --git a/src/qmf/hostagent.h b/src/qmf/hostagent.h index 6d2f2a0..f9a6f8e 100644 --- a/src/qmf/hostagent.h +++ b/src/qmf/hostagent.h @@ -31,11 +31,14 @@ using namespace qpid::management; using namespace std; +namespace _qmf = qmf::com::redhat::matahari; + class HostAgent : public Manageable, public HostListener { private: - qmf::com::redhat::matahari::Host* _management_object; - Host& _host; + _qmf::Host* _management_object; + Host& _host; + ManagementAgent* _agent; public: HostAgent(Host& host); diff --git a/src/schema.xml b/src/schema.xml index 206e39b..31abb35 100644 --- a/src/schema.xml +++ b/src/schema.xml @@ -14,6 +14,12 @@ + + + + + + -- 1.6.6.1 From dpierce at redhat.com Tue May 25 15:34:03 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Tue, 25 May 2010 11:34:03 -0400 Subject: [Ovirt-devel] Supercedes previous patch... Message-ID: <1274801644-17892-1-git-send-email-dpierce@redhat.com> The previous patch, for whatever reason, fails to apply on top of tip. This patch is reimplemented and, hopefully, fixed. From dpierce at redhat.com Tue May 25 15:34:04 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Tue, 25 May 2010 11:34:04 -0400 Subject: [Ovirt-devel] [PATCH matahari] Introduces explicit heartbeat events to the QMF transport. In-Reply-To: <1274801644-17892-1-git-send-email-dpierce@redhat.com> References: <1274801644-17892-1-git-send-email-dpierce@redhat.com> Message-ID: <1274801644-17892-2-git-send-email-dpierce@redhat.com> Signed-off-by: Darryl L. Pierce --- src/Makefile.am | 2 ++ src/host.cpp | 9 ++++++--- src/qmf/hostagent.cpp | 5 ++++- src/qmf/hostagent.h | 7 +++++-- src/schema.xml | 6 ++++++ 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 498ee72..d830031 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,6 +5,8 @@ sbin_PROGRAMS = matahari first = qmf/com/redhat/matahari/Host.cpp generated_file_list = \ + qmf/com/redhat/matahari/EventHeartbeat.cpp \ + qmf/com/redhat/matahari/EventHeartbeat.h \ qmf/com/redhat/matahari/Host.h \ qmf/com/redhat/matahari/NetworkDevice.cpp \ qmf/com/redhat/matahari/NetworkDevice.h \ diff --git a/src/host.cpp b/src/host.cpp index 29b84ec..d9bd698 100644 --- a/src/host.cpp +++ b/src/host.cpp @@ -101,11 +101,14 @@ Host::update() { _processors.update(); - for(vector::iterator iter = _networkdevices.begin(); - iter != _networkdevices.end(); + time_t __time; + time(&__time); + + for(set::iterator iter = _listeners.begin(); + iter != _listeners.end(); iter++) { - iter->update(); + (*iter)->heartbeat((unsigned long)__time); } } diff --git a/src/qmf/hostagent.cpp b/src/qmf/hostagent.cpp index 9807f65..7376f69 100644 --- a/src/qmf/hostagent.cpp +++ b/src/qmf/hostagent.cpp @@ -20,7 +20,7 @@ #include "hostagent.h" #include -namespace _qmf = qmf::com::redhat::matahari; +#include "qmf/com/redhat/matahari/EventHeartbeat.h" HostAgent::HostAgent(Host& host) :_host(host) @@ -35,6 +35,8 @@ HostAgent::~HostAgent() void HostAgent::setup(ManagementAgent* agent) { + this->_agent = agent; + _management_object = new _qmf::Host(agent, this); agent->addObject(_management_object); @@ -65,4 +67,5 @@ HostAgent::ManagementMethod(uint32_t method, Args& arguments, string& text) void HostAgent::heartbeat(unsigned long timestamp) { + this->_agent->raiseEvent(_qmf::EventHeartbeat(timestamp)); } diff --git a/src/qmf/hostagent.h b/src/qmf/hostagent.h index 6d2f2a0..f9a6f8e 100644 --- a/src/qmf/hostagent.h +++ b/src/qmf/hostagent.h @@ -31,11 +31,14 @@ using namespace qpid::management; using namespace std; +namespace _qmf = qmf::com::redhat::matahari; + class HostAgent : public Manageable, public HostListener { private: - qmf::com::redhat::matahari::Host* _management_object; - Host& _host; + _qmf::Host* _management_object; + Host& _host; + ManagementAgent* _agent; public: HostAgent(Host& host); diff --git a/src/schema.xml b/src/schema.xml index 206e39b..31abb35 100644 --- a/src/schema.xml +++ b/src/schema.xml @@ -14,6 +14,12 @@ + + + + + + -- 1.6.6.1 From matinata at br.ibm.com Tue May 25 23:03:16 2010 From: matinata at br.ibm.com (Ricardo Marin Matinata) Date: Tue, 25 May 2010 20:03:16 -0300 Subject: [Ovirt-devel] RFC: Advanced Storage Configuration In-Reply-To: <4BC8AB7A.8070304@redhat.com> References: <1271078300.3715.31.camel@localhost> <4BC8AB7A.8070304@redhat.com> Message-ID: <1274828596.15541.12.camel@localhost> On Fri, 2010-04-16 at 14:24 -0400, Perry Myers wrote: > On 04/16/2010 01:51 PM, Alan Pevec wrote: > > On Mon, Apr 12, 2010 at 3:18 PM, Ricardo Marin Matinata > > wrote: > >> - Addition of a new top level install menu called "Advanced Storage > >> Configuration" where one can select a storage device to which should the > >> guest's images be stored. > >> - Next to the device selection, creates a new volume group - > >> HostVG-Images - to be mounted at /images > >> - Perform adjustments do /var/lib/libvirt/images "mount binds" > >> against /images > > > > This sound good, I would just like to extend this and allow also > > separation of swap LV into separate VG. > > It also makes sense to organize all of these option as a sub-menu > > under storage configuration. > > One more aspect is to extend the syntax of "storage_vol" boot > > parameter to support autoinstalls with advanced storage > > configurations: > > > > storage_vol=,,,:... > > Just for clarification, are we talking here about: #1 Potentially deprecating ovirt_init param in favor of storage_vol fancier syntax #2 Going from solely having ROOTDRIVE and HOSTVGDRIVE, to any number of devices, since for each LV you'd be allowed to specify a different one #3 Going from solely having HostVG VG, to any number of VGs, since for each LV you'd be allowed to specify a different one. > > instead of current format: > > storage_vol=BOOT_MB:SWAP_MB:ROOT_MB:CONFIG_MB:LOGGING_MB:DATA_MB > > > > Any other ideas what else should we have in the storage configuration sub-menu? > > This all sounds good. Only thing we also discussed was swap encryption > > Perry -- Ricardo Marin Matinata Linux Technology Center IBM Brazil | Hortolandia | SP matinata br ibm com From apevec at gmail.com Wed May 26 10:22:14 2010 From: apevec at gmail.com (Alan Pevec) Date: Wed, 26 May 2010 12:22:14 +0200 Subject: [Ovirt-devel] RFC: Advanced Storage Configuration In-Reply-To: <1274828596.15541.12.camel@localhost> References: <1271078300.3715.31.camel@localhost> <4BC8AB7A.8070304@redhat.com> <1274828596.15541.12.camel@localhost> Message-ID: On Wed, May 26, 2010 at 1:03 AM, Ricardo Marin Matinata wrote: >> > ?storage_vol=,,,:... > > Just for clarification, are we talking here about: > > #1 Potentially deprecating ovirt_init param in favor of storage_vol > fancier syntax > #2 Going from solely having ROOTDRIVE and HOSTVGDRIVE, to any number of > devices, since for each LV you'd be allowed to specify a different one > #3 Going from solely having HostVG VG, to any number of VGs, since for > each LV you'd be allowed to specify a different one. Yes, that's a good summary, now we just need a patch :) Alan From dpierce at redhat.com Wed May 26 13:43:03 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 26 May 2010 09:43:03 -0400 Subject: [Ovirt-devel] [Matahari] [PATCH matahari] Introduces explicit heartbeat events to the QMF transport. In-Reply-To: References: <1274801644-17892-1-git-send-email-dpierce@redhat.com> <1274801644-17892-2-git-send-email-dpierce@redhat.com> Message-ID: <20100526134303.GC7330@mcpierce-desktop.usersys.redhat.com> On Wed, May 26, 2010 at 09:23:44AM +0200, Andrew Beekhof wrote: > Some quick questions... > > Is the interval not being used yet? I don't see any timers or such. Not implemented yet. This patch just introduces the actual heartbeat event over QMF. > Wouldn't you still need to update the network devices in Host::update()? Those are going to get refactored. As it stands they weren't being updated. > Does the heartbeat event need a counter (like ICMP packets do) to > detect backward jumps and/or lost heartbeats? Right now the heartbeat sends out the timestamp. But if the clock gets changed, it could seem to be a backwards jump. Changing it to be a counter instead would be a simple change to this patch for pushing. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/ From dpierce at redhat.com Wed May 26 15:24:06 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 26 May 2010 11:24:06 -0400 Subject: [Ovirt-devel] [PATCH matahari] Adds a check for the qmf-gen executable to the autoconf setup. Message-ID: <1274887446-15997-1-git-send-email-dpierce@redhat.com> Signed-off-by: Darryl L. Pierce --- configure.ac | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/configure.ac b/configure.ac index 6666c95..42d319b 100644 --- a/configure.ac +++ b/configure.ac @@ -7,6 +7,13 @@ AM_INIT_AUTOMAKE AC_PROG_CXX AC_PROG_CC AC_PROG_CPP + +AC_CHECK_PROG(HASQMFGEN, qmf-gen, "yes") + +if test x"$HASQMFGEN" = "x"; then + AC_MSG_ERROR([Missing QMF schema processor.]) +fi + AC_CHECK_HEADERS([arpa/inet.h netinet/in.h sys/ioctl.h sys/socket.h unistd.h libudev.h]) # Checks for typedefs, structures, and compiler characteristics. -- 1.7.0.1 From dpierce at redhat.com Thu May 27 17:55:33 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 27 May 2010 13:55:33 -0400 Subject: [Ovirt-devel] [Matahari] [PATCH matahari] Introduces explicit heartbeat events to the QMF transport. In-Reply-To: <4F401212-F403-4D8E-A02D-24A8563C1BAD@beekhof.net> References: <1274801644-17892-1-git-send-email-dpierce@redhat.com> <1274801644-17892-2-git-send-email-dpierce@redhat.com> <20100526134303.GC7330@mcpierce-desktop.usersys.redhat.com> <4F401212-F403-4D8E-A02D-24A8563C1BAD@beekhof.net> Message-ID: <20100527175532.GF3619@mcpierce-desktop.usersys.redhat.com> On Thu, May 27, 2010 at 08:43:30AM +0200, Andrew Beekhof wrote: > >> Does the heartbeat event need a counter (like ICMP packets do) to > >> detect backward jumps and/or lost heartbeats? > > > > Right now the heartbeat sends out the timestamp. But if the clock gets changed, it > > could seem to be a backwards jump. Changing it to be a counter instead would > > be a simple change to this patch for pushing. > > I think you'd probably want both. The timestamp and a sequence number. That's cool. Okay, so if this is an ACK with that change (I'll wait for a response) I'll go ahead and push it. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From dpierce at redhat.com Thu May 27 18:19:16 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 27 May 2010 14:19:16 -0400 Subject: [Ovirt-devel] Updated with heartbeat sequence... Message-ID: <1274984357-13415-1-git-send-email-dpierce@redhat.com> This patch supercedes the previous one, introducing a heartbeat sequence in the API. It also includes a change to the linking to accomodate changes to qpid. From dpierce at redhat.com Thu May 27 18:19:17 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 27 May 2010 14:19:17 -0400 Subject: [Ovirt-devel] [PATCH matahari] Introduces explicit heartbeat events to the QMF transport. In-Reply-To: <1274984357-13415-1-git-send-email-dpierce@redhat.com> References: <1274984357-13415-1-git-send-email-dpierce@redhat.com> Message-ID: <1274984357-13415-2-git-send-email-dpierce@redhat.com> Also changes the linking to include the two newer qpid libraries. Signed-off-by: Darryl L. Pierce --- src/Makefile.am | 4 +++- src/host.cpp | 28 ++++++++++++++++++---------- src/host.h | 1 + src/hostlistener.h | 2 +- src/qmf/hostagent.cpp | 7 +++++-- src/qmf/hostagent.h | 9 ++++++--- src/schema.xml | 7 +++++++ 7 files changed, 41 insertions(+), 17 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 498ee72..eaad138 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,6 +5,8 @@ sbin_PROGRAMS = matahari first = qmf/com/redhat/matahari/Host.cpp generated_file_list = \ + qmf/com/redhat/matahari/EventHeartbeat.cpp \ + qmf/com/redhat/matahari/EventHeartbeat.h \ qmf/com/redhat/matahari/Host.h \ qmf/com/redhat/matahari/NetworkDevice.cpp \ qmf/com/redhat/matahari/NetworkDevice.h \ @@ -44,6 +46,6 @@ CLEANFILES = $(generated_file_list) $(first) matahari_CPPFLAGS = -fno-strict-aliasing matahari_LDFLAGS = -L/usr/local/lib -matahari_LDADD = -lqmf $(LIBVIRT_LIBS) $(PCRE_LIBS) $(UDEV_LIBS) +matahari_LDADD = -lqmf -lqpidclient -lqpidcommon $(LIBVIRT_LIBS) $(PCRE_LIBS) $(UDEV_LIBS) dist_pkgdata_DATA = schema.xml diff --git a/src/host.cpp b/src/host.cpp index 29b84ec..63dbceb 100644 --- a/src/host.cpp +++ b/src/host.cpp @@ -29,16 +29,18 @@ using namespace std; +const string UNKNOWN("Unknow"); + Host::Host() + :_uuid(UNKNOWN) + ,_hostname(UNKNOWN) + ,_hypervisor(UNKNOWN) + ,_architecture(UNKNOWN) + ,_memory(0) + ,_beeping(false) + ,_heartbeat_sequence(0) { struct utsname details; - this->_uuid = string("Unknown"); - this->_hostname = string("Unknown"); - this->_hypervisor = string("Unknown"); - this->_architecture = string("None"); - this->_memory = 0; - this->_beeping = false; - std::ifstream input("/var/lib/dbus/machine-id"); if(input.is_open()) @@ -99,13 +101,19 @@ Host::setup(ManagementAgent* agent, HostAgent* hostAgent) void Host::update() { + this->_heartbeat_sequence++; + _processors.update(); - for(vector::iterator iter = _networkdevices.begin(); - iter != _networkdevices.end(); + time_t __time; + time(&__time); + + for(set::iterator iter = _listeners.begin(); + iter != _listeners.end(); iter++) { - iter->update(); + (*iter)->heartbeat((unsigned long)__time, + this->_heartbeat_sequence); } } diff --git a/src/host.h b/src/host.h index bcb8c12..b6885e8 100644 --- a/src/host.h +++ b/src/host.h @@ -41,6 +41,7 @@ class Host string _architecture; unsigned int _memory; bool _beeping; + unsigned int _heartbeat_sequence; Processors _processors; vector _networkdevices; diff --git a/src/hostlistener.h b/src/hostlistener.h index 298e51d..de7352a 100644 --- a/src/hostlistener.h +++ b/src/hostlistener.h @@ -27,7 +27,7 @@ class HostListener { public: - virtual void heartbeat(unsigned long timestamp) = 0; + virtual void heartbeat(unsigned long timestamp, unsigned int sequence) = 0; }; #endif diff --git a/src/qmf/hostagent.cpp b/src/qmf/hostagent.cpp index 9807f65..21e377b 100644 --- a/src/qmf/hostagent.cpp +++ b/src/qmf/hostagent.cpp @@ -20,7 +20,7 @@ #include "hostagent.h" #include -namespace _qmf = qmf::com::redhat::matahari; +#include "qmf/com/redhat/matahari/EventHeartbeat.h" HostAgent::HostAgent(Host& host) :_host(host) @@ -35,6 +35,8 @@ HostAgent::~HostAgent() void HostAgent::setup(ManagementAgent* agent) { + this->_agent = agent; + _management_object = new _qmf::Host(agent, this); agent->addObject(_management_object); @@ -63,6 +65,7 @@ HostAgent::ManagementMethod(uint32_t method, Args& arguments, string& text) } void -HostAgent::heartbeat(unsigned long timestamp) +HostAgent::heartbeat(unsigned long timestamp, unsigned int sequence) { + this->_agent->raiseEvent(_qmf::EventHeartbeat(timestamp, sequence)); } diff --git a/src/qmf/hostagent.h b/src/qmf/hostagent.h index 6d2f2a0..a31f844 100644 --- a/src/qmf/hostagent.h +++ b/src/qmf/hostagent.h @@ -31,11 +31,14 @@ using namespace qpid::management; using namespace std; +namespace _qmf = qmf::com::redhat::matahari; + class HostAgent : public Manageable, public HostListener { private: - qmf::com::redhat::matahari::Host* _management_object; - Host& _host; + _qmf::Host* _management_object; + Host& _host; + ManagementAgent* _agent; public: HostAgent(Host& host); @@ -45,7 +48,7 @@ class HostAgent : public Manageable, public HostListener ManagementObject* GetManagementObject() const { return _management_object; } status_t ManagementMethod(uint32_t method, Args& arguments, string& text); - virtual void heartbeat(unsigned long timestamp); + virtual void heartbeat(unsigned long timestamp, unsigned int sequence); }; #endif diff --git a/src/schema.xml b/src/schema.xml index 206e39b..aac5425 100644 --- a/src/schema.xml +++ b/src/schema.xml @@ -14,6 +14,13 @@ + + + + + + + -- 1.7.0.1 From dpierce at redhat.com Thu May 27 20:36:11 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 27 May 2010 16:36:11 -0400 Subject: [Ovirt-devel] [PATCH matahari] Introduces a multiplexer for taking requests and mapping them to APIs. Message-ID: <1274992571-27616-1-git-send-email-dpierce@redhat.com> The Multiplexer lets Matahari register APIs and then call them by that registered name. APIs are function pointers in the form of: const char* function(const char *); where the API takes as input a descriptor containing any arguments, and returns an array containing the response or result. Also adds a testing directory and unit tests to validate the Multiplexer. The new directory, src/tests, has its own standalone makefile that builds the tests. Signed-off-by: Darryl L. Pierce --- configure.ac | 3 +- src/Makefile.am | 6 ++- src/tests/.gitignore | 1 + src/tests/Makefile.am | 13 +++++ src/tests/testmultiplexer.cpp | 109 +++++++++++++++++++++++++++++++++++++++++ src/tests/testmultiplexer.h | 46 +++++++++++++++++ src/virtio/multiplexer.cpp | 62 +++++++++++++++++++++++ src/virtio/multiplexer.h | 48 ++++++++++++++++++ 8 files changed, 285 insertions(+), 3 deletions(-) create mode 100644 src/tests/.gitignore create mode 100644 src/tests/Makefile.am create mode 100644 src/tests/testmultiplexer.cpp create mode 100644 src/tests/testmultiplexer.h create mode 100644 src/virtio/multiplexer.cpp create mode 100644 src/virtio/multiplexer.h diff --git a/configure.ac b/configure.ac index 42d319b..3481c09 100644 --- a/configure.ac +++ b/configure.ac @@ -21,6 +21,7 @@ AC_HEADER_STDBOOL AC_TYPE_UINT32_T # Checks for libraries. +PKG_CHECK_MODULES(CPPUNIT, cppunit >= 1.12.1) PKG_CHECK_MODULES(LIBVIRT, libvirt >= 0.6.2) PKG_CHECK_MODULES(PCRE, libpcre >= 7.8) PKG_CHECK_MODULES(UDEV, libudev >= 145) @@ -28,4 +29,4 @@ PKG_CHECK_MODULES(UDEV, libudev >= 145) # Checks for library functions. AC_CHECK_FUNCS([gethostname inet_ntoa socket]) -AC_OUTPUT(Makefile src/Makefile) +AC_OUTPUT(Makefile src/Makefile src/tests/Makefile) diff --git a/src/Makefile.am b/src/Makefile.am index 498ee72..7b5245a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,7 +32,9 @@ matahari_SOURCES = \ qmf/hostagent.cpp \ qmf/hostagent.h \ qmf/processorsagent.cpp \ - qmf/processorsagent.h + qmf/processorsagent.h \ + virtio/multiplexer.cpp \ + virtio/multiplexer.h $(generated_file_list): $(generated_file_list) @@ -44,6 +46,6 @@ CLEANFILES = $(generated_file_list) $(first) matahari_CPPFLAGS = -fno-strict-aliasing matahari_LDFLAGS = -L/usr/local/lib -matahari_LDADD = -lqmf $(LIBVIRT_LIBS) $(PCRE_LIBS) $(UDEV_LIBS) +matahari_LDADD = -lqmf -lqpidclient -lqpidcommon $(LIBVIRT_LIBS) $(PCRE_LIBS) $(UDEV_LIBS) dist_pkgdata_DATA = schema.xml diff --git a/src/tests/.gitignore b/src/tests/.gitignore new file mode 100644 index 0000000..06042ff --- /dev/null +++ b/src/tests/.gitignore @@ -0,0 +1 @@ +testmultiplexer diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am new file mode 100644 index 0000000..8573ac3 --- /dev/null +++ b/src/tests/Makefile.am @@ -0,0 +1,13 @@ + +bin_PROGRAMS = testmultiplexer + +INCLUDES = \ + -I$(top_srcdir)/src + +testmultiplexer_SOURCES = \ + $(top_srcdir)/src/virtio/multiplexer.cpp \ + $(top_srcdir)/src/virtio/multiplexer.h \ + testmultiplexer.cpp \ + testmultiplexer.h + +testmultiplexer_LDADD = -lcppunit \ No newline at end of file diff --git a/src/tests/testmultiplexer.cpp b/src/tests/testmultiplexer.cpp new file mode 100644 index 0000000..8ed77fd --- /dev/null +++ b/src/tests/testmultiplexer.cpp @@ -0,0 +1,109 @@ +/* testmultiplexer.cpp - Copyright (C) 2010 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. + */ + +#include "testmultiplexer.h" + +#include "virtio/multiplexer.h" + +#include +#include +#include +#include +#include + +const string APINAME("testapifunction"); + +const char* +test_callback_function(const char* input) +{ + return input; +} + +TestMultiplexer::TestMultiplexer() + :TestCase("TestMultiplexer") +{} + +TestSuite* +TestMultiplexer::suite() +{ + CppUnit::TestSuite *result = new CppUnit::TestSuite("TestMultiplexer"); + + result->addTest(new CppUnit::TestCaller + ("testBadAPINameGetsNull", + &TestMultiplexer::testUnregisteredAPIIsNull)); + result->addTest(new CppUnit::TestCaller + ("testRegisterAPIMethod", + &TestMultiplexer::testRegisterAPIMethod)); + result->addTest(new CppUnit::TestCaller + ("testEnsureCallingAnUnregisteredAPIFails", + &TestMultiplexer::testEnsureCallingAnUnregisteredAPIFails)); + result->addTest(new CppUnit::TestCaller + ("testEnsureAPIIsCalled", + &TestMultiplexer::testEnsureAPIIsCalled)); + + return result; +} + +void +TestMultiplexer::setUp() +{ + Multiplexer::instance()->registerAPI(APINAME, test_callback_function); +} + +void +TestMultiplexer::testUnregisteredAPIIsNull() +{ + CPPUNIT_ASSERT(NULL == Multiplexer::instance()->getAPI(APINAME + "!")); +} + +void +TestMultiplexer::testRegisterAPIMethod() +{ + t_apifunction apifunction = test_callback_function; + + CPPUNIT_ASSERT(apifunction == Multiplexer::instance()->getAPI(APINAME)); +} + +void +TestMultiplexer::testEnsureCallingAnUnregisteredAPIFails() +{ + string input = string("This is some input"); + string result = Multiplexer::instance()->invokeAPI(APINAME + "!", input); + + CPPUNIT_ASSERT(string("") == result); +} + +void TestMultiplexer::testEnsureAPIIsCalled() +{ + string expected = "This is what I expected"; + string result = Multiplexer::instance()->invokeAPI(APINAME, expected); + + CPPUNIT_ASSERT(expected == result); +} + +int +main(int argc, char** argv) +{ + CppUnit::TextUi::TestRunner runner; + + runner.addTest(TestMultiplexer::suite()); + runner.run(); + + return 0; +} diff --git a/src/tests/testmultiplexer.h b/src/tests/testmultiplexer.h new file mode 100644 index 0000000..04cb9e5 --- /dev/null +++ b/src/tests/testmultiplexer.h @@ -0,0 +1,46 @@ +#ifndef __TESTMULTIPLEXER_H +#define __TESTMULTIPLEXER_H + +/* testmultiplexer.h - Copyright (C) 2010 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. + */ + +#include "virtio/multiplexer.h" + +#include +#include + +using namespace CppUnit; +using namespace std; + +class TestMultiplexer : public CppUnit::TestCase +{ + public: + TestMultiplexer(); + + static TestSuite* suite(); + + void setUp(); + + void testUnregisteredAPIIsNull(); + void testRegisterAPIMethod(); + void testEnsureCallingAnUnregisteredAPIFails(); + void testEnsureAPIIsCalled(); +}; + +#endif diff --git a/src/virtio/multiplexer.cpp b/src/virtio/multiplexer.cpp new file mode 100644 index 0000000..79f8b35 --- /dev/null +++ b/src/virtio/multiplexer.cpp @@ -0,0 +1,62 @@ +#include "multiplexer.h" + +/* multiplexer.cpp - Copyright (C) 2010 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. + */ + +#include "multiplexer.h" + +// the singleton +Multiplexer* Multiplexer::_instance = new Multiplexer(); + +typedef map APIMAP; + +Multiplexer::Multiplexer() +{} + +Multiplexer* +Multiplexer::instance() +{ + return _instance; +} + +void +Multiplexer::registerAPI(string name, t_apifunction apifunction) +{ + _apis.insert(APIMAP::value_type(string(name), apifunction)); +} + +t_apifunction +Multiplexer::getAPI(string name) +{ + return (*_apis.find(name)).second; +} + +string +Multiplexer::invokeAPI(string name, string input) +{ + string result = string(""); + t_apifunction funcptr = (*_apis.find(name)).second; + + if(funcptr) + { + result = funcptr(input.c_str()); + } + + return result; +} diff --git a/src/virtio/multiplexer.h b/src/virtio/multiplexer.h new file mode 100644 index 0000000..26a288c --- /dev/null +++ b/src/virtio/multiplexer.h @@ -0,0 +1,48 @@ +#ifndef __MULTIPLEXER_H +#define __MULTIPLEXER_H + +/* multiplexer.h - Copyright (C) 2010 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. + */ + +#include +#include + +using namespace std; + +typedef const char*(*t_apifunction)(const char*); + +// Multiplexer processes the content received from a remote system. +class Multiplexer +{ + private: + Multiplexer(); + + static Multiplexer* _instance; + + map _apis; + + public: + static Multiplexer* instance(); + + void registerAPI(string apiname, t_apifunction apifunction); + t_apifunction getAPI(string apiname); + string invokeAPI(string apiname, string input); +}; + +#endif -- 1.7.0.1 From abeekhof at redhat.com Fri May 28 09:31:19 2010 From: abeekhof at redhat.com (Andrew Beekhof) Date: Fri, 28 May 2010 11:31:19 +0200 Subject: [Ovirt-devel] [Matahari] [PATCH matahari] Introduces explicit heartbeat events to the QMF transport. In-Reply-To: <1274984357-13415-2-git-send-email-dpierce@redhat.com> References: <1274984357-13415-1-git-send-email-dpierce@redhat.com> <1274984357-13415-2-git-send-email-dpierce@redhat.com> Message-ID: ack On May 27, 2010, at 8:19 PM, Darryl L. Pierce wrote: > Also changes the linking to include the two newer qpid libraries. > > Signed-off-by: Darryl L. Pierce > --- > src/Makefile.am | 4 +++- > src/host.cpp | 28 ++++++++++++++++++---------- > src/host.h | 1 + > src/hostlistener.h | 2 +- > src/qmf/hostagent.cpp | 7 +++++-- > src/qmf/hostagent.h | 9 ++++++--- > src/schema.xml | 7 +++++++ > 7 files changed, 41 insertions(+), 17 deletions(-) > > diff --git a/src/Makefile.am b/src/Makefile.am > index 498ee72..eaad138 100644 > --- a/src/Makefile.am > +++ b/src/Makefile.am > @@ -5,6 +5,8 @@ sbin_PROGRAMS = matahari > first = qmf/com/redhat/matahari/Host.cpp > > generated_file_list = \ > + qmf/com/redhat/matahari/EventHeartbeat.cpp \ > + qmf/com/redhat/matahari/EventHeartbeat.h \ > qmf/com/redhat/matahari/Host.h \ > qmf/com/redhat/matahari/NetworkDevice.cpp \ > qmf/com/redhat/matahari/NetworkDevice.h \ > @@ -44,6 +46,6 @@ CLEANFILES = $(generated_file_list) $(first) > > matahari_CPPFLAGS = -fno-strict-aliasing > matahari_LDFLAGS = -L/usr/local/lib > -matahari_LDADD = -lqmf $(LIBVIRT_LIBS) $(PCRE_LIBS) $(UDEV_LIBS) > +matahari_LDADD = -lqmf -lqpidclient -lqpidcommon $(LIBVIRT_LIBS) $(PCRE_LIBS) $(UDEV_LIBS) > > dist_pkgdata_DATA = schema.xml > diff --git a/src/host.cpp b/src/host.cpp > index 29b84ec..63dbceb 100644 > --- a/src/host.cpp > +++ b/src/host.cpp > @@ -29,16 +29,18 @@ > > using namespace std; > > +const string UNKNOWN("Unknow"); > + > Host::Host() > + :_uuid(UNKNOWN) > + ,_hostname(UNKNOWN) > + ,_hypervisor(UNKNOWN) > + ,_architecture(UNKNOWN) > + ,_memory(0) > + ,_beeping(false) > + ,_heartbeat_sequence(0) > { > struct utsname details; > - this->_uuid = string("Unknown"); > - this->_hostname = string("Unknown"); > - this->_hypervisor = string("Unknown"); > - this->_architecture = string("None"); > - this->_memory = 0; > - this->_beeping = false; > - > std::ifstream input("/var/lib/dbus/machine-id"); > > if(input.is_open()) > @@ -99,13 +101,19 @@ Host::setup(ManagementAgent* agent, HostAgent* hostAgent) > void > Host::update() > { > + this->_heartbeat_sequence++; > + > _processors.update(); > > - for(vector::iterator iter = _networkdevices.begin(); > - iter != _networkdevices.end(); > + time_t __time; > + time(&__time); > + > + for(set::iterator iter = _listeners.begin(); > + iter != _listeners.end(); > iter++) > { > - iter->update(); > + (*iter)->heartbeat((unsigned long)__time, > + this->_heartbeat_sequence); > } > } > > diff --git a/src/host.h b/src/host.h > index bcb8c12..b6885e8 100644 > --- a/src/host.h > +++ b/src/host.h > @@ -41,6 +41,7 @@ class Host > string _architecture; > unsigned int _memory; > bool _beeping; > + unsigned int _heartbeat_sequence; > > Processors _processors; > vector _networkdevices; > diff --git a/src/hostlistener.h b/src/hostlistener.h > index 298e51d..de7352a 100644 > --- a/src/hostlistener.h > +++ b/src/hostlistener.h > @@ -27,7 +27,7 @@ > class HostListener > { > public: > - virtual void heartbeat(unsigned long timestamp) = 0; > + virtual void heartbeat(unsigned long timestamp, unsigned int sequence) = 0; > }; > > #endif > diff --git a/src/qmf/hostagent.cpp b/src/qmf/hostagent.cpp > index 9807f65..21e377b 100644 > --- a/src/qmf/hostagent.cpp > +++ b/src/qmf/hostagent.cpp > @@ -20,7 +20,7 @@ > #include "hostagent.h" > #include > > -namespace _qmf = qmf::com::redhat::matahari; > +#include "qmf/com/redhat/matahari/EventHeartbeat.h" > > HostAgent::HostAgent(Host& host) > :_host(host) > @@ -35,6 +35,8 @@ HostAgent::~HostAgent() > void > HostAgent::setup(ManagementAgent* agent) > { > + this->_agent = agent; > + > _management_object = new _qmf::Host(agent, this); > agent->addObject(_management_object); > > @@ -63,6 +65,7 @@ HostAgent::ManagementMethod(uint32_t method, Args& arguments, string& text) > } > > void > -HostAgent::heartbeat(unsigned long timestamp) > +HostAgent::heartbeat(unsigned long timestamp, unsigned int sequence) > { > + this->_agent->raiseEvent(_qmf::EventHeartbeat(timestamp, sequence)); > } > diff --git a/src/qmf/hostagent.h b/src/qmf/hostagent.h > index 6d2f2a0..a31f844 100644 > --- a/src/qmf/hostagent.h > +++ b/src/qmf/hostagent.h > @@ -31,11 +31,14 @@ > using namespace qpid::management; > using namespace std; > > +namespace _qmf = qmf::com::redhat::matahari; > + > class HostAgent : public Manageable, public HostListener > { > private: > - qmf::com::redhat::matahari::Host* _management_object; > - Host& _host; > + _qmf::Host* _management_object; > + Host& _host; > + ManagementAgent* _agent; > > public: > HostAgent(Host& host); > @@ -45,7 +48,7 @@ class HostAgent : public Manageable, public HostListener > ManagementObject* GetManagementObject() const { return _management_object; } > status_t ManagementMethod(uint32_t method, Args& arguments, string& text); > > - virtual void heartbeat(unsigned long timestamp); > + virtual void heartbeat(unsigned long timestamp, unsigned int sequence); > }; > > #endif > diff --git a/src/schema.xml b/src/schema.xml > index 206e39b..aac5425 100644 > --- a/src/schema.xml > +++ b/src/schema.xml > @@ -14,6 +14,13 @@ > > > > + > + > + > + > + > + > + > > > > -- > 1.7.0.1 > > _______________________________________________ > Matahari mailing list > Matahari at lists.fedorahosted.org > https://fedorahosted.org/mailman/listinfo/matahari From dpierce at redhat.com Fri May 28 15:27:53 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 28 May 2010 11:27:53 -0400 Subject: [Ovirt-devel] [Matahari] [PATCH matahari] Introduces explicit heartbeat events to the QMF transport. In-Reply-To: References: <1274984357-13415-1-git-send-email-dpierce@redhat.com> <1274984357-13415-2-git-send-email-dpierce@redhat.com> Message-ID: <20100528152752.GC24928@mcpierce-desktop.usersys.redhat.com> On Fri, May 28, 2010 at 11:31:19AM +0200, Andrew Beekhof wrote: > ack I refactored the patch to include the heartbeat sequence, per your feedback. This is now pushed upstream. Thank you. :) -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From dpierce at redhat.com Fri May 28 15:41:14 2010 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 28 May 2010 11:41:14 -0400 Subject: [Ovirt-devel] [Matahari] [PATCH matahari] Introduces a multiplexer for taking requests and mapping them to APIs. In-Reply-To: References: <1274992571-27616-1-git-send-email-dpierce@redhat.com> Message-ID: <20100528154114.GD24928@mcpierce-desktop.usersys.redhat.com> On Fri, May 28, 2010 at 11:24:46AM +0200, Andrew Beekhof wrote: > > const char* function(const char *); > > Not sure about this method signature. > It would mean each function has to do its own packing and unpacking which might lead to excessive duplication. > It would also cause problems for API calls like "get the paste buffer" which could easily contain images (and thus zero'd bytes which would confuse strlen()). Yeah, I was trying to keep things simple. Perhaps better would be to pass around just a void * and let each API know for itself what to extract. My main goal there was just to avoid having the Multiplexer dig into the XML and try to map values and types to specific method arguments. > Since the input is xml, perhaps xmlNodePtr is a better I/O vector. > > Other than that, the patch is fine. > I'd go ahead and commit it and we can continue discussing the method signature. Agreed. This is pushed now. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From abeekhof at redhat.com Mon May 31 08:58:51 2010 From: abeekhof at redhat.com (Andrew Beekhof) Date: Mon, 31 May 2010 10:58:51 +0200 Subject: [Ovirt-devel] [Matahari] [PATCH matahari] Introduces a multiplexer for taking requests and mapping them to APIs. In-Reply-To: <20100528154114.GD24928@mcpierce-desktop.usersys.redhat.com> References: <1274992571-27616-1-git-send-email-dpierce@redhat.com> <20100528154114.GD24928@mcpierce-desktop.usersys.redhat.com> Message-ID: <1684AC61-F890-4037-89EA-ABD5F7F708E1@redhat.com> On May 28, 2010, at 5:41 PM, Darryl L. Pierce wrote: > On Fri, May 28, 2010 at 11:24:46AM +0200, Andrew Beekhof wrote: >>> const char* function(const char *); >> >> Not sure about this method signature. >> It would mean each function has to do its own packing and unpacking which might lead to excessive duplication. >> It would also cause problems for API calls like "get the paste buffer" which could easily contain images (and thus zero'd bytes which would confuse strlen()). > > Yeah, I was trying to keep things simple. Perhaps better would be to > pass around just a void * and let each API know for itself what to > extract. My main goal there was just to avoid having the Multiplexer dig > into the XML and try to map values and types to specific method > arguments. It should at least parse the string into an xmlNode/xmlDoc for the API call to work with it easily. So I'd not be passing around void*. > >> Since the input is xml, perhaps xmlNodePtr is a better I/O vector. >> >> Other than that, the patch is fine. >> I'd go ahead and commit it and we can continue discussing the method signature. > > Agreed. > > This is pushed now. > > -- > Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. > Delivering value year after year. > Red Hat ranks #1 in value among software vendors. > http://www.redhat.com/promo/vendor/ >