From sseago at redhat.com Sat Nov 1 03:13:38 2008 From: sseago at redhat.com (Scott Seago) Date: Fri, 31 Oct 2008 23:13:38 -0400 Subject: [Ovirt-devel] Re: [PATCH server] network integration into ovirt server db and wui In-Reply-To: <490B9B71.2040409@redhat.com> References: <1225416455-7607-1-git-send-email-mmorsi@redhat.com> <490B25C8.1020509@redhat.com> <20081031160305.GH30553@redhat.com> <490B30A6.70406@redhat.com> <490B7CEB.2080302@redhat.com> <490B9B71.2040409@redhat.com> Message-ID: <490BC962.8080507@redhat.com> Mohammed Morsi wrote: > [snip] > >> so not yet ACK -- we need to fix: >> >> 1) ManagedNodeConfiguration bit -- I'm not sure about this one -- but >> my concern is without this fix networking will be completely broken on >> the nodes/VMs >> 2) static IP VLAN for bondings >> 3) host details pane needs to show the bonding name in the 'bonding' >> section. >> >> Scott >> >> > I just sent out an updated patch containing fixes for #2 and #3. I'm not > sure about #1. If it isn't an issue then I believe this patch is > committable. > > -Mo > I just tested 2 and 3 -- they work now. So 1) is the big question -- if this isn't required for release, then ACK. I suspect, though, that it will break things. Scott From apevec at redhat.com Sat Nov 1 13:16:21 2008 From: apevec at redhat.com (Alan Pevec) Date: Sat, 01 Nov 2008 14:16:21 +0100 Subject: [Ovirt-devel] [PATCH recipe] Add new rubygem-qpid package to the wui. In-Reply-To: <1225494089.10508.21.camel@localhost.localdomain> References: <1225477828-3304-1-git-send-email-imain@redhat.com> <490B8845.5060405@redhat.com> <1225494089.10508.21.camel@localhost.localdomain> Message-ID: <490C56A5.2030307@redhat.com> David Lutterkort wrote: > On Fri, 2008-10-31 at 23:35 +0100, Alan Pevec wrote: >>> +Requires: rubygem-qpid >> Fedora Review BZ for this package please :) > > A catch-22: we haven't handed the ruby/qpid code over to the Qpid team > yet, since we first wanted to make sure it works well for ovirt's need > (right now, a bugfix is a commit to our internal git repo, after the > handoff we'll have to send in patches and wait for them to show up in > Qpid's svn, and for them to make a release) > > OTOH, we don't want to own that package, i.e. the review request should > come from the Qpid folks. > > Can we live with this situation for a few days until Ian has used it > enough to make sure we don't have terribly obvious bugs in the client ? Yep, I just wanted to make it clear that all packages used by oVirt are to be properly up-streamed and in Fedora. Something along the lines of http://fedoraproject.org/wiki/Packaging/Guidelines#All_patches_should_have_an_upstream_bug_link_or_comment When package is not in Fedora, please add a comment stating the reason and status e.g. +# qpid team will send this to Fedora, current development SCM is http://.... ++Requires: rubygem-qpid From apevec at redhat.com Sat Nov 1 21:38:58 2008 From: apevec at redhat.com (Alan Pevec) Date: Sat, 01 Nov 2008 22:38:58 +0100 Subject: [Ovirt-devel] Re: [PATCH server] network integration into ovirt server db and wui In-Reply-To: <490BC962.8080507@redhat.com> References: <1225416455-7607-1-git-send-email-mmorsi@redhat.com> <490B25C8.1020509@redhat.com> <20081031160305.GH30553@redhat.com> <490B30A6.70406@redhat.com> <490B7CEB.2080302@redhat.com> <490B9B71.2040409@redhat.com> <490BC962.8080507@redhat.com> Message-ID: <490CCC72.4070804@redhat.com> Scott Seago wrote: > Mohammed Morsi wrote: >>> 1) ManagedNodeConfiguration bit -- I'm not sure about this one -- but >>> my concern is without this fix networking will be completely broken on the nodes/VMs > So 1) is the big question -- if this isn't required for release, then > ACK. I suspect, though, that it will break things. Yeah, Darryl's NAK was about 1) Here's my naive fix (just takes first ip_address and assumes IPv4), please review it: diff --git a/src/lib/managed_node_configuration.rb b/src/lib/managed_node_configuration.rb index 101be9f..d0642d1 100644 --- a/src/lib/managed_node_configuration.rb +++ b/src/lib/managed_node_configuration.rb @@ -67,10 +67,11 @@ class ManagedNodeConfiguration host.bondings.each do |bonding| entry = "ifcfg=none|#{bonding.interface_name}|BONDING_OPTS=\"mode=#{bonding.bonding_type.mode} miimon=100\"" - if bonding.ip_addr == nil || bonding.ip_addr.empty? + if bonding.ip_addresses.empty? entry += "|BOOTPROTO=dhcp" else - entry += "|BOOTPROTO=static|IPADDR=#{bonding.ip_addr}|NETMASK=#{bonding.netmask}|BROADCAST=#{bonding.broadcast}" + ip = bonding.ip_addresses[0] + entry += "|BOOTPROTO=static|IPADDR=#{ip.address}|NETMASK=#{ip.netmask}|BROADCAST=#{ip.broadcast}" end result.puts "#{entry}|ONBOOT=yes" @@ -111,7 +112,10 @@ class ManagedNodeConfiguration entry += "|MASTER=#{bonding.interface_name}|SLAVE=yes" else entry += "|BOOTPROTO=#{nic.boot_type.proto}" - entry += "|IPADDR=#{nic.ip_addr}|NETMASK=#{nic.netmask}|BROADCAST=#{nic.broadcast}" if nic.boot_type.proto == 'static' + if nic.boot_type.proto == 'static' + ip = nic.ip_addresses[0] + entry += "|IPADDR=#{ip.address}|NETMASK=#{ip.netmask}|BROADCAST=#{ip.broadcast}" + end entry += "|BRIDGE=#{nic.bridge}" if nic.bridge && !is_bridge entry += "|BRIDGE=ovirtbr0" if !nic.bridge && !is_bridge entry += "|TYPE=bridge" if is_bridge From apevec at redhat.com Sat Nov 1 23:40:15 2008 From: apevec at redhat.com (Alan Pevec) Date: Sun, 2 Nov 2008 00:40:15 +0100 Subject: [Ovirt-devel] [PATCH ovirt-node] use disk/by-id to support non-sdX block devices like cciss Message-ID: <1225582815-24854-1-git-send-email-apevec@redhat.com> Signed-off-by: Alan Pevec --- scripts/ovirt-early | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/ovirt-early b/scripts/ovirt-early index 3c8c494..1a14220 100755 --- a/scripts/ovirt-early +++ b/scripts/ovirt-early @@ -85,15 +85,17 @@ find_disk() { local bus=$1 local serial=$2 local live=$3 - for d in /dev/sd?; do + for d in /dev/disk/by-id/{scsi,usb}*; do + ID_FS_USAGE= eval $(udevinfo --query env --name $d) - if [ "$ID_BUS" = "$bus" ]; then + # ID_FS_USAGE is set for partitions + if [ -z "$ID_FS_USAGE" -a "$ID_BUS" = "$bus" ]; then if [ -z "$serial" -o "$ID_SERIAL" = "$serial" ]; then if [ -n "$live" -a "$d" = "$live" ]; then # cannot install LiveOS over itself continue else - echo $d + echo $(readlink -e $d) return 0 fi fi -- 1.5.6.5 From dpierce at redhat.com Mon Nov 3 14:06:07 2008 From: dpierce at redhat.com (Darryl Pierce) Date: Mon, 03 Nov 2008 09:06:07 -0500 Subject: [Ovirt-devel] Re: [PATCH server] network integration into ovirt server db and wui In-Reply-To: <490CCC72.4070804@redhat.com> References: <1225416455-7607-1-git-send-email-mmorsi@redhat.com> <490B25C8.1020509@redhat.com> <20081031160305.GH30553@redhat.com> <490B30A6.70406@redhat.com> <490B7CEB.2080302@redhat.com> <490B9B71.2040409@redhat.com> <490BC962.8080507@redhat.com> <490CCC72.4070804@redhat.com> Message-ID: <490F054F.30102@redhat.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Alan Pevec wrote: > Yeah, Darryl's NAK was about 1) > Here's my naive fix (just takes first ip_address and assumes IPv4), > please review it: ACK. Just a single style note. > > diff --git a/src/lib/managed_node_configuration.rb > b/src/lib/managed_node_configuration.rb > index 101be9f..d0642d1 100644 > --- a/src/lib/managed_node_configuration.rb > +++ b/src/lib/managed_node_configuration.rb > @@ -67,10 +67,11 @@ class ManagedNodeConfiguration > host.bondings.each do |bonding| > entry = > "ifcfg=none|#{bonding.interface_name}|BONDING_OPTS=\"mode=#{bonding.bonding_type.mode} > miimon=100\"" > > - if bonding.ip_addr == nil || bonding.ip_addr.empty? > + if bonding.ip_addresses.empty? > entry += "|BOOTPROTO=dhcp" > else > - entry += > "|BOOTPROTO=static|IPADDR=#{bonding.ip_addr}|NETMASK=#{bonding.netmask}|BROADCAST=#{bonding.broadcast}" > > + ip = bonding.ip_addresses[0] Stylistic note: you can do, to avoid an index out of bounds error: ip = bonding.ip_addresses.first > + entry += > "|BOOTPROTO=static|IPADDR=#{ip.address}|NETMASK=#{ip.netmask}|BROADCAST=#{ip.broadcast}" > > end > > result.puts "#{entry}|ONBOOT=yes" > @@ -111,7 +112,10 @@ class ManagedNodeConfiguration > entry += "|MASTER=#{bonding.interface_name}|SLAVE=yes" > else > entry += "|BOOTPROTO=#{nic.boot_type.proto}" > - entry += > "|IPADDR=#{nic.ip_addr}|NETMASK=#{nic.netmask}|BROADCAST=#{nic.broadcast}" > if nic.boot_type.proto == 'static' > + if nic.boot_type.proto == 'static' I think we ought to hide this detail in the BootType class itself; i.e., def static? static == 'static' end so we don't couple ourselves to the value of proto directly. > + ip = nic.ip_addresses[0] Same here with using .first. > + entry += > "|IPADDR=#{ip.address}|NETMASK=#{ip.netmask}|BROADCAST=#{ip.broadcast}" > + end > entry += "|BRIDGE=#{nic.bridge}" if nic.bridge && !is_bridge > entry += "|BRIDGE=ovirtbr0" if !nic.bridge && !is_bridge > entry += "|TYPE=bridge" if is_bridge - -- Darryl L. Pierce : GPG KEYID: 6C4E7F1B -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAkkPBUwACgkQjaT4DmxOfxtCQwCfXlQnV9yH42aw1TlG8201W4oJ 2YkAoMAxCG6CauRUMWQtVTpcdN8qLhUl =934m -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: dpierce.vcf Type: text/x-vcard Size: 333 bytes Desc: not available URL: From mmorsi at redhat.com Mon Nov 3 18:21:25 2008 From: mmorsi at redhat.com (Mohammed Morsi) Date: Mon, 3 Nov 2008 13:21:25 -0500 Subject: [Ovirt-devel] [PATCH server] network related fixes to tests and backend components Message-ID: <1225736485-4232-1-git-send-email-mmorsi@redhat.com> --- src/host-browser/host-browser.rb | 19 ++-- src/lib/managed_node_configuration.rb | 14 ++- src/test/fixtures/bondings.yml | 4 - src/test/fixtures/ip_addresses.yml | 61 +++++++++++ src/test/fixtures/networks.yml | 33 ++++++ src/test/fixtures/nics.yml | 108 +++++++++----------- src/test/fixtures/usages.yml | 7 ++ .../functional/managed_node_configuration_test.rb | 14 ++-- src/test/functional/network_controller_test.rb | 8 ++ src/test/functional/nic_controller_test.rb | 2 +- src/test/unit/bonding_test.rb | 11 +-- src/test/unit/ip_address_test.rb | 8 ++ src/test/unit/ip_v4_address_test.rb | 106 +++++++++++++++++++ src/test/unit/ip_v6_address_test.rb | 85 +++++++++++++++ src/test/unit/network_test.rb | 8 ++ src/test/unit/nic_test.rb | 1 + src/test/unit/usage_test.rb | 8 ++ 17 files changed, 402 insertions(+), 95 deletions(-) create mode 100644 src/test/fixtures/ip_addresses.yml create mode 100644 src/test/fixtures/networks.yml create mode 100644 src/test/fixtures/usages.yml create mode 100644 src/test/functional/network_controller_test.rb create mode 100644 src/test/unit/ip_address_test.rb create mode 100644 src/test/unit/ip_v4_address_test.rb create mode 100644 src/test/unit/ip_v6_address_test.rb create mode 100644 src/test/unit/network_test.rb create mode 100644 src/test/unit/usage_test.rb diff --git a/src/host-browser/host-browser.rb b/src/host-browser/host-browser.rb index 79d34e8..52d2999 100755 --- a/src/host-browser/host-browser.rb +++ b/src/host-browser/host-browser.rb @@ -264,6 +264,13 @@ class HostBrowser host.cpus << detail end + # Create a new network for the host + boot_type = BootType.find_by_proto('dhcp') + network_name = (host.uuid ? host.uuid : "") + ' Physical Network' + network = PhysicalNetwork.create( + :name => network_name, + :boot_type_id => boot_type.id) + # Update the NIC details for this host: # -if the NIC exists, then update the IP address # -if the NIC does not exist, create it @@ -284,9 +291,6 @@ class HostBrowser updated_nic = Nic.find_by_id(nic.id) updated_nic.bandwidth = detail['BANDWIDTH'] - updated_nic.ip_addr = detail['IP_ADDRESS'] - updated_nic.netmask = detail['NETMASK'] - updated_nic.broadcast = detail['BROADCAST'] updated_nic.save! found=true @@ -302,18 +306,13 @@ class HostBrowser end # iterate over any nics left and create new records for them. - boot_type = BootType.find_by_proto('dhcp') - nic_info.collect do |nic| puts "Creating a new nic..." detail = Nic.new( 'mac' => nic['MAC'].upcase, 'bandwidth' => nic['BANDWIDTH'], - 'usage_type' => 1, - 'ip_addr' => nic['IP_ADDRESS'], - 'netmask' => nic['NETMASK'], - 'broadcast' => nic['BROADCAST'], - 'boot_type_id' => boot_type.id) + 'usage_type' => 1) + detail.physical_network = network host.nics << detail end diff --git a/src/lib/managed_node_configuration.rb b/src/lib/managed_node_configuration.rb index 101be9f..7cd2839 100644 --- a/src/lib/managed_node_configuration.rb +++ b/src/lib/managed_node_configuration.rb @@ -67,10 +67,11 @@ class ManagedNodeConfiguration host.bondings.each do |bonding| entry = "ifcfg=none|#{bonding.interface_name}|BONDING_OPTS=\"mode=#{bonding.bonding_type.mode} miimon=100\"" - if bonding.ip_addr == nil || bonding.ip_addr.empty? + if bonding.ip_addresses.empty? entry += "|BOOTPROTO=dhcp" else - entry += "|BOOTPROTO=static|IPADDR=#{bonding.ip_addr}|NETMASK=#{bonding.netmask}|BROADCAST=#{bonding.broadcast}" + ip = bonding.ip_addresses[0] + entry += "|BOOTPROTO=static|IPADDR=#{ip.address}|NETMASK=#{ip.netmask}|BROADCAST=#{ip.broadcast}" end result.puts "#{entry}|ONBOOT=yes" @@ -84,7 +85,7 @@ class ManagedNodeConfiguration host.nics.each do |nic| # only process this nic if it doesn't have a bonding # TODO remove the hack to force a bridge into the picture - if nic.bonding.empty? + if nic.bondings.empty? process_nic result, nic, macs, nil, false, true # TODO remove this when bridges are properly supported @@ -110,8 +111,11 @@ class ManagedNodeConfiguration if bonding entry += "|MASTER=#{bonding.interface_name}|SLAVE=yes" else - entry += "|BOOTPROTO=#{nic.boot_type.proto}" - entry += "|IPADDR=#{nic.ip_addr}|NETMASK=#{nic.netmask}|BROADCAST=#{nic.broadcast}" if nic.boot_type.proto == 'static' + entry += "|BOOTPROTO=#{nic.physical_network.boot_type.proto}" + if nic.physical_network.boot_type.proto == 'static' + ip = nic.ip_addresses[0] + entry += "|IPADDR=#{ip.address}|NETMASK=#{ip.netmask}|BROADCAST=#{ip.broadcast}" + end entry += "|BRIDGE=#{nic.bridge}" if nic.bridge && !is_bridge entry += "|BRIDGE=ovirtbr0" if !nic.bridge && !is_bridge entry += "|TYPE=bridge" if is_bridge diff --git a/src/test/fixtures/bondings.yml b/src/test/fixtures/bondings.yml index 227b92b..3c793f6 100644 --- a/src/test/fixtures/bondings.yml +++ b/src/test/fixtures/bondings.yml @@ -3,10 +3,6 @@ mailservers_managed_node_bonding: interface_name: mailbonding0 bonding_type_id: <%= Fixtures.identify(:link_aggregation_bonding_type) %> host_id: <%= Fixtures.identify(:mailservers_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> - ip_addr: 172.31.0.15 - netmask: 255.255.255. - broadcast: 172.31.0.255 arp_ping_address: 172.31.0.100 arp_interval: 0 diff --git a/src/test/fixtures/ip_addresses.yml b/src/test/fixtures/ip_addresses.yml new file mode 100644 index 0000000..aed3811 --- /dev/null +++ b/src/test/fixtures/ip_addresses.yml @@ -0,0 +1,61 @@ +ip_v4_one: + nic_id: <%= Fixtures.identify(:nic_one) %> + type: IpV4Address + address: 1.2.3.4 + netmask: 255.255.255.0 + gateway: 1.2.3.1 + broadcast: 1.2.3.255 + +ip_v4_two: + nic_id: <%= Fixtures.identify(:nic_two) %> + type: IpV4Address + address: 2.3.4.5 + netmask: 255.255.255.0 + gateway: 1.2.3.1 + broadcast: 2.3.4.255 + +ip_v4_three: + nic_id: <%= Fixtures.identify(:nic_three) %> + type: IpV4Address + address: 3.4.5.6 + netmask: 255.255.255.0 + gateway: 3.4.5.1 + broadcast: 3.4.5.255 + +ip_v4_four: + nic_id: <%= Fixtures.identify(:nic_four) %> + type: IpV4Address + address: 3.4.5.6 + netmask: 255.255.255.0 + gateway: 3.4.5.1 + broadcast: 3.4.5.255 + +ip_v4_mailserver_nic_one: + nic_id: <%= Fixtures.identify(:mailserver_nic_one) %> + type: IpV4Address + address: 172.31.0.15 + netmask: 255.255.255.0 + gateway: 172.31.0.1 + broadcast: 172.31.0.255 + +ip_v4_ldapserver_nic_one: + nic_id: <%= Fixtures.identify(:ldapserver_nic_one) %> + type: IpV4Address + address: 172.31.0.25 + gateway: 172.31.0.1 + +ip_v4_buildserver_nic_one: + nic_id: <%= Fixtures.identify(:buildserver_nic_two) %> + type: IpV4Address + address: 172.31.0.31 + netmask: 255.255.255.0 + gateway: 172.31.0.1 + broadcast: 172.31.0.255 + +ip_v4_mailservers_managed_node_bonding: + bonding_id: <%= Fixtures.identify(:mailservers_managed_node_bonding) %> + type: IpV4Address + address: 192.168.50.100 + netmask: 255.255.255.0 + gateway: 192.168.50.1 + broadcast: 192.168.50.255 diff --git a/src/test/fixtures/networks.yml b/src/test/fixtures/networks.yml new file mode 100644 index 0000000..cb50c0c --- /dev/null +++ b/src/test/fixtures/networks.yml @@ -0,0 +1,33 @@ +static_vlan_one: + type: 'Vlan' + name: 'Static Vlan 1' + boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + number: 1 + +dhcp_vlan_one: + type: 'Vlan' + name: 'DHCP Vlan 1' + boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + number: 2 + +bootp_vlan_one: + type: 'Vlan' + name: 'BOOTP Vlan 1' + boot_type_id: <%= Fixtures.identify(:boot_type_bootp) %> + number: 3 + +static_physical_network_one: + type: 'PhysicalNetwork' + name: 'Static Physical Network 1' + boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + +dhcp_physical_network_one: + type: 'PhysicalNetwork' + name: 'DHCP Physical Network 1' + boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + +bootp_physical_network_one: + type: 'PhysicalNetwork' + name: 'BOOTP Physical Network 1' + boot_type_id: <%= Fixtures.identify(:boot_type_bootp) %> + diff --git a/src/test/fixtures/nics.yml b/src/test/fixtures/nics.yml index 5b2cecc..7f65ef6 100644 --- a/src/test/fixtures/nics.yml +++ b/src/test/fixtures/nics.yml @@ -1,94 +1,84 @@ -one: +nic_one: id: 1 mac: '00:11:22:33:44:55' - ip_addr: '1.2.3.4' - usage_type: '1' bandwidth: 100 host_id: 10 - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> -two: + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> +nic_two: id: 2 mac: 'AA:BB:CC:DD:EE:FF' - ip_addr: '2.3.4.5' usage_type: '2' bandwidth: 1000 host_id: 10 - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> -three: + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> +nic_three: id: 3 mac: '00:FF:11:EE:22:DD' - ip_addr: '3.4.5.6' usage_type: '1' bandwidth: 10 host_id: 10 - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> -four: + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> +nic_four: id: 4 mac: '00:FF:11:EE:22:DD' - ip_addr: '3.4.5.6' usage_type: '1' bandwidth: 10 host_id: 10 - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> mailserver_nic_one: - mac: '00:11:22:33:44:55' - usage_type: '1' - bandwidth: 100 - ip_addr: '172.31.0.15' - host_id: <%= Fixtures.identify(:mailservers_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + mac: '00:11:22:33:44:55' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:mailservers_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> mailserver_nic_two: - mac: '22:11:33:66:44:55' - usage_type: '1' - bandwidth: 100 - host_id: <%= Fixtures.identify(:mailservers_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + mac: '22:11:33:66:44:55' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:mailservers_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> fileserver_nic_one: - mac: '00:99:00:99:13:07' - usage_type: '1' - bandwidth: 100 - host_id: <%= Fixtures.identify(:fileserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + mac: '00:99:00:99:13:07' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:fileserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> ldapserver_nic_one: - mac: '00:03:02:00:09:06' - usage_type: '1' - bandwidth: 100 - bridge: 'ovirtbr0' - ip_addr: '172.31.0.25' - host_id: <%= Fixtures.identify(:ldapserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + mac: '00:03:02:00:09:06' + usage_type: '1' + bandwidth: 100 + bridge: 'ovirtbr0' + host_id: <%= Fixtures.identify(:ldapserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:static_physical_network_one) %> buildserver_nic_one: - mac: '07:17:19:65:03:38' - usage_type: '1' - bandwidth: 100 - host_id: <%= Fixtures.identify(:buildserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + mac: '07:17:19:65:03:38' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:buildserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> buildserver_nic_two: - mac: '07:17:19:65:03:39' - usage_type: '1' - bandwidth: 100 - ip_addr: '172.31.0.31' - netmask: '255.255.255.0' - broadcast: '172.31.0.255' - host_id: <%= Fixtures.identify(:buildserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + mac: '07:17:19:65:03:39' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:buildserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:static_physical_network_one) %> mediaserver_nic_one: - mac: '07:17:19:65:03:32' - usage_type: '1' - bandwidth: 100 - host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + mac: '07:17:19:65:03:32' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> mediaserver_nic_two: - mac: '07:17:19:65:03:31' - usage_type: '1' - bandwidth: 100 - host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + mac: '07:17:19:65:03:31' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> diff --git a/src/test/fixtures/usages.yml b/src/test/fixtures/usages.yml new file mode 100644 index 0000000..5bf0293 --- /dev/null +++ b/src/test/fixtures/usages.yml @@ -0,0 +1,7 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html + +# one: +# column: value +# +# two: +# column: value diff --git a/src/test/functional/managed_node_configuration_test.rb b/src/test/functional/managed_node_configuration_test.rb index 14c9736..b614502 100644 --- a/src/test/functional/managed_node_configuration_test.rb +++ b/src/test/functional/managed_node_configuration_test.rb @@ -30,6 +30,7 @@ class ManagedNodeConfigurationTest < Test::Unit::TestCase fixtures :boot_types fixtures :hosts fixtures :nics + fixtures :networks def setup @host_with_dhcp_card = hosts(:fileserver_managed_node) @@ -65,8 +66,8 @@ ifcfg=#{nic.mac}|ovirtbr0|BOOTPROTO=dhcp|TYPE=bridge|ONBOOT=yes expected = <<-HERE # THIS FILE IS GENERATED! -ifcfg=#{nic.mac}|eth0|BOOTPROTO=#{nic.boot_type.proto}|IPADDR=#{nic.ip_addr}|NETMASK=#{nic.netmask}|BROADCAST=#{nic.broadcast}|BRIDGE=#{nic.bridge}|ONBOOT=yes -ifcfg=#{nic.mac}|ovirtbr0|BOOTPROTO=#{nic.boot_type.proto}|IPADDR=#{nic.ip_addr}|NETMASK=|BROADCAST=#{nic.netmask}|TYPE=bridge|ONBOOT=yes +ifcfg=#{nic.mac}|eth0|BOOTPROTO=#{nic.physical_network.boot_type.proto}|IPADDR=#{nic.ip_addresses.first.address}|NETMASK=#{nic.ip_addresses.first.netmask}|BROADCAST=#{nic.ip_addresses.first.broadcast}|BRIDGE=#{nic.bridge}|ONBOOT=yes +ifcfg=#{nic.mac}|ovirtbr0|BOOTPROTO=#{nic.physical_network.boot_type.proto}|IPADDR=#{nic.ip_addresses.first.address}|NETMASK=|BROADCAST=#{nic.ip_addresses.first.netmask}|TYPE=bridge|ONBOOT=yes HERE result = ManagedNodeConfiguration.generate( @@ -85,9 +86,9 @@ ifcfg=#{nic.mac}|ovirtbr0|BOOTPROTO=#{nic.boot_type.proto}|IPADDR=#{nic.ip_addr} expected = <<-HERE # THIS FILE IS GENERATED! -ifcfg=#{nic1.mac}|eth0|BOOTPROTO=#{nic1.boot_type.proto}|IPADDR=#{nic1.ip_addr}|NETMASK=#{nic1.netmask}|BROADCAST=#{nic1.broadcast}|BRIDGE=ovirtbr0|ONBOOT=yes -ifcfg=#{nic1.mac}|ovirtbr0|BOOTPROTO=#{nic1.boot_type.proto}|IPADDR=#{nic1.ip_addr}|NETMASK=#{nic1.netmask}|BROADCAST=#{nic1.broadcast}|TYPE=bridge|ONBOOT=yes -ifcfg=#{nic2.mac}|eth1|BOOTPROTO=#{nic2.boot_type.proto}|BRIDGE=ovirtbr0|ONBOOT=yes +ifcfg=#{nic1.mac}|eth0|BOOTPROTO=#{nic1.physical_network.boot_type.proto}|IPADDR=#{nic1.ip_addresses.first.address}|NETMASK=#{nic1.ip_addresses.first.netmask}|BROADCAST=#{nic1.ip_addresses.first.broadcast}|BRIDGE=ovirtbr0|ONBOOT=yes +ifcfg=#{nic1.mac}|ovirtbr0|BOOTPROTO=#{nic1.physical_network.boot_type.proto}|IPADDR=#{nic1.ip_addresses.first.address}|NETMASK=#{nic1.ip_addresses.first.netmask}|BROADCAST=#{nic1.ip_addresses.first.broadcast}|TYPE=bridge|ONBOOT=yes +ifcfg=#{nic2.mac}|eth1|BOOTPROTO=#{nic2.physical_network.boot_type.proto}|BRIDGE=ovirtbr0|ONBOOT=yes HERE result = ManagedNodeConfiguration.generate( @@ -112,7 +113,7 @@ ifcfg=#{nic2.mac}|eth1|BOOTPROTO=#{nic2.boot_type.proto}|BRIDGE=ovirtbr0|ONBOOT= expected = <<-HERE # THIS FILE IS GENERATED! bonding=#{bonding.interface_name} -ifcfg=none|#{bonding.interface_name}|BONDING_OPTS="mode=#{bonding.bonding_type.mode} miimon=100"|BOOTPROTO=static|IPADDR=#{bonding.ip_addr}|NETMASK=#{bonding.netmask}|BROADCAST=#{bonding.broadcast}|ONBOOT=yes +ifcfg=none|#{bonding.interface_name}|BONDING_OPTS="mode=#{bonding.bonding_type.mode} miimon=100"|BOOTPROTO=static|IPADDR=#{bonding.ip_addresses.first.address}|NETMASK=#{bonding.ip_addresses.first.netmask}|BROADCAST=#{bonding.ip_addresses.first.broadcast}|ONBOOT=yes ifcfg=#{nic1.mac}|eth0|MASTER=#{bonding.interface_name}|SLAVE=yes|ONBOOT=yes ifcfg=#{nic2.mac}|eth1|MASTER=#{bonding.interface_name}|SLAVE=yes|ONBOOT=yes HERE @@ -132,7 +133,6 @@ HERE def test_generate_with_dhcp_bonding bonding = @host_with_dhcp_bondings.bondings.first - bonding.ip_addr=nil nic1 = bonding.nics[0] nic2 = bonding.nics[1] diff --git a/src/test/functional/network_controller_test.rb b/src/test/functional/network_controller_test.rb new file mode 100644 index 0000000..8ca4094 --- /dev/null +++ b/src/test/functional/network_controller_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class NetworkControllerTest < ActionController::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end diff --git a/src/test/functional/nic_controller_test.rb b/src/test/functional/nic_controller_test.rb index 4ae1f8d..3405c80 100644 --- a/src/test/functional/nic_controller_test.rb +++ b/src/test/functional/nic_controller_test.rb @@ -31,7 +31,7 @@ class NicControllerTest < Test::Unit::TestCase @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @first_id = nics(:one).id + @first_id = nics(:nic_one).id end def test_show diff --git a/src/test/unit/bonding_test.rb b/src/test/unit/bonding_test.rb index fbcb138..3df46da 100644 --- a/src/test/unit/bonding_test.rb +++ b/src/test/unit/bonding_test.rb @@ -26,13 +26,14 @@ class BondingTest < ActiveSupport::TestCase fixtures :boot_types fixtures :hosts fixtures :nics + fixtures :networks def setup @bonding = Bonding.new( :name => 'Bonding1', :interface_name => 'bond0', + :vlan_id => networks(:dhcp_vlan_one), :bonding_type_id => bonding_types(:failover_bonding_type), - :boot_type_id => boot_types(:boot_type_dhcp), :host_id => hosts(:mailservers_managed_node)) end @@ -52,14 +53,6 @@ class BondingTest < ActiveSupport::TestCase flunk 'Bondings have to have an interface name.' if @bonding.valid? end - # Ensures that the bonding requires a boot type. - # - def test_valid_fails_without_boot_type - @bonding.boot_type_id = nil - - flunk 'Bondings have to have a boot type.' if @bonding.valid? - end - # Ensures that the bonding type is required. # def test_valid_fails_without_type diff --git a/src/test/unit/ip_address_test.rb b/src/test/unit/ip_address_test.rb new file mode 100644 index 0000000..152578e --- /dev/null +++ b/src/test/unit/ip_address_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class IpAddressTest < ActiveSupport::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end diff --git a/src/test/unit/ip_v4_address_test.rb b/src/test/unit/ip_v4_address_test.rb new file mode 100644 index 0000000..65a08d3 --- /dev/null +++ b/src/test/unit/ip_v4_address_test.rb @@ -0,0 +1,106 @@ +# +# Copyright (C) 2008 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. + +require File.dirname(__FILE__) + '/../test_helper' + +class IpV4AddressTest < ActiveSupport::TestCase + def setup + @address = IpV4Address.new(:address => '192.168.50.2', + :netmask => '255.255.255.0', + :gateway => '192.168.50.1', + :broadcast => '192.168.50.255') + end + + # Ensures that an address must be supplied. + # + def test_valid_fails_without_address + @address.address = nil + + flunk "An address must be present." if @address.valid? + end + + # Ensures that an address has to be in the correct format. + # + def test_valid_fails_with_bad_address + @address.address = '192.168' + + flunk "An address must be in the format ##.##.##.##." if @address.valid? + end + + # Ensures that a netmask must be supplied. + # + def test_valid_fails_without_netmask + @address.network_id = 1 + @address.netmask = nil + + flunk "An address must have a netmask." if @address.valid? + end + + # Ensures that a netmask must have the correct format. + # + def test_valid_fails_with_bad_netmask + @address.network_id = 1 + @address.netmask = 'farkle' + + flunk "A netmask must be in the format ##.##.##.##." if @address.valid? + end + + # Ensures that a gateway must be supplied. + # + def test_valid_fails_without_gateway + @address.network_id = 1 + @address.gateway = nil + + flunk "A gateway address must be supplied." if @address.valid? + end + + # Ensures that a gateway must be in the correct format. + # + def test_valid_fails_with_bad_gateway + @address.network_id = 1 + @address.gateway = '-3.a2.0.8' + + + flunk "The gateway address must be in the format ##.##.##.##." if @address.valid? + end + + # Ensures that a broadcast must be supplied. + # + def test_valid_fails_without_broadcast + @address.network_id = 1 + @address.broadcast = nil + + flunk "A broadcast addres must be supplied." if @address.valid? + end + + # Ensures that a broadcast must be in the correct format. + # + def test_valid_fails_with_bad_broadcast + @address.network_id = 1 + @address.broadcast = '-3.2.0.8' + + flunk "The broadcast address must be in the format ##.##.##.##." if @address.valid? + end + + # Ensures that a well-formed address is valid. + # + def test_valid + flunk "There is an error with validation." unless @address.valid? + end +end diff --git a/src/test/unit/ip_v6_address_test.rb b/src/test/unit/ip_v6_address_test.rb new file mode 100644 index 0000000..070f407 --- /dev/null +++ b/src/test/unit/ip_v6_address_test.rb @@ -0,0 +1,85 @@ +# +# Copyright (C) 2008 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. + +require File.dirname(__FILE__) + '/../test_helper' + +class IpV6AddressTest < ActiveSupport::TestCase + def setup + @address = IpV6Address.new(:address => 'fe80:0:0:0:200:f8ff:fe21:67cf', + :gateway => ':::::::717', + :prefix => '0000:0000:0000:0000:1234:1234:1234:1234') + end + + # Ensures that the address must be provided. + # + def test_valid_fails_without_address + @address.address = nil + flunk "An address must be provided." if @address.valid? + end + + # Ensures that the address must be in the correct format. + # + def test_valid_fails_with_bad_address + @address.address = "farkle" + + flunk "The address must be in the correct format." if @address.valid? + end + + # Ensures that the gateway must be provided. + # + def test_valid_fails_without_gateway + @address.network_id = 1 + @address.gateway = nil + + flunk "The gateway address must be provided." if @address.valid? + end + + # Ensures that the gateway address is in the correct format. + # + def test_valid_fails_with_bad_gateway + @address.network_id = 1 + @address.gateway = '0-:::::::717' + + flunk "The gateway address must be in the correct format." if @address.valid? + end + + # Ensures that the prefix must be provided. + # + def test_valid_fails_without_prefix + @address.network_id = 1 + @address.prefix = nil + + flunk "The prefix must be provided." if @address.valid? + end + + # Ensures that the prefix is in the correct format. + # + def test_valid_fails_with_invalid_prefix + @address.network_id = 1 + @address.prefix = 'whoops' + + flunk "The prefix must be in the correct format." if @address.valid? + end + + # Ensures that a well-formed address is considered valid. + # + def test_valid + flunk "There is an problem with address validation." unless @address.valid? + end +end diff --git a/src/test/unit/network_test.rb b/src/test/unit/network_test.rb new file mode 100644 index 0000000..64c5df4 --- /dev/null +++ b/src/test/unit/network_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class NetworkTest < ActiveSupport::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end diff --git a/src/test/unit/nic_test.rb b/src/test/unit/nic_test.rb index a0776a2..1de1e00 100644 --- a/src/test/unit/nic_test.rb +++ b/src/test/unit/nic_test.rb @@ -20,6 +20,7 @@ require File.dirname(__FILE__) + '/../test_helper' class NicTest < Test::Unit::TestCase + fixtures :ip_addresses fixtures :nics # Replace this with your real tests. diff --git a/src/test/unit/usage_test.rb b/src/test/unit/usage_test.rb new file mode 100644 index 0000000..9a8ec9b --- /dev/null +++ b/src/test/unit/usage_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class UsageTest < ActiveSupport::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end -- 1.5.6.5 From sseago at redhat.com Mon Nov 3 18:37:14 2008 From: sseago at redhat.com (Scott Seago) Date: Mon, 03 Nov 2008 13:37:14 -0500 Subject: [Ovirt-devel] [PATCH server] WIP - Rev 1 of Storage Tree UI for 'Create VM'. In-Reply-To: <1225403343-18309-1-git-send-email-jguiditt@redhat.com> References: <1225403343-18309-1-git-send-email-jguiditt@redhat.com> Message-ID: <490F44DA.2080709@redhat.com> Jason Guiditta wrote: > This probably needs some visual tweaks, but should work as > is. Needs integration testing with scott's work to create > lvm volumes. > > Signed-off-by: Jason Guiditta > --- > src/app/controllers/vm_controller.rb | 2 + > src/app/models/storage_volume.rb | 3 + > src/app/views/vm/_form.rhtml | 59 ++++++++++++++------------- > src/public/javascripts/ovirt.tree.js | 8 +++- > src/public/stylesheets/ovirt-tree/tree.css | 5 ++- > 5 files changed, 46 insertions(+), 31 deletions(-) > > ACK. Works for me on top of my LVM UI patch. Scott From mmorsi at redhat.com Mon Nov 3 21:12:25 2008 From: mmorsi at redhat.com (Mohammed Morsi) Date: Mon, 3 Nov 2008 16:12:25 -0500 Subject: [Ovirt-devel] [PATCH server] network related fixes to tests and backend components Message-ID: <1225746745-26070-1-git-send-email-mmorsi@redhat.com> --- src/host-browser/host-browser.rb | 19 ++-- src/lib/managed_node_configuration.rb | 14 ++- src/test/fixtures/bondings.yml | 6 +- src/test/fixtures/ip_addresses.yml | 61 +++++++++++ src/test/fixtures/networks.yml | 33 ++++++ src/test/fixtures/nics.yml | 108 +++++++++----------- src/test/fixtures/usages.yml | 7 ++ .../functional/managed_node_configuration_test.rb | 14 ++-- src/test/functional/network_controller_test.rb | 8 ++ src/test/functional/nic_controller_test.rb | 2 +- src/test/unit/bonding_test.rb | 11 +-- src/test/unit/ip_address_test.rb | 8 ++ src/test/unit/ip_v4_address_test.rb | 106 +++++++++++++++++++ src/test/unit/ip_v6_address_test.rb | 85 +++++++++++++++ src/test/unit/network_test.rb | 8 ++ src/test/unit/nic_test.rb | 1 + src/test/unit/usage_test.rb | 8 ++ 17 files changed, 404 insertions(+), 95 deletions(-) create mode 100644 src/test/fixtures/ip_addresses.yml create mode 100644 src/test/fixtures/networks.yml create mode 100644 src/test/fixtures/usages.yml create mode 100644 src/test/functional/network_controller_test.rb create mode 100644 src/test/unit/ip_address_test.rb create mode 100644 src/test/unit/ip_v4_address_test.rb create mode 100644 src/test/unit/ip_v6_address_test.rb create mode 100644 src/test/unit/network_test.rb create mode 100644 src/test/unit/usage_test.rb diff --git a/src/host-browser/host-browser.rb b/src/host-browser/host-browser.rb index 79d34e8..52d2999 100755 --- a/src/host-browser/host-browser.rb +++ b/src/host-browser/host-browser.rb @@ -264,6 +264,13 @@ class HostBrowser host.cpus << detail end + # Create a new network for the host + boot_type = BootType.find_by_proto('dhcp') + network_name = (host.uuid ? host.uuid : "") + ' Physical Network' + network = PhysicalNetwork.create( + :name => network_name, + :boot_type_id => boot_type.id) + # Update the NIC details for this host: # -if the NIC exists, then update the IP address # -if the NIC does not exist, create it @@ -284,9 +291,6 @@ class HostBrowser updated_nic = Nic.find_by_id(nic.id) updated_nic.bandwidth = detail['BANDWIDTH'] - updated_nic.ip_addr = detail['IP_ADDRESS'] - updated_nic.netmask = detail['NETMASK'] - updated_nic.broadcast = detail['BROADCAST'] updated_nic.save! found=true @@ -302,18 +306,13 @@ class HostBrowser end # iterate over any nics left and create new records for them. - boot_type = BootType.find_by_proto('dhcp') - nic_info.collect do |nic| puts "Creating a new nic..." detail = Nic.new( 'mac' => nic['MAC'].upcase, 'bandwidth' => nic['BANDWIDTH'], - 'usage_type' => 1, - 'ip_addr' => nic['IP_ADDRESS'], - 'netmask' => nic['NETMASK'], - 'broadcast' => nic['BROADCAST'], - 'boot_type_id' => boot_type.id) + 'usage_type' => 1) + detail.physical_network = network host.nics << detail end diff --git a/src/lib/managed_node_configuration.rb b/src/lib/managed_node_configuration.rb index 101be9f..7cd2839 100644 --- a/src/lib/managed_node_configuration.rb +++ b/src/lib/managed_node_configuration.rb @@ -67,10 +67,11 @@ class ManagedNodeConfiguration host.bondings.each do |bonding| entry = "ifcfg=none|#{bonding.interface_name}|BONDING_OPTS=\"mode=#{bonding.bonding_type.mode} miimon=100\"" - if bonding.ip_addr == nil || bonding.ip_addr.empty? + if bonding.ip_addresses.empty? entry += "|BOOTPROTO=dhcp" else - entry += "|BOOTPROTO=static|IPADDR=#{bonding.ip_addr}|NETMASK=#{bonding.netmask}|BROADCAST=#{bonding.broadcast}" + ip = bonding.ip_addresses[0] + entry += "|BOOTPROTO=static|IPADDR=#{ip.address}|NETMASK=#{ip.netmask}|BROADCAST=#{ip.broadcast}" end result.puts "#{entry}|ONBOOT=yes" @@ -84,7 +85,7 @@ class ManagedNodeConfiguration host.nics.each do |nic| # only process this nic if it doesn't have a bonding # TODO remove the hack to force a bridge into the picture - if nic.bonding.empty? + if nic.bondings.empty? process_nic result, nic, macs, nil, false, true # TODO remove this when bridges are properly supported @@ -110,8 +111,11 @@ class ManagedNodeConfiguration if bonding entry += "|MASTER=#{bonding.interface_name}|SLAVE=yes" else - entry += "|BOOTPROTO=#{nic.boot_type.proto}" - entry += "|IPADDR=#{nic.ip_addr}|NETMASK=#{nic.netmask}|BROADCAST=#{nic.broadcast}" if nic.boot_type.proto == 'static' + entry += "|BOOTPROTO=#{nic.physical_network.boot_type.proto}" + if nic.physical_network.boot_type.proto == 'static' + ip = nic.ip_addresses[0] + entry += "|IPADDR=#{ip.address}|NETMASK=#{ip.netmask}|BROADCAST=#{ip.broadcast}" + end entry += "|BRIDGE=#{nic.bridge}" if nic.bridge && !is_bridge entry += "|BRIDGE=ovirtbr0" if !nic.bridge && !is_bridge entry += "|TYPE=bridge" if is_bridge diff --git a/src/test/fixtures/bondings.yml b/src/test/fixtures/bondings.yml index 227b92b..ee1939d 100644 --- a/src/test/fixtures/bondings.yml +++ b/src/test/fixtures/bondings.yml @@ -3,15 +3,13 @@ mailservers_managed_node_bonding: interface_name: mailbonding0 bonding_type_id: <%= Fixtures.identify(:link_aggregation_bonding_type) %> host_id: <%= Fixtures.identify(:mailservers_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> - ip_addr: 172.31.0.15 - netmask: 255.255.255. - broadcast: 172.31.0.255 arp_ping_address: 172.31.0.100 arp_interval: 0 + vlan_id: <%= Fixtures.identify(:dhcp_vlan_one) %> mediaserver_managed_node_bonding: name: Fileserver Network interface_name: mediabonding0 bonding_type_id: <%= Fixtures.identify(:link_aggregation_bonding_type) %> host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> + vlan_id: <%= Fixtures.identify(:dhcp_vlan_one) %> diff --git a/src/test/fixtures/ip_addresses.yml b/src/test/fixtures/ip_addresses.yml new file mode 100644 index 0000000..aed3811 --- /dev/null +++ b/src/test/fixtures/ip_addresses.yml @@ -0,0 +1,61 @@ +ip_v4_one: + nic_id: <%= Fixtures.identify(:nic_one) %> + type: IpV4Address + address: 1.2.3.4 + netmask: 255.255.255.0 + gateway: 1.2.3.1 + broadcast: 1.2.3.255 + +ip_v4_two: + nic_id: <%= Fixtures.identify(:nic_two) %> + type: IpV4Address + address: 2.3.4.5 + netmask: 255.255.255.0 + gateway: 1.2.3.1 + broadcast: 2.3.4.255 + +ip_v4_three: + nic_id: <%= Fixtures.identify(:nic_three) %> + type: IpV4Address + address: 3.4.5.6 + netmask: 255.255.255.0 + gateway: 3.4.5.1 + broadcast: 3.4.5.255 + +ip_v4_four: + nic_id: <%= Fixtures.identify(:nic_four) %> + type: IpV4Address + address: 3.4.5.6 + netmask: 255.255.255.0 + gateway: 3.4.5.1 + broadcast: 3.4.5.255 + +ip_v4_mailserver_nic_one: + nic_id: <%= Fixtures.identify(:mailserver_nic_one) %> + type: IpV4Address + address: 172.31.0.15 + netmask: 255.255.255.0 + gateway: 172.31.0.1 + broadcast: 172.31.0.255 + +ip_v4_ldapserver_nic_one: + nic_id: <%= Fixtures.identify(:ldapserver_nic_one) %> + type: IpV4Address + address: 172.31.0.25 + gateway: 172.31.0.1 + +ip_v4_buildserver_nic_one: + nic_id: <%= Fixtures.identify(:buildserver_nic_two) %> + type: IpV4Address + address: 172.31.0.31 + netmask: 255.255.255.0 + gateway: 172.31.0.1 + broadcast: 172.31.0.255 + +ip_v4_mailservers_managed_node_bonding: + bonding_id: <%= Fixtures.identify(:mailservers_managed_node_bonding) %> + type: IpV4Address + address: 192.168.50.100 + netmask: 255.255.255.0 + gateway: 192.168.50.1 + broadcast: 192.168.50.255 diff --git a/src/test/fixtures/networks.yml b/src/test/fixtures/networks.yml new file mode 100644 index 0000000..cb50c0c --- /dev/null +++ b/src/test/fixtures/networks.yml @@ -0,0 +1,33 @@ +static_vlan_one: + type: 'Vlan' + name: 'Static Vlan 1' + boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + number: 1 + +dhcp_vlan_one: + type: 'Vlan' + name: 'DHCP Vlan 1' + boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + number: 2 + +bootp_vlan_one: + type: 'Vlan' + name: 'BOOTP Vlan 1' + boot_type_id: <%= Fixtures.identify(:boot_type_bootp) %> + number: 3 + +static_physical_network_one: + type: 'PhysicalNetwork' + name: 'Static Physical Network 1' + boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + +dhcp_physical_network_one: + type: 'PhysicalNetwork' + name: 'DHCP Physical Network 1' + boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + +bootp_physical_network_one: + type: 'PhysicalNetwork' + name: 'BOOTP Physical Network 1' + boot_type_id: <%= Fixtures.identify(:boot_type_bootp) %> + diff --git a/src/test/fixtures/nics.yml b/src/test/fixtures/nics.yml index 5b2cecc..7f65ef6 100644 --- a/src/test/fixtures/nics.yml +++ b/src/test/fixtures/nics.yml @@ -1,94 +1,84 @@ -one: +nic_one: id: 1 mac: '00:11:22:33:44:55' - ip_addr: '1.2.3.4' - usage_type: '1' bandwidth: 100 host_id: 10 - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> -two: + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> +nic_two: id: 2 mac: 'AA:BB:CC:DD:EE:FF' - ip_addr: '2.3.4.5' usage_type: '2' bandwidth: 1000 host_id: 10 - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> -three: + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> +nic_three: id: 3 mac: '00:FF:11:EE:22:DD' - ip_addr: '3.4.5.6' usage_type: '1' bandwidth: 10 host_id: 10 - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> -four: + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> +nic_four: id: 4 mac: '00:FF:11:EE:22:DD' - ip_addr: '3.4.5.6' usage_type: '1' bandwidth: 10 host_id: 10 - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> mailserver_nic_one: - mac: '00:11:22:33:44:55' - usage_type: '1' - bandwidth: 100 - ip_addr: '172.31.0.15' - host_id: <%= Fixtures.identify(:mailservers_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + mac: '00:11:22:33:44:55' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:mailservers_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> mailserver_nic_two: - mac: '22:11:33:66:44:55' - usage_type: '1' - bandwidth: 100 - host_id: <%= Fixtures.identify(:mailservers_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + mac: '22:11:33:66:44:55' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:mailservers_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> fileserver_nic_one: - mac: '00:99:00:99:13:07' - usage_type: '1' - bandwidth: 100 - host_id: <%= Fixtures.identify(:fileserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + mac: '00:99:00:99:13:07' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:fileserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> ldapserver_nic_one: - mac: '00:03:02:00:09:06' - usage_type: '1' - bandwidth: 100 - bridge: 'ovirtbr0' - ip_addr: '172.31.0.25' - host_id: <%= Fixtures.identify(:ldapserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + mac: '00:03:02:00:09:06' + usage_type: '1' + bandwidth: 100 + bridge: 'ovirtbr0' + host_id: <%= Fixtures.identify(:ldapserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:static_physical_network_one) %> buildserver_nic_one: - mac: '07:17:19:65:03:38' - usage_type: '1' - bandwidth: 100 - host_id: <%= Fixtures.identify(:buildserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + mac: '07:17:19:65:03:38' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:buildserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> buildserver_nic_two: - mac: '07:17:19:65:03:39' - usage_type: '1' - bandwidth: 100 - ip_addr: '172.31.0.31' - netmask: '255.255.255.0' - broadcast: '172.31.0.255' - host_id: <%= Fixtures.identify(:buildserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + mac: '07:17:19:65:03:39' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:buildserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:static_physical_network_one) %> mediaserver_nic_one: - mac: '07:17:19:65:03:32' - usage_type: '1' - bandwidth: 100 - host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + mac: '07:17:19:65:03:32' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> mediaserver_nic_two: - mac: '07:17:19:65:03:31' - usage_type: '1' - bandwidth: 100 - host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + mac: '07:17:19:65:03:31' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> diff --git a/src/test/fixtures/usages.yml b/src/test/fixtures/usages.yml new file mode 100644 index 0000000..5bf0293 --- /dev/null +++ b/src/test/fixtures/usages.yml @@ -0,0 +1,7 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html + +# one: +# column: value +# +# two: +# column: value diff --git a/src/test/functional/managed_node_configuration_test.rb b/src/test/functional/managed_node_configuration_test.rb index 14c9736..b614502 100644 --- a/src/test/functional/managed_node_configuration_test.rb +++ b/src/test/functional/managed_node_configuration_test.rb @@ -30,6 +30,7 @@ class ManagedNodeConfigurationTest < Test::Unit::TestCase fixtures :boot_types fixtures :hosts fixtures :nics + fixtures :networks def setup @host_with_dhcp_card = hosts(:fileserver_managed_node) @@ -65,8 +66,8 @@ ifcfg=#{nic.mac}|ovirtbr0|BOOTPROTO=dhcp|TYPE=bridge|ONBOOT=yes expected = <<-HERE # THIS FILE IS GENERATED! -ifcfg=#{nic.mac}|eth0|BOOTPROTO=#{nic.boot_type.proto}|IPADDR=#{nic.ip_addr}|NETMASK=#{nic.netmask}|BROADCAST=#{nic.broadcast}|BRIDGE=#{nic.bridge}|ONBOOT=yes -ifcfg=#{nic.mac}|ovirtbr0|BOOTPROTO=#{nic.boot_type.proto}|IPADDR=#{nic.ip_addr}|NETMASK=|BROADCAST=#{nic.netmask}|TYPE=bridge|ONBOOT=yes +ifcfg=#{nic.mac}|eth0|BOOTPROTO=#{nic.physical_network.boot_type.proto}|IPADDR=#{nic.ip_addresses.first.address}|NETMASK=#{nic.ip_addresses.first.netmask}|BROADCAST=#{nic.ip_addresses.first.broadcast}|BRIDGE=#{nic.bridge}|ONBOOT=yes +ifcfg=#{nic.mac}|ovirtbr0|BOOTPROTO=#{nic.physical_network.boot_type.proto}|IPADDR=#{nic.ip_addresses.first.address}|NETMASK=|BROADCAST=#{nic.ip_addresses.first.netmask}|TYPE=bridge|ONBOOT=yes HERE result = ManagedNodeConfiguration.generate( @@ -85,9 +86,9 @@ ifcfg=#{nic.mac}|ovirtbr0|BOOTPROTO=#{nic.boot_type.proto}|IPADDR=#{nic.ip_addr} expected = <<-HERE # THIS FILE IS GENERATED! -ifcfg=#{nic1.mac}|eth0|BOOTPROTO=#{nic1.boot_type.proto}|IPADDR=#{nic1.ip_addr}|NETMASK=#{nic1.netmask}|BROADCAST=#{nic1.broadcast}|BRIDGE=ovirtbr0|ONBOOT=yes -ifcfg=#{nic1.mac}|ovirtbr0|BOOTPROTO=#{nic1.boot_type.proto}|IPADDR=#{nic1.ip_addr}|NETMASK=#{nic1.netmask}|BROADCAST=#{nic1.broadcast}|TYPE=bridge|ONBOOT=yes -ifcfg=#{nic2.mac}|eth1|BOOTPROTO=#{nic2.boot_type.proto}|BRIDGE=ovirtbr0|ONBOOT=yes +ifcfg=#{nic1.mac}|eth0|BOOTPROTO=#{nic1.physical_network.boot_type.proto}|IPADDR=#{nic1.ip_addresses.first.address}|NETMASK=#{nic1.ip_addresses.first.netmask}|BROADCAST=#{nic1.ip_addresses.first.broadcast}|BRIDGE=ovirtbr0|ONBOOT=yes +ifcfg=#{nic1.mac}|ovirtbr0|BOOTPROTO=#{nic1.physical_network.boot_type.proto}|IPADDR=#{nic1.ip_addresses.first.address}|NETMASK=#{nic1.ip_addresses.first.netmask}|BROADCAST=#{nic1.ip_addresses.first.broadcast}|TYPE=bridge|ONBOOT=yes +ifcfg=#{nic2.mac}|eth1|BOOTPROTO=#{nic2.physical_network.boot_type.proto}|BRIDGE=ovirtbr0|ONBOOT=yes HERE result = ManagedNodeConfiguration.generate( @@ -112,7 +113,7 @@ ifcfg=#{nic2.mac}|eth1|BOOTPROTO=#{nic2.boot_type.proto}|BRIDGE=ovirtbr0|ONBOOT= expected = <<-HERE # THIS FILE IS GENERATED! bonding=#{bonding.interface_name} -ifcfg=none|#{bonding.interface_name}|BONDING_OPTS="mode=#{bonding.bonding_type.mode} miimon=100"|BOOTPROTO=static|IPADDR=#{bonding.ip_addr}|NETMASK=#{bonding.netmask}|BROADCAST=#{bonding.broadcast}|ONBOOT=yes +ifcfg=none|#{bonding.interface_name}|BONDING_OPTS="mode=#{bonding.bonding_type.mode} miimon=100"|BOOTPROTO=static|IPADDR=#{bonding.ip_addresses.first.address}|NETMASK=#{bonding.ip_addresses.first.netmask}|BROADCAST=#{bonding.ip_addresses.first.broadcast}|ONBOOT=yes ifcfg=#{nic1.mac}|eth0|MASTER=#{bonding.interface_name}|SLAVE=yes|ONBOOT=yes ifcfg=#{nic2.mac}|eth1|MASTER=#{bonding.interface_name}|SLAVE=yes|ONBOOT=yes HERE @@ -132,7 +133,6 @@ HERE def test_generate_with_dhcp_bonding bonding = @host_with_dhcp_bondings.bondings.first - bonding.ip_addr=nil nic1 = bonding.nics[0] nic2 = bonding.nics[1] diff --git a/src/test/functional/network_controller_test.rb b/src/test/functional/network_controller_test.rb new file mode 100644 index 0000000..8ca4094 --- /dev/null +++ b/src/test/functional/network_controller_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class NetworkControllerTest < ActionController::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end diff --git a/src/test/functional/nic_controller_test.rb b/src/test/functional/nic_controller_test.rb index 4ae1f8d..3405c80 100644 --- a/src/test/functional/nic_controller_test.rb +++ b/src/test/functional/nic_controller_test.rb @@ -31,7 +31,7 @@ class NicControllerTest < Test::Unit::TestCase @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @first_id = nics(:one).id + @first_id = nics(:nic_one).id end def test_show diff --git a/src/test/unit/bonding_test.rb b/src/test/unit/bonding_test.rb index fbcb138..8b90cd5 100644 --- a/src/test/unit/bonding_test.rb +++ b/src/test/unit/bonding_test.rb @@ -26,14 +26,15 @@ class BondingTest < ActiveSupport::TestCase fixtures :boot_types fixtures :hosts fixtures :nics + fixtures :networks def setup @bonding = Bonding.new( :name => 'Bonding1', :interface_name => 'bond0', :bonding_type_id => bonding_types(:failover_bonding_type), - :boot_type_id => boot_types(:boot_type_dhcp), :host_id => hosts(:mailservers_managed_node)) + @bonding.vlan = networks(:dhcp_vlan_one) end # Ensures that the name is required. @@ -52,14 +53,6 @@ class BondingTest < ActiveSupport::TestCase flunk 'Bondings have to have an interface name.' if @bonding.valid? end - # Ensures that the bonding requires a boot type. - # - def test_valid_fails_without_boot_type - @bonding.boot_type_id = nil - - flunk 'Bondings have to have a boot type.' if @bonding.valid? - end - # Ensures that the bonding type is required. # def test_valid_fails_without_type diff --git a/src/test/unit/ip_address_test.rb b/src/test/unit/ip_address_test.rb new file mode 100644 index 0000000..152578e --- /dev/null +++ b/src/test/unit/ip_address_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class IpAddressTest < ActiveSupport::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end diff --git a/src/test/unit/ip_v4_address_test.rb b/src/test/unit/ip_v4_address_test.rb new file mode 100644 index 0000000..65a08d3 --- /dev/null +++ b/src/test/unit/ip_v4_address_test.rb @@ -0,0 +1,106 @@ +# +# Copyright (C) 2008 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. + +require File.dirname(__FILE__) + '/../test_helper' + +class IpV4AddressTest < ActiveSupport::TestCase + def setup + @address = IpV4Address.new(:address => '192.168.50.2', + :netmask => '255.255.255.0', + :gateway => '192.168.50.1', + :broadcast => '192.168.50.255') + end + + # Ensures that an address must be supplied. + # + def test_valid_fails_without_address + @address.address = nil + + flunk "An address must be present." if @address.valid? + end + + # Ensures that an address has to be in the correct format. + # + def test_valid_fails_with_bad_address + @address.address = '192.168' + + flunk "An address must be in the format ##.##.##.##." if @address.valid? + end + + # Ensures that a netmask must be supplied. + # + def test_valid_fails_without_netmask + @address.network_id = 1 + @address.netmask = nil + + flunk "An address must have a netmask." if @address.valid? + end + + # Ensures that a netmask must have the correct format. + # + def test_valid_fails_with_bad_netmask + @address.network_id = 1 + @address.netmask = 'farkle' + + flunk "A netmask must be in the format ##.##.##.##." if @address.valid? + end + + # Ensures that a gateway must be supplied. + # + def test_valid_fails_without_gateway + @address.network_id = 1 + @address.gateway = nil + + flunk "A gateway address must be supplied." if @address.valid? + end + + # Ensures that a gateway must be in the correct format. + # + def test_valid_fails_with_bad_gateway + @address.network_id = 1 + @address.gateway = '-3.a2.0.8' + + + flunk "The gateway address must be in the format ##.##.##.##." if @address.valid? + end + + # Ensures that a broadcast must be supplied. + # + def test_valid_fails_without_broadcast + @address.network_id = 1 + @address.broadcast = nil + + flunk "A broadcast addres must be supplied." if @address.valid? + end + + # Ensures that a broadcast must be in the correct format. + # + def test_valid_fails_with_bad_broadcast + @address.network_id = 1 + @address.broadcast = '-3.2.0.8' + + flunk "The broadcast address must be in the format ##.##.##.##." if @address.valid? + end + + # Ensures that a well-formed address is valid. + # + def test_valid + flunk "There is an error with validation." unless @address.valid? + end +end diff --git a/src/test/unit/ip_v6_address_test.rb b/src/test/unit/ip_v6_address_test.rb new file mode 100644 index 0000000..070f407 --- /dev/null +++ b/src/test/unit/ip_v6_address_test.rb @@ -0,0 +1,85 @@ +# +# Copyright (C) 2008 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. + +require File.dirname(__FILE__) + '/../test_helper' + +class IpV6AddressTest < ActiveSupport::TestCase + def setup + @address = IpV6Address.new(:address => 'fe80:0:0:0:200:f8ff:fe21:67cf', + :gateway => ':::::::717', + :prefix => '0000:0000:0000:0000:1234:1234:1234:1234') + end + + # Ensures that the address must be provided. + # + def test_valid_fails_without_address + @address.address = nil + flunk "An address must be provided." if @address.valid? + end + + # Ensures that the address must be in the correct format. + # + def test_valid_fails_with_bad_address + @address.address = "farkle" + + flunk "The address must be in the correct format." if @address.valid? + end + + # Ensures that the gateway must be provided. + # + def test_valid_fails_without_gateway + @address.network_id = 1 + @address.gateway = nil + + flunk "The gateway address must be provided." if @address.valid? + end + + # Ensures that the gateway address is in the correct format. + # + def test_valid_fails_with_bad_gateway + @address.network_id = 1 + @address.gateway = '0-:::::::717' + + flunk "The gateway address must be in the correct format." if @address.valid? + end + + # Ensures that the prefix must be provided. + # + def test_valid_fails_without_prefix + @address.network_id = 1 + @address.prefix = nil + + flunk "The prefix must be provided." if @address.valid? + end + + # Ensures that the prefix is in the correct format. + # + def test_valid_fails_with_invalid_prefix + @address.network_id = 1 + @address.prefix = 'whoops' + + flunk "The prefix must be in the correct format." if @address.valid? + end + + # Ensures that a well-formed address is considered valid. + # + def test_valid + flunk "There is an problem with address validation." unless @address.valid? + end +end diff --git a/src/test/unit/network_test.rb b/src/test/unit/network_test.rb new file mode 100644 index 0000000..64c5df4 --- /dev/null +++ b/src/test/unit/network_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class NetworkTest < ActiveSupport::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end diff --git a/src/test/unit/nic_test.rb b/src/test/unit/nic_test.rb index a0776a2..1de1e00 100644 --- a/src/test/unit/nic_test.rb +++ b/src/test/unit/nic_test.rb @@ -20,6 +20,7 @@ require File.dirname(__FILE__) + '/../test_helper' class NicTest < Test::Unit::TestCase + fixtures :ip_addresses fixtures :nics # Replace this with your real tests. diff --git a/src/test/unit/usage_test.rb b/src/test/unit/usage_test.rb new file mode 100644 index 0000000..9a8ec9b --- /dev/null +++ b/src/test/unit/usage_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class UsageTest < ActiveSupport::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end -- 1.5.6.5 From mmorsi at redhat.com Mon Nov 3 21:52:35 2008 From: mmorsi at redhat.com (Mohammed Morsi) Date: Mon, 3 Nov 2008 16:52:35 -0500 Subject: [Ovirt-devel] [PATCH server] network related fixes to tests and backend components Message-ID: <1225749155-26162-1-git-send-email-mmorsi@redhat.com> --- src/app/controllers/host_controller.rb | 9 +- src/host-browser/host-browser.rb | 19 ++-- src/lib/managed_node_configuration.rb | 14 ++- src/test/fixtures/bondings.yml | 6 +- src/test/fixtures/ip_addresses.yml | 61 +++++++++++ src/test/fixtures/networks.yml | 33 ++++++ src/test/fixtures/nics.yml | 108 +++++++++----------- src/test/fixtures/usages.yml | 7 ++ .../functional/managed_node_configuration_test.rb | 15 ++-- src/test/functional/network_controller_test.rb | 8 ++ src/test/functional/nic_controller_test.rb | 2 +- src/test/unit/bonding_test.rb | 11 +-- src/test/unit/ip_address_test.rb | 8 ++ src/test/unit/ip_v4_address_test.rb | 106 +++++++++++++++++++ src/test/unit/ip_v6_address_test.rb | 85 +++++++++++++++ src/test/unit/network_test.rb | 8 ++ src/test/unit/nic_test.rb | 1 + src/test/unit/usage_test.rb | 8 ++ 18 files changed, 410 insertions(+), 99 deletions(-) create mode 100644 src/test/fixtures/ip_addresses.yml create mode 100644 src/test/fixtures/networks.yml create mode 100644 src/test/fixtures/usages.yml create mode 100644 src/test/functional/network_controller_test.rb create mode 100644 src/test/unit/ip_address_test.rb create mode 100644 src/test/unit/ip_v4_address_test.rb create mode 100644 src/test/unit/ip_v6_address_test.rb create mode 100644 src/test/unit/network_test.rb create mode 100644 src/test/unit/usage_test.rb diff --git a/src/app/controllers/host_controller.rb b/src/app/controllers/host_controller.rb index f961d1a..da630f7 100644 --- a/src/app/controllers/host_controller.rb +++ b/src/app/controllers/host_controller.rb @@ -57,10 +57,11 @@ class HostController < ApplicationController flash[:notice] = 'You do not have permission to view this host: redirecting to top level' #perm errors for ajax should be done differently redirect_to :controller => 'dashboard', :action => 'list' - end - respond_to do |format| - format.html { render :layout => 'selection' } - format.xml { render :xml => @host.to_xml } + else + respond_to do |format| + format.html { render :layout => 'selection' } + format.xml { render :xml => @host.to_xml } + end end end diff --git a/src/host-browser/host-browser.rb b/src/host-browser/host-browser.rb index 79d34e8..52d2999 100755 --- a/src/host-browser/host-browser.rb +++ b/src/host-browser/host-browser.rb @@ -264,6 +264,13 @@ class HostBrowser host.cpus << detail end + # Create a new network for the host + boot_type = BootType.find_by_proto('dhcp') + network_name = (host.uuid ? host.uuid : "") + ' Physical Network' + network = PhysicalNetwork.create( + :name => network_name, + :boot_type_id => boot_type.id) + # Update the NIC details for this host: # -if the NIC exists, then update the IP address # -if the NIC does not exist, create it @@ -284,9 +291,6 @@ class HostBrowser updated_nic = Nic.find_by_id(nic.id) updated_nic.bandwidth = detail['BANDWIDTH'] - updated_nic.ip_addr = detail['IP_ADDRESS'] - updated_nic.netmask = detail['NETMASK'] - updated_nic.broadcast = detail['BROADCAST'] updated_nic.save! found=true @@ -302,18 +306,13 @@ class HostBrowser end # iterate over any nics left and create new records for them. - boot_type = BootType.find_by_proto('dhcp') - nic_info.collect do |nic| puts "Creating a new nic..." detail = Nic.new( 'mac' => nic['MAC'].upcase, 'bandwidth' => nic['BANDWIDTH'], - 'usage_type' => 1, - 'ip_addr' => nic['IP_ADDRESS'], - 'netmask' => nic['NETMASK'], - 'broadcast' => nic['BROADCAST'], - 'boot_type_id' => boot_type.id) + 'usage_type' => 1) + detail.physical_network = network host.nics << detail end diff --git a/src/lib/managed_node_configuration.rb b/src/lib/managed_node_configuration.rb index 101be9f..7cd2839 100644 --- a/src/lib/managed_node_configuration.rb +++ b/src/lib/managed_node_configuration.rb @@ -67,10 +67,11 @@ class ManagedNodeConfiguration host.bondings.each do |bonding| entry = "ifcfg=none|#{bonding.interface_name}|BONDING_OPTS=\"mode=#{bonding.bonding_type.mode} miimon=100\"" - if bonding.ip_addr == nil || bonding.ip_addr.empty? + if bonding.ip_addresses.empty? entry += "|BOOTPROTO=dhcp" else - entry += "|BOOTPROTO=static|IPADDR=#{bonding.ip_addr}|NETMASK=#{bonding.netmask}|BROADCAST=#{bonding.broadcast}" + ip = bonding.ip_addresses[0] + entry += "|BOOTPROTO=static|IPADDR=#{ip.address}|NETMASK=#{ip.netmask}|BROADCAST=#{ip.broadcast}" end result.puts "#{entry}|ONBOOT=yes" @@ -84,7 +85,7 @@ class ManagedNodeConfiguration host.nics.each do |nic| # only process this nic if it doesn't have a bonding # TODO remove the hack to force a bridge into the picture - if nic.bonding.empty? + if nic.bondings.empty? process_nic result, nic, macs, nil, false, true # TODO remove this when bridges are properly supported @@ -110,8 +111,11 @@ class ManagedNodeConfiguration if bonding entry += "|MASTER=#{bonding.interface_name}|SLAVE=yes" else - entry += "|BOOTPROTO=#{nic.boot_type.proto}" - entry += "|IPADDR=#{nic.ip_addr}|NETMASK=#{nic.netmask}|BROADCAST=#{nic.broadcast}" if nic.boot_type.proto == 'static' + entry += "|BOOTPROTO=#{nic.physical_network.boot_type.proto}" + if nic.physical_network.boot_type.proto == 'static' + ip = nic.ip_addresses[0] + entry += "|IPADDR=#{ip.address}|NETMASK=#{ip.netmask}|BROADCAST=#{ip.broadcast}" + end entry += "|BRIDGE=#{nic.bridge}" if nic.bridge && !is_bridge entry += "|BRIDGE=ovirtbr0" if !nic.bridge && !is_bridge entry += "|TYPE=bridge" if is_bridge diff --git a/src/test/fixtures/bondings.yml b/src/test/fixtures/bondings.yml index 227b92b..ee1939d 100644 --- a/src/test/fixtures/bondings.yml +++ b/src/test/fixtures/bondings.yml @@ -3,15 +3,13 @@ mailservers_managed_node_bonding: interface_name: mailbonding0 bonding_type_id: <%= Fixtures.identify(:link_aggregation_bonding_type) %> host_id: <%= Fixtures.identify(:mailservers_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> - ip_addr: 172.31.0.15 - netmask: 255.255.255. - broadcast: 172.31.0.255 arp_ping_address: 172.31.0.100 arp_interval: 0 + vlan_id: <%= Fixtures.identify(:dhcp_vlan_one) %> mediaserver_managed_node_bonding: name: Fileserver Network interface_name: mediabonding0 bonding_type_id: <%= Fixtures.identify(:link_aggregation_bonding_type) %> host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> + vlan_id: <%= Fixtures.identify(:dhcp_vlan_one) %> diff --git a/src/test/fixtures/ip_addresses.yml b/src/test/fixtures/ip_addresses.yml new file mode 100644 index 0000000..aed3811 --- /dev/null +++ b/src/test/fixtures/ip_addresses.yml @@ -0,0 +1,61 @@ +ip_v4_one: + nic_id: <%= Fixtures.identify(:nic_one) %> + type: IpV4Address + address: 1.2.3.4 + netmask: 255.255.255.0 + gateway: 1.2.3.1 + broadcast: 1.2.3.255 + +ip_v4_two: + nic_id: <%= Fixtures.identify(:nic_two) %> + type: IpV4Address + address: 2.3.4.5 + netmask: 255.255.255.0 + gateway: 1.2.3.1 + broadcast: 2.3.4.255 + +ip_v4_three: + nic_id: <%= Fixtures.identify(:nic_three) %> + type: IpV4Address + address: 3.4.5.6 + netmask: 255.255.255.0 + gateway: 3.4.5.1 + broadcast: 3.4.5.255 + +ip_v4_four: + nic_id: <%= Fixtures.identify(:nic_four) %> + type: IpV4Address + address: 3.4.5.6 + netmask: 255.255.255.0 + gateway: 3.4.5.1 + broadcast: 3.4.5.255 + +ip_v4_mailserver_nic_one: + nic_id: <%= Fixtures.identify(:mailserver_nic_one) %> + type: IpV4Address + address: 172.31.0.15 + netmask: 255.255.255.0 + gateway: 172.31.0.1 + broadcast: 172.31.0.255 + +ip_v4_ldapserver_nic_one: + nic_id: <%= Fixtures.identify(:ldapserver_nic_one) %> + type: IpV4Address + address: 172.31.0.25 + gateway: 172.31.0.1 + +ip_v4_buildserver_nic_one: + nic_id: <%= Fixtures.identify(:buildserver_nic_two) %> + type: IpV4Address + address: 172.31.0.31 + netmask: 255.255.255.0 + gateway: 172.31.0.1 + broadcast: 172.31.0.255 + +ip_v4_mailservers_managed_node_bonding: + bonding_id: <%= Fixtures.identify(:mailservers_managed_node_bonding) %> + type: IpV4Address + address: 192.168.50.100 + netmask: 255.255.255.0 + gateway: 192.168.50.1 + broadcast: 192.168.50.255 diff --git a/src/test/fixtures/networks.yml b/src/test/fixtures/networks.yml new file mode 100644 index 0000000..cb50c0c --- /dev/null +++ b/src/test/fixtures/networks.yml @@ -0,0 +1,33 @@ +static_vlan_one: + type: 'Vlan' + name: 'Static Vlan 1' + boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + number: 1 + +dhcp_vlan_one: + type: 'Vlan' + name: 'DHCP Vlan 1' + boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + number: 2 + +bootp_vlan_one: + type: 'Vlan' + name: 'BOOTP Vlan 1' + boot_type_id: <%= Fixtures.identify(:boot_type_bootp) %> + number: 3 + +static_physical_network_one: + type: 'PhysicalNetwork' + name: 'Static Physical Network 1' + boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + +dhcp_physical_network_one: + type: 'PhysicalNetwork' + name: 'DHCP Physical Network 1' + boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + +bootp_physical_network_one: + type: 'PhysicalNetwork' + name: 'BOOTP Physical Network 1' + boot_type_id: <%= Fixtures.identify(:boot_type_bootp) %> + diff --git a/src/test/fixtures/nics.yml b/src/test/fixtures/nics.yml index 5b2cecc..7f65ef6 100644 --- a/src/test/fixtures/nics.yml +++ b/src/test/fixtures/nics.yml @@ -1,94 +1,84 @@ -one: +nic_one: id: 1 mac: '00:11:22:33:44:55' - ip_addr: '1.2.3.4' - usage_type: '1' bandwidth: 100 host_id: 10 - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> -two: + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> +nic_two: id: 2 mac: 'AA:BB:CC:DD:EE:FF' - ip_addr: '2.3.4.5' usage_type: '2' bandwidth: 1000 host_id: 10 - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> -three: + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> +nic_three: id: 3 mac: '00:FF:11:EE:22:DD' - ip_addr: '3.4.5.6' usage_type: '1' bandwidth: 10 host_id: 10 - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> -four: + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> +nic_four: id: 4 mac: '00:FF:11:EE:22:DD' - ip_addr: '3.4.5.6' usage_type: '1' bandwidth: 10 host_id: 10 - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> mailserver_nic_one: - mac: '00:11:22:33:44:55' - usage_type: '1' - bandwidth: 100 - ip_addr: '172.31.0.15' - host_id: <%= Fixtures.identify(:mailservers_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + mac: '00:11:22:33:44:55' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:mailservers_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> mailserver_nic_two: - mac: '22:11:33:66:44:55' - usage_type: '1' - bandwidth: 100 - host_id: <%= Fixtures.identify(:mailservers_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + mac: '22:11:33:66:44:55' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:mailservers_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> fileserver_nic_one: - mac: '00:99:00:99:13:07' - usage_type: '1' - bandwidth: 100 - host_id: <%= Fixtures.identify(:fileserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + mac: '00:99:00:99:13:07' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:fileserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> ldapserver_nic_one: - mac: '00:03:02:00:09:06' - usage_type: '1' - bandwidth: 100 - bridge: 'ovirtbr0' - ip_addr: '172.31.0.25' - host_id: <%= Fixtures.identify(:ldapserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + mac: '00:03:02:00:09:06' + usage_type: '1' + bandwidth: 100 + bridge: 'ovirtbr0' + host_id: <%= Fixtures.identify(:ldapserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:static_physical_network_one) %> buildserver_nic_one: - mac: '07:17:19:65:03:38' - usage_type: '1' - bandwidth: 100 - host_id: <%= Fixtures.identify(:buildserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + mac: '07:17:19:65:03:38' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:buildserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> buildserver_nic_two: - mac: '07:17:19:65:03:39' - usage_type: '1' - bandwidth: 100 - ip_addr: '172.31.0.31' - netmask: '255.255.255.0' - broadcast: '172.31.0.255' - host_id: <%= Fixtures.identify(:buildserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + mac: '07:17:19:65:03:39' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:buildserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:static_physical_network_one) %> mediaserver_nic_one: - mac: '07:17:19:65:03:32' - usage_type: '1' - bandwidth: 100 - host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + mac: '07:17:19:65:03:32' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> mediaserver_nic_two: - mac: '07:17:19:65:03:31' - usage_type: '1' - bandwidth: 100 - host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + mac: '07:17:19:65:03:31' + usage_type: '1' + bandwidth: 100 + host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> + physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> diff --git a/src/test/fixtures/usages.yml b/src/test/fixtures/usages.yml new file mode 100644 index 0000000..5bf0293 --- /dev/null +++ b/src/test/fixtures/usages.yml @@ -0,0 +1,7 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html + +# one: +# column: value +# +# two: +# column: value diff --git a/src/test/functional/managed_node_configuration_test.rb b/src/test/functional/managed_node_configuration_test.rb index 14c9736..517f819 100644 --- a/src/test/functional/managed_node_configuration_test.rb +++ b/src/test/functional/managed_node_configuration_test.rb @@ -30,6 +30,8 @@ class ManagedNodeConfigurationTest < Test::Unit::TestCase fixtures :boot_types fixtures :hosts fixtures :nics + fixtures :networks + fixtures :ip_addresses def setup @host_with_dhcp_card = hosts(:fileserver_managed_node) @@ -65,8 +67,8 @@ ifcfg=#{nic.mac}|ovirtbr0|BOOTPROTO=dhcp|TYPE=bridge|ONBOOT=yes expected = <<-HERE # THIS FILE IS GENERATED! -ifcfg=#{nic.mac}|eth0|BOOTPROTO=#{nic.boot_type.proto}|IPADDR=#{nic.ip_addr}|NETMASK=#{nic.netmask}|BROADCAST=#{nic.broadcast}|BRIDGE=#{nic.bridge}|ONBOOT=yes -ifcfg=#{nic.mac}|ovirtbr0|BOOTPROTO=#{nic.boot_type.proto}|IPADDR=#{nic.ip_addr}|NETMASK=|BROADCAST=#{nic.netmask}|TYPE=bridge|ONBOOT=yes +ifcfg=#{nic.mac}|eth0|BOOTPROTO=#{nic.physical_network.boot_type.proto}|IPADDR=#{nic.ip_addresses.first.address}|NETMASK=#{nic.ip_addresses.first.netmask}|BROADCAST=#{nic.ip_addresses.first.broadcast}|BRIDGE=#{nic.bridge}|ONBOOT=yes +ifcfg=#{nic.mac}|ovirtbr0|BOOTPROTO=#{nic.physical_network.boot_type.proto}|IPADDR=#{nic.ip_addresses.first.address}|NETMASK=|BROADCAST=#{nic.ip_addresses.first.netmask}|TYPE=bridge|ONBOOT=yes HERE result = ManagedNodeConfiguration.generate( @@ -85,9 +87,9 @@ ifcfg=#{nic.mac}|ovirtbr0|BOOTPROTO=#{nic.boot_type.proto}|IPADDR=#{nic.ip_addr} expected = <<-HERE # THIS FILE IS GENERATED! -ifcfg=#{nic1.mac}|eth0|BOOTPROTO=#{nic1.boot_type.proto}|IPADDR=#{nic1.ip_addr}|NETMASK=#{nic1.netmask}|BROADCAST=#{nic1.broadcast}|BRIDGE=ovirtbr0|ONBOOT=yes -ifcfg=#{nic1.mac}|ovirtbr0|BOOTPROTO=#{nic1.boot_type.proto}|IPADDR=#{nic1.ip_addr}|NETMASK=#{nic1.netmask}|BROADCAST=#{nic1.broadcast}|TYPE=bridge|ONBOOT=yes -ifcfg=#{nic2.mac}|eth1|BOOTPROTO=#{nic2.boot_type.proto}|BRIDGE=ovirtbr0|ONBOOT=yes +ifcfg=#{nic1.mac}|eth0|BOOTPROTO=#{nic1.physical_network.boot_type.proto}|IPADDR=#{nic1.ip_addresses.first.address}|NETMASK=#{nic1.ip_addresses.first.netmask}|BROADCAST=#{nic1.ip_addresses.first.broadcast}|BRIDGE=ovirtbr0|ONBOOT=yes +ifcfg=#{nic1.mac}|ovirtbr0|BOOTPROTO=#{nic1.physical_network.boot_type.proto}|IPADDR=#{nic1.ip_addresses.first.address}|NETMASK=#{nic1.ip_addresses.first.netmask}|BROADCAST=#{nic1.ip_addresses.first.broadcast}|TYPE=bridge|ONBOOT=yes +ifcfg=#{nic2.mac}|eth1|BOOTPROTO=#{nic2.physical_network.boot_type.proto}|BRIDGE=ovirtbr0|ONBOOT=yes HERE result = ManagedNodeConfiguration.generate( @@ -112,7 +114,7 @@ ifcfg=#{nic2.mac}|eth1|BOOTPROTO=#{nic2.boot_type.proto}|BRIDGE=ovirtbr0|ONBOOT= expected = <<-HERE # THIS FILE IS GENERATED! bonding=#{bonding.interface_name} -ifcfg=none|#{bonding.interface_name}|BONDING_OPTS="mode=#{bonding.bonding_type.mode} miimon=100"|BOOTPROTO=static|IPADDR=#{bonding.ip_addr}|NETMASK=#{bonding.netmask}|BROADCAST=#{bonding.broadcast}|ONBOOT=yes +ifcfg=none|#{bonding.interface_name}|BONDING_OPTS="mode=#{bonding.bonding_type.mode} miimon=100"|BOOTPROTO=static|IPADDR=#{bonding.ip_addresses.first.address}|NETMASK=#{bonding.ip_addresses.first.netmask}|BROADCAST=#{bonding.ip_addresses.first.broadcast}|ONBOOT=yes ifcfg=#{nic1.mac}|eth0|MASTER=#{bonding.interface_name}|SLAVE=yes|ONBOOT=yes ifcfg=#{nic2.mac}|eth1|MASTER=#{bonding.interface_name}|SLAVE=yes|ONBOOT=yes HERE @@ -132,7 +134,6 @@ HERE def test_generate_with_dhcp_bonding bonding = @host_with_dhcp_bondings.bondings.first - bonding.ip_addr=nil nic1 = bonding.nics[0] nic2 = bonding.nics[1] diff --git a/src/test/functional/network_controller_test.rb b/src/test/functional/network_controller_test.rb new file mode 100644 index 0000000..8ca4094 --- /dev/null +++ b/src/test/functional/network_controller_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class NetworkControllerTest < ActionController::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end diff --git a/src/test/functional/nic_controller_test.rb b/src/test/functional/nic_controller_test.rb index 4ae1f8d..3405c80 100644 --- a/src/test/functional/nic_controller_test.rb +++ b/src/test/functional/nic_controller_test.rb @@ -31,7 +31,7 @@ class NicControllerTest < Test::Unit::TestCase @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @first_id = nics(:one).id + @first_id = nics(:nic_one).id end def test_show diff --git a/src/test/unit/bonding_test.rb b/src/test/unit/bonding_test.rb index fbcb138..8b90cd5 100644 --- a/src/test/unit/bonding_test.rb +++ b/src/test/unit/bonding_test.rb @@ -26,14 +26,15 @@ class BondingTest < ActiveSupport::TestCase fixtures :boot_types fixtures :hosts fixtures :nics + fixtures :networks def setup @bonding = Bonding.new( :name => 'Bonding1', :interface_name => 'bond0', :bonding_type_id => bonding_types(:failover_bonding_type), - :boot_type_id => boot_types(:boot_type_dhcp), :host_id => hosts(:mailservers_managed_node)) + @bonding.vlan = networks(:dhcp_vlan_one) end # Ensures that the name is required. @@ -52,14 +53,6 @@ class BondingTest < ActiveSupport::TestCase flunk 'Bondings have to have an interface name.' if @bonding.valid? end - # Ensures that the bonding requires a boot type. - # - def test_valid_fails_without_boot_type - @bonding.boot_type_id = nil - - flunk 'Bondings have to have a boot type.' if @bonding.valid? - end - # Ensures that the bonding type is required. # def test_valid_fails_without_type diff --git a/src/test/unit/ip_address_test.rb b/src/test/unit/ip_address_test.rb new file mode 100644 index 0000000..152578e --- /dev/null +++ b/src/test/unit/ip_address_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class IpAddressTest < ActiveSupport::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end diff --git a/src/test/unit/ip_v4_address_test.rb b/src/test/unit/ip_v4_address_test.rb new file mode 100644 index 0000000..65a08d3 --- /dev/null +++ b/src/test/unit/ip_v4_address_test.rb @@ -0,0 +1,106 @@ +# +# Copyright (C) 2008 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. + +require File.dirname(__FILE__) + '/../test_helper' + +class IpV4AddressTest < ActiveSupport::TestCase + def setup + @address = IpV4Address.new(:address => '192.168.50.2', + :netmask => '255.255.255.0', + :gateway => '192.168.50.1', + :broadcast => '192.168.50.255') + end + + # Ensures that an address must be supplied. + # + def test_valid_fails_without_address + @address.address = nil + + flunk "An address must be present." if @address.valid? + end + + # Ensures that an address has to be in the correct format. + # + def test_valid_fails_with_bad_address + @address.address = '192.168' + + flunk "An address must be in the format ##.##.##.##." if @address.valid? + end + + # Ensures that a netmask must be supplied. + # + def test_valid_fails_without_netmask + @address.network_id = 1 + @address.netmask = nil + + flunk "An address must have a netmask." if @address.valid? + end + + # Ensures that a netmask must have the correct format. + # + def test_valid_fails_with_bad_netmask + @address.network_id = 1 + @address.netmask = 'farkle' + + flunk "A netmask must be in the format ##.##.##.##." if @address.valid? + end + + # Ensures that a gateway must be supplied. + # + def test_valid_fails_without_gateway + @address.network_id = 1 + @address.gateway = nil + + flunk "A gateway address must be supplied." if @address.valid? + end + + # Ensures that a gateway must be in the correct format. + # + def test_valid_fails_with_bad_gateway + @address.network_id = 1 + @address.gateway = '-3.a2.0.8' + + + flunk "The gateway address must be in the format ##.##.##.##." if @address.valid? + end + + # Ensures that a broadcast must be supplied. + # + def test_valid_fails_without_broadcast + @address.network_id = 1 + @address.broadcast = nil + + flunk "A broadcast addres must be supplied." if @address.valid? + end + + # Ensures that a broadcast must be in the correct format. + # + def test_valid_fails_with_bad_broadcast + @address.network_id = 1 + @address.broadcast = '-3.2.0.8' + + flunk "The broadcast address must be in the format ##.##.##.##." if @address.valid? + end + + # Ensures that a well-formed address is valid. + # + def test_valid + flunk "There is an error with validation." unless @address.valid? + end +end diff --git a/src/test/unit/ip_v6_address_test.rb b/src/test/unit/ip_v6_address_test.rb new file mode 100644 index 0000000..070f407 --- /dev/null +++ b/src/test/unit/ip_v6_address_test.rb @@ -0,0 +1,85 @@ +# +# Copyright (C) 2008 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. + +require File.dirname(__FILE__) + '/../test_helper' + +class IpV6AddressTest < ActiveSupport::TestCase + def setup + @address = IpV6Address.new(:address => 'fe80:0:0:0:200:f8ff:fe21:67cf', + :gateway => ':::::::717', + :prefix => '0000:0000:0000:0000:1234:1234:1234:1234') + end + + # Ensures that the address must be provided. + # + def test_valid_fails_without_address + @address.address = nil + flunk "An address must be provided." if @address.valid? + end + + # Ensures that the address must be in the correct format. + # + def test_valid_fails_with_bad_address + @address.address = "farkle" + + flunk "The address must be in the correct format." if @address.valid? + end + + # Ensures that the gateway must be provided. + # + def test_valid_fails_without_gateway + @address.network_id = 1 + @address.gateway = nil + + flunk "The gateway address must be provided." if @address.valid? + end + + # Ensures that the gateway address is in the correct format. + # + def test_valid_fails_with_bad_gateway + @address.network_id = 1 + @address.gateway = '0-:::::::717' + + flunk "The gateway address must be in the correct format." if @address.valid? + end + + # Ensures that the prefix must be provided. + # + def test_valid_fails_without_prefix + @address.network_id = 1 + @address.prefix = nil + + flunk "The prefix must be provided." if @address.valid? + end + + # Ensures that the prefix is in the correct format. + # + def test_valid_fails_with_invalid_prefix + @address.network_id = 1 + @address.prefix = 'whoops' + + flunk "The prefix must be in the correct format." if @address.valid? + end + + # Ensures that a well-formed address is considered valid. + # + def test_valid + flunk "There is an problem with address validation." unless @address.valid? + end +end diff --git a/src/test/unit/network_test.rb b/src/test/unit/network_test.rb new file mode 100644 index 0000000..64c5df4 --- /dev/null +++ b/src/test/unit/network_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class NetworkTest < ActiveSupport::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end diff --git a/src/test/unit/nic_test.rb b/src/test/unit/nic_test.rb index a0776a2..1de1e00 100644 --- a/src/test/unit/nic_test.rb +++ b/src/test/unit/nic_test.rb @@ -20,6 +20,7 @@ require File.dirname(__FILE__) + '/../test_helper' class NicTest < Test::Unit::TestCase + fixtures :ip_addresses fixtures :nics # Replace this with your real tests. diff --git a/src/test/unit/usage_test.rb b/src/test/unit/usage_test.rb new file mode 100644 index 0000000..9a8ec9b --- /dev/null +++ b/src/test/unit/usage_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class UsageTest < ActiveSupport::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end -- 1.5.6.5 From jguiditt at redhat.com Mon Nov 3 22:24:46 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Mon, 03 Nov 2008 17:24:46 -0500 Subject: [Ovirt-devel] [PATCH] lvm storage volume HW pool admin tab. In-Reply-To: <1225410795-2680-1-git-send-email-sseago@redhat.com> References: <1225410795-2680-1-git-send-email-sseago@redhat.com> Message-ID: <1225751086.3652.3.camel@physical.priv.ovirt.org> On Thu, 2008-10-30 at 23:53 +0000, Scott Seago wrote: > Includes 'view storage volume' facebox popup and new/delete LVM volume functionality. Although lvm tasks are created, taskomatic doesn't yet know what to do with them. > > Signed-off-by: Scott Seago > --- > src/app/controllers/hardware_controller.rb | 5 +- > src/app/controllers/storage_controller.rb | 180 +++++++++++++++++++++++++- > src/app/controllers/task_controller.rb | 2 + > src/app/models/lvm_storage_pool.rb | 5 + > src/app/models/storage_volume_task.rb | 3 +- > src/app/views/storage/_lvm_volume_form.rhtml | 19 +++ > src/app/views/storage/new_lvm_volume.rhtml | 42 ++++++ > src/app/views/storage/show.rhtml | 63 +++++---- > src/app/views/storage/show_volume.rhtml | 169 +++++++++++++++++------- > 9 files changed, 404 insertions(+), 84 deletions(-) > create mode 100644 src/app/views/storage/_lvm_volume_form.rhtml > create mode 100644 src/app/views/storage/new_lvm_volume.rhtml > > diff --git a/src/app/controllers/hardware_controller.rb b/src/app/controllers/hardware_controller.rb > index 4f24cb3..8c26184 100644 > --- a/src/app/controllers/hardware_controller.rb > +++ b/src/app/controllers/hardware_controller.rb > @@ -117,7 +117,8 @@ class HardwareController < PoolController > def show_tasks > @task_types = [["VM Task", "VmTask"], > ["Host Task", "HostTask"], > - ["Storage Task", "StorageTask", "break"], > + ["Storage Task", "StorageTask"], > + ["Storage Volume Task", "StorageVolumeTask", "break"], > ["Show All", ""]] > super > end > @@ -162,7 +163,7 @@ class HardwareController < PoolController > if params[:id] > pre_show > storage_pools = @pool.storage_pools > - find_opts = {} > + find_opts = {:conditions => "type != 'LvmStoragePool'"} > include_pool = false > else > # FIXME: no permissions or usage checks here yet > diff --git a/src/app/controllers/storage_controller.rb b/src/app/controllers/storage_controller.rb > index fe524f3..75058cd 100644 > --- a/src/app/controllers/storage_controller.rb > +++ b/src/app/controllers/storage_controller.rb > @@ -25,6 +25,7 @@ class StorageController < ApplicationController > before_filter :pre_pool_admin, :only => [:refresh] > before_filter :pre_new2, :only => [:new2] > before_filter :pre_json, :only => [:storage_volumes_json] > + before_filter :pre_create_volume, :only => [:create_volume] > > def index > list > @@ -90,15 +91,25 @@ class StorageController < ApplicationController > flash[:notice] = 'You do not have permission to view this storage pool: redirecting to top level' > redirect_to :controller => 'dashboard' > end > - json_list(@storage_pool.storage_volumes, > - [:display_name, :size_in_gb, :get_type_label]) > + attr_list = [] > + attr_list << :id if (@storage_pool.user_subdividable and @can_modify) > + attr_list += [:display_name, :size_in_gb, :get_type_label] > + json_list(@storage_pool.storage_volumes, attr_list) > end > def show_volume > @storage_volume = StorageVolume.find(params[:id]) > set_perms(@storage_volume.storage_pool.hardware_pool) > unless @can_view > flash[:notice] = 'You do not have permission to view this storage volume: redirecting to top level' > - redirect_to :controller => 'dashboard' > + respond_to do |format| > + format.html { redirect_to :controller => 'dashboard' } > + format.xml { head :forbidden } > + end > + else > + respond_to do |format| > + format.html { render :layout => 'popup' } > + format.xml { render :xml => @storage_volume.to_xml } > + end > end > end > > @@ -110,6 +121,70 @@ class StorageController < ApplicationController > render :layout => false > end > > + def new_volume > + new_volume_internal(StoragePool.find(params[:storage_pool_id]), > + { :storage_pool_id => params[:storage_pool_id]}) > + render :layout => 'popup' > + end > + > + def new_lvm_volume > + @source_volume = StorageVolume.find(params[:source_volume_id]) > + @return_facebox = params[:return_facebox] > + unless @source_volume.supports_lvm_subdivision > + #fixme: proper error page for popups > + redirect_to :controller => 'dashboard' > + return > + end > + lvm_pool = @source_volume.lvm_storage_pool > + unless lvm_pool > + # FIXME: what should we do about VG/LV names? > + # for now auto-create VG name as ovirt_vg_#{@source_volume.id} > + lvm_pool = LvmStoragePool.new(:vg_name => "ovirt_vg_#{@source_volume.id}", > + :hardware_pool_id => @source_volume.storage_pool.hardware_pool_id) > + lvm_pool.source_volumes << @source_volume > + lvm_pool.save! > + end > + new_volume_internal(lvm_pool, { :storage_pool_id => lvm_pool.id}) > + @storage_volume.lv_owner_perms='0744' > + @storage_volume.lv_group_perms='0744' > + @storage_volume.lv_mode_perms='0744' > + render :layout => 'popup' > + end > + > + def create_volume > + begin > + StorageVolume.transaction do > + @storage_volume.save! > + @task = StorageVolumeTask.new({ :user => @user, > + :task_target => @storage_volume, > + :action => StorageVolumeTask::ACTION_CREATE_VOLUME, > + :state => Task::STATE_QUEUED}) > + @task.save! > + end > + respond_to do |format| > + format.json { render :json => { :object => "storage_volume", > + :success => true, > + :alert => "Storage Volume was successfully created." } } > + format.xml { render :xml => @storage_volume, > + :status => :created, > + # FIXME: create storage_volume_url method if relevant > + :location => storage_pool_url(@storage_volume) > + } > + end > + rescue => ex > + # FIXME: need to distinguish volume vs. task save errors > + respond_to do |format| > + format.json { > + json_hash = { :object => "storage_volume", :success => false, > + :errors => @storage_volume.errors.localize_error_messages.to_a } > + json_hash[:message] = ex.message if json_hash[:errors].empty? > + render :json => json_hash } > + format.xml { render :xml => @storage_volume.errors, > + :status => :unprocessable_entity } > + end > + end > + end > + > def insert_refresh_task > @task = StorageTask.new({ :user => @user, > :task_target => @storage_pool, > @@ -244,6 +319,67 @@ class StorageController < ApplicationController > end > end > > + def delete_volumes > + storage_volume_ids_str = params[:storage_volume_ids] > + storage_volume_ids = storage_volume_ids_str.split(",").collect {|x| x.to_i} > + alerts = [] > + status = true > + begin > + StorageVolume.transaction do > + storage = StorageVolume.find(:all, :conditions => "id in (#{storage_volume_ids.join(', ')})") > + unless storage.empty? > + set_perms(storage[0].storage_pool.hardware_pool) > + unless @can_modify and storage[0].storage_pool.user_subdividable > + respond_to do |format| > + format.json { render :json => { :object => "storage_volume", > + :success => false, > + :alert => "You do not have permission to delete this storage volume." } } > + format.xml { head :forbidden } > + end > + else > + storage.each do |storage_volume| > + alert, success = delete_volume_internal(storage_volume) > + alerts << alert > + status = false unless success > + end > + respond_to do |format| > + format.json { render :json => { :object => "storage_volume", > + :success => status, :alert => alerts.join("\n") } } > + format.xml { head(status ? :ok : :method_not_allowed) } > + end > + end > + else > + respond_to do |format| > + format.json { render :json => { :object => "storage_volume", > + :success => false, :alert => "no volumes selected" } } > + format.xml { head(status ? :ok : :method_not_allowed) } > + end > + end > + end > + end > + end > + > + def delete_volume > + @storage_volume = StorageVolume.find(params[:id]) > + set_perms(@storage_volume.storage_pool.hardware_pool) > + unless @can_modify and @storage_volume.storage_pool.user_subdividable > + respond_to do |format| > + format.json { render :json => { :object => "storage_volume", > + :success => false, > + :alert => "You do not have permission to delete this storage volume." } } > + format.xml { head :forbidden } > + end > + else > + alert, success = delete_volume_internal(@storage_volume) > + respond_to do |format| > + format.json { render :json => { :object => "storage_volume", > + :success => success, :alert => alert } } > + format.xml { head(success ? :ok : :method_not_allowed) } > + end > + end > + > + end > + > def pre_new > @hardware_pool = HardwarePool.find(params[:hardware_pool_id]) > @perm_obj = @hardware_pool > @@ -274,6 +410,16 @@ class StorageController < ApplicationController > @perm_obj = @storage_pool.hardware_pool > @redir_obj = @storage_pool > end > + def pre_create_volume > + volume = params[:storage_volume] > + unless type = params[:storage_type] > + type = volume.delete(:storage_type) > + end > + @storage_volume = StorageVolume.factory(type, volume) > + @perm_obj = @storage_volume.storage_pool.hardware_pool > + @redir_controller = @storage_volume.storage_pool.hardware_pool.get_controller > + authorize_admin > + end > def pre_json > pre_show > end > @@ -282,4 +428,32 @@ class StorageController < ApplicationController > authorize_admin > end > > + private > + def new_volume_internal(storage_pool, new_params) > + @storage_volume = StorageVolume.factory(storage_pool.get_type_label, new_params) > + @perm_obj = @storage_volume.storage_pool.hardware_pool > + authorize_admin > + end > + > + def delete_volume_internal(volume) > + begin > + name = volume.display_name > + if !volume.vms.empty? > + vm_list = volume.vms.collect {|vm| vm.description}.join(", ") > + ["Storage Volume #{name} must be unattached from VMs (#{vm_list}) before deleting it.", > + false] > + #FIXME: create delete volume task. include metadata in task > + else > + #FIXME: need to set volume to 'unavailable' state once we have states > + @task = StorageVolumeTask.new({ :user => @user, > + :task_target => volume, > + :action => StorageVolumeTask::ACTION_DELETE_VOLUME, > + :state => Task::STATE_QUEUED}) > + @task.save! > + ["Storage Volume #{name} deletion was successfully queued.", true] > + end > + rescue => ex > + ["Failed to delete storage volume #{name} (#{ex.message}.",false] > + end > + end > end > diff --git a/src/app/controllers/task_controller.rb b/src/app/controllers/task_controller.rb > index 73e5155..647d69c 100644 > --- a/src/app/controllers/task_controller.rb > +++ b/src/app/controllers/task_controller.rb > @@ -24,6 +24,8 @@ class TaskController < ApplicationController > set_perms(@task.vm.vm_resource_pool) > elsif @task[:type] == StorageTask.name > set_perms(@task.storage_pool.hardware_pool) > + elsif @task[:type] == StorageVolumeTask.name > + set_perms(@task.storage_volume.storage_pool.hardware_pool) > elsif @task[:type] == HostTask.name > set_perms(@task.host.hardware_pool) > end > diff --git a/src/app/models/lvm_storage_pool.rb b/src/app/models/lvm_storage_pool.rb > index 08b8938..84fbb28 100644 > --- a/src/app/models/lvm_storage_pool.rb > +++ b/src/app/models/lvm_storage_pool.rb > @@ -44,5 +44,10 @@ class LvmStoragePool < StoragePool > kb_to_gb(size) > end > > + # FIXME: needs to take free space into account here > + def user_subdividable > + true > + end > + > > end > diff --git a/src/app/models/storage_volume_task.rb b/src/app/models/storage_volume_task.rb > index 78f2895..136f1ba 100644 > --- a/src/app/models/storage_volume_task.rb > +++ b/src/app/models/storage_volume_task.rb > @@ -20,7 +20,7 @@ > class StorageVolumeTask < Task > > ACTION_CREATE_VOLUME = "create_volume" > - ACTION_EDIT_VOLUME = "edit_volume" > + ACTION_DELETE_VOLUME = "delete_volume" > > def after_initialize > self.hardware_pool = task_target.storage_pool.hardware_pool if self.task_target_type=="StorageVolume" > @@ -29,7 +29,6 @@ class StorageVolumeTask < Task > def task_obj > "StorageVolume;;;#{self.storage_volume.id};;;#{self.storage_volume.display_name}" > end > - end > def host > nil > end > diff --git a/src/app/views/storage/_lvm_volume_form.rhtml b/src/app/views/storage/_lvm_volume_form.rhtml > new file mode 100644 > index 0000000..823158e > --- /dev/null > +++ b/src/app/views/storage/_lvm_volume_form.rhtml > @@ -0,0 +1,19 @@ > +<%= error_messages_for 'storage_volume' %> > + > + > +<%= hidden_field 'storage_volume', 'storage_pool_id' %> > +<%= hidden_field_tag 'storage_type', @storage_volume.get_type_label %> > + > +<%= text_field_with_label "Size (GB):", 'storage_volume', 'size_in_gb' %> > + > +<%= text_field_with_label "LV Name:", 'storage_volume', 'lv_name' %> > + > +<%= text_field_with_label "Owner permissions:", 'storage_volume', 'lv_owner_perms' %> > + > +<%= text_field_with_label "Group permissions:", 'storage_volume', 'lv_group_perms' %> > + > +<%= text_field_with_label "Mode permissions:", 'storage_volume', 'lv_mode_perms' %> > + > + > + > + > diff --git a/src/app/views/storage/new_lvm_volume.rhtml b/src/app/views/storage/new_lvm_volume.rhtml > new file mode 100644 > index 0000000..ea51cc5 > --- /dev/null > +++ b/src/app/views/storage/new_lvm_volume.rhtml > @@ -0,0 +1,42 @@ > +<%- content_for :title do -%> > + <%= _("Add New LVM Volume") %> > +<%- end -%> > +<%- content_for :description do -%> > + Add a new LVM Storage Volume to <%= @source_volume.display_name %>. > +<%- end -%> > +
> +
> +
> +
> +
> + <%= render :partial => 'lvm_volume_form' %> > +
> +
> + > + <%= popup_footer("$('#lvm_volume_form').submit()", "New LVM Volume") %> > +
> +
> + > diff --git a/src/app/views/storage/show.rhtml b/src/app/views/storage/show.rhtml > index 82c9dab..a84dc62 100644 > --- a/src/app/views/storage/show.rhtml > +++ b/src/app/views/storage/show.rhtml > @@ -18,24 +18,24 @@ > > >
> - IP address:
> + IP address:
> <% if @storage_pool[:type] == "IscsiStoragePool" %> > - Port:
> - Target:
> + Port:
> + Target:
> <% elsif @storage_pool[:type] == "NfsStoragePool" %> > - Export path:
> + Export path:
> <% end %> > - Type:
> + Type:
>
>
> - <%=h @storage_pool.ip_addr %>
> + <%=h @storage_pool.ip_addr %>
> <% if @storage_pool[:type] == "IscsiStoragePool" %> > - <%=h @storage_pool.port %>
> - <%=h @storage_pool.target %>
> + <%=h @storage_pool.port %>
> + <%=h @storage_pool.target %>
> <% elsif @storage_pool[:type] == "NfsStoragePool" %> > - <%=h @storage_pool.export_path %>
> + <%=h @storage_pool.export_path %>
> <% end %> > - <%=h @storage_pool.get_type_label %>
> + <%=h @storage_pool.get_type_label %>
>
> <%- content_for :right do -%> >
Volumes
> @@ -54,24 +54,33 @@ > > <%= confirmation_dialog("confirm_delete_storage", "Are you sure?", "delete_storage_pool()") %> > > ACK, with one fix- dutils/active_record_env.rb needs: require 'models/storage_volume_task.rb' added around line 78. Also, could you put a FIXME or something around line 57 suggesting we pull in the requires with a splat of some sort? Then we don't have to remember to bring in every model and it will keep the code smaller (I didn't have time to try it, just seems like it would be worth doing). From apevec at redhat.com Mon Nov 3 23:47:50 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 4 Nov 2008 00:47:50 +0100 Subject: [Ovirt-devel] [PATCH server] add missing includes for new network config model Message-ID: <1225756070-6408-1-git-send-email-apevec@redhat.com> --- src/dutils/active_record_env.rb | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/dutils/active_record_env.rb b/src/dutils/active_record_env.rb index 26caac2..afbf8f2 100644 --- a/src/dutils/active_record_env.rb +++ b/src/dutils/active_record_env.rb @@ -89,3 +89,11 @@ require 'models/lvm_storage_volume.rb' require 'models/smart_pool.rb' require 'models/smart_pool_tag.rb' +require 'models/ip_address.rb' +require 'models/ip_v4_address.rb' +require 'models/ip_v6_address.rb' +require 'models/network.rb' +require 'models/physical_network.rb' +require 'models/usage.rb' +require 'models/vlan.rb' + -- 1.5.6.5 From dpierce at redhat.com Tue Nov 4 14:36:48 2008 From: dpierce at redhat.com (Darryl Pierce) Date: Tue, 04 Nov 2008 09:36:48 -0500 Subject: [Ovirt-devel] [PATCH server] add missing includes for new network config model In-Reply-To: <1225756070-6408-1-git-send-email-apevec@redhat.com> References: <1225756070-6408-1-git-send-email-apevec@redhat.com> Message-ID: <49105E00.3070703@redhat.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Alan Dovecot wrote: > --- > src/dutils/active_record_env.rb | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/src/dutils/active_record_env.rb b/src/dutils/active_record_env.rb > index 26caac2..afbf8f2 100644 > --- a/src/dutils/active_record_env.rb > +++ b/src/dutils/active_record_env.rb > @@ -89,3 +89,11 @@ require 'models/lvm_storage_volume.rb' > require 'models/smart_pool.rb' > require 'models/smart_pool_tag.rb' > > +require 'models/ip_address.rb' > +require 'models/ip_v4_address.rb' > +require 'models/ip_v6_address.rb' > +require 'models/network.rb' > +require 'models/physical_network.rb' > +require 'models/usage.rb' > +require 'models/vlan.rb' > + ACK. - -- Darryl L. Pierce : GPG KEYID: 6C4E7F1B -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAkkQXfwACgkQjaT4DmxOfxt9OgCgqJdKslhJbH/ihGkxoSTSkoKN A1UAn0WmP+/WV6+1Jjn8TNf5kq5nHbKW =nRGw -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: dpierce.vcf Type: text/x-vcard Size: 319 bytes Desc: not available URL: From apevec at redhat.com Tue Nov 4 14:40:14 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 4 Nov 2008 15:40:14 +0100 Subject: [Ovirt-devel] [PATCH ovirt-node-image] build procedure change: include image ISO in SRPM Message-ID: <1225809614-23896-1-git-send-email-apevec@redhat.com> livecd images cannot be built in Koji build-system at the moment, they need to be included in SRPM Signed-off-by: Alan Pevec --- Makefile.am | 4 ++-- autobuild.sh | 2 +- ovirt-node-image.spec.in | 9 +++------ 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Makefile.am b/Makefile.am index fce5131..6020609 100644 --- a/Makefile.am +++ b/Makefile.am @@ -97,7 +97,7 @@ ovirt-node-image.iso: repos.ks fi \ ) -rpms: dist +rpms: ovirt-node-image.iso dist rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz publish: rpms @@ -106,4 +106,4 @@ publish: rpms rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src createrepo $(OVIRT_CACHE_DIR)/ovirt -.PHONY: rpms publish +.PHONY: rpms publish ovirt-node-image.iso diff --git a/autobuild.sh b/autobuild.sh index 1651a63..e82f4f2 100755 --- a/autobuild.sh +++ b/autobuild.sh @@ -27,6 +27,7 @@ test -f Makefile && make -k distclean || : ./autogen.sh --prefix=$AUTOBUILD_INSTALL_ROOT make dist +make ovirt-node-image.iso OVIRT_LOCAL_REPO=file://$AUTOBUILD_PACKAGE_ROOT/rpm/RPMS if [ -f /usr/bin/rpmbuild ]; then if [ -n "$AUTOBUILD_COUNTER" ]; then @@ -37,6 +38,5 @@ if [ -f /usr/bin/rpmbuild ]; then fi rpmbuild --nodeps --define "extra_release $EXTRA_RELEASE" \ - --define "ovirt_local_repo file://$AUTOBUILD_PACKAGE_ROOT/rpm/RPMS" \ -ta --clean *.tar.gz fi diff --git a/ovirt-node-image.spec.in b/ovirt-node-image.spec.in index 79ce2c3..eb17714 100644 --- a/ovirt-node-image.spec.in +++ b/ovirt-node-image.spec.in @@ -3,6 +3,7 @@ Name: ovirt-node-image Version: @VERSION@ Release: 0%{?dist}%{?extra_release} Source0: %{name}-%{version}.tar.gz +Source1: %{name}.iso License: GPLv2+ Group: Applications/System BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot @@ -33,11 +34,7 @@ The PXE boot image for oVirt Node network boot from oVirt Server. ./configure %build -make %{?ovirt_cache_dir: OVIRT_CACHE_DIR=%{ovirt_cache_dir}} \ - %{?ovirt_local_repo: OVIRT_LOCAL_REPO=%{ovirt_local_repo}} \ - %{?ovirt_url: OVIRT_URL=%{ovirt_url}} \ - ovirt-node-image.iso -sudo su - -c "cd $(pwd) && ./ovirt-pxe %{name}.iso" +sudo su - -c "cd $(pwd) && ./ovirt-pxe %{SOURCE1}" sudo su - -c "cd $(pwd) && chown -R $USER ." %install @@ -51,7 +48,7 @@ mkdir %{buildroot} %{__install} -p -m0644 tftpboot/initrd0.img %{buildroot}%{tftpboot} %{__install} -p -m0644 tftpboot/vmlinuz0 %{buildroot}%{tftpboot} %{__install} -d -m0755 %{buildroot}%{app_root} -%{__install} -p -m0644 %{name}.iso %{buildroot}%{app_root} +%{__install} -p -m0644 %{SOURCE1} %{buildroot}%{app_root} %{__install} -d -m0755 %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-pxe %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-flash %{buildroot}%{_sbindir} -- 1.5.6.5 From berrange at redhat.com Tue Nov 4 14:44:51 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Tue, 4 Nov 2008 14:44:51 +0000 Subject: [Ovirt-devel] [PATCH ovirt-node-image] build procedure change: include image ISO in SRPM In-Reply-To: <1225809614-23896-1-git-send-email-apevec@redhat.com> References: <1225809614-23896-1-git-send-email-apevec@redhat.com> Message-ID: <20081104144451.GI3041@redhat.com> On Tue, Nov 04, 2008 at 03:40:14PM +0100, Alan Pevec wrote: > livecd images cannot be built in Koji build-system at the moment, > they need to be included in SRPM > > Signed-off-by: Alan Pevec NACK. In doing this you are no longer testing ISO image creation in the automated builds. The existing core functionality of the SPEC file shouldn't be removed. There should be a conditional in the spec file to let you optionally build the RPM with a pre-built ISO. Or if that's too complex, create a separate 'ovirt-node-image-prebuilt.spec' which has a 'Provides: ovirt-node-image' in it. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From apevec at redhat.com Tue Nov 4 18:08:58 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 04 Nov 2008 19:08:58 +0100 Subject: [Ovirt-devel] [PATCH ovirt-node-image] build procedure change: include image ISO in SRPM In-Reply-To: <20081104144451.GI3041@redhat.com> References: <1225809614-23896-1-git-send-email-apevec@redhat.com> <20081104144451.GI3041@redhat.com> Message-ID: <49108FBA.3000003@redhat.com> Daniel P. Berrange wrote: > On Tue, Nov 04, 2008 at 03:40:14PM +0100, Alan Pevec wrote: >> livecd images cannot be built in Koji build-system at the moment, >> they need to be included in SRPM >> >> Signed-off-by: Alan Pevec > > NACK. > > In doing this you are no longer testing ISO image creation in > the automated builds. but I changed autobuild.sh too, so it does create the ISO image > The existing core functionality of the SPEC file shouldn't > be removed. > There should be a conditional in the spec file to let you > optionally build the RPM with a pre-built ISO. ok, that's a good idea, I'll add that From imain at redhat.com Tue Nov 4 18:42:24 2008 From: imain at redhat.com (Ian Main) Date: Tue, 4 Nov 2008 10:42:24 -0800 Subject: [Ovirt-devel] [PATCH recipe] Add new rubygem-qpid package to the wui. In-Reply-To: <1225494089.10508.21.camel@localhost.localdomain> References: <1225477828-3304-1-git-send-email-imain@redhat.com> <490B8845.5060405@redhat.com> <1225494089.10508.21.camel@localhost.localdomain> Message-ID: <20081104104224.40863c31@tp.mains.net> On Fri, 31 Oct 2008 16:01:29 -0700 David Lutterkort wrote: > On Fri, 2008-10-31 at 23:35 +0100, Alan Pevec wrote: > > > +Requires: rubygem-qpid > > > > Fedora Review BZ for this package please :) > > A catch-22: we haven't handed the ruby/qpid code over to the Qpid team > yet, since we first wanted to make sure it works well for ovirt's need > (right now, a bugfix is a commit to our internal git repo, after the > handoff we'll have to send in patches and wait for them to show up in > Qpid's svn, and for them to make a release) > > OTOH, we don't want to own that package, i.e. the review request should > come from the Qpid folks. > > Can we live with this situation for a few days until Ian has used it > enough to make sure we don't have terribly obvious bugs in the client ? Yes, I've found a number of bugs already while trying to use it as a "console", where you only receive messages when things change. This is for a host-status replacement. Should be ready in the next few days. Ian From dpierce at redhat.com Wed Nov 5 13:37:30 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 5 Nov 2008 08:37:30 -0500 Subject: [Ovirt-devel] [PATCH node] Creates a standalone mode entry point script. Message-ID: <1225892250-6704-1-git-send-email-dpierce@redhat.com> NOTE: This is for feedback and testing, and requires the patch for node-image to reintroduce hal-device. The script will execute only when the node is booted without the support of a server suite. If it determines that the node is running in standalone mode, it will then kick over to a node setup script. This iteration defines the general flow for the standalone mode's firstboot use case. When the node boots and determines it's in standalone mode, it goes through the following steps: 1. Prompt for an administrator password 2. Prompt the user to configure disk storage 3. Prompt the user to configure networking 4. Prompt the user to configure logging The node then continues to boot normally. --- Makefile.am | 34 +++++---- ovirt-node.spec.in | 15 ++++- scripts/ovirt-config-logging | 1 + scripts/ovirt-config-networking | 98 ++++++++++++++++++++++++++ scripts/ovirt-config-password | 1 + scripts/ovirt-config-setup | 43 +++++++++++ scripts/ovirt-config-storage | 147 +++++++++++++++++++++++++++++++++++++++ scripts/ovirt-functions | 5 ++ scripts/ovirt-standalone-mode | 55 +++++++++++++++ 9 files changed, 384 insertions(+), 15 deletions(-) create mode 100755 scripts/ovirt-config-logging create mode 100755 scripts/ovirt-config-networking create mode 100755 scripts/ovirt-config-password create mode 100755 scripts/ovirt-config-setup create mode 100755 scripts/ovirt-config-storage create mode 100755 scripts/ovirt-standalone-mode diff --git a/Makefile.am b/Makefile.am index c55db13..3d824db 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,20 +18,26 @@ OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache SUBDIRS = ovirt-identify-node ovirt-listen-awake -EXTRA_DIST = \ - .gitignore \ - ovirt-node.spec \ - ovirt-node.spec.in \ - ovirt-node-selinux.te \ - scripts/collectd \ - scripts/collectd.conf.in \ - scripts/ovirt \ - scripts/ovirt-awake \ - scripts/ovirt-early \ - scripts/ovirt-functions \ - scripts/ovirt-post \ - scripts/ovirt-process-config \ - logrotate/ovirt-logrotate \ +EXTRA_DIST = \ + .gitignore \ + ovirt-node.spec \ + ovirt-node.spec.in \ + ovirt-node-selinux.te \ + scripts/collectd \ + scripts/collectd.conf.in \ + scripts/ovirt \ + scripts/ovirt-awake \ + scripts/ovirt-config-logging \ + scripts/ovirt-config-networking \ + scripts/ovirt-config-password \ + scripts/ovirt-config-setup \ + scripts/ovirt-config-storage \ + scripts/ovirt-early \ + scripts/ovirt-functions \ + scripts/ovirt-post \ + scripts/ovirt-process-config \ + scripts/ovirt-standalone-mode \ + logrotate/ovirt-logrotate \ logrotate/ovirt-logrotate.conf # For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT- diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index d029c57..10a544b 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -88,17 +88,22 @@ cd - %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-process-config %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-logging %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-networking %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-password %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-setup %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-storage %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-identify-node/ovirt-identify-node %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-listen-awake/ovirt-listen-awake %{buildroot}%{_sbindir} %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-listen-awake.init %{buildroot}%{_initrddir}/ovirt-listen-awake %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-install-node %{buildroot}%{_sbindir} %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-uninstall-node %{buildroot}%{_sbindir} - %{__install} -p -m0644 scripts/ovirt-functions %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-early %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-post %{buildroot}%{_initrddir} +%{__install} -p -m0755 scripts/ovirt-standalone-mode %{buildroot}%{_initrddir} %{__install} -p -m0644 scripts/collectd %{buildroot}%{_sysconfdir}/chkconfig.d %{__install} -p -m0644 scripts/collectd.conf.in %{buildroot}%{_sysconfdir} @@ -125,6 +130,7 @@ cd - /sbin/chkconfig --add ovirt-early /sbin/chkconfig --add ovirt /sbin/chkconfig --add ovirt-post +/sbin/chkconfig --add ovirt-standalone-mode # this is ugly; we need collectd to start *after* libvirtd, so we own the # /etc/chkconfig.d/collectd file, and then have to re-define collectd here /sbin/chkconfig --add collectd @@ -136,6 +142,7 @@ if [ "$1" = 0 ] ; then /sbin/chkconfig --del ovirt /sbin/chkconfig --del ovirt-post /sbin/chkconfig --del ovirt-listen-awake + /sbin/chkconfig --del ovirt-standalone-mode fi %post selinux @@ -159,6 +166,11 @@ fi %files %defattr(-,root,root,0755) %{_sbindir}/ovirt-awake +%{_sbindir}/ovirt-config-logging +%{_sbindir}/ovirt-config-networking +%{_sbindir}/ovirt-config-password +%{_sbindir}/ovirt-config-setup +%{_sbindir}/ovirt-config-storage %{_sbindir}/ovirt-process-config %{_sbindir}/ovirt-identify-node %{_sbindir}/ovirt-listen-awake @@ -168,6 +180,7 @@ fi %{_initrddir}/ovirt %{_initrddir}/ovirt-post %{_initrddir}/ovirt-listen-awake +%{_initrddir}/ovirt-standalone-mode %config %{_sysconfdir}/logrotate.d/ovirt-logrotate.conf %config %{_sysconfdir}/cron.hourly/ovirt-logrotate %defattr(-,root,root,0644) diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging new file mode 100755 index 0000000..8b13789 --- /dev/null +++ b/scripts/ovirt-config-logging @@ -0,0 +1 @@ + diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking new file mode 100755 index 0000000..705521b --- /dev/null +++ b/scripts/ovirt-config-networking @@ -0,0 +1,98 @@ +#!/bin/bash +# +# Iterates over the list of network devices on the node and prompts the user +# to configure each. + +CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" + +function configure_interface +{ + NIC=$1 + FILENAME="/var/tmp/augtool-$NIC" + + printf "\nCONFIGURE INTERFACE: $NIC\n\n" + + THIS_ROOT="$CONFIG_FILE_ROOT-$NIC" + CONFIG="rm $THIS_ROOT\nset $THIS_ROOT/DEVICE $NIC" + + # Is this NIC shared? + while true; do + printf "Is $NIC a shared interface? (Y/N) " + read + case $REPLY in + Y|y) CONFIG="$CONFIG\nset $THIS_ROOT/TYPE bridge"; break ;; + N|n) bridge="N"; break ;; + esac + done + + # how do you want to configure this device? (dhcp, static IP) + while true; do + printf "Does $NIC use dynamic addressing? (Y/N) " + read + case $REPLY in + Y|y) CONFIG="$CONFIG\nset $THIS_ROOT/BOOTPROTO dhcp"; break ;; + N|n) + printf "\tIP Address: "; read; IPADDR=$REPLY + printf "\t Netmask: "; read; NETMASK=$REPLY + printf "\t Broadcast: "; read; BROADCAST=$REPLY + printf "\t Gateway: "; read; GATEWAY=$REPLY + + printf "\nIP Address: $IPADDR\nNetmask: $NETMASK\nBroadcast: $BROADCAST\nGateway: $GATEWAY\n" + printf "Is this correct? (Y/N) " + read + case $REPLY in + Y|y) + CONFIG="$CONFIG\nset $THIS_ROOT/IPADDR $IPADDR" + CONFIG="$CONFIG\nset $THIS_ROOT/BROADCAST $BROADCAST" + CONFIG="$CONFIG\nset $THIS_ROOT/NETMASK $NETMASK" + break + ;; + esac + ;; + esac + done + + if [ "$bridge" == "N" ]; then + printf "Is $NIC bridged? (Y/N) " + read + case $REPLY in + Y|y) + printf "What is the bridge name? " + read + CONFIG="$CONFIG\n set $THIS_ROOT/BRIDGE $REPLY" + ;; + esac + fi + + CONFIG="$CONFIG\nset $THIS_ROOT/ONBOOT yes" + printf "$CONFIG\n" > $FILENAME + + echo +} + +# TODO the menu doesn't redisplay unless you hit enter -- needs fixing +# get the list of network cards on this machine +NICS=$(hal-device | awk '/net.interface/ { + match($0, "= '"'"'(.*)'"'"' ", nic); printf("%s ", nic[1]); }') + +# Append a quit option +NICS="$NICS Quit" + +PS3="Please select a network interface to configure:" +select NIC in $NICS +do + case "$NIC" in + "Quit") + break + ;; + + *) + configure_interface $NIC + ;; + esac +done + +# Merge together all generated files and run augtool + +cat /var/tmp/augtool-* > /var/tmp/config-augtool +augtool < /var/tmp/config-augtool diff --git a/scripts/ovirt-config-password b/scripts/ovirt-config-password new file mode 100755 index 0000000..8b13789 --- /dev/null +++ b/scripts/ovirt-config-password @@ -0,0 +1 @@ + diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup new file mode 100755 index 0000000..a8bdc5d --- /dev/null +++ b/scripts/ovirt-config-setup @@ -0,0 +1,43 @@ +#!/bin/bash +# +# Entry point for configuring an oVirt node when running in standalone mode. + +PS3="Please select an option: " + +# TODO should we make this optional, based on whether the password was already set? +PASSWORD_OPTION="Password" + +LIST="Networking Storage Logging ${PASSWORD_OPTION} Quit" + +select OPT in $LIST +do + printf "\n" + + case "$OPT" in + "Networking") + ovirt-config-networking + ;; + + "Storage") + ovirt-config-storage + ;; + + "Logging") + ovirt-config-logging + ;; + + "Password") + # TODO only do this if we allow it + ovirt-config-password + ;; + + "Quit") + printf "Finished.\n" + exit 0 + ;; + + "*") + printf "Invalid option \"${OPT}\".\n" + ;; + esac +done diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage new file mode 100755 index 0000000..3a16411 --- /dev/null +++ b/scripts/ovirt-config-storage @@ -0,0 +1,147 @@ +#!/bin/bash +# + +function show_logical_volumes +{ + OUTPUT=$(lvdisplay | awk '/LV Name/ { print " "$3 }') + + printf "Current Logical Volumes:\n" + printf "========================\n" + printf "$OUTPUT\n" +} + +function create_partition +{ + PHYVOLS=$(pvdisplay | awk '/VG Name/ { print $3" " }') + PHYVOLS="$PHYVOLS Quit" + printf "\n" + + PS3="Please select a physical volume: " + select PHYVOL in $PHYVOLS + do + case "$PHYVOL" in + "Quit") + return + ;; + + *) + if [ "" != "$PHYVOL" ] + then + PVOLUME="$PHYVOL" + break + fi + ;; + esac + printf "\n" + done + + printf "\nWhat is the name for the new logical volume? " + read + if [[ "$REPLY" =~ '^\w+$' ]]; then + LVOLUME="$REPLY" + + printf "\nWhat size (in Gigabytes) is this new logical volume? " + read + if [[ "$REPLY" =~ '^[0-9.]+$' ]]; then + LVSIZE="$REPLY" + + printf "\nMount point for this new file system? " + read + if [[ "$REPLY" =~ '^\/(\w|\/)*$' ]]; then + MOUNTPT="$REPLY" + + printf "\nCreating /dev/${PHYVOL}/${LVOLUME} (${LVSIZE} GB), mounted at ${MOUNTPT} :\n\n" + printf " Is that correct? (Y/N) " + read + case $REPLY in + Y|y) + lvdevice="/dev/${PHYVOL}/${LVOLUME}" + lvcreate --size ${LVSIZE}G /dev/${PHYVOL} --name $LVOLUME; + printf "${lvdevice}\t${MOUNTPT}\text3\tdefaults\t1 2\n" >> /etc/fstab + ;; + + N|n) printf "Logical volume creation aborted.\n"; break ;; + esac + else + printf "\nInvalid mount point.\n" + fi + else + printf "\nLogical volume size must be a numeric value.\n" + fi + else + printf "\n'$REPLY' is an invalid logical volume name.\n" + fi + + printf "\n" +} + +function format_partition +{ + LVOLUMES=$(lvdisplay | awk '/LV Name/ { print $3" " }') + LVOLUMES="${LVOLUMES} Quit" + PS3="Select a volume to format: " + + select LVM in $LVOLUMES + do + case "$LVM" in + "Quit") + return + ;; + + *) + if [ "" != "$LVM" ]; then + break + fi + ;; + esac + printf "\n" + done + + printf "Formatting ${LVM} with EXT3..." + + mkfs -t ext3 ${LVM} +} + +function delete_partition +{ + echo "Delete" +} + + +declare -a OPTIONS +OPTIONS[${#OPTIONS[*]}]="Create Partition" +OPTIONS[${#OPTIONS[*]}]="Format Partition" +OPTIONS[${#OPTIONS[*]}]="Remove Partition" +OPTIONS[${#OPTIONS[*]}]="Quit" +eval set $OPTIONS + +show_logical_volumes + +PS3="Please select a storage operation to perform: " +printf "\n" + +eval set $OPTIONS +select OPTION in "${OPTIONS[@]}" +do + case "$OPTION" in + "Create Partition") + create_partition + ;; + + "Format Partition") + format_partition + ;; + + "Delete Partition") + delete_partition + ;; + + "Quit") + break + ;; + esac + + printf "\n" + show_logical_volumes + PS3="Please select a storage operation to perform: " +done diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions index e251eac..53e9f62 100644 --- a/scripts/ovirt-functions +++ b/scripts/ovirt-functions @@ -7,6 +7,11 @@ OVIRT_LABEL=OVIRT OVIRT_BACKUP_DIR=/var/lib/ovirt-backup +is_standalone() +{ + return 0 +} + find_srv() { local dnsreply diff --git a/scripts/ovirt-standalone-mode b/scripts/ovirt-standalone-mode new file mode 100755 index 0000000..e503917 --- /dev/null +++ b/scripts/ovirt-standalone-mode @@ -0,0 +1,55 @@ +#!/bin/bash +# +# ovirt-standalone-mode Starts the node in standalone mode. +# +# chkconfig: 2345 01 99 +# description: ovirt-early services +# +# Copyright (C) 2008 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. + +## Source functions library +. /etc/init.d/functions +. /etc/init.d/ovirt-functions + +start () +{ + ovirt-config-setup +} + +case "$1" in + start) + #is_standalone + #if [ $? -ne 0 ]; then + # exit 0 + #fi + + printf "Starting ovirt-standalone-mode: " + + { + start + } + + test $? == 0 && success || failure + echo + ;; + + *) + echo "Usage: ovirt-early {start}" + exit 2 +esac -- 1.5.6.5 From dpierce at redhat.com Wed Nov 5 13:38:23 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 5 Nov 2008 08:38:23 -0500 Subject: [Ovirt-devel] [PATCH node-image] Delists necessary executables that were blacklisted. Message-ID: <1225892303-6795-1-git-send-email-dpierce@redhat.com> hal-device is needed for standalone mode to run. Signed-off-by: Darryl L. Pierce --- common-blacklist.ks | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/common-blacklist.ks b/common-blacklist.ks index 2fa2d82..d67c8e4 100644 --- a/common-blacklist.ks +++ b/common-blacklist.ks @@ -88,7 +88,7 @@ blacklist_lib="/usr/lib{,64}/python2.5 /usr/lib{,64}/gconv \ /lib/firmware /usr/lib/locale /usr/lib/syslinux" blacklist_pango="/usr/lib{,64}/pango /usr/lib{,64}/libpango* \ /etc/pango /usr/bin/pango*" -blacklist_hal="/usr/bin/hal-device /usr/bin/hal-disable-polling \ +blacklist_hal="/usr/bin/hal-disable-polling \ /usr/bin/hal-find-by-capability /usr/bin/hal-find-by-property \ /usr/bin/hal-is-caller-locked-out /usr/bin/hal-is-caller-privileged \ /usr/bin/hal-lock /usr/bin/hal-set-property /usr/bin/hal-setup-keymap" -- 1.5.6.5 From jguiditt at redhat.com Wed Nov 5 14:03:21 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Wed, 5 Nov 2008 09:03:21 -0500 Subject: [Ovirt-devel] [PATCH server] Simplified active_record_env to make less error-prone. Message-ID: <1225893801-27822-1-git-send-email-jguiditt@redhat.com> Too many requires to keep track of, this should make it easier until we rewrite it again. Signed-off-by: Jason Guiditta --- src/dutils/active_record_env.rb | 80 ++++--------------------------- src/test/unit/active_record_env_test.rb | 31 ++++++++++++ 2 files changed, 41 insertions(+), 70 deletions(-) create mode 100644 src/test/unit/active_record_env_test.rb diff --git a/src/dutils/active_record_env.rb b/src/dutils/active_record_env.rb index afbf8f2..ad5e762 100644 --- a/src/dutils/active_record_env.rb +++ b/src/dutils/active_record_env.rb @@ -19,81 +19,21 @@ # also available at http://www.gnu.org/copyleft/gpl.html. $: << File.join(File.dirname(__FILE__), "../app") -$: << File.join(File.dirname(__FILE__), "../vendor/plugins/betternestedset/lib") +#$: << File.join(File.dirname(__FILE__), "../vendor/plugins/betternestedset/lib") require 'rubygems' -gem 'activeldap' +$LOAD_PATH << File.expand_path(File.dirname(__FILE__)) -require 'active_ldap' -require 'active_support' -require 'active_record' -require 'action_pack' -require 'action_controller' -require 'action_view' -require 'erb' +ENV['RAILS_ENV'] = 'production' || ENV['RAILS_ENV'] -OVIRT_DIR = "/usr/share/ovirt-server" +require File.dirname(__FILE__) + '/../config/boot' +require "#{RAILS_ROOT}/config/environment" -require "#{OVIRT_DIR}/vendor/plugins/betternestedset/init.rb" -require "#{OVIRT_DIR}/vendor/plugins/acts_as_xapian/lib/acts_as_xapian" - -def database_connect - yml = YAML::load(ERB.new(IO.read("#{OVIRT_DIR}/config/database.yml")).result) - rails_env = ENV['RAILS_ENV'] - rails_env = 'production' unless rails_env - dbconfig = yml[rails_env] - ActiveRecord::Base.establish_connection( - :adapter => dbconfig['adapter'], - :host => dbconfig['host'], - :username => dbconfig['username'], - :password => dbconfig['password'], - :database => dbconfig['database'] - ) +def database_connect(environment) + conf = YAML::load(File.open(File.dirname(__FILE__) + '/../config/database.yml')) + ActiveRecord::Base.establish_connection(conf[environment]) end -database_connect - -require 'models/account.rb' -require 'models/pool.rb' -require 'models/permission.rb' -require 'models/quota.rb' - -require 'models/hardware_pool.rb' -require 'models/directory_pool.rb' -require 'models/smart_pool.rb' -require 'models/host.rb' -require 'models/cpu.rb' -require 'models/boot_type.rb' -require 'models/bonding.rb' -require 'models/bonding_type.rb' -require 'models/nic.rb' - -require 'models/vm_resource_pool.rb' -require 'models/vm.rb' - -require 'models/task' -require 'models/host_task.rb' -require 'models/storage_task.rb' -require 'models/vm_task.rb' - -require 'models/storage_pool.rb' -require 'models/iscsi_storage_pool.rb' -require 'models/nfs_storage_pool.rb' -require 'models/lvm_storage_pool.rb' - -require 'models/storage_volume.rb' -require 'models/iscsi_storage_volume.rb' -require 'models/nfs_storage_volume.rb' -require 'models/lvm_storage_volume.rb' -require 'models/smart_pool.rb' -require 'models/smart_pool_tag.rb' - -require 'models/ip_address.rb' -require 'models/ip_v4_address.rb' -require 'models/ip_v6_address.rb' -require 'models/network.rb' -require 'models/physical_network.rb' -require 'models/usage.rb' -require 'models/vlan.rb' - +# Open ActiveRecord connection +database_connect(ENV['RAILS_ENV']) \ No newline at end of file diff --git a/src/test/unit/active_record_env_test.rb b/src/test/unit/active_record_env_test.rb new file mode 100644 index 0000000..e5fe064 --- /dev/null +++ b/src/test/unit/active_record_env_test.rb @@ -0,0 +1,31 @@ +# +# Copyright (C) 2008 Red Hat, Inc. +# Written by Jason Guiditta +# +# 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. + +require File.dirname(__FILE__) + '/../test_helper' +require File.dirname(__FILE__) + '/../../dutils/active_record_env' + +class ActiveRecordEnvTest < Test::Unit::TestCase + fixtures :pools, :storage_pools, :hosts, :cpus, :vms, :tasks + + def test_can_find_hosts + database_connect(ENV["RAILS_ENV"]) + hosts = Host.find(:all, :limit => 2) + assert_not_nil hosts, 'you have no hosts list!' + end +end -- 1.5.6.5 From clalance at redhat.com Wed Nov 5 15:03:24 2008 From: clalance at redhat.com (Chris Lalancette) Date: Wed, 05 Nov 2008 16:03:24 +0100 Subject: [Ovirt-devel] [PATCH server] Simplified active_record_env to make less error-prone. In-Reply-To: <1225893801-27822-1-git-send-email-jguiditt@redhat.com> References: <1225893801-27822-1-git-send-email-jguiditt@redhat.com> Message-ID: <4911B5BC.9060008@redhat.com> Jason Guiditta wrote: > Too many requires to keep track of, this should make it easier until we rewrite it again. > > Signed-off-by: Jason Guiditta > --- > src/dutils/active_record_env.rb | 80 ++++--------------------------- > src/test/unit/active_record_env_test.rb | 31 ++++++++++++ > 2 files changed, 41 insertions(+), 70 deletions(-) > create mode 100644 src/test/unit/active_record_env_test.rb OK, I've done some basic testing of this, and it seems to work. As Jason explained to me, basically all of the things we were doing we get for free by loading up the Rails environment. Taskomatic seems happy with it too. ACK Chris Lalancette From clalance at redhat.com Wed Nov 5 15:17:36 2008 From: clalance at redhat.com (Chris Lalancette) Date: Wed, 05 Nov 2008 16:17:36 +0100 Subject: [Ovirt-devel] [PATCH server] Simplified active_record_env to make less error-prone. In-Reply-To: <1225893801-27822-1-git-send-email-jguiditt@redhat.com> References: <1225893801-27822-1-git-send-email-jguiditt@redhat.com> Message-ID: <4911B910.7030001@redhat.com> Jason Guiditta wrote: > Too many requires to keep track of, this should make it easier until we rewrite it again. > > Signed-off-by: Jason Guiditta > --- > src/dutils/active_record_env.rb | 80 ++++--------------------------- > src/test/unit/active_record_env_test.rb | 31 ++++++++++++ > 2 files changed, 41 insertions(+), 70 deletions(-) > create mode 100644 src/test/unit/active_record_env_test.rb Committed. -- Chris Lalancette From clalance at redhat.com Wed Nov 5 15:18:03 2008 From: clalance at redhat.com (Chris Lalancette) Date: Wed, 05 Nov 2008 16:18:03 +0100 Subject: [Ovirt-devel] [PATCH] lvm storage volume HW pool admin tab. In-Reply-To: <1225410795-2680-1-git-send-email-sseago@redhat.com> References: <1225410795-2680-1-git-send-email-sseago@redhat.com> Message-ID: <4911B92B.2010901@redhat.com> Scott Seago wrote: > Includes 'view storage volume' facebox popup and new/delete LVM volume > functionality. Although lvm tasks are created, taskomatic doesn't yet know > what to do with them. > > Signed-off-by: Scott Seago Committed. -- Chris Lalancette From clalance at redhat.com Wed Nov 5 15:18:19 2008 From: clalance at redhat.com (Chris Lalancette) Date: Wed, 05 Nov 2008 16:18:19 +0100 Subject: [Ovirt-devel] [PATCH server] WIP - Rev 1 of Storage Tree UI for 'Create VM'. In-Reply-To: <1225403343-18309-1-git-send-email-jguiditt@redhat.com> References: <1225403343-18309-1-git-send-email-jguiditt@redhat.com> Message-ID: <4911B93B.8080001@redhat.com> Jason Guiditta wrote: > This probably needs some visual tweaks, but should work as > is. Needs integration testing with scott's work to create > lvm volumes. > > Signed-off-by: Jason Guiditta Committed. -- Chris Lalancette From pmyers at redhat.com Wed Nov 5 15:31:27 2008 From: pmyers at redhat.com (Perry Myers) Date: Wed, 05 Nov 2008 10:31:27 -0500 Subject: [Ovirt-devel] oVirt Appliance and Node Packaging Message-ID: <4911BC4F.90304@redhat.com> A few releases ago we moved from packaging the oVirt Appliance in an RPM instead of a tarball for various reasons. RPM isn't the best format for packaging this since we want the packaging format to be OS neutral. So we're thinking about refactoring how the oVirt Node and Appliance are packaged/distributed. Here's the plan, feedback from the community at large is appreciated. 1. oVirt Appliance will be formatted as a raw disk image and packaged in a zip file that will contain metadata files for various hypervisors (virt-image format to start, soon vmx and ovf). The create-ovirt-appliance script will be in this zip as well for convenience 2. the ovirt-appliance RPM will continue to exist but it will just contain the Requires (for automatic dependency downloading) and required scripts. Script will be included to download the image zip from ovirt.org site or use local copy on disk 3. ovirt-node-image RPM will continue to exist, but we'll also provide the Node ISO image in zip file format 4. ovirt-node-image-pxe RPM will be removed. ovirt-node-image RPM can create the PXE images during installation The goal of this change is to make the appliance and Node more accessible to users of other distributions. Thanks, Perry -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=| From clalance at redhat.com Wed Nov 5 15:57:12 2008 From: clalance at redhat.com (Chris Lalancette) Date: Wed, 5 Nov 2008 16:57:12 +0100 Subject: [Ovirt-devel] [PATCH server] Implement LVM taskomatic In-Reply-To: <> References: <> Message-ID: <1225900632-15279-1-git-send-email-clalance@redhat.com> This patch implements LVM scanning, creation, deletion, and VM use in the taskomatic backend. This required a re-thinking of the way we do things, and because of this the implementation ended up being much simpler and more object oriented. Note that in order for this to have any chance to work, you need updated libvirt (a pre 0.5.0 snapshot), and an updated ruby-libvirt package, both of which I am working on and will presently upload to the ovirt yum repositories. Signed-off-by: Chris Lalancette --- src/app/models/iscsi_storage_volume.rb | 4 + src/app/models/lvm_storage_volume.rb | 4 + src/app/models/nfs_storage_volume.rb | 4 + src/task-omatic/task_storage.rb | 301 ++++++++++++++++++++++++++------ src/task-omatic/task_vm.rb | 135 ++++++++++++--- src/task-omatic/taskomatic.rb | 2 + src/task-omatic/utils.rb | 242 ++++++++++++-------------- 7 files changed, 480 insertions(+), 212 deletions(-) diff --git a/src/app/models/iscsi_storage_volume.rb b/src/app/models/iscsi_storage_volume.rb index 00d7db2..48edbd8 100644 --- a/src/app/models/iscsi_storage_volume.rb +++ b/src/app/models/iscsi_storage_volume.rb @@ -22,6 +22,10 @@ class IscsiStorageVolume < StorageVolume "#{storage_pool[:target]}:#{lun}" end + def volume_name + "lun" + end + #FIXME: should also take available free space into account def supports_lvm_subdivision return true diff --git a/src/app/models/lvm_storage_volume.rb b/src/app/models/lvm_storage_volume.rb index 7dde2d1..4aac265 100644 --- a/src/app/models/lvm_storage_volume.rb +++ b/src/app/models/lvm_storage_volume.rb @@ -21,4 +21,8 @@ class LvmStorageVolume < StorageVolume def display_name "#{get_type_label}: #{storage_pool.vg_name}:#{lv_name}" end + + def volume_name + "lv_name" + end end diff --git a/src/app/models/nfs_storage_volume.rb b/src/app/models/nfs_storage_volume.rb index f220930..2c18d67 100644 --- a/src/app/models/nfs_storage_volume.rb +++ b/src/app/models/nfs_storage_volume.rb @@ -21,4 +21,8 @@ class NfsStorageVolume < StorageVolume def label_components "#{storage_pool.export_path}/#{filename}" end + + def volume_name + "filename" + end end diff --git a/src/task-omatic/task_storage.rb b/src/task-omatic/task_storage.rb index 5cddf2b..44ba164 100644 --- a/src/task-omatic/task_storage.rb +++ b/src/task-omatic/task_storage.rb @@ -20,26 +20,65 @@ require 'utils' require 'libvirt' -def refresh_pool(task) - puts "refresh_pool" +def build_libvirt_vol_xml(name, size, owner, group, mode) + vol_xml = Document.new + vol_xml.add_element("volume", {"type" => "logical"}) + vol_xml.root.add_element("name").add_text(name) + vol_xml.root.add_element("capacity", {"unit" => "K"}).add_text(size.to_s) + vol_xml.root.add_element("target") + vol_xml.root.elements["target"].add_element("permissions") + vol_xml.root.elements["target"].elements["permissions"].add_element("owner").add_text(owner) + vol_xml.root.elements["target"].elements["permissions"].add_element("group").add_text(group) + vol_xml.root.elements["target"].elements["permissions"].add_element("mode").add_text(mode) - pool = task.storage_pool + return vol_xml +end - if pool == nil - raise "Could not find storage pool" - end +def add_volumes_to_db(db_pool, libvirt_pool, owner = nil, group = nil, mode = nil) + # FIXME: this is currently broken if you do something like: + # 1. Add an iscsi pool with 3 volumes (lun-1, lun-2, lun-3) + # 2. Scan it in + # 3. Remove lun-3 from the pool + # 4. Re-scan it + # What will happen is that you will still have lun-3 available in the + # database, even though it's not available in the pool anymore. It's a + # little tricky, though; we have to make sure that we don't pull the + # database entry out from underneath a possibly running VM (or do we?) + libvirt_pool.list_volumes.each do |volname| + storage_volume = StorageVolume.factory(db_pool.get_type_label) - if pool[:type] == "IscsiStoragePool" - storage = Iscsi.new(pool.ip_addr, pool[:target]) - elsif pool[:type] == "NfsStoragePool" - storage = NFS.new(pool.ip_addr, pool.export_path) - else - raise "Unknown storage pool type " + pool[:type].to_s + # NOTE: it is safe (and, in fact, necessary) to use + # #{storage_volume.volume_name} here without sanitizing it. This is + # because this is *not* based on user modifiable data, but rather, on an + # internal implementation detail + existing_vol = StorageVolume.find(:first, :conditions => + [ "storage_pool_id = ? AND #{storage_volume.volume_name} = ?", + db_pool.id, volname]) + if existing_vol != nil + # in this case, this path already exists in the database; just skip + next + end + + volptr = libvirt_pool.lookup_vol_by_name(volname) + + volinfo = volptr.info + + storage_volume = StorageVolume.factory(db_pool.get_type_label) + storage_volume.path = volptr.path + storage_volume.size = volinfo.capacity / 1024 + storage_volume.storage_pool_id = db_pool.id + storage_volume.write_attribute(storage_volume.volume_name, volname) + storage_volume.lv_owner_perms = owner + storage_volume.lv_group_perms = group + storage_volume.lv_mode_perms = mode + storage_volume.save end +end +def storage_find_suitable_host(pool_id) # find all of the hosts in the same pool as the storage hosts = Host.find(:all, :conditions => - [ "hardware_pool_id = ?", pool.hardware_pool_id ]) + [ "hardware_pool_id = ?", pool_id ]) conn = nil hosts.each do |host| @@ -59,66 +98,212 @@ def refresh_pool(task) end if conn == nil + # last ditch effort; if we didn't find any hosts, just use ourselves. + # this may or may not work + begin + conn = Libvirt::open("qemu:///system") + rescue + end + end + + if conn == nil raise "Could not find a host to scan storage" end - remote_pool_defined = false - remote_pool_started = false - remote_pool = nil + return conn +end - # here, run through the list of already defined pools on the remote side - # and see if a pool matching the XML already exists. If it does - # we don't try to define it again, we just scan it - pool_defined = false - all_storage_pools(conn).each do |remote_pool_name| - tmppool = conn.lookup_storage_pool_by_name(remote_pool_name) - doc = Document.new(tmppool.xml_desc(0)) +# The words "pool" and "volume" are ridiculously overloaded in our context. +# Therefore, the refresh_pool method adopts this convention: +# phys_db_pool: The underlying physical storage pool, as it is represented in +# the database +# phys_libvirt_pool: The underlying physical storage, as it is represented in +# libvirt +# lvm_db_pool: The logical storage pool (if it exists), as it is represented +# in the database +# lvm_libvirt_pool: The logical storage pool (if it exists), as it is +# represented in the database - if storage.xmlequal?(doc.root) - pool_defined = true - remote_pool = tmppool - break +def refresh_pool(task) + puts "refresh_pool" + + phys_db_pool = task.storage_pool + if phys_db_pool == nil + raise "Could not find storage pool" + end + + conn = storage_find_suitable_host(phys_db_pool.hardware_pool_id) + + begin + phys_libvirt_pool = LibvirtPool.factory(phys_db_pool) + phys_libvirt_pool.connect(conn) + + begin + # OK, the pool is all set. Add in all of the volumes + add_volumes_to_db(phys_db_pool, phys_libvirt_pool) + + # OK, now we've scanned the underlying hardware pool and added the + # volumes. Next we scan for pre-existing LVM volumes + logical_xml = conn.discover_storage_pool_sources("logical") + + Document.new(logical_xml).elements.each('sources/source') do |source| + vgname = source.elements["name"].text + + begin + source.elements.each("device") do |device| + byid_device = phys_libvirt_pool.lookup_vol_by_path(device.attributes["path"]).path + end + rescue + # If matching any of the sections in the LVM XML fails + # against the storage pool, then it is likely that this is a storage + # pool not associated with the one we connected above. Go on + # FIXME: it would be nicer to catch the right exception here, and + # fail on other exceptions + puts "One of the logical volumes in #{vgname} is not part of the pool of type #{phys_db_pool[:type]} that we are scanning; ignore the previous error!" + next + end + + # if we make it here, then we were able to resolve all of the devices, + # so we know we need to use a new pool + lvm_db_pool = LvmStoragePool.find(:first, :conditions => + [ "vg_name = ?", vgname ]) + if lvm_db_pool == nil + lvm_db_pool = LvmStoragePool.new + lvm_db_pool[:type] = "LvmStoragePool" + # set the LVM pool to the same hardware pool as the underlying storage + lvm_db_pool.hardware_pool_id = phys_db_pool.hardware_pool_id + lvm_db_pool.vg_name = vgname + lvm_db_pool.save + end + + source.elements.each("device") do |device| + byid_device = phys_libvirt_pool.lookup_vol_by_path(device.attributes["path"]).path + physical_vol = StorageVolume.find(:first, :conditions => + [ "path = ?", byid_device]) + if physical_vol == nil + # Hm. We didn't find the device in the storage volumes already. + # something went wrong internally, and we have to bail + raise "Storage internal physical volume error" + end + + # OK, put the right lvm_pool_id in place + physical_vol.lvm_pool_id = lvm_db_pool.id + physical_vol.save + end + + lvm_libvirt_pool = LibvirtPool.factory(lvm_db_pool) + lvm_libvirt_pool.connect(conn) + + begin + add_volumes_to_db(lvm_db_pool, lvm_libvirt_pool, "0744", "0744", "0744") + ensure + lvm_libvirt_pool.shutdown + end + end + ensure + phys_libvirt_pool.shutdown end + ensure + conn.close end - if not pool_defined - remote_pool = conn.define_storage_pool_xml(storage.getxml, 0) - remote_pool.build(0) - remote_pool_defined = true +end + +def create_volume(task) + puts "create_volume" + + lvm_db_volume = task.storage_volume + if lvm_db_volume == nil + raise "Could not find storage volume to create" + end + if lvm_db_volume[:type] != "LvmStorageVolume" + raise "The volume to create must be of type LvmStorageVolume, not type #{lvm_db_volume[:type]}" end - remote_pool_info = remote_pool.info - if remote_pool_info.state == Libvirt::StoragePool::INACTIVE - # only try to start the pool if it is currently inactive; in all other - # states, assume it is already running - remote_pool.create(0) - remote_pool_started = true + lvm_db_pool = lvm_db_volume.storage_pool + if lvm_db_pool == nil + raise "Could not find storage pool" + end + if lvm_db_pool[:type] != "LvmStoragePool" + raise "The pool for the volume must be of type LvmStoragePool, not type #{lvm_db_pool[:type]}" end - vols = remote_pool.list_volumes - vols.each do |volname| - volptr = remote_pool.lookup_volume_by_name(volname) - existing_vol = StorageVolume.find(:first, :conditions => - [ "path = ?", volptr.path ]) - if existing_vol != nil - # in this case, this path already exists in the database; just skip - next + conn = storage_find_suitable_host(lvm_db_pool.hardware_pool_id) + + begin + phys_libvirt_pool = get_libvirt_pool_from_volume(lvm_db_volume) + phys_libvirt_pool.connect(conn) + + begin + lvm_libvirt_pool = LibvirtPool.factory(lvm_db_pool) + lvm_libvirt_pool.connect(conn) + + begin + vol_xml = build_libvirt_vol_xml(lvm_db_volume.lv_name, + lvm_db_volume.size, + lvm_db_volume.lv_owner_perms, + lvm_db_volume.lv_group_perms, + lvm_db_volume.lv_mode_perms) + + lvm_libvirt_pool.create_vol_xml(vol_xml.to_s) + ensure + lvm_libvirt_pool.shutdown + end + ensure + phys_libvirt_pool.shutdown end + ensure + conn.close + end +end - volinfo = volptr.info +def delete_volume(task) + puts "delete_volume" - storage_volume = StorageVolume.new - storage_volume.path = volptr.path - storage_volume.size = volinfo.capacity / 1024 - storage_volume.storage_pool_id = pool.id - storage_volume[:type] = StoragePool::STORAGE_TYPES[pool.get_type_label] + "StorageVolume" - storage_volume.write_attribute(storage.db_column, volname) - storage_volume.save + lvm_db_volume = task.storage_volume + if lvm_db_volume == nil + raise "Could not find storage volume to delete" + end + if lvm_db_volume[:type] != "LvmStorageVolume" + raise "The volume to delete must be of type LvmStorageVolume, not type #{lvm_db_volume[:type]}" + end + + lvm_db_pool = lvm_db_volume.storage_pool + if lvm_db_pool == nil + raise "Could not find storage pool" end - if remote_pool_started - remote_pool.destroy + if lvm_db_pool[:type] != "LvmStoragePool" + raise "The pool for the volume must be of type LvmStoragePool, not type #{lvm_db_pool[:type]}" end - if remote_pool_defined - remote_pool.undefine + + conn = storage_find_suitable_host(lvm_db_pool.hardware_pool_id) + + begin + phys_libvirt_pool = get_libvirt_pool_from_volume(lvm_db_volume) + phys_libvirt_pool.connect(conn) + + begin + lvm_libvirt_pool = LibvirtPool.factory(lvm_db_pool) + lvm_libvirt_pool.connect(conn) + + begin + libvirt_volume = lvm_libvirt_pool.lookup_vol_by_name(lvm_db_volume.lv_name) + # FIXME: we actually probably want to zero out the whole volume here, so + # we aren't potentially leaking data from one user to another. There + # are two problems, though: + # 1) I'm not sure how I would go about zero'ing the data on a remote + # machine, since there is no "libvirt_write_data" call + # 2) This could potentially take quite a while, so we want to spawn + # off another thread to do it + libvirt_volume.delete + + LvmStorageVolume.delete(lvm_db_volume.id) + ensure + lvm_libvirt_pool.shutdown + end + ensure + phys_libvirt_pool.shutdown + end + ensure + conn.close end - conn.close end diff --git a/src/task-omatic/task_vm.rb b/src/task-omatic/task_vm.rb index b5f888d..c30c6a9 100644 --- a/src/task-omatic/task_vm.rb +++ b/src/task-omatic/task_vm.rb @@ -24,46 +24,140 @@ require 'utils' gem 'cobbler' require 'cobbler' +def findHostSLA(vm) + host = nil + + vm.vm_resource_pool.get_hardware_pool.hosts.each do |curr| + # FIXME: we probably need to add in some notion of "load" into this check + if curr.num_cpus >= vm.num_vcpus_allocated \ + and curr.memory >= vm.memory_allocated \ + and not curr.is_disabled.nil? and curr.is_disabled == 0 \ + and curr.state == Host::STATE_AVAILABLE \ + and (vm.host_id.nil? or (not vm.host_id.nil? and vm.host_id != curr.id)) + host = curr + break + end + end + + if host == nil + # we couldn't find a host that matches this criteria + raise "No host matching VM parameters could be found" + end + + return host +end + +def findHost(host_id) + host = Host.find(:first, :conditions => [ "id = ?", host_id]) + + if host == nil + # Hm, we didn't find the host_id. Seems odd. Return a failure + raise "Could not find host_id " + host_id.to_s + end + + return host +end + +def connect_storage_pools(conn, storage_volumes) + storagedevs = [] + storage_volumes.each do |volume| + # here, we need to iterate through each volume and possibly attach it + # to the host we are going to be using + db_pool = volume.storage_pool + if db_pool == nil + # Hum. Specified by the VM description, but not in the storage pool? + # continue on and hope for the best + puts "Couldn't find pool for volume #{volume.path}; skipping" + next + end + + # we have to special case LVM pools. In that case, we need to first + # activate the underlying physical device, and then do the logical one + if volume[:type] == "LvmStorageVolume" + phys_libvirt_pool = get_libvirt_pool_from_volume(volume) + phys_libvirt_pool.connect(conn) + end + + libvirt_pool = LibvirtPool.factory(db_pool) + libvirt_pool.connect(conn) + + # OK, the pool should be all set. The last thing we need to do is get + # the path based on the volume name + storagedevs << libvirt_pool.lookup_vol_by_name(volume.read_attribute(volume.volume_name)).path + end + + return storagedevs +end + +def remove_pools(conn, type = nil) + all_storage_pools(conn).each do |remote_pool_name| + pool = conn.lookup_storage_pool_by_name(remote_pool_name) + + if type == nil or type == Document.new(pool.xml_desc).root.attributes['type'] + begin + pool.destroy + rescue + end + + begin + # if the destroy failed, we still try to undefine; it may be a pool + # that was previously destroyed but not undefined for whatever reason + pool.undefine + rescue + # do nothing if any of this failed; the worst that happens is that + # we leave a pool configured + puts "Could not teardown pool " + remote_pool_name + "; skipping" + end + end + end +end + +def teardown_storage_pools(conn) + # FIXME: this needs to get a *lot* smarter. In particular, we want to make + # sure we can tear down unused pools even when there are other guests running + if conn.list_domains.empty? + # OK, there are no running guests on this host anymore. We can teardown + # any storage pools that are there without fear + + # we first have to tear-down LVM pools, because they might depend on the + # underlying physical pools + remove_pools(conn, "logical") + + # now tear down the rest of the pools + remove_pools(conn) + end +end + def create_vm_xml(name, uuid, memAllocated, memUsed, vcpus, bootDevice, macAddr, bridge, diskDevices) doc = Document.new doc.add_element("domain", {"type" => "kvm"}) - doc.root.add_element("name") - doc.root.elements["name"].text = name + doc.root.add_element("name").add_text(name) - doc.root.add_element("uuid") - doc.root.elements["uuid"].text = uuid + doc.root.add_element("uuid").add_text(uuid) - doc.root.add_element("memory") - doc.root.elements["memory"].text = memAllocated + doc.root.add_element("memory").add_text(memAllocated.to_s) - doc.root.add_element("currentMemory") - doc.root.elements["currentMemory"].text = memUsed + doc.root.add_element("currentMemory").add_text(memUsed.to_s) - doc.root.add_element("vcpu") - doc.root.elements["vcpu"].text = vcpus + doc.root.add_element("vcpu").add_text(vcpus.to_s) doc.root.add_element("os") - doc.root.elements["os"].add_element("type") - doc.root.elements["os"].elements["type"].text = "hvm" + doc.root.elements["os"].add_element("type").add_text("hvm") doc.root.elements["os"].add_element("boot", {"dev" => bootDevice}) doc.root.add_element("clock", {"offset" => "utc"}) - doc.root.add_element("on_poweroff") - doc.root.elements["on_poweroff"].text = "destroy" + doc.root.add_element("on_poweroff").add_text("destroy") - doc.root.add_element("on_reboot") - doc.root.elements["on_reboot"].text = "restart" + doc.root.add_element("on_reboot").add_text("restart") - doc.root.add_element("on_crash") - doc.root.elements["on_crash"].text = "destroy" + doc.root.add_element("on_crash").add_text("destroy") doc.root.add_element("devices") - doc.root.elements["devices"].add_element("emulator") - doc.root.elements["devices"].elements["emulator"].text = "/usr/bin/qemu-kvm" + doc.root.elements["devices"].add_element("emulator").add_text("/usr/bin/qemu-kvm") devs = ['hda', 'hdb', 'hdc', 'hdd'] which_device = 0 @@ -115,7 +209,6 @@ def setVmVncPort(vm, domain) vm.save end - def findVM(task, fail_on_nil_host_id = true) # find the matching VM in the vms table vm = task.vm diff --git a/src/task-omatic/taskomatic.rb b/src/task-omatic/taskomatic.rb index 0af68bf..1264207 100755 --- a/src/task-omatic/taskomatic.rb +++ b/src/task-omatic/taskomatic.rb @@ -104,6 +104,8 @@ loop do when VmTask::ACTION_UPDATE_STATE_VM then update_state_vm(task) when VmTask::ACTION_MIGRATE_VM then migrate_vm(task) when StorageTask::ACTION_REFRESH_POOL then refresh_pool(task) + when StorageVolumeTask::ACTION_CREATE_VOLUME then create_volume(task) + when StorageVolumeTask::ACTION_DELETE_VOLUME then delete_volume(task) when HostTask::ACTION_CLEAR_VMS then clear_vms_host(task) else puts "unknown task " + task.action diff --git a/src/task-omatic/utils.rb b/src/task-omatic/utils.rb index 47a4543..26516ae 100644 --- a/src/task-omatic/utils.rb +++ b/src/task-omatic/utils.rb @@ -1,40 +1,6 @@ require 'rexml/document' include REXML -def findHostSLA(vm) - host = nil - - vm.vm_resource_pool.get_hardware_pool.hosts.each do |curr| - # FIXME: we probably need to add in some notion of "load" into this check - if curr.num_cpus >= vm.num_vcpus_allocated \ - and curr.memory >= vm.memory_allocated \ - and not curr.is_disabled.nil? and curr.is_disabled == 0 \ - and curr.state == Host::STATE_AVAILABLE \ - and (vm.host_id.nil? or (not vm.host_id.nil? and vm.host_id != curr.id)) - host = curr - break - end - end - - if host == nil - # we couldn't find a host that matches this criteria - raise "No host matching VM parameters could be found" - end - - return host -end - -def findHost(host_id) - host = Host.find(:first, :conditions => [ "id = ?", host_id]) - - if host == nil - # Hm, we didn't find the host_id. Seems odd. Return a failure - raise "Could not find host_id " + host_id.to_s - end - - return host -end - def String.random_alphanumeric(size=16) s = "" size.times { s << (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr } @@ -47,156 +13,166 @@ def all_storage_pools(conn) return all_pools end -def teardown_storage_pools(conn) - # FIXME: this needs to get a *lot* smarter. In particular, we want to make - # sure we can tear down unused pools even when there are other guests running - if conn.list_domains.empty? - # OK, there are no running guests on this host anymore. We can teardown - # any storage pools that are there without fear - all_storage_pools(conn).each do |remote_pool_name| - begin - pool = conn.lookup_storage_pool_by_name(remote_pool_name) - pool.destroy - pool.undefine - rescue - # do nothing if any of this failed; the worst that happens is that - # we leave a pool configured - puts "Could not teardown pool " + remote_pool_name + "; skipping" - end - end - end -end - -def connect_storage_pools(conn, storage_volumes) - # here, build up a list of already defined pools. We'll use it - # later to see if we need to define new pools for the storage or just - # keep using existing ones +def get_libvirt_pool_from_volume(db_volume) + phys_volume = StorageVolume.find(:first, :conditions => + [ "lvm_pool_id = ?", db_volume.storage_pool_id]) - defined_pools = [] - all_storage_pools(conn).each do |remote_pool_name| - defined_pools << conn.lookup_storage_pool_by_name(remote_pool_name) - end + return LibvirtPool.factory(phys_volume.storage_pool) +end - storagedevs = [] - storage_volumes.each do |volume| - # here, we need to iterate through each volume and possibly attach it - # to the host we are going to be using - storage_pool = volume.storage_pool - - if storage_pool == nil - # Hum. Specified by the VM description, but not in the storage pool? - # continue on and hope for the best - # FIXME: probably want a print to the logs here - next - end +class LibvirtPool + def initialize(type, name = nil) + @remote_pool = nil + @build_on_start = true + @remote_pool_defined = false + @remote_pool_started = false - if storage_pool[:type] == "IscsiStoragePool" - thisstorage = Iscsi.new(storage_pool.ip_addr, storage_pool[:target]) - elsif storage_pool[:type] == "NfsStoragePool" - thisstorage = NFS.new(storage_pool.ip_addr, storage_pool.export_path) + if name == nil + @name = type + "-" + String.random_alphanumeric else - # Hm, a storage type we don't understand; skip it - puts "Storage type " + storage_pool[:type] + " is not understood; skipping" - next + @name = name end - thepool = nil - defined_pools.each do |pool| - doc = Document.new(pool.xml_desc) - root = doc.root + @xml = Document.new + @xml.add_element("pool", {"type" => type}) + + @xml.root.add_element("name").add_text(@name) + + @xml.root.add_element("source") + + @xml.root.add_element("target") + @xml.root.elements["target"].add_element("path") + end + + def connect(conn) + all_storage_pools(conn).each do |remote_pool_name| + tmppool = conn.lookup_storage_pool_by_name(remote_pool_name) - if thisstorage.xmlequal?(doc.root) - thepool = pool + if self.xmlequal?(Document.new(tmppool.xml_desc).root) + @remote_pool = tmppool break end end - if thepool == nil - thepool = conn.define_storage_pool_xml(thisstorage.getxml) - thepool.build - thepool.create - elsif thepool.info.state == Libvirt::StoragePool::INACTIVE + if @remote_pool == nil + @remote_pool = conn.define_storage_pool_xml(@xml.to_s) + # we need this because we don't want to "build" LVM pools, which would + # destroy existing data + if @build_on_start + @remote_pool.build + end + @remote_pool_defined = true + end + + if @remote_pool.info.state == Libvirt::StoragePool::INACTIVE # only try to start the pool if it is currently inactive; in all other # states, assume it is already running - thepool.create + @remote_pool.create + @remote_pool_started = true end + end - storagedevs << thepool.lookup_volume_by_name(volume.read_attribute(thisstorage.db_column)).path + def list_volumes + return @remote_pool.list_volumes end - return storagedevs -end + def lookup_vol_by_path(dev) + return @remote_pool.lookup_volume_by_path(dev) + end -class StorageType - attr_reader :db_column + def lookup_vol_by_name(name) + return @remote_pool.lookup_volume_by_name(name) + end + + def create_vol_xml(xml) + return @remote_pool.create_vol_xml(xml) + end + + def shutdown + if @remote_pool_started + @remote_pool.destroy + end + if @remote_pool_defined + @remote_pool.undefine + end + end def xmlequal?(docroot) return false end - def getxml - return @xml.to_s + def self.factory(pool) + if pool[:type] == "IscsiStoragePool" + return IscsiLibvirtPool.new(pool.ip_addr, pool[:target]) + elsif pool[:type] == "NfsStoragePool" + return NFSLibvirtPool.new(pool.ip_addr, pool.export_path) + elsif pool[:type] == "LvmStoragePool" + return LVMLibvirtPool.new(pool.vg_name) + else + raise "Unknown storage pool type " + pool[:type].to_s + end end end -class Iscsi < StorageType - def initialize(ipaddr, target) +class IscsiLibvirtPool < LibvirtPool + def initialize(ip_addr, target) + super('iscsi') + @type = 'iscsi' - @ipaddr = ipaddr + @ipaddr = ip_addr @target = target - @db_column = 'lun' - - @xml = Document.new - @xml.add_element("pool", {"type" => @type}) - - @xml.root.add_element("name") - @xml.root.elements["name"].text = String.random_alphanumeric - - @xml.root.add_element("source") @xml.root.elements["source"].add_element("host", {"name" => @ipaddr}) @xml.root.elements["source"].add_element("device", {"path" => @target}) - @xml.root.add_element("target") - @xml.root.elements["target"].add_element("path") @xml.root.elements["target"].elements["path"].text = "/dev/disk/by-id" end def xmlequal?(docroot) return (docroot.attributes['type'] == @type and - docroot.elements['source'].elements['host'].attributes['name'] == @ipaddr and - docroot.elements['source'].elements['device'].attributes['path'] == @target) + docroot.elements['source'].elements['host'].attributes['name'] == @ipaddr and + docroot.elements['source'].elements['device'].attributes['path'] == @target) end end -class NFS < StorageType - def initialize(host, remote_path) +class NFSLibvirtPool < LibvirtPool + def initialize(ip_addr, export_path) + super('netfs') + @type = 'netfs' - @host = host - @remote_path = remote_path + @host = ip_addr + @remote_path = export_path @name = String.random_alphanumeric - @db_column = 'filename' - - @xml = Document.new - @xml.add_element("pool", {"type" => @type}) - - @xml.root.add_element("name") - - @xml.root.elements["name"].text = @name - @xml.root.add_element("source") @xml.root.elements["source"].add_element("host", {"name" => @host}) @xml.root.elements["source"].add_element("dir", {"path" => @remote_path}) @xml.root.elements["source"].add_element("format", {"type" => "nfs"}) - @xml.root.add_element("target") - @xml.root.elements["target"].add_element("path") @xml.root.elements["target"].elements["path"].text = "/mnt/" + @name end def xmlequal?(docroot) return (docroot.attributes['type'] == @type and - docroot.elements['source'].elements['host'].attributes['name'] == @host and - docroot.elements['source'].elements['dir'].attributes['path'] == @remote_path) + docroot.elements['source'].elements['host'].attributes['name'] == @host and + docroot.elements['source'].elements['dir'].attributes['path'] == @remote_path) + end +end + +class LVMLibvirtPool < LibvirtPool + def initialize(vg_name) + super('logical', vg_name) + + @type = 'logical' + @build_on_start = false + + @xml.root.elements["source"].add_element("name").add_text(@name) + + @xml.root.elements["target"].elements["path"].text = "/dev/" + @name + end + + def xmlequal?(docroot) + return (docroot.attributes['type'] == @type and + docroot.elements['name'].text == @name and + docroot.elements['source'].elements['name'] == @name) end end -- 1.5.4.3 From clalance at redhat.com Wed Nov 5 15:57:26 2008 From: clalance at redhat.com (Chris Lalancette) Date: Wed, 5 Nov 2008 16:57:26 +0100 Subject: [Ovirt-devel] [PATCH server] Implement "poweroff" in the WUI. In-Reply-To: <> References: <> Message-ID: <1225900646-15307-1-git-send-email-clalance@redhat.com> Implement the concept of "poweroff" for VMs in the WUI, and in the backend taskomatic bits. This is the counterpart to "shutdown"; while shutdown does a graceful shutdown of the guest (with an ACPI event), poweroff pull the plug. This is necessary for situations in which the guest doesn't understand the ACPI event (like 2.4 based Linux guests), where the ACPI event fails for some reason, or where you just want to pull the plug. Signed-off-by: Chris Lalancette --- src/app/controllers/resources_controller.rb | 3 ++- src/app/models/vm.rb | 3 +++ src/app/models/vm_task.rb | 9 +++++++++ src/task-omatic/task_vm.rb | 22 ++++++++++++---------- src/task-omatic/taskomatic.rb | 1 + 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/app/controllers/resources_controller.rb b/src/app/controllers/resources_controller.rb index 2c54ccc..6a2482c 100644 --- a/src/app/controllers/resources_controller.rb +++ b/src/app/controllers/resources_controller.rb @@ -53,7 +53,8 @@ class ResourcesController < PoolController # resource's vms list page def show_vms @actions = [VmTask.label_and_action(VmTask::ACTION_START_VM), - (VmTask.label_and_action(VmTask::ACTION_SHUTDOWN_VM) << "break"), + VmTask.label_and_action(VmTask::ACTION_SHUTDOWN_VM), + (VmTask.label_and_action(VmTask::ACTION_POWEROFF_VM) << "break"), VmTask.label_and_action(VmTask::ACTION_SUSPEND_VM), VmTask.label_and_action(VmTask::ACTION_RESUME_VM), VmTask.label_and_action(VmTask::ACTION_SAVE_VM), diff --git a/src/app/models/vm.rb b/src/app/models/vm.rb index 9a4c4fa..227f343 100644 --- a/src/app/models/vm.rb +++ b/src/app/models/vm.rb @@ -68,6 +68,7 @@ class Vm < ActiveRecord::Base STATE_UNREACHABLE = "unreachable" + STATE_POWERING_OFF = "powering_off" STATE_STOPPING = "stopping" STATE_STOPPED = "stopped" STATE_STARTING = "starting" @@ -92,6 +93,7 @@ class Vm < ActiveRecord::Base RUNNING_STATES = [STATE_RUNNING, STATE_SUSPENDED, + STATE_POWERING_OFF, STATE_STOPPING, STATE_STARTING, STATE_SUSPENDING, @@ -105,6 +107,7 @@ class Vm < ActiveRecord::Base STATE_CREATING => STATE_STOPPED, STATE_RUNNING => STATE_RUNNING, STATE_STOPPING => STATE_STOPPED, + STATE_POWERING_OFF => STATE_STOPPED, STATE_STOPPED => STATE_STOPPED, STATE_STARTING => STATE_RUNNING, STATE_SUSPENDING => STATE_SUSPENDED, diff --git a/src/app/models/vm_task.rb b/src/app/models/vm_task.rb index c38f24f..27e3e65 100644 --- a/src/app/models/vm_task.rb +++ b/src/app/models/vm_task.rb @@ -23,6 +23,7 @@ class VmTask < Task ACTION_START_VM = "start_vm" ACTION_SHUTDOWN_VM = "shutdown_vm" + ACTION_POWEROFF_VM = "poweroff_vm" ACTION_SUSPEND_VM = "suspend_vm" ACTION_RESUME_VM = "resume_vm" @@ -64,6 +65,14 @@ class VmTask < Task :failure => Vm::STATE_RUNNING, :privilege => [Permission::PRIV_VM_CONTROL, PRIV_OBJECT_VM_POOL]}, + ACTION_POWEROFF_VM => { :label => "Poweroff", + :icon => "icon_x.png", + :start => Vm::STATE_RUNNING, + :running => Vm::STATE_POWERING_OFF, + :success => Vm::STATE_STOPPED, + :failure => Vm::STATE_RUNNING, + :privilege => [Permission::PRIV_VM_CONTROL, + PRIV_OBJECT_VM_POOL]}, ACTION_SUSPEND_VM => { :label => "Suspend", :icon => "icon_suspend.png", :start => Vm::STATE_RUNNING, diff --git a/src/task-omatic/task_vm.rb b/src/task-omatic/task_vm.rb index c30c6a9..56f024c 100644 --- a/src/task-omatic/task_vm.rb +++ b/src/task-omatic/task_vm.rb @@ -267,9 +267,7 @@ def create_vm(task) end end -def shutdown_vm(task) - puts "shutdown_vm" - +def shut_or_destroy_vm(task, which) # here, we are given an id for a VM to shutdown; we have to lookup which # physical host it is running on @@ -291,13 +289,7 @@ def shutdown_vm(task) begin conn = Libvirt::open("qemu+tcp://" + vm.host.hostname + "/system") dom = conn.lookup_domain_by_uuid(vm.uuid) - # FIXME: crappy. Right now we destroy the domain to make sure it - # really went away. We really want to shutdown the domain to make - # sure it gets a chance to cleanly go down, but how can we tell when - # it is truly shut off? And then we probably need a timeout in case - # of problems. Needs more thought - #dom.shutdown - dom.destroy + dom.send(which) begin dom.undefine @@ -321,6 +313,16 @@ def shutdown_vm(task) setVmShutdown(vm) end +def shutdown_vm(task) + puts "shutdown_vm" + shut_or_destroy_vm(task, "shutdown") +end + +def poweroff_vm(task) + puts "poweroff_vm" + shut_or_destroy_vm(task, "destroy") +end + def start_vm(task) puts "start_vm" diff --git a/src/task-omatic/taskomatic.rb b/src/task-omatic/taskomatic.rb index 1264207..651e652 100755 --- a/src/task-omatic/taskomatic.rb +++ b/src/task-omatic/taskomatic.rb @@ -96,6 +96,7 @@ loop do case task.action when VmTask::ACTION_CREATE_VM then create_vm(task) when VmTask::ACTION_SHUTDOWN_VM then shutdown_vm(task) + when VmTask::ACTION_POWEROFF_VM then poweroff_vm(task) when VmTask::ACTION_START_VM then start_vm(task) when VmTask::ACTION_SUSPEND_VM then suspend_vm(task) when VmTask::ACTION_RESUME_VM then resume_vm(task) -- 1.5.4.3 From dhuff at redhat.com Wed Nov 5 18:17:43 2008 From: dhuff at redhat.com (David Huff) Date: Wed, 05 Nov 2008 13:17:43 -0500 Subject: [Thincrust-devel] Re: [Ovirt-devel] unable to add hosts in web admin tool In-Reply-To: <4905C96E.5080407@redhat.com> References: <48F2EED5.6030908@redfish-group.com> <48F2F6C7.4020300@redfish-group.com> <48F2FEEB.10705@redhat.com> <48F3128A.7090800@redfish-group.com> <48F35A21.6070101@redhat.com> <48FEF4CE.2090002@redfish-group.com> <4901DA04.40808@redhat.com> <4901E150.2020700@redhat.com> <4905BFD3.5090906@redhat.com> <4905C96E.5080407@redhat.com> Message-ID: <4911E347.4080704@redhat.com> Alan Pevec wrote: > Bryan Kearney wrote: >> http://ovirt.org/page/TroubleShooting#Debugging_oVirt_Appliance_firstboot >> >> You appear to be modifying the host, not the guest is that correct? > > guest image modified, it is mounted at /mnt using qemu-nbd (network > block device) > > _______________________________________________ > Thincrust-devel mailing list > Thincrust-devel at redhat.com > https://www.redhat.com/mailman/listinfo/thincrust-devel This can be corrected just by adding "console=ttyS0,115200" to the kernel options of the appliance. This can be done in the ks file via the --appned line. I have updated the sample kickstart file included in appliance-creator and the ks files in the AOS repo. -D From bkearney at redhat.com Wed Nov 5 21:19:19 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Wed, 05 Nov 2008 16:19:19 -0500 Subject: [Ovirt-devel] [PATCH node] Creates a standalone mode entry point script. In-Reply-To: <1225892250-6704-1-git-send-email-dpierce@redhat.com> References: <1225892250-6704-1-git-send-email-dpierce@redhat.com> Message-ID: <49120DD7.4030201@redhat.com> Darryl L. Pierce wrote: > NOTE: This is for feedback and testing, and requires the patch for > node-image to reintroduce hal-device. > > The script will execute only when the node is booted without the support of > a server suite. If it determines that the node is running in standalone mode, > it will then kick over to a node setup script. > > This iteration defines the general flow for the standalone mode's firstboot > use case. When the node boots and determines it's in standalone mode, it > goes through the following steps: > > 1. Prompt for an administrator password > 2. Prompt the user to configure disk storage > 3. Prompt the user to configure networking > 4. Prompt the user to configure logging > > The node then continues to boot normally. > --- > Makefile.am | 34 +++++---- > ovirt-node.spec.in | 15 ++++- > scripts/ovirt-config-logging | 1 + > scripts/ovirt-config-networking | 98 ++++++++++++++++++++++++++ > scripts/ovirt-config-password | 1 + > scripts/ovirt-config-setup | 43 +++++++++++ > scripts/ovirt-config-storage | 147 +++++++++++++++++++++++++++++++++++++++ > scripts/ovirt-functions | 5 ++ > scripts/ovirt-standalone-mode | 55 +++++++++++++++ > 9 files changed, 384 insertions(+), 15 deletions(-) > create mode 100755 scripts/ovirt-config-logging > create mode 100755 scripts/ovirt-config-networking > create mode 100755 scripts/ovirt-config-password > create mode 100755 scripts/ovirt-config-setup > create mode 100755 scripts/ovirt-config-storage > create mode 100755 scripts/ovirt-standalone-mode > > diff --git a/Makefile.am b/Makefile.am > index c55db13..3d824db 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -18,20 +18,26 @@ > OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache > SUBDIRS = ovirt-identify-node ovirt-listen-awake > > -EXTRA_DIST = \ > - .gitignore \ > - ovirt-node.spec \ > - ovirt-node.spec.in \ > - ovirt-node-selinux.te \ > - scripts/collectd \ > - scripts/collectd.conf.in \ > - scripts/ovirt \ > - scripts/ovirt-awake \ > - scripts/ovirt-early \ > - scripts/ovirt-functions \ > - scripts/ovirt-post \ > - scripts/ovirt-process-config \ > - logrotate/ovirt-logrotate \ > +EXTRA_DIST = \ > + .gitignore \ > + ovirt-node.spec \ > + ovirt-node.spec.in \ > + ovirt-node-selinux.te \ > + scripts/collectd \ > + scripts/collectd.conf.in \ > + scripts/ovirt \ > + scripts/ovirt-awake \ > + scripts/ovirt-config-logging \ > + scripts/ovirt-config-networking \ > + scripts/ovirt-config-password \ > + scripts/ovirt-config-setup \ > + scripts/ovirt-config-storage \ > + scripts/ovirt-early \ > + scripts/ovirt-functions \ > + scripts/ovirt-post \ > + scripts/ovirt-process-config \ > + scripts/ovirt-standalone-mode \ > + logrotate/ovirt-logrotate \ > logrotate/ovirt-logrotate.conf > > # For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT- > diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in > index d029c57..10a544b 100644 > --- a/ovirt-node.spec.in > +++ b/ovirt-node.spec.in > @@ -88,17 +88,22 @@ cd - > > %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir} > %{__install} -p -m0755 scripts/ovirt-process-config %{buildroot}%{_sbindir} > +%{__install} -p -m0755 scripts/ovirt-config-logging %{buildroot}%{_sbindir} > +%{__install} -p -m0755 scripts/ovirt-config-networking %{buildroot}%{_sbindir} > +%{__install} -p -m0755 scripts/ovirt-config-password %{buildroot}%{_sbindir} > +%{__install} -p -m0755 scripts/ovirt-config-setup %{buildroot}%{_sbindir} > +%{__install} -p -m0755 scripts/ovirt-config-storage %{buildroot}%{_sbindir} > %{__install} -p -m0755 ovirt-identify-node/ovirt-identify-node %{buildroot}%{_sbindir} > %{__install} -p -m0755 ovirt-listen-awake/ovirt-listen-awake %{buildroot}%{_sbindir} > %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-listen-awake.init %{buildroot}%{_initrddir}/ovirt-listen-awake > %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-install-node %{buildroot}%{_sbindir} > %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-uninstall-node %{buildroot}%{_sbindir} > > - > %{__install} -p -m0644 scripts/ovirt-functions %{buildroot}%{_initrddir} > %{__install} -p -m0755 scripts/ovirt-early %{buildroot}%{_initrddir} > %{__install} -p -m0755 scripts/ovirt %{buildroot}%{_initrddir} > %{__install} -p -m0755 scripts/ovirt-post %{buildroot}%{_initrddir} > +%{__install} -p -m0755 scripts/ovirt-standalone-mode %{buildroot}%{_initrddir} > > %{__install} -p -m0644 scripts/collectd %{buildroot}%{_sysconfdir}/chkconfig.d > %{__install} -p -m0644 scripts/collectd.conf.in %{buildroot}%{_sysconfdir} > @@ -125,6 +130,7 @@ cd - > /sbin/chkconfig --add ovirt-early > /sbin/chkconfig --add ovirt > /sbin/chkconfig --add ovirt-post > +/sbin/chkconfig --add ovirt-standalone-mode > # this is ugly; we need collectd to start *after* libvirtd, so we own the > # /etc/chkconfig.d/collectd file, and then have to re-define collectd here > /sbin/chkconfig --add collectd > @@ -136,6 +142,7 @@ if [ "$1" = 0 ] ; then > /sbin/chkconfig --del ovirt > /sbin/chkconfig --del ovirt-post > /sbin/chkconfig --del ovirt-listen-awake > + /sbin/chkconfig --del ovirt-standalone-mode > fi > > %post selinux > @@ -159,6 +166,11 @@ fi > %files > %defattr(-,root,root,0755) > %{_sbindir}/ovirt-awake > +%{_sbindir}/ovirt-config-logging > +%{_sbindir}/ovirt-config-networking > +%{_sbindir}/ovirt-config-password > +%{_sbindir}/ovirt-config-setup > +%{_sbindir}/ovirt-config-storage > %{_sbindir}/ovirt-process-config > %{_sbindir}/ovirt-identify-node > %{_sbindir}/ovirt-listen-awake > @@ -168,6 +180,7 @@ fi > %{_initrddir}/ovirt > %{_initrddir}/ovirt-post > %{_initrddir}/ovirt-listen-awake > +%{_initrddir}/ovirt-standalone-mode > %config %{_sysconfdir}/logrotate.d/ovirt-logrotate.conf > %config %{_sysconfdir}/cron.hourly/ovirt-logrotate > %defattr(-,root,root,0644) > diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging > new file mode 100755 > index 0000000..8b13789 > --- /dev/null > +++ b/scripts/ovirt-config-logging > @@ -0,0 +1 @@ > + > diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking > new file mode 100755 > index 0000000..705521b > --- /dev/null > +++ b/scripts/ovirt-config-networking > @@ -0,0 +1,98 @@ > +#!/bin/bash > +# > +# Iterates over the list of network devices on the node and prompts the user > +# to configure each. > + > +CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" > + > +function configure_interface > +{ > + NIC=$1 > + FILENAME="/var/tmp/augtool-$NIC" > + > + printf "\nCONFIGURE INTERFACE: $NIC\n\n" > + > + THIS_ROOT="$CONFIG_FILE_ROOT-$NIC" > + CONFIG="rm $THIS_ROOT\nset $THIS_ROOT/DEVICE $NIC" > + > + # Is this NIC shared? > + while true; do > + printf "Is $NIC a shared interface? (Y/N) " > + read > + case $REPLY in > + Y|y) CONFIG="$CONFIG\nset $THIS_ROOT/TYPE bridge"; break ;; > + N|n) bridge="N"; break ;; > + esac > + done > + > + # how do you want to configure this device? (dhcp, static IP) > + while true; do > + printf "Does $NIC use dynamic addressing? (Y/N) " > + read > + case $REPLY in > + Y|y) CONFIG="$CONFIG\nset $THIS_ROOT/BOOTPROTO dhcp"; break ;; > + N|n) > + printf "\tIP Address: "; read; IPADDR=$REPLY > + printf "\t Netmask: "; read; NETMASK=$REPLY > + printf "\t Broadcast: "; read; BROADCAST=$REPLY > + printf "\t Gateway: "; read; GATEWAY=$REPLY > + > + printf "\nIP Address: $IPADDR\nNetmask: $NETMASK\nBroadcast: $BROADCAST\nGateway: $GATEWAY\n" > + printf "Is this correct? (Y/N) " > + read > + case $REPLY in > + Y|y) > + CONFIG="$CONFIG\nset $THIS_ROOT/IPADDR $IPADDR" > + CONFIG="$CONFIG\nset $THIS_ROOT/BROADCAST $BROADCAST" > + CONFIG="$CONFIG\nset $THIS_ROOT/NETMASK $NETMASK" > + break > + ;; > + esac > + ;; > + esac > + done > + > + if [ "$bridge" == "N" ]; then > + printf "Is $NIC bridged? (Y/N) " > + read > + case $REPLY in > + Y|y) > + printf "What is the bridge name? " > + read > + CONFIG="$CONFIG\n set $THIS_ROOT/BRIDGE $REPLY" > + ;; > + esac > + fi > + > + CONFIG="$CONFIG\nset $THIS_ROOT/ONBOOT yes" > + printf "$CONFIG\n" > $FILENAME > + > + echo > +} > + > +# TODO the menu doesn't redisplay unless you hit enter -- needs fixing > +# get the list of network cards on this machine > +NICS=$(hal-device | awk '/net.interface/ { > + match($0, "= '"'"'(.*)'"'"' ", nic); printf("%s ", nic[1]); }') > + > +# Append a quit option > +NICS="$NICS Quit" > + > +PS3="Please select a network interface to configure:" > +select NIC in $NICS > +do > + case "$NIC" in > + "Quit") > + break > + ;; > + > + *) > + configure_interface $NIC > + ;; > + esac > +done > + > +# Merge together all generated files and run augtool > + > +cat /var/tmp/augtool-* > /var/tmp/config-augtool > +augtool < /var/tmp/config-augtool > diff --git a/scripts/ovirt-config-password b/scripts/ovirt-config-password > new file mode 100755 > index 0000000..8b13789 > --- /dev/null > +++ b/scripts/ovirt-config-password > @@ -0,0 +1 @@ > + > diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup > new file mode 100755 > index 0000000..a8bdc5d > --- /dev/null > +++ b/scripts/ovirt-config-setup > @@ -0,0 +1,43 @@ > +#!/bin/bash > +# > +# Entry point for configuring an oVirt node when running in standalone mode. > + > +PS3="Please select an option: " > + > +# TODO should we make this optional, based on whether the password was already set? > +PASSWORD_OPTION="Password" > + > +LIST="Networking Storage Logging ${PASSWORD_OPTION} Quit" > + > +select OPT in $LIST > +do > + printf "\n" > + > + case "$OPT" in > + "Networking") > + ovirt-config-networking > + ;; > + > + "Storage") > + ovirt-config-storage > + ;; > + > + "Logging") > + ovirt-config-logging > + ;; > + > + "Password") > + # TODO only do this if we allow it > + ovirt-config-password > + ;; > + > + "Quit") > + printf "Finished.\n" > + exit 0 > + ;; > + > + "*") > + printf "Invalid option \"${OPT}\".\n" > + ;; > + esac > +done > diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage > new file mode 100755 > index 0000000..3a16411 > --- /dev/null > +++ b/scripts/ovirt-config-storage > @@ -0,0 +1,147 @@ > +#!/bin/bash > +# > + > +function show_logical_volumes > +{ > + OUTPUT=$(lvdisplay | awk '/LV Name/ { print " "$3 }') > + > + printf "Current Logical Volumes:\n" > + printf "========================\n" > + printf "$OUTPUT\n" > +} > + > +function create_partition > +{ > + PHYVOLS=$(pvdisplay | awk '/VG Name/ { print $3" " }') > + PHYVOLS="$PHYVOLS Quit" > + printf "\n" > + > + PS3="Please select a physical volume: " > + select PHYVOL in $PHYVOLS > + do > + case "$PHYVOL" in > + "Quit") > + return > + ;; > + > + *) > + if [ "" != "$PHYVOL" ] > + then > + PVOLUME="$PHYVOL" > + break > + fi > + ;; > + esac > + printf "\n" > + done > + > + printf "\nWhat is the name for the new logical volume? " > + read > + if [[ "$REPLY" =~ '^\w+$' ]]; then > + LVOLUME="$REPLY" > + > + printf "\nWhat size (in Gigabytes) is this new logical volume? " > + read > + if [[ "$REPLY" =~ '^[0-9.]+$' ]]; then > + LVSIZE="$REPLY" > + > + printf "\nMount point for this new file system? " > + read > + if [[ "$REPLY" =~ '^\/(\w|\/)*$' ]]; then > + MOUNTPT="$REPLY" > + > + printf "\nCreating /dev/${PHYVOL}/${LVOLUME} (${LVSIZE} GB), mounted at ${MOUNTPT} :\n\n" > + printf " Is that correct? (Y/N) " > + read > + case $REPLY in > + Y|y) > + lvdevice="/dev/${PHYVOL}/${LVOLUME}" > + lvcreate --size ${LVSIZE}G /dev/${PHYVOL} --name $LVOLUME; > + printf "${lvdevice}\t${MOUNTPT}\text3\tdefaults\t1 2\n" >> /etc/fstab > + ;; > + > + N|n) printf "Logical volume creation aborted.\n"; break ;; > + esac > + else > + printf "\nInvalid mount point.\n" > + fi > + else > + printf "\nLogical volume size must be a numeric value.\n" > + fi > + else > + printf "\n'$REPLY' is an invalid logical volume name.\n" > + fi > + > + printf "\n" > +} > + > +function format_partition > +{ > + LVOLUMES=$(lvdisplay | awk '/LV Name/ { print $3" " }') > + LVOLUMES="${LVOLUMES} Quit" > + PS3="Select a volume to format: " > + > + select LVM in $LVOLUMES > + do > + case "$LVM" in > + "Quit") > + return > + ;; > + > + *) > + if [ "" != "$LVM" ]; then > + break > + fi > + ;; > + esac > + printf "\n" > + done > + > + printf "Formatting ${LVM} with EXT3..." > + > + mkfs -t ext3 ${LVM} > +} > + > +function delete_partition > +{ > + echo "Delete" > +} > + > + > +declare -a OPTIONS > +OPTIONS[${#OPTIONS[*]}]="Create Partition" > +OPTIONS[${#OPTIONS[*]}]="Format Partition" > +OPTIONS[${#OPTIONS[*]}]="Remove Partition" > +OPTIONS[${#OPTIONS[*]}]="Quit" > +eval set $OPTIONS > + > +show_logical_volumes > + > +PS3="Please select a storage operation to perform: " > +printf "\n" > + > +eval set $OPTIONS > +select OPTION in "${OPTIONS[@]}" > +do > + case "$OPTION" in > + "Create Partition") > + create_partition > + ;; > + > + "Format Partition") > + format_partition > + ;; > + > + "Delete Partition") > + delete_partition > + ;; > + > + "Quit") > + break > + ;; > + esac > + > + printf "\n" > + show_logical_volumes > + PS3="Please select a storage operation to perform: " > +done > diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions > index e251eac..53e9f62 100644 > --- a/scripts/ovirt-functions > +++ b/scripts/ovirt-functions > @@ -7,6 +7,11 @@ OVIRT_LABEL=OVIRT > > OVIRT_BACKUP_DIR=/var/lib/ovirt-backup > > +is_standalone() > +{ > + return 0 > +} > + > find_srv() > { > local dnsreply > diff --git a/scripts/ovirt-standalone-mode b/scripts/ovirt-standalone-mode > new file mode 100755 > index 0000000..e503917 > --- /dev/null > +++ b/scripts/ovirt-standalone-mode > @@ -0,0 +1,55 @@ > +#!/bin/bash > +# > +# ovirt-standalone-mode Starts the node in standalone mode. > +# > +# chkconfig: 2345 01 99 > +# description: ovirt-early services > +# > +# Copyright (C) 2008 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. > + > +## Source functions library > +. /etc/init.d/functions > +. /etc/init.d/ovirt-functions > + > +start () > +{ > + ovirt-config-setup > +} > + > +case "$1" in > + start) > + #is_standalone > + #if [ $? -ne 0 ]; then > + # exit 0 > + #fi > + > + printf "Starting ovirt-standalone-mode: " > + > + { > + start > + } > + > + test $? == 0 && success || failure > + echo > + ;; > + > + *) > + echo "Usage: ovirt-early {start}" > + exit 2 > +esac I get this error when trying to run this: http://bkearney.fedorapeople.org/dbus_error.png -- bk From imain at redhat.com Wed Nov 5 21:32:38 2008 From: imain at redhat.com (Ian Main) Date: Wed, 5 Nov 2008 13:32:38 -0800 Subject: [Ovirt-devel] Another Pass at Ovirt Node Qpid API Message-ID: <20081105133238.6b80946c@tp.mains.net> Here is another pass at the ovirt qpid API. I've cleaned a few things up, incorporated some suggestions, done away with camel case (just because I can), and fleshed out the network configuration. I've sent it as an attachment because it's getting pretty big. I'm really wishing QMF had inheritance implemented but that's not in yet (future versions will have it I'm told). Here is an example of how you might use it to configure networking: s = Qpid::Qmf::Session.new() b = s.add_broker("amqp://localhost:5672") node = s.objects(:class => 'OvirtNode', 'hostname' => 'node3.priv.ovirt.org') # Grab all the real interfaces. interfaces = s.objects(:class => 'NetworkInterface', 'ovirt_node' => node.object_id) # Print their name/mac and then print all IPv4 addresses bound to them. interfaces.each do |interface| puts "interface name: #{interface.name}, mac: #{interface.mac}" ips = s.objects(:class => 'IpAddress', 'interface' => interface.object_id) puts "IP Addresses:" ips.each do |ip| puts "IP address: #{ip.ipaddr}" end end # Add a new bond to the current network. This is kind of shortcutting because in # a real application we'd have to find the real names of the interfaces, but as you # can see above that's not hard. iface1 = s.objects(:class => 'NetworkInterface', 'name' => 'eth1', 'ovirt_node' => node.object_id) iface2 = s.objects(:class => 'NetworkInterface', 'name' => 'eth2', 'ovirt_node' => node.object_id) bond = node.create_bonding_interface("bond0") # Setup the two interfaces to be bonded. iface1.master = bond.object_id iface2.master = bond.object_id # We'll pretend there was a previous config and we'll remove everything to do with it. # Remove dhcp config. iface1.dhcp = false iface2.dhcp = false # Remove all IPs. Should do the same with v6, but we'll assume its disabled. ips = s.objects(:class => 'IpAddress', 'interface' => iface1.object_id) ips |= s.objects(:class => 'IpAddress', 'interface' => iface2.object_id) ips.each do |ip| ip.delete end bond.bonding_mode = 'balance-alb' bond.dhcp = true # Restart network service.. I'm sure we could just restart the individual interfaces # and it would work too. node.restart_network() # Make bond0 use a static IP instead bond.dhcp = false ipaddr = bond.add_ip_address() ipaddr.ipaddr = "172.31.0.53" ipaddr.prefix = 24 ipaddr.broadcast = "172.31.0.255" # Just restart the interface.. bond.restart() -------------- next part -------------- A non-text attachment was scrubbed... Name: ovirt-node-2008-11-05.xml Type: application/xml Size: 8814 bytes Desc: not available URL: From dpierce at redhat.com Wed Nov 5 21:40:45 2008 From: dpierce at redhat.com (Darryl Pierce) Date: Wed, 05 Nov 2008 16:40:45 -0500 Subject: [Ovirt-devel] [PATCH node] Creates a standalone mode entry point script. In-Reply-To: <49120DD7.4030201@redhat.com> References: <1225892250-6704-1-git-send-email-dpierce@redhat.com> <49120DD7.4030201@redhat.com> Message-ID: <491212DD.9010701@redhat.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Bryan Kearney wrote: > I get this error when trying to run this: > > http://bkearney.fedorapeople.org/dbus_error.png Hnmmm, is that due to hal not being started? We should have standalone mode script run after hal's started. - -- Darryl L. Pierce : GPG KEYID: 6C4E7F1B -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAkkSEtoACgkQjaT4DmxOfxtoUgCfVf7OsAxjLnB8Xy72/1o37iCr zooAoN1bA8N92wjm8xF/L04Fmc+U8NNt =PKfZ -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: dpierce.vcf Type: text/x-vcard Size: 319 bytes Desc: not available URL: From bkearney at redhat.com Wed Nov 5 21:46:59 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Wed, 05 Nov 2008 16:46:59 -0500 Subject: [Ovirt-devel] [PATCH node] Creates a standalone mode entry point script. In-Reply-To: <491212DD.9010701@redhat.com> References: <1225892250-6704-1-git-send-email-dpierce@redhat.com> <49120DD7.4030201@redhat.com> <491212DD.9010701@redhat.com> Message-ID: <49121453.6040803@redhat.com> Darryl Pierce wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Bryan Kearney wrote: >> I get this error when trying to run this: >> >> http://bkearney.fedorapeople.org/dbus_error.png > > Hnmmm, is that due to hal not being started? > > We should have standalone mode script run after hal's started. So, haldaemon starts at 26, and network starts at 10. Can you probe the nics w/o hal-device? -- bk From dpierce at redhat.com Wed Nov 5 21:55:54 2008 From: dpierce at redhat.com (Darryl Pierce) Date: Wed, 05 Nov 2008 16:55:54 -0500 Subject: [Ovirt-devel] [PATCH node] Creates a standalone mode entry point script. In-Reply-To: <49121453.6040803@redhat.com> References: <1225892250-6704-1-git-send-email-dpierce@redhat.com> <49120DD7.4030201@redhat.com> <491212DD.9010701@redhat.com> <49121453.6040803@redhat.com> Message-ID: <4912166A.1090007@redhat.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Bryan Kearney wrote: > Darryl Pierce wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Bryan Kearney wrote: >>> I get this error when trying to run this: >>> >>> http://bkearney.fedorapeople.org/dbus_error.png >> >> Hnmmm, is that due to hal not being started? >> >> We should have standalone mode script run after hal's started. > > So, haldaemon starts at 26, and network starts at 10. Can you probe the > nics w/o hal-device? Sure, we could use Awk to scrape through the output from /sbin/ifconfig. - -- Darryl L. Pierce : GPG KEYID: 6C4E7F1B -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAkkSFmUACgkQjaT4DmxOfxueLgCfXxzvOa1DCdE7UkUWlRYrJfhs gj0AoLgSA5RB5WxAV+CfK0cAX+29ZXFX =Oigg -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: dpierce.vcf Type: text/x-vcard Size: 319 bytes Desc: not available URL: From bkearney at redhat.com Wed Nov 5 21:55:14 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Wed, 5 Nov 2008 16:55:14 -0500 Subject: [Ovirt-devel] KISS Patch for remote logging Message-ID: <1225922115-27960-1-git-send-email-bkearney@redhat.com> 1) KISS may be the better appraoch, so this needs to be reviewed. 2) The defaults settings for the rsyslog are in this patch, and I would like for them to be reviewed. THanks! -- bk From bkearney at redhat.com Wed Nov 5 21:55:15 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Wed, 5 Nov 2008 16:55:15 -0500 Subject: [Ovirt-devel] [PATCH node] Add remote logging configuration. This version only supports manual configuration In-Reply-To: <1225922115-27960-1-git-send-email-bkearney@redhat.com> References: <1225922115-27960-1-git-send-email-bkearney@redhat.com> Message-ID: <1225922115-27960-2-git-send-email-bkearney@redhat.com> --- scripts/ovirt-config-logging | 108 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 108 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging index 8b13789..345e79d 100755 --- a/scripts/ovirt-config-logging +++ b/scripts/ovirt-config-logging @@ -1 +1,109 @@ +#!/bin/bash +# +# Configures the rsyslog daemon. +RSYSLOG_FILE="/etc/rsyslog.conf" + +# Creates the rsyslog file based on the following inputs +# $1 ipaddress of remote syslog server +# $2 port of remote syslog server +# $3 protocol (tcp or udp) +function ovirt_rsyslog { + +DELIM="" + +if [[ "$3" = "tcp" ]]; then + DELIM="@@" +else + DELIM="@" +fi + +cat > $RSYSLOG_FILE << EOF +#ovirt rsyslog config file + +#### MODULES #### +\$ModLoad imuxsock.so # provides support for local system logging (e.g. via logger command) +\$ModLoad imklog.so # provides kernel logging support (previously done by rklogd) + +#### GLOBAL DIRECTIVES #### +# Use default timestamp format +\$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +#### RULES #### +# Log anything (except mail) of level info or higher. +# Don't log private authentication messages! +*.info;mail.none;authpriv.none;cron.none /var/log/messages + +# The authpriv file has restricted access. +authpriv.* /var/log/secure + +# Log all the mail messages in one place. +mail.* -/var/log/maillog + +# Log cron stuff +cron.* /var/log/cron + +# Everybody gets emergency messages +*.emerg * + +# Save news errors of level crit and higher in a special file. +uucp,news.crit /var/log/spooler + +# Save boot messages also to boot.log +local7.* /var/log/boot.log + +\$WorkDirectory /var/spppl/rsyslog +\$ActionQueueFileName ovirtNode +\$ActionQueueMaxDiskSpace 10m +\$ActionQueueSaveOnShutdown on +\$ActionQueueType LinkedList +\$ActionResumeRetryCount -1 +*.* $DELIM$1:$2 +EOF +} + +function prompt_user { + while true ; do + printf "\nWhat is the IP address or server name for the syslog server? " + read + SYSLOG_SERVER_IP=$REPLY + printf "\nWHat port does the syslog daemon run on? " + read + if [[ "$REPLY" =~ '^[0-9.]+$' ]]; then + SYSLOG_SERVER_PORT=$REPLY + NICS="$NICS Quit" + + PROTOCOLS="tcp udp" + PS3="Please select a the protocol to use: " + select SYSLOG_SERVER_PROTOCOL in $PROTOCOLS; + do + case $SYSLOG_SERVER_PROTOCOL in + "tcp") + break ;; + "udp") + break;; + esac + done + + printf "\nConfirm send all log messages to server '$SYSLOG_SERVER_IP' on port '$SYSLOG_SERVER_PORT' using protocol '$SYSLOG_SERVER_PROTOCOL' (Y/N)" + read + case $REPLY in + Y|y) + ovirt_rsyslog $SYSLOG_SERVER_IP $SYSLOG_SERVER_PORT $SYSLOG_SERVER_PROTOCOL + break + ;; + N|n) + printf "\nDiscarding settings" + break + ;; + esac + else + printf "\nInvalid port number" + fi + done + +} + +prompt_user + +exit 0 -- 1.5.6.5 From clalance at redhat.com Thu Nov 6 08:15:18 2008 From: clalance at redhat.com (Chris Lalancette) Date: Thu, 06 Nov 2008 09:15:18 +0100 Subject: [Ovirt-devel] Pushed new libvirt and ruby-libvirt packages Message-ID: <4912A796.70102@redhat.com> All, I've pushed new libvirt (0.4.6-2.cvs20081105.2ovirt) and ruby-libvirt (0.0.7-3ovirt) packages to the yum repository. With these two packages in place, you should be able to successfully use the LVM support that I posted to the list yesterday. I've done basic testing of the packages (guest start/stop/save/restore, iSCSI, NFS, LVM storage), but it is pretty bleeding edge, so let me know if you have problems with them. -- Chris Lalancette From berrange at redhat.com Thu Nov 6 10:39:01 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 6 Nov 2008 10:39:01 +0000 Subject: [Ovirt-devel] [PATCH node] Creates a standalone mode entry point script. In-Reply-To: <4912166A.1090007@redhat.com> References: <1225892250-6704-1-git-send-email-dpierce@redhat.com> <49120DD7.4030201@redhat.com> <491212DD.9010701@redhat.com> <49121453.6040803@redhat.com> <4912166A.1090007@redhat.com> Message-ID: <20081106103901.GD5716@redhat.com> On Wed, Nov 05, 2008 at 04:55:54PM -0500, Darryl Pierce wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Bryan Kearney wrote: > > Darryl Pierce wrote: > >> -----BEGIN PGP SIGNED MESSAGE----- > >> Hash: SHA1 > >> > >> Bryan Kearney wrote: > >>> I get this error when trying to run this: > >>> > >>> http://bkearney.fedorapeople.org/dbus_error.png > >> > >> Hnmmm, is that due to hal not being started? > >> > >> We should have standalone mode script run after hal's started. > > > > So, haldaemon starts at 26, and network starts at 10. Can you probe the > > nics w/o hal-device? > > Sure, we could use Awk to scrape through the output from /sbin/ifconfig. No, this is wrong. Hardware enumeration is what HAL is for, you should not try to re-invent this, because you will do a worse job than HAL. You have a core boot strapping issue here. The first time boot you can just let it automatically go all the way through init process without networking, and then run your configuration script at S99. This lets you use HAL (and later libvirt) to enumeration devices. When this script is complete, either just ifup the interfaces you configure, or restart the network service script, or just do a reboot. For all subseequent boots the config will be there already, so there's no ordering issue. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From bkearney at redhat.com Thu Nov 6 13:53:47 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Thu, 06 Nov 2008 08:53:47 -0500 Subject: [Ovirt-devel] [PATCH node] Creates a standalone mode entry point script. In-Reply-To: <20081106103901.GD5716@redhat.com> References: <1225892250-6704-1-git-send-email-dpierce@redhat.com> <49120DD7.4030201@redhat.com> <491212DD.9010701@redhat.com> <49121453.6040803@redhat.com> <4912166A.1090007@redhat.com> <20081106103901.GD5716@redhat.com> Message-ID: <4912F6EB.2040307@redhat.com> Daniel P. Berrange wrote: > On Wed, Nov 05, 2008 at 04:55:54PM -0500, Darryl Pierce wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Bryan Kearney wrote: >>> Darryl Pierce wrote: >>>> -----BEGIN PGP SIGNED MESSAGE----- >>>> Hash: SHA1 >>>> >>>> Bryan Kearney wrote: >>>>> I get this error when trying to run this: >>>>> >>>>> http://bkearney.fedorapeople.org/dbus_error.png >>>> Hnmmm, is that due to hal not being started? >>>> >>>> We should have standalone mode script run after hal's started. >>> So, haldaemon starts at 26, and network starts at 10. Can you probe the >>> nics w/o hal-device? >> Sure, we could use Awk to scrape through the output from /sbin/ifconfig. > > No, this is wrong. Hardware enumeration is what HAL is for, you should > not try to re-invent this, because you will do a worse job than HAL. > > You have a core boot strapping issue here. The first time boot you can > just let it automatically go all the way through init process without > networking, and then run your configuration script at S99. This lets > you use HAL (and later libvirt) to enumeration devices. When this script > is complete, either just ifup the interfaces you configure, or restart > the network service script, or just do a reboot. For all subseequent > boots the config will be there already, so there's no ordering issue. > > Daniel Attahced id a modified patch. It sets the startup to 99, and the shutdown to 01 and it cleans up the menu. Given that, it worked well for me. Couple of UI comments: 1) It would be nice for the backspace to work.. but in console that may not be possible. 2) Can you hide the output of augtool? That is a detail I do not need to see. -- bk -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0001-Creates-a-standalone-mode-entry-point-script.patch URL: From bkearney at redhat.com Thu Nov 6 14:40:08 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Thu, 6 Nov 2008 09:40:08 -0500 Subject: [Ovirt-devel] [PATCH node] RSyslog configuration for standalone mode. It looks for a DNS service locator record by default, and lets the user override if desired Message-ID: <1225982408-27662-1-git-send-email-bkearney@redhat.com> --- scripts/ovirt-config-logging | 124 ++++++++++++++++++++++++++++++++++++++++++ scripts/ovirt-config-setup | 7 ++- 2 files changed, 128 insertions(+), 3 deletions(-) diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging index 8b13789..831dee5 100755 --- a/scripts/ovirt-config-logging +++ b/scripts/ovirt-config-logging @@ -1 +1,125 @@ +#!/bin/bash +# +# Configures the rsyslog daemon. +RSYSLOG_FILE="/etc/rsyslog.conf" + +# Creates the rsyslog file based on the following inputs +# $1 ipaddress of remote syslog server +# $2 port of remote syslog server +# $3 protocol (tcp or udp) +function ovirt_rsyslog { + +DELIM="" + +if [[ "$3" = "tcp" ]]; then + DELIM="@@" +else + DELIM="@" +fi + +cat > $RSYSLOG_FILE << EOF +#ovirt rsyslog config file + +#### MODULES #### +\$ModLoad imuxsock.so # provides support for local system logging (e.g. via logger command) +\$ModLoad imklog.so # provides kernel logging support (previously done by rklogd) + +#### GLOBAL DIRECTIVES #### +# Use default timestamp format +\$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +#### RULES #### +# Log anything (except mail) of level info or higher. +# Don't log private authentication messages! +*.info;mail.none;authpriv.none;cron.none /var/log/messages + +# The authpriv file has restricted access. +authpriv.* /var/log/secure + +# Log all the mail messages in one place. +mail.* -/var/log/maillog + +# Log cron stuff +cron.* /var/log/cron + +# Everybody gets emergency messages +*.emerg * + +# Save news errors of level crit and higher in a special file. +uucp,news.crit /var/log/spooler + +# Save boot messages also to boot.log +local7.* /var/log/boot.log + +\$WorkDirectory /var/spppl/rsyslog +\$ActionQueueFileName ovirtNode +\$ActionQueueMaxDiskSpace 10m +\$ActionQueueSaveOnShutdown on +\$ActionQueueType LinkedList +\$ActionResumeRetryCount -1 +*.* $DELIM$1:$2 +EOF + +/sbin/service rsyslog restart +} + +function prompt_user { + while true ; do + printf "\nWhat is the IP address or server name for the syslog server? " + read + SYSLOG_SERVER_IP=$REPLY + printf "\nWhat port does the syslog daemon run on? " + read + if [[ "$REPLY" =~ '^[0-9.]+$' ]]; then + SYSLOG_SERVER_PORT=$REPLY + NICS="$NICS Quit" + + PROTOCOLS="tcp udp" + PS3="Please select a the protocol to use: " + select SYSLOG_SERVER_PROTOCOL in $PROTOCOLS; + do + case $SYSLOG_SERVER_PROTOCOL in + "tcp") + break ;; + "udp") + break;; + esac + done + + printf "\nConfirm send all log messages to server '$SYSLOG_SERVER_IP' on port '$SYSLOG_SERVER_PORT' using protocol '$SYSLOG_SERVER_PROTOCOL' (Y/N)" + read + case $REPLY in + Y|y) + ovirt_rsyslog $SYSLOG_SERVER_IP $SYSLOG_SERVER_PORT $SYSLOG_SERVER_PROTOCOL + break + ;; + N|n) + printf "\nDiscarding settings" + break + ;; + esac + else + printf "\nInvalid port number" + fi + done + +} + +# check if we were called to attempt to default +# to remote logging +if [[ "$1" = "default" ]] ; then + printf "\nAttempting to locate remote syslog server..." + DEFAULT_SERVER=$(host -N 3 -t srv _syslog._udp | rev | awk '/VRS/ {print $1}' | cut -d. -f2- | rev) + DEFAULT_PORT=$(host -N 3 -t srv _syslog._udp | rev | awk '/VRS/ {print $2}' | cut -d. -f2- | rev) + if [[ "$DEFAULT_PORT" != "" ]] && [[ "$DEFAULT_SERVER" != "" ]] ; then + printf "found! Useing server '$DEFAULT_SERVER'.\n" + ovirt_rsyslog $DEFAULT_SERVER $DEFAULT_PORT "udp" + else + printf "not found!\n" + fi +else + prompt_user +fi + +exit 0 diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup index 48cfcdd..7d3d900 100755 --- a/scripts/ovirt-config-setup +++ b/scripts/ovirt-config-setup @@ -4,13 +4,14 @@ PS3="Please select an option: " +#Attempt to default the syslog setting +ovirt-config-logging "default" + # TODO should we make this optional, based on whether the password was already set? PASSWORD_OPTION="Password" -LIST="Networking Storage Logging ${PASSWORD_OPTION} Quit" +LIST="Networking Storage Logging ${PASSWORD_OPTION} Done" CONTINUE=true - -printf "\n" while $CONTINUE; do select OPT in $LIST do -- 1.5.6.5 From sseago at redhat.com Thu Nov 6 15:05:45 2008 From: sseago at redhat.com (Scott Seago) Date: Thu, 06 Nov 2008 10:05:45 -0500 Subject: [Ovirt-devel] [PATCH server] Implement LVM taskomatic In-Reply-To: <1225900632-15279-1-git-send-email-clalance@redhat.com> References: <> <1225900632-15279-1-git-send-email-clalance@redhat.com> Message-ID: <491307C9.2040908@redhat.com> Just a few comments inline -- I haven't had a chance to test this. Chris Lalancette wrote: > This patch implements LVM scanning, creation, deletion, and VM use in the > taskomatic backend. This required a re-thinking of the way we do things, and > because of this the implementation ended up being much simpler and more object > oriented. > > Note that in order for this to have any chance to work, you need updated > libvirt (a pre 0.5.0 snapshot), and an updated ruby-libvirt package, both of > which I am working on and will presently upload to the ovirt yum repositories. > > Signed-off-by: Chris Lalancette > --- > src/app/models/iscsi_storage_volume.rb | 4 + > src/app/models/lvm_storage_volume.rb | 4 + > src/app/models/nfs_storage_volume.rb | 4 + > src/task-omatic/task_storage.rb | 301 ++++++++++++++++++++++++++------ > src/task-omatic/task_vm.rb | 135 ++++++++++++--- > src/task-omatic/taskomatic.rb | 2 + > src/task-omatic/utils.rb | 242 ++++++++++++-------------- > 7 files changed, 480 insertions(+), 212 deletions(-) > > diff --git a/src/app/models/iscsi_storage_volume.rb b/src/app/models/iscsi_storage_volume.rb > index 00d7db2..48edbd8 100644 > --- a/src/app/models/iscsi_storage_volume.rb > +++ b/src/app/models/iscsi_storage_volume.rb > @@ -22,6 +22,10 @@ class IscsiStorageVolume < StorageVolume > "#{storage_pool[:target]}:#{lun}" > end > > + def volume_name > + "lun" > + end > + > For now we need this -- but once you no longer need the db name here you can just return the lun directly. Same comment applies to the other storage types. > diff --git a/src/task-omatic/task_storage.rb b/src/task-omatic/task_storage.rb > index 5cddf2b..44ba164 100644 > --- a/src/task-omatic/task_storage.rb > +++ b/src/task-omatic/task_storage.rb > @@ -20,26 +20,65 @@ require 'utils' > > require 'libvirt' > > -def refresh_pool(task) > - puts "refresh_pool" > +def build_libvirt_vol_xml(name, size, owner, group, mode) > + vol_xml = Document.new > + vol_xml.add_element("volume", {"type" => "logical"}) > + vol_xml.root.add_element("name").add_text(name) > + vol_xml.root.add_element("capacity", {"unit" => "K"}).add_text(size.to_s) > + vol_xml.root.add_element("target") > + vol_xml.root.elements["target"].add_element("permissions") > + vol_xml.root.elements["target"].elements["permissions"].add_element("owner").add_text(owner) > + vol_xml.root.elements["target"].elements["permissions"].add_element("group").add_text(group) > + vol_xml.root.elements["target"].elements["permissions"].add_element("mode").add_text(mode) > > - pool = task.storage_pool > + return vol_xml > +end > > - if pool == nil > - raise "Could not find storage pool" > - end > +def add_volumes_to_db(db_pool, libvirt_pool, owner = nil, group = nil, mode = nil) > + # FIXME: this is currently broken if you do something like: > + # 1. Add an iscsi pool with 3 volumes (lun-1, lun-2, lun-3) > + # 2. Scan it in > + # 3. Remove lun-3 from the pool > + # 4. Re-scan it > + # What will happen is that you will still have lun-3 available in the > + # database, even though it's not available in the pool anymore. It's a > + # little tricky, though; we have to make sure that we don't pull the > + # database entry out from underneath a possibly running VM (or do we?) > + libvirt_pool.list_volumes.each do |volname| > + storage_volume = StorageVolume.factory(db_pool.get_type_label) > > - if pool[:type] == "IscsiStoragePool" > - storage = Iscsi.new(pool.ip_addr, pool[:target]) > - elsif pool[:type] == "NfsStoragePool" > - storage = NFS.new(pool.ip_addr, pool.export_path) > - else > - raise "Unknown storage pool type " + pool[:type].to_s > + # NOTE: it is safe (and, in fact, necessary) to use > + # #{storage_volume.volume_name} here without sanitizing it. This is > + # because this is *not* based on user modifiable data, but rather, on an > + # internal implementation detail > + existing_vol = StorageVolume.find(:first, :conditions => > + [ "storage_pool_id = ? AND #{storage_volume.volume_name} = ?", > + db_pool.id, volname]) > + if existing_vol != nil > + # in this case, this path already exists in the database; just skip > + next > + end > + > + volptr = libvirt_pool.lookup_vol_by_name(volname) > + > + volinfo = volptr.info > + > + storage_volume = StorageVolume.factory(db_pool.get_type_label) > + storage_volume.path = volptr.path > + storage_volume.size = volinfo.capacity / 1024 > + storage_volume.storage_pool_id = db_pool.id > + storage_volume.write_attribute(storage_volume.volume_name, volname) > + storage_volume.lv_owner_perms = owner > + storage_volume.lv_group_perms = group > + storage_volume.lv_mode_perms = mode > + storage_volume.save > end > +end > > You should probably use save! here as we're doing elsewhere so that it raises an exception upon failure. > @@ -59,66 +98,212 @@ def refresh_pool(task) > end > > if conn == nil > + # last ditch effort; if we didn't find any hosts, just use ourselves. > + # this may or may not work > + begin > + conn = Libvirt::open("qemu:///system") > + rescue > + end > + end > + > + if conn == nil > raise "Could not find a host to scan storage" > end > > - remote_pool_defined = false > - remote_pool_started = false > - remote_pool = nil > + return conn > +end > > - # here, run through the list of already defined pools on the remote side > - # and see if a pool matching the XML already exists. If it does > - # we don't try to define it again, we just scan it > - pool_defined = false > - all_storage_pools(conn).each do |remote_pool_name| > - tmppool = conn.lookup_storage_pool_by_name(remote_pool_name) > - doc = Document.new(tmppool.xml_desc(0)) > +# The words "pool" and "volume" are ridiculously overloaded in our context. > +# Therefore, the refresh_pool method adopts this convention: > +# phys_db_pool: The underlying physical storage pool, as it is represented in > +# the database > +# phys_libvirt_pool: The underlying physical storage, as it is represented in > +# libvirt > +# lvm_db_pool: The logical storage pool (if it exists), as it is represented > +# in the database > +# lvm_libvirt_pool: The logical storage pool (if it exists), as it is > +# represented in the database > > - if storage.xmlequal?(doc.root) > - pool_defined = true > - remote_pool = tmppool > - break > +def refresh_pool(task) > + puts "refresh_pool" > + > + phys_db_pool = task.storage_pool > + if phys_db_pool == nil > + raise "Could not find storage pool" > + end > + > + conn = storage_find_suitable_host(phys_db_pool.hardware_pool_id) > + > + begin > + phys_libvirt_pool = LibvirtPool.factory(phys_db_pool) > + phys_libvirt_pool.connect(conn) > + > + begin > + # OK, the pool is all set. Add in all of the volumes > + add_volumes_to_db(phys_db_pool, phys_libvirt_pool) > + > + # OK, now we've scanned the underlying hardware pool and added the > + # volumes. Next we scan for pre-existing LVM volumes > + logical_xml = conn.discover_storage_pool_sources("logical") > + > + Document.new(logical_xml).elements.each('sources/source') do |source| > + vgname = source.elements["name"].text > + > + begin > + source.elements.each("device") do |device| > + byid_device = phys_libvirt_pool.lookup_vol_by_path(device.attributes["path"]).path > + end > + rescue > + # If matching any of the sections in the LVM XML fails > + # against the storage pool, then it is likely that this is a storage > + # pool not associated with the one we connected above. Go on > + # FIXME: it would be nicer to catch the right exception here, and > + # fail on other exceptions > + puts "One of the logical volumes in #{vgname} is not part of the pool of type #{phys_db_pool[:type]} that we are scanning; ignore the previous error!" > + next > + end > + > + # if we make it here, then we were able to resolve all of the devices, > + # so we know we need to use a new pool > + lvm_db_pool = LvmStoragePool.find(:first, :conditions => > + [ "vg_name = ?", vgname ]) > + if lvm_db_pool == nil > + lvm_db_pool = LvmStoragePool.new > + lvm_db_pool[:type] = "LvmStoragePool" > + # set the LVM pool to the same hardware pool as the underlying storage > + lvm_db_pool.hardware_pool_id = phys_db_pool.hardware_pool_id > + lvm_db_pool.vg_name = vgname > + lvm_db_pool.save > + end > use save! > + > + source.elements.each("device") do |device| > + byid_device = phys_libvirt_pool.lookup_vol_by_path(device.attributes["path"]).path > + physical_vol = StorageVolume.find(:first, :conditions => > + [ "path = ?", byid_device]) > + if physical_vol == nil > + # Hm. We didn't find the device in the storage volumes already. > + # something went wrong internally, and we have to bail > + raise "Storage internal physical volume error" > + end > + > + # OK, put the right lvm_pool_id in place > + physical_vol.lvm_pool_id = lvm_db_pool.id > + physical_vol.save > save! > + end > + > + lvm_libvirt_pool = LibvirtPool.factory(lvm_db_pool) > + lvm_libvirt_pool.connect(conn) > + > + begin > + add_volumes_to_db(lvm_db_pool, lvm_libvirt_pool, "0744", "0744", "0744") > + ensure > + lvm_libvirt_pool.shutdown > + end > + end > + ensure > + phys_libvirt_pool.shutdown > end > + ensure > + conn.close > end > - if not pool_defined > - remote_pool = conn.define_storage_pool_xml(storage.getxml, 0) > - remote_pool.build(0) > - remote_pool_defined = true > +end > + > +def create_volume(task) > + puts "create_volume" > + > + lvm_db_volume = task.storage_volume > + if lvm_db_volume == nil > + raise "Could not find storage volume to create" > + end > + if lvm_db_volume[:type] != "LvmStorageVolume" > + raise "The volume to create must be of type LvmStorageVolume, not type #{lvm_db_volume[:type]}" > end > > - remote_pool_info = remote_pool.info > - if remote_pool_info.state == Libvirt::StoragePool::INACTIVE > - # only try to start the pool if it is currently inactive; in all other > - # states, assume it is already running > - remote_pool.create(0) > - remote_pool_started = true > + lvm_db_pool = lvm_db_volume.storage_pool > + if lvm_db_pool == nil > + raise "Could not find storage pool" > + end > + if lvm_db_pool[:type] != "LvmStoragePool" > + raise "The pool for the volume must be of type LvmStoragePool, not type #{lvm_db_pool[:type]}" > end > > - vols = remote_pool.list_volumes > - vols.each do |volname| > - volptr = remote_pool.lookup_volume_by_name(volname) > - existing_vol = StorageVolume.find(:first, :conditions => > - [ "path = ?", volptr.path ]) > - if existing_vol != nil > - # in this case, this path already exists in the database; just skip > - next > + conn = storage_find_suitable_host(lvm_db_pool.hardware_pool_id) > + > + begin > + phys_libvirt_pool = get_libvirt_pool_from_volume(lvm_db_volume) > + phys_libvirt_pool.connect(conn) > + > + begin > + lvm_libvirt_pool = LibvirtPool.factory(lvm_db_pool) > + lvm_libvirt_pool.connect(conn) > + > + begin > + vol_xml = build_libvirt_vol_xml(lvm_db_volume.lv_name, > + lvm_db_volume.size, > + lvm_db_volume.lv_owner_perms, > + lvm_db_volume.lv_group_perms, > + lvm_db_volume.lv_mode_perms) > + > + lvm_libvirt_pool.create_vol_xml(vol_xml.to_s) > + ensure > + lvm_libvirt_pool.shutdown > + end > + ensure > + phys_libvirt_pool.shutdown > end > + ensure > + conn.close > + end > +end > > - volinfo = volptr.info > +def delete_volume(task) > + puts "delete_volume" > > - storage_volume = StorageVolume.new > - storage_volume.path = volptr.path > - storage_volume.size = volinfo.capacity / 1024 > - storage_volume.storage_pool_id = pool.id > - storage_volume[:type] = StoragePool::STORAGE_TYPES[pool.get_type_label] + "StorageVolume" > - storage_volume.write_attribute(storage.db_column, volname) > - storage_volume.save > + lvm_db_volume = task.storage_volume > + if lvm_db_volume == nil > + raise "Could not find storage volume to delete" > + end > + if lvm_db_volume[:type] != "LvmStorageVolume" > + raise "The volume to delete must be of type LvmStorageVolume, not type #{lvm_db_volume[:type]}" > + end > + > + lvm_db_pool = lvm_db_volume.storage_pool > + if lvm_db_pool == nil > + raise "Could not find storage pool" > end > - if remote_pool_started > - remote_pool.destroy > + if lvm_db_pool[:type] != "LvmStoragePool" > + raise "The pool for the volume must be of type LvmStoragePool, not type #{lvm_db_pool[:type]}" > end > - if remote_pool_defined > - remote_pool.undefine > + > + conn = storage_find_suitable_host(lvm_db_pool.hardware_pool_id) > + > + begin > + phys_libvirt_pool = get_libvirt_pool_from_volume(lvm_db_volume) > + phys_libvirt_pool.connect(conn) > + > + begin > + lvm_libvirt_pool = LibvirtPool.factory(lvm_db_pool) > + lvm_libvirt_pool.connect(conn) > + > + begin > + libvirt_volume = lvm_libvirt_pool.lookup_vol_by_name(lvm_db_volume.lv_name) > + # FIXME: we actually probably want to zero out the whole volume here, so > + # we aren't potentially leaking data from one user to another. There > + # are two problems, though: > + # 1) I'm not sure how I would go about zero'ing the data on a remote > + # machine, since there is no "libvirt_write_data" call > + # 2) This could potentially take quite a while, so we want to spawn > + # off another thread to do it > + libvirt_volume.delete > + > + LvmStorageVolume.delete(lvm_db_volume.id) > We need to get this working with lvm_db_volume.destroy, since the error you were getting with that might mean that it's failing to do some necessary cleanup that delete is skipping. But we can probably do that after pushing this patch. > + ensure > + lvm_libvirt_pool.shutdown > + end > + ensure > + phys_libvirt_pool.shutdown > + end > + ensure > + conn.close > end > - conn.close > end > diff --git a/src/task-omatic/task_vm.rb b/src/task-omatic/task_vm.rb > index b5f888d..c30c6a9 100644 > --- a/src/task-omatic/task_vm.rb > +++ b/src/task-omatic/task_vm.rb > @@ -24,46 +24,140 @@ require 'utils' > gem 'cobbler' > require 'cobbler' > > +def findHostSLA(vm) > + host = nil > + > + vm.vm_resource_pool.get_hardware_pool.hosts.each do |curr| > + # FIXME: we probably need to add in some notion of "load" into this check > + if curr.num_cpus >= vm.num_vcpus_allocated \ > + and curr.memory >= vm.memory_allocated \ > + and not curr.is_disabled.nil? and curr.is_disabled == 0 \ > + and curr.state == Host::STATE_AVAILABLE \ > + and (vm.host_id.nil? or (not vm.host_id.nil? and vm.host_id != curr.id)) > + host = curr > + break > + end > + end > + > + if host == nil > + # we couldn't find a host that matches this criteria > + raise "No host matching VM parameters could be found" > + end > + > + return host > +end > + > +def findHost(host_id) > + host = Host.find(:first, :conditions => [ "id = ?", host_id]) > + > + if host == nil > + # Hm, we didn't find the host_id. Seems odd. Return a failure > + raise "Could not find host_id " + host_id.to_s > + end > + > + return host > +end > + > +def connect_storage_pools(conn, storage_volumes) > + storagedevs = [] > + storage_volumes.each do |volume| > + # here, we need to iterate through each volume and possibly attach it > + # to the host we are going to be using > + db_pool = volume.storage_pool > + if db_pool == nil > + # Hum. Specified by the VM description, but not in the storage pool? > + # continue on and hope for the best > + puts "Couldn't find pool for volume #{volume.path}; skipping" > + next > + end > + > + # we have to special case LVM pools. In that case, we need to first > + # activate the underlying physical device, and then do the logical one > + if volume[:type] == "LvmStorageVolume" > + phys_libvirt_pool = get_libvirt_pool_from_volume(volume) > + phys_libvirt_pool.connect(conn) > + end > + > + libvirt_pool = LibvirtPool.factory(db_pool) > + libvirt_pool.connect(conn) > + > + # OK, the pool should be all set. The last thing we need to do is get > + # the path based on the volume name > + storagedevs << libvirt_pool.lookup_vol_by_name(volume.read_attribute(volume.volume_name)).path > And when the volume_name method gets fixed this will also be simplified. > + end > + > + return storagedevs > +end > + > +def remove_pools(conn, type = nil) > + all_storage_pools(conn).each do |remote_pool_name| > + pool = conn.lookup_storage_pool_by_name(remote_pool_name) > + > + if type == nil or type == Document.new(pool.xml_desc).root.attributes['type'] > + begin > + pool.destroy > + rescue > + end > + > + begin > + # if the destroy failed, we still try to undefine; it may be a pool > + # that was previously destroyed but not undefined for whatever reason > + pool.undefine > + rescue > + # do nothing if any of this failed; the worst that happens is that > + # we leave a pool configured > + puts "Could not teardown pool " + remote_pool_name + "; skipping" > + end > + end > + end > +end > + > +def teardown_storage_pools(conn) > + # FIXME: this needs to get a *lot* smarter. In particular, we want to make > + # sure we can tear down unused pools even when there are other guests running > + if conn.list_domains.empty? > + # OK, there are no running guests on this host anymore. We can teardown > + # any storage pools that are there without fear > + > + # we first have to tear-down LVM pools, because they might depend on the > + # underlying physical pools > + remove_pools(conn, "logical") > + > + # now tear down the rest of the pools > + remove_pools(conn) > + end > +end > + > def create_vm_xml(name, uuid, memAllocated, memUsed, vcpus, bootDevice, > macAddr, bridge, diskDevices) > doc = Document.new > > doc.add_element("domain", {"type" => "kvm"}) > > - doc.root.add_element("name") > - doc.root.elements["name"].text = name > + doc.root.add_element("name").add_text(name) > > - doc.root.add_element("uuid") > - doc.root.elements["uuid"].text = uuid > + doc.root.add_element("uuid").add_text(uuid) > > - doc.root.add_element("memory") > - doc.root.elements["memory"].text = memAllocated > + doc.root.add_element("memory").add_text(memAllocated.to_s) > > - doc.root.add_element("currentMemory") > - doc.root.elements["currentMemory"].text = memUsed > + doc.root.add_element("currentMemory").add_text(memUsed.to_s) > > - doc.root.add_element("vcpu") > - doc.root.elements["vcpu"].text = vcpus > + doc.root.add_element("vcpu").add_text(vcpus.to_s) > > doc.root.add_element("os") > - doc.root.elements["os"].add_element("type") > - doc.root.elements["os"].elements["type"].text = "hvm" > + doc.root.elements["os"].add_element("type").add_text("hvm") > doc.root.elements["os"].add_element("boot", {"dev" => bootDevice}) > > doc.root.add_element("clock", {"offset" => "utc"}) > > - doc.root.add_element("on_poweroff") > - doc.root.elements["on_poweroff"].text = "destroy" > + doc.root.add_element("on_poweroff").add_text("destroy") > > - doc.root.add_element("on_reboot") > - doc.root.elements["on_reboot"].text = "restart" > + doc.root.add_element("on_reboot").add_text("restart") > > - doc.root.add_element("on_crash") > - doc.root.elements["on_crash"].text = "destroy" > + doc.root.add_element("on_crash").add_text("destroy") > > doc.root.add_element("devices") > - doc.root.elements["devices"].add_element("emulator") > - doc.root.elements["devices"].elements["emulator"].text = "/usr/bin/qemu-kvm" > + doc.root.elements["devices"].add_element("emulator").add_text("/usr/bin/qemu-kvm") > > devs = ['hda', 'hdb', 'hdc', 'hdd'] > which_device = 0 > @@ -115,7 +209,6 @@ def setVmVncPort(vm, domain) > vm.save > end > > - > def findVM(task, fail_on_nil_host_id = true) > # find the matching VM in the vms table > vm = task.vm > From dpierce at redhat.com Thu Nov 6 16:41:24 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 6 Nov 2008 11:41:24 -0500 Subject: [Ovirt-devel] [PATCH node] Creates a standalone mode entry point script. Message-ID: <1225989684-24116-1-git-send-email-dpierce@redhat.com> Request for comments: This patch includes booting to firstboot/standalone mode, configure networking and also configure local storage (DESTRUCTIVE). The script will execute only when the node is booted without the support of a server suite. If it determines that the node is running in standalone mode, it will then kick over to a node setup script. This iteration defines the general flow for the standalone mode's firstboot use case. When the node boots and determines it's in standalone mode, it goes through the following steps: 1. Prompt for an administrator password 2. Prompt the user to configure disk storage 3. Prompt the user to configure networking 4. Prompt the user to configure logging The node then continues to boot normally. Signed-off-by: Darryl L. Pierce --- Makefile.am | 34 +++++++----- ovirt-node.spec.in | 15 +++++- scripts/ovirt-config-logging | 1 + scripts/ovirt-config-networking | 98 +++++++++++++++++++++++++++++++++ scripts/ovirt-config-password | 1 + scripts/ovirt-config-setup | 23 ++++++++ scripts/ovirt-config-storage | 113 +++++++++++++++++++++++++++++++++++++++ scripts/ovirt-functions | 5 ++ scripts/ovirt-standalone-mode | 55 +++++++++++++++++++ 9 files changed, 330 insertions(+), 15 deletions(-) create mode 100755 scripts/ovirt-config-logging create mode 100755 scripts/ovirt-config-networking create mode 100755 scripts/ovirt-config-password create mode 100755 scripts/ovirt-config-setup create mode 100755 scripts/ovirt-config-storage create mode 100755 scripts/ovirt-standalone-mode diff --git a/Makefile.am b/Makefile.am index c55db13..3d824db 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,20 +18,26 @@ OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache SUBDIRS = ovirt-identify-node ovirt-listen-awake -EXTRA_DIST = \ - .gitignore \ - ovirt-node.spec \ - ovirt-node.spec.in \ - ovirt-node-selinux.te \ - scripts/collectd \ - scripts/collectd.conf.in \ - scripts/ovirt \ - scripts/ovirt-awake \ - scripts/ovirt-early \ - scripts/ovirt-functions \ - scripts/ovirt-post \ - scripts/ovirt-process-config \ - logrotate/ovirt-logrotate \ +EXTRA_DIST = \ + .gitignore \ + ovirt-node.spec \ + ovirt-node.spec.in \ + ovirt-node-selinux.te \ + scripts/collectd \ + scripts/collectd.conf.in \ + scripts/ovirt \ + scripts/ovirt-awake \ + scripts/ovirt-config-logging \ + scripts/ovirt-config-networking \ + scripts/ovirt-config-password \ + scripts/ovirt-config-setup \ + scripts/ovirt-config-storage \ + scripts/ovirt-early \ + scripts/ovirt-functions \ + scripts/ovirt-post \ + scripts/ovirt-process-config \ + scripts/ovirt-standalone-mode \ + logrotate/ovirt-logrotate \ logrotate/ovirt-logrotate.conf # For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT- diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index d029c57..10a544b 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -88,17 +88,22 @@ cd - %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-process-config %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-logging %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-networking %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-password %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-setup %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-storage %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-identify-node/ovirt-identify-node %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-listen-awake/ovirt-listen-awake %{buildroot}%{_sbindir} %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-listen-awake.init %{buildroot}%{_initrddir}/ovirt-listen-awake %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-install-node %{buildroot}%{_sbindir} %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-uninstall-node %{buildroot}%{_sbindir} - %{__install} -p -m0644 scripts/ovirt-functions %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-early %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-post %{buildroot}%{_initrddir} +%{__install} -p -m0755 scripts/ovirt-standalone-mode %{buildroot}%{_initrddir} %{__install} -p -m0644 scripts/collectd %{buildroot}%{_sysconfdir}/chkconfig.d %{__install} -p -m0644 scripts/collectd.conf.in %{buildroot}%{_sysconfdir} @@ -125,6 +130,7 @@ cd - /sbin/chkconfig --add ovirt-early /sbin/chkconfig --add ovirt /sbin/chkconfig --add ovirt-post +/sbin/chkconfig --add ovirt-standalone-mode # this is ugly; we need collectd to start *after* libvirtd, so we own the # /etc/chkconfig.d/collectd file, and then have to re-define collectd here /sbin/chkconfig --add collectd @@ -136,6 +142,7 @@ if [ "$1" = 0 ] ; then /sbin/chkconfig --del ovirt /sbin/chkconfig --del ovirt-post /sbin/chkconfig --del ovirt-listen-awake + /sbin/chkconfig --del ovirt-standalone-mode fi %post selinux @@ -159,6 +166,11 @@ fi %files %defattr(-,root,root,0755) %{_sbindir}/ovirt-awake +%{_sbindir}/ovirt-config-logging +%{_sbindir}/ovirt-config-networking +%{_sbindir}/ovirt-config-password +%{_sbindir}/ovirt-config-setup +%{_sbindir}/ovirt-config-storage %{_sbindir}/ovirt-process-config %{_sbindir}/ovirt-identify-node %{_sbindir}/ovirt-listen-awake @@ -168,6 +180,7 @@ fi %{_initrddir}/ovirt %{_initrddir}/ovirt-post %{_initrddir}/ovirt-listen-awake +%{_initrddir}/ovirt-standalone-mode %config %{_sysconfdir}/logrotate.d/ovirt-logrotate.conf %config %{_sysconfdir}/cron.hourly/ovirt-logrotate %defattr(-,root,root,0644) diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging new file mode 100755 index 0000000..8b13789 --- /dev/null +++ b/scripts/ovirt-config-logging @@ -0,0 +1 @@ + diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking new file mode 100755 index 0000000..705521b --- /dev/null +++ b/scripts/ovirt-config-networking @@ -0,0 +1,98 @@ +#!/bin/bash +# +# Iterates over the list of network devices on the node and prompts the user +# to configure each. + +CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" + +function configure_interface +{ + NIC=$1 + FILENAME="/var/tmp/augtool-$NIC" + + printf "\nCONFIGURE INTERFACE: $NIC\n\n" + + THIS_ROOT="$CONFIG_FILE_ROOT-$NIC" + CONFIG="rm $THIS_ROOT\nset $THIS_ROOT/DEVICE $NIC" + + # Is this NIC shared? + while true; do + printf "Is $NIC a shared interface? (Y/N) " + read + case $REPLY in + Y|y) CONFIG="$CONFIG\nset $THIS_ROOT/TYPE bridge"; break ;; + N|n) bridge="N"; break ;; + esac + done + + # how do you want to configure this device? (dhcp, static IP) + while true; do + printf "Does $NIC use dynamic addressing? (Y/N) " + read + case $REPLY in + Y|y) CONFIG="$CONFIG\nset $THIS_ROOT/BOOTPROTO dhcp"; break ;; + N|n) + printf "\tIP Address: "; read; IPADDR=$REPLY + printf "\t Netmask: "; read; NETMASK=$REPLY + printf "\t Broadcast: "; read; BROADCAST=$REPLY + printf "\t Gateway: "; read; GATEWAY=$REPLY + + printf "\nIP Address: $IPADDR\nNetmask: $NETMASK\nBroadcast: $BROADCAST\nGateway: $GATEWAY\n" + printf "Is this correct? (Y/N) " + read + case $REPLY in + Y|y) + CONFIG="$CONFIG\nset $THIS_ROOT/IPADDR $IPADDR" + CONFIG="$CONFIG\nset $THIS_ROOT/BROADCAST $BROADCAST" + CONFIG="$CONFIG\nset $THIS_ROOT/NETMASK $NETMASK" + break + ;; + esac + ;; + esac + done + + if [ "$bridge" == "N" ]; then + printf "Is $NIC bridged? (Y/N) " + read + case $REPLY in + Y|y) + printf "What is the bridge name? " + read + CONFIG="$CONFIG\n set $THIS_ROOT/BRIDGE $REPLY" + ;; + esac + fi + + CONFIG="$CONFIG\nset $THIS_ROOT/ONBOOT yes" + printf "$CONFIG\n" > $FILENAME + + echo +} + +# TODO the menu doesn't redisplay unless you hit enter -- needs fixing +# get the list of network cards on this machine +NICS=$(hal-device | awk '/net.interface/ { + match($0, "= '"'"'(.*)'"'"' ", nic); printf("%s ", nic[1]); }') + +# Append a quit option +NICS="$NICS Quit" + +PS3="Please select a network interface to configure:" +select NIC in $NICS +do + case "$NIC" in + "Quit") + break + ;; + + *) + configure_interface $NIC + ;; + esac +done + +# Merge together all generated files and run augtool + +cat /var/tmp/augtool-* > /var/tmp/config-augtool +augtool < /var/tmp/config-augtool diff --git a/scripts/ovirt-config-password b/scripts/ovirt-config-password new file mode 100755 index 0000000..8b13789 --- /dev/null +++ b/scripts/ovirt-config-password @@ -0,0 +1 @@ + diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup new file mode 100755 index 0000000..8408d14 --- /dev/null +++ b/scripts/ovirt-config-setup @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Entry point for configuring an oVirt node when running in standalone mode. + +while true; do + PS3="Please select an option: " + # TODO should we make this optional, based on whether the password was already set? + PASSWORD_OPTION="Password" + OPTIONS="Networking Storage Logging ${PASSWORD_OPTION} Quit" + + select OPTION in $OPTIONS + do + printf "\n" + + case "$OPTION" in + "Networking") ovirt-config-networking ; break ;; + "Storage") ovirt-config-storage ; break ;; + "Logging") ovirt-config-logging ; break ;; + "Password") ovirt-config-password ; break ;; + "Quit") exit 0 ;; + esac + done +done diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage new file mode 100755 index 0000000..91d50de --- /dev/null +++ b/scripts/ovirt-config-storage @@ -0,0 +1,113 @@ +#!/bin/bash +# +# All sizes are in gigabytes + +DRIVE=$(sfdisk -s | awk '/\/dev\/([sh]da)/ { match($0, "^(.*):.*", data); printf data[1] }') +BOOT_SIZE=1 +INSTALL_SIZE=10 +CONFIG_SIZE=5 +LOGGING_SIZE=2 + +MEM_SIZE=$(cat /proc/meminfo | awk '/MemTotal/ { print $2 }') +MEM_SIZE=$(( $MEM_SIZE / ( 1024 ** 2) )) +SWAP_SIZE=$(($MEM_SIZE * 2 + 1)) + +function do_configure +{ + read -p "Swap partition size (Currently ${SWAP_SIZE})? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + SWAP_SIZE=$REPLY + else + printf "Swap value is invalid.\n" + return + fi + + read -p "Boot partition size (Currently ${SWAP_SIZE})? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + BOOT_SIZE=$REPLY + else + printf "Boot value is invalid.\n" + return + fi + +} + +function do_review +{ + printf "\n" + printf "The local disk will be repartitioned as follows:\n" + printf "================================================\n" + printf " Physical Hard Disk: ${DRIVE}\n" + printf " Boot partition size: ${BOOT_SIZE} GB\n" + printf " Swap partition size: ${SWAP_SIZE} GB\n" + printf " Installation partition size: ${INSTALL_SIZE} GB\n" + printf " Configuration partition size: ${CONFIG_SIZE} GB\n" + printf " Logging partition size: ${LOGGING_SIZE} GB\n" + printf "\n" +} + +function do_partitioning +{ + while true; do + printf "\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! If you proceed this will destroy all data on your local system, and !!WARNING!!\n" + printf "!!WARNING!! your hard disk will be irreversably reconfiguration. !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "\n" + printf "\tContinue? (Y/n) " + read + case $REPLY in + Y|y) + { + dd if=/dev/zero of=/dev/sda bs=1K count=1 + blockdev --rereadpt /dev/sda + # Boot partition + # /dev/sda1 = Boot partition + # /dev/sda2 = Swap partition + # /dev/sda4 = LVM + echo -e "n\np\n1\n\n+$(( $BOOT_SIZE * 1024))M\na\n1\n + n\np\n2\n\n+$(( $SWAP_SIZE * 1024))M\nt\n2\n82\n + n\np\n4\n\n\nt\n4\n8e\n + w\n" | fdisk $DRIVE + pvcreate /dev/sda4 + vgcreate /dev/VolGroup00 /dev/sda4 + + lvcreate --name Ovirt /dev/VolGroup00 --size ${INSTALL_SIZE}G + lvcreate --name Config /dev/VolGroup00 --size ${CONFIG_SIZE}G + lvcreate --name Logging /dev/VolGroup00 --size ${LOGGING_SIZE}G + + mkfs -t ext3 /dev/sda1 + mkfs -t ext3 /dev/VolGroup00/Ovirt + mkfs -t ext3 /dev/VolGroup00/Config + mkfs -t ext3 /dev/VolGroup00/Logging + + } > partition.log + break ;; + N|n) return ;; + esac + done +} + +while true; do + OPTIONS="Configure Review Partition Quit" + PS3="Choose an option: " + + printf "\n" + + select OPTION in $OPTIONS + do + case "$OPTION" in + "Configure") do_configure ; break ;; + "Review") do_review ; break ;; + "Partition") do_partitioning ; break ;; + "Quit") exit ;; + esac + done +done diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions index e251eac..53e9f62 100644 --- a/scripts/ovirt-functions +++ b/scripts/ovirt-functions @@ -7,6 +7,11 @@ OVIRT_LABEL=OVIRT OVIRT_BACKUP_DIR=/var/lib/ovirt-backup +is_standalone() +{ + return 0 +} + find_srv() { local dnsreply diff --git a/scripts/ovirt-standalone-mode b/scripts/ovirt-standalone-mode new file mode 100755 index 0000000..46d081a --- /dev/null +++ b/scripts/ovirt-standalone-mode @@ -0,0 +1,55 @@ +#!/bin/bash +# +# ovirt-standalone-mode Starts the node in standalone mode. +# +# chkconfig: 2345 99 01 +# description: ovirt-early services +# +# Copyright (C) 2008 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. + +## Source functions library +. /etc/init.d/functions +. /etc/init.d/ovirt-functions + +start () +{ + ovirt-config-setup +} + +case "$1" in + start) + #is_standalone + #if [ $? -ne 0 ]; then + # exit 0 + #fi + + printf "Starting ovirt-standalone-mode: " + + { + start + } + + test $? == 0 && success || failure + echo + ;; + + *) + echo "Usage: ovirt-early {start}" + exit 2 +esac -- 1.5.6.5 From rjones at redhat.com Thu Nov 6 17:01:18 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Thu, 6 Nov 2008 17:01:18 +0000 Subject: [Ovirt-devel] oVirt console (again!) Message-ID: <20081106170118.GA21838@amd.home.annexia.org> Previous discussion: https://www.redhat.com/archives/ovirt-devel/2008-August/msg00004.html Back to the oVirt console issue. So far we've look at: (1) A Gtk-based VNC browser plugin. Unfortunately we couldn't make this stable enough for real production use. (2) Launching an external program such as virt-viewer from a browser plugin. This works, but it's a security issue, and we can't use a Gtk dialog to get around the warning issue because of (1). (3) Running virt-viewer or viagre as separate, standalone programs. This works, but requires the user to type in some very long and complicated command line by hand, and there are unresolved authentication problems. We are now in a state where we have a working virt-viewer binary for Windows. Vinagre is not far off. And we know pretty well how to write C / Gtk programs which cross-compile and run under Windows reliably. On the call today we discussed: (4) Write a custom C/Gtk/Gtk-VNC Windows program which contacts the oVirt WUI to do authentication, get available consoles, and launch a Gtk-VNC widget with the appropriate tunnelling (openssh.exe based?). Thoughts? Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/ From hbrock at redhat.com Thu Nov 6 17:19:33 2008 From: hbrock at redhat.com (Hugh O. Brock) Date: Thu, 6 Nov 2008 12:19:33 -0500 Subject: [Ovirt-devel] oVirt console (again!) In-Reply-To: <20081106170118.GA21838@amd.home.annexia.org> References: <20081106170118.GA21838@amd.home.annexia.org> Message-ID: <20081106171933.GN32206@redhat.com> On Thu, Nov 06, 2008 at 05:01:18PM +0000, Richard W.M. Jones wrote: > Previous discussion: > https://www.redhat.com/archives/ovirt-devel/2008-August/msg00004.html > > Back to the oVirt console issue. > > So far we've look at: > > (1) A Gtk-based VNC browser plugin. Unfortunately we couldn't > make this stable enough for real production use. > > (2) Launching an external program such as virt-viewer from a browser > plugin. This works, but it's a security issue, and we can't use > a Gtk dialog to get around the warning issue because of (1). > > (3) Running virt-viewer or viagre as separate, standalone programs. > This works, but requires the user to type in some very long > and complicated command line by hand, and there are unresolved > authentication problems. > > We are now in a state where we have a working virt-viewer binary for > Windows. Vinagre is not far off. And we know pretty well how to > write C / Gtk programs which cross-compile and run under Windows > reliably. > > On the call today we discussed: > > (4) Write a custom C/Gtk/Gtk-VNC Windows program which contacts the > oVirt WUI to do authentication, get available consoles, and > launch a Gtk-VNC widget with the appropriate tunnelling > (openssh.exe based?). > > Thoughts? > Well, we could certainly contact the REST API on the server securely to get that information. Would the Windows program be launched by our browser plugin, or be an entirely separate program? --H From berrange at redhat.com Thu Nov 6 17:26:56 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 6 Nov 2008 17:26:56 +0000 Subject: [Ovirt-devel] Re: oVirt console (again!) In-Reply-To: <20081106170118.GA21838@amd.home.annexia.org> References: <20081106170118.GA21838@amd.home.annexia.org> Message-ID: <20081106172656.GU5716@redhat.com> On Thu, Nov 06, 2008 at 05:01:18PM +0000, Richard W.M. Jones wrote: > On the call today we discussed: > > (4) Write a custom C/Gtk/Gtk-VNC Windows program which contacts the > oVirt WUI to do authentication, get available consoles, and > launch a Gtk-VNC widget with the appropriate tunnelling > (openssh.exe based?). This is actually quite a good idea - a oVirt thin client desktop. You could even add in some basic operations like stop/start/blah, and they can avoid the web UI completely for day-to-day work. Basically this is kind of a cross of virt-viewer + vinagre, but talking to oVirt instead of libvirt. Or you could write a libvirt driver that talks to oVirt - cf the OpenNebula guys Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From rjones at redhat.com Thu Nov 6 17:35:01 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Thu, 6 Nov 2008 17:35:01 +0000 Subject: [Ovirt-devel] oVirt console (again!) In-Reply-To: <20081106171933.GN32206@redhat.com> References: <20081106170118.GA21838@amd.home.annexia.org> <20081106171933.GN32206@redhat.com> Message-ID: <20081106173501.GA22125@amd.home.annexia.org> On Thu, Nov 06, 2008 at 12:19:33PM -0500, Hugh O. Brock wrote: > Would the Windows program be launched by our browser plugin, or be an > entirely separate program? An entirely separate program. We don't do browser plugins very well :-( However we can & should offer a Windows installer, through the ovirt.org website and the ovirt WUI. We have also solved the 'build a Windows installer' thing very well too. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 68 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora From sseago at redhat.com Thu Nov 6 20:24:42 2008 From: sseago at redhat.com (Scott Seago) Date: Thu, 6 Nov 2008 20:24:42 +0000 Subject: [Ovirt-devel] [PATCH] add 'state' field to storage pools and volumes Message-ID: <1226003082-12718-1-git-send-email-sseago@redhat.com> I've added a state field to StoragePool and StorageVolume. When initially created, pools and volumes are in the pending_setup state -- once taskomatic is done they're 'available'. Upon deletion, they go into pending_deletion until taskomatic is done. Taskomatic changes to take this into account have not yet been included, since clalance's LVM patch hasn't been pushed. Signed-off-by: Scott Seago --- src/app/controllers/storage_controller.rb | 4 +- src/app/controllers/vm_controller.rb | 2 +- src/app/models/hardware_pool.rb | 17 +++++++++-- src/app/models/storage_pool.rb | 33 ++++++++++++++++++----- src/app/models/storage_volume.rb | 33 ++++++++++++++++++----- src/app/views/storage/show.rhtml | 2 + src/app/views/storage/show_volume.rhtml | 2 + src/db/migrate/029_storage_state_field.rb | 42 +++++++++++++++++++++++++++++ src/test/fixtures/storage_pools.yml | 10 +++++++ src/test/fixtures/storage_volumes.yml | 6 ++++ 10 files changed, 131 insertions(+), 20 deletions(-) create mode 100644 src/db/migrate/029_storage_state_field.rb diff --git a/src/app/controllers/storage_controller.rb b/src/app/controllers/storage_controller.rb index 75058cd..e3e5522 100644 --- a/src/app/controllers/storage_controller.rb +++ b/src/app/controllers/storage_controller.rb @@ -442,9 +442,9 @@ class StorageController < ApplicationController vm_list = volume.vms.collect {|vm| vm.description}.join(", ") ["Storage Volume #{name} must be unattached from VMs (#{vm_list}) before deleting it.", false] - #FIXME: create delete volume task. include metadata in task else - #FIXME: need to set volume to 'unavailable' state once we have states + volume.state=StorageVolume::STATE_PENDING_DELETION + volume.save! @task = StorageVolumeTask.new({ :user => @user, :task_target => volume, :action => StorageVolumeTask::ACTION_DELETE_VOLUME, diff --git a/src/app/controllers/vm_controller.rb b/src/app/controllers/vm_controller.rb index ee956da..ff74a37 100644 --- a/src/app/controllers/vm_controller.rb +++ b/src/app/controllers/vm_controller.rb @@ -81,7 +81,7 @@ class VmController < ApplicationController end def edit - @storage_tree = @vm.vm_resource_pool.get_hardware_pool.storage_tree(@vm).to_json + @storage_tree = @vm.vm_resource_pool.get_hardware_pool.storage_tree(:vm_to_include => @vm).to_json render :layout => 'popup' end diff --git a/src/app/models/hardware_pool.rb b/src/app/models/hardware_pool.rb index 6780329..d39d8e7 100644 --- a/src/app/models/hardware_pool.rb +++ b/src/app/models/hardware_pool.rb @@ -101,10 +101,21 @@ class HardwarePool < Pool return {:total => total, :labels => labels} end - def storage_tree(vm_to_include=nil) + # params accepted: + # :vm_to_include - if specified, storage used by this VM is included in the tree + # :filter_unavailable - if true, don't include Storage not currently available + # :include_used - include all storage pools/volumes, even those in use + def storage_tree(params = {}) + vm_to_include=params.fetch(:vm_to_include, nil) + filter_unavailable = params.fetch(:filter_unavailable, true) + include_used = params.fetch(:include_used, false) + conditions = "type != 'LvmStoragePool'" + if filter_unavailable + conditions = "(#{conditions}) and (storage_pools.state = '#{StoragePool::STATE_AVAILABLE}')" + end storage_pools.find(:all, - :conditions => "type != 'LvmStoragePool'").collect do |pool| - pool.storage_tree_element(vm_to_include) + :conditions => conditions).collect do |pool| + pool.storage_tree_element(params) end end end diff --git a/src/app/models/storage_pool.rb b/src/app/models/storage_pool.rb index 9c550b8..9c80f54 100644 --- a/src/app/models/storage_pool.rb +++ b/src/app/models/storage_pool.rb @@ -50,7 +50,12 @@ class StoragePool < ActiveRecord::Base LVM => "Lvm" } STORAGE_TYPE_PICKLIST = STORAGE_TYPES.keys - [LVM] - def self.factory(type, params = nil) + STATE_PENDING_SETUP = "pending_setup" + STATE_PENDING_DELETION = "pending_deletion" + STATE_AVAILABLE = "available" + + def self.factory(type, params = {}) + params[:state] = STATE_PENDING_SETUP unless params[:state] case type when ISCSI return IscsiStoragePool.new(params) @@ -82,7 +87,10 @@ class StoragePool < ActiveRecord::Base false end - def storage_tree_element(vm_to_include=nil) + def storage_tree_element(params = {}) + vm_to_include=params.fetch(:vm_to_include, nil) + filter_unavailable = params.fetch(:filter_unavailable, true) + include_used = params.fetch(:include_used, false) return_hash = { :id => id, :type => self[:type], :text => display_name, @@ -90,14 +98,25 @@ class StoragePool < ActiveRecord::Base :available => false, :create_volume => user_subdividable, :selected => false} - condition = "vms.id is null" - if (vm_to_include and vm_to_include.id) - condition +=" or vms.id=#{vm_to_include.id}" + conditions = nil + unless include_used + conditions = "vms.id is null" + if (vm_to_include and vm_to_include.id) + conditions +=" or vms.id=#{vm_to_include.id}" + end + end + if filter_unavailable + availability_conditions = "storage_volumes.state = '#{StoragePool::STATE_AVAILABLE}'" + if conditions.nil? + conditions = availability_conditions + else + conditions ="(#{conditions}) and (#{availability_conditions})" + end end return_hash[:children] = storage_volumes.find(:all, :include => :vms, - :conditions => condition).collect do |volume| - volume.storage_tree_element(vm_to_include) + :conditions => conditions).collect do |volume| + volume.storage_tree_element(params) end return_hash end diff --git a/src/app/models/storage_volume.rb b/src/app/models/storage_volume.rb index 6f14c4d..56cdcef 100644 --- a/src/app/models/storage_volume.rb +++ b/src/app/models/storage_volume.rb @@ -32,7 +32,12 @@ class StorageVolume < ActiveRecord::Base end end - def self.factory(type, params = nil) + STATE_PENDING_SETUP = "pending_setup" + STATE_PENDING_DELETION = "pending_deletion" + STATE_AVAILABLE = "available" + + def self.factory(type, params = {}) + params[:state] = STATE_PENDING_SETUP unless params[:state] case type when StoragePool::ISCSI return IscsiStorageVolume.new(params) @@ -75,7 +80,10 @@ class StorageVolume < ActiveRecord::Base return false end - def storage_tree_element(vm_to_include=nil) + def storage_tree_element(params = {}) + vm_to_include=params.fetch(:vm_to_include, nil) + filter_unavailable = params.fetch(:filter_unavailable, true) + include_used = params.fetch(:include_used, false) vm_ids = vms.collect {|vm| vm.id} return_hash = { :id => id, :type => self[:type], @@ -92,14 +100,25 @@ class StorageVolume < ActiveRecord::Base if return_hash[:available] return_hash[:available] = lvm_storage_pool.storage_volumes.full_vm_list.empty? end - condition = "vms.id is null" - if (vm_to_include and vm_to_include.id) - condition +=" or vms.id=#{vm_to_include.id}" + conditions = nil + unless include_used + conditions = "vms.id is null" + if (vm_to_include and vm_to_include.id) + conditions +=" or vms.id=#{vm_to_include.id}" + end + end + if filter_unavailable + availability_conditions = "storage_volumes.state = '#{StoragePool::STATE_AVAILABLE}'" + if conditions.nil? + conditions = availability_conditions + else + conditions ="(#{conditions}) and (#{availability_conditions})" + end end return_hash[:children] = lvm_storage_pool.storage_volumes.find(:all, :include => :vms, - :conditions => condition).collect do |volume| - volume.storage_tree_element(vm_to_include) + :conditions => conditions).collect do |volume| + volume.storage_tree_element(params) end else return_hash[:children] = [] diff --git a/src/app/views/storage/show.rhtml b/src/app/views/storage/show.rhtml index a84dc62..123cf20 100644 --- a/src/app/views/storage/show.rhtml +++ b/src/app/views/storage/show.rhtml @@ -26,6 +26,7 @@ Export path:
<% end %> Type:
+ State:
<%=h @storage_pool.ip_addr %>
@@ -36,6 +37,7 @@ <%=h @storage_pool.export_path %>
<% end %> <%=h @storage_pool.get_type_label %>
+ <%=h @storage_pool.state %>
<%- content_for :right do -%>
Volumes
diff --git a/src/app/views/storage/show_volume.rhtml b/src/app/views/storage/show_volume.rhtml index e39c10e..c1cb66a 100644 --- a/src/app/views/storage/show_volume.rhtml +++ b/src/app/views/storage/show_volume.rhtml @@ -28,6 +28,7 @@ Export path:
<% end %> Type:
+ State:
Path:
<% if @storage_volume[:type] == "IscsiStorageVolume" %> LUN:
@@ -45,6 +46,7 @@ <%=h @storage_volume.storage_pool.export_path %>
<% end %> <%=h @storage_volume.storage_pool.get_type_label %>
+ <%=h @storage_volume.state %>
<%=h @storage_volume.path %>
<% if @storage_volume[:type] == "IscsiStorageVolume" %> <%=h @storage_volume.lun %>
diff --git a/src/db/migrate/029_storage_state_field.rb b/src/db/migrate/029_storage_state_field.rb new file mode 100644 index 0000000..d8f3ab1 --- /dev/null +++ b/src/db/migrate/029_storage_state_field.rb @@ -0,0 +1,42 @@ +# +# Copyright (C) 2008 Red Hat, Inc. +# Written by Scott Seago +# +# 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 StorageStateField < ActiveRecord::Migration + def self.up + add_column :storage_pools, :state, :string + add_column :storage_volumes, :state, :string + begin + StoragePool.transaction do + StoragePool.find(:all).each do |pool| + pool.state = 'available' + pool.save! + end + StorageVolume.find(:all).each do |volume| + volume.state = 'available' + volume.save! + end + end + end + end + + def self.down + remove_column :storage_pools, :state + remove_column :storage_volumes, :state + end +end diff --git a/src/test/fixtures/storage_pools.yml b/src/test/fixtures/storage_pools.yml index ac042a0..d52bf51 100644 --- a/src/test/fixtures/storage_pools.yml +++ b/src/test/fixtures/storage_pools.yml @@ -5,18 +5,21 @@ one: type: 'IscsiStoragePool' port: 53 target: 'footarget' + state: 'available' two: id: 2 hardware_pool_id: 4 type: 'NfsStoragePool' ip_addr: '127.0.0.1' export_path: '/tmp/foopath' + state: 'available' three: id: 3 hardware_pool_id: 4 type: 'NfsStoragePool' ip_addr: '192.168.50.1' export_path: '/tmp/barpath' + state: 'available' four: id: 4 hardware_pool_id: 9 @@ -25,24 +28,28 @@ four: ip_addr: '192.168.50.1' target: 'rubarb' hardware_pool_id: 1 + state: 'available' five: id: 5 hardware_pool_id: 9 type: 'NfsStoragePool' ip_addr: '192.168.50.2' export_path: '/tmp/thepath' + state: 'available' six: id: 6 hardware_pool_id: 9 type: 'NfsStoragePool' ip_addr: '192.168.50.3' export_path: '/tmp/anotherpath' + state: 'available' seven: id: 7 hardware_pool_id: 9 type: 'NfsStoragePool' ip_addr: '192.168.50.4' export_path: '/tmp/apath' + state: 'available' eight: id: 8 hardware_pool_id: 9 @@ -50,12 +57,14 @@ eight: type: 'IscsiStoragePool' port: 531 target: 'bartarget' + state: 'available' nine: id: 9 hardware_pool_id: 9 type: 'NfsStoragePool' ip_addr: '1.2.3.4' export_path: '/tmp/somepath' + state: 'available' ten: id: 10 hardware_pool_id: 9 @@ -63,3 +72,4 @@ ten: ip_addr: '192.168.50.3' port: 539 target: 'stayontarget' + state: 'available' diff --git a/src/test/fixtures/storage_volumes.yml b/src/test/fixtures/storage_volumes.yml index 1c49ace..4761d95 100644 --- a/src/test/fixtures/storage_volumes.yml +++ b/src/test/fixtures/storage_volumes.yml @@ -6,6 +6,7 @@ one: path: '/tmp/foobar' storage_pool_id: 1 type: 'IscsiStorageVolume' + state: 'available' two: id: 2 size: '20485760' @@ -13,6 +14,7 @@ two: storage_pool_id: 2 type: 'NfsStorageVolume' filename: 'secretstuff' + state: 'available' three: id: 3 lun: 'abcd' @@ -20,21 +22,25 @@ three: path: storage_pool_id: 1 type: 'IscsiStorageVolume' + state: 'available' four: id: 4 lun: '49723e4d-32e6-469e-8019-913a3dc1bb5d' size: '01223542' storage_pool_id: 4 type: 'IscsiStorageVolume' + state: 'available' five: id: 5 size: '42424242' storage_pool_id: 2 type: 'NfsStorageVolume' filename: 'foobar' + state: 'available' six: id: 6 size: '007007' storage_pool_id: 6 type: 'NfsStorageVolume' filename: 'barfoo' + state: 'available' -- 1.5.5.1 From kraxel at redhat.com Thu Nov 6 21:02:37 2008 From: kraxel at redhat.com (Gerd Hoffmann) Date: Thu, 06 Nov 2008 22:02:37 +0100 Subject: [Ovirt-devel] oVirt console (again!) In-Reply-To: <20081106170118.GA21838@amd.home.annexia.org> References: <20081106170118.GA21838@amd.home.annexia.org> Message-ID: <49135B6D.9010008@redhat.com> Hi, > (3) Running virt-viewer or viagre as separate, standalone programs. > This works, but requires the user to type in some very long > and complicated command line by hand, and there are unresolved > authentication problems. Authentication problems? Which authentication problems? /me uses virt-manager for the guest consoles. Authenticates just fine via kerberos, using the same ticket I need for the ovirt wui anyway. Not the most elegant solution as I'll have to add each node manually to virt-manager. Not a big issue either with my two-node-test-setup ;) For a larger-scale setup you'll probably want build some dedicated app (say ovirt-viewer) which gets a list of vms from ovirt, the node they are running on and then goes talk to libvirt on the nodes for the vnc display. The kerberos ticket should open all doors needed. cheers, Gerd From rjones at redhat.com Thu Nov 6 21:02:53 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Thu, 6 Nov 2008 21:02:53 +0000 Subject: [Ovirt-devel] oVirt console (again!) In-Reply-To: <49135B6D.9010008@redhat.com> References: <20081106170118.GA21838@amd.home.annexia.org> <49135B6D.9010008@redhat.com> Message-ID: <20081106210253.GA22878@amd.home.annexia.org> On Thu, Nov 06, 2008 at 10:02:37PM +0100, Gerd Hoffmann wrote: > Hi, > > > (3) Running virt-viewer or viagre as separate, standalone programs. > > This works, but requires the user to type in some very long > > and complicated command line by hand, and there are unresolved > > authentication problems. > > Authentication problems? Which authentication problems? > > /me uses virt-manager for the guest consoles. Authenticates just fine > via kerberos, using the same ticket I need for the ovirt wui anyway. The problem, as ever, is with Windows. It's hard to set up a Windows client as a Kerberos client, so this won't just work. > For a larger-scale setup you'll probably want build some dedicated app > (say ovirt-viewer) which gets a list of vms from ovirt, the node they > are running on and then goes talk to libvirt on the nodes for the vnc > display. That's basically the plan for number (4). Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 68 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora From jguiditt at redhat.com Thu Nov 6 21:28:03 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Thu, 6 Nov 2008 16:28:03 -0500 Subject: [Ovirt-devel] [PATCH server] Feedback Requested. Message-ID: <1226006883-5633-1-git-send-email-jguiditt@redhat.com> This is a first attempt at doing some fixes on the unit tests. I have been having problems getting the full test suite to run on my machines, so I am trying to get this remedied. I am hoping to do it as a series of small patches, rather than one very large patch, so this is the first of those. Since I can't run 'rake test:units' right now, I can't really tell if this breaks the whole test suite or not, so I am looking for feedback from someone who _is_ able to run that. I have added some tests to pool_test.rb and been able to run them successfully with 'ruby test/unit/pool_test.rb', so I know this component is fine, just not what effect it might have on everything else. Signed-off-by: Jason Guiditta --- src/test/fixtures/pools.yml | 96 ++++++++++++++++++------------------------ src/test/unit/pool_test.rb | 8 +++- 2 files changed, 47 insertions(+), 57 deletions(-) diff --git a/src/test/fixtures/pools.yml b/src/test/fixtures/pools.yml index 181a75b..41241f6 100644 --- a/src/test/fixtures/pools.yml +++ b/src/test/fixtures/pools.yml @@ -1,100 +1,86 @@ -one: - id: 1 +root_dir_pool: + name: 'root' + type: 'DirectoryPool' + lft: 1 + rgt: 28 + +hw_dir_pool: + name: 'hardware' + type: 'DirectoryPool' + parent_id: <%= Fixtures.identify(:root_dir_pool) %> + lft: 2 + rgt: 25 + +smart_dir_pool: + name: 'users' + type: 'DirectoryPool' + parent_id: <%= Fixtures.identify(:root_dir_pool) %> + lft: 26 + rgt: 27 + +default: name: 'default' type: 'HardwarePool' - parent_id: 12 - created_at: '2008-02-13 15:42:43.417883' - updated_at: '2008-02-14 16:41:42.417883' + parent_id: <%= Fixtures.identify(:hw_dir_pool) %> lft: 3 rgt: 24 -two: - id: 2 +foobar_hosts: name: 'foobar hosts' type: 'VmResourcePool' - parent_id: 1 + parent_id: <%= Fixtures.identify(:default) %> lft: 4 rgt: 5 -three: - id: 3 +corp_com: name: 'corp.com' type: 'HardwarePool' - parent_id: 1 + parent_id: <%= Fixtures.identify(:default) %> lft: 6 rgt: 23 -four: - id: 4 +corp_com_dev: name: 'corp.com dev' type: 'HardwarePool' - parent_id: 3 + parent_id: <%= Fixtures.identify(:corp_com) %> lft: 7 rgt: 8 -five: - id: 5 +corp_com_qa: name: 'corp.com qa' type: 'HardwarePool' - parent_id: 3 + parent_id: <%= Fixtures.identify(:corp_com) %> lft: 9 rgt: 20 -six: - id: 6 +corp_com_production_vms: name: 'corp.com production vms' type: 'VmResourcePool' - parent_id: 3 + parent_id: <%= Fixtures.identify(:corp_com) %> lft: 21 rgt: 22 -seven: - id: 7 +foobar: name: 'foobar' type: 'VmResourcePool' - parent_id: 5 + parent_id: <%= Fixtures.identify(:corp_com_qa) %> lft: 10 rgt: 11 -eight: - id: 8 +some_foobar_hardware: name: 'some foobar hardware' type: 'HardwarePool' - parent_id: 5 + parent_id: <%= Fixtures.identify(:corp_com_qa) %> lft: 12 rgt: 15 -nine: - id: 9 +some_more_foobar_hardware: name: 'some more foobar hardware' type: 'HardwarePool' - parent_id: 8 + parent_id: <%= Fixtures.identify(:some_foobar_hardware) %> lft: 13 rgt: 14 -ten: - id: 10 +yet_another_pool: name: 'yet another pool' type: 'VmResourcePool' - parent_id: 5 + parent_id: <%= Fixtures.identify(:corp_com_qa) %> lft: 16 rgt: 17 prodops_pool: - id: 11 name: 'Production Operations' type: 'HardwarePool' - parent_id: 5 + parent_id: <%= Fixtures.identify(:corp_com_qa) %> lft: 18 rgt: 19 -hw_dir_pool: - id: 12 - name: 'hardware' - type: 'DirectoryPool' - parent_id: 13 - lft: 2 - rgt: 25 -root_dir_pool: - id: 13 - name: 'root' - type: 'DirectoryPool' - lft: 1 - rgt: 28 -smart_dir_pool: - id: 14 - name: 'hardware' - type: 'DirectoryPool' - parent_id: 13 - lft: 26 - rgt: 27 - diff --git a/src/test/unit/pool_test.rb b/src/test/unit/pool_test.rb index c591e58..c0ca7cc 100644 --- a/src/test/unit/pool_test.rb +++ b/src/test/unit/pool_test.rb @@ -23,7 +23,11 @@ class PoolTest < Test::Unit::TestCase fixtures :pools # Replace this with your real tests. - def test_truth - assert true + def test_get_name + assert_equal(pools(:prodops_pool).name, 'Production Operations') + end + + def test_get_parent + assert_equal(pools(:prodops_pool).parent.name, 'corp.com qa') end end -- 1.5.6.5 From dpierce at redhat.com Thu Nov 6 21:33:37 2008 From: dpierce at redhat.com (Darryl Pierce) Date: Thu, 06 Nov 2008 16:33:37 -0500 Subject: [Ovirt-devel] [PATCH server] Feedback Requested. In-Reply-To: <1226006883-5633-1-git-send-email-jguiditt@redhat.com> References: <1226006883-5633-1-git-send-email-jguiditt@redhat.com> Message-ID: <491362B1.4090406@redhat.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jason Giuditta wrote: > This is a first attempt at doing some fixes on the unit tests. I have > been having problems getting the full test suite to run on my machines, > so I am trying to get this remedied. I am hoping to do it as a series of > small patches, rather than one very large patch, so this is the first of > those. Since I can't run 'rake test:units' right now, I can't really > tell if this breaks the whole test suite or not, so I am looking for > feedback from someone who _is_ able to run that. I have added some tests > to pool_test.rb and been able to run them successfully with 'ruby > test/unit/pool_test.rb', so I know this component is fine, just not what > effect it might have on everything else. Looks good so far. > > Signed-off-by: Jason Guiditta > --- > src/test/fixtures/pools.yml | 96 ++++++++++++++++++------------------------ > src/test/unit/pool_test.rb | 8 +++- > 2 files changed, 47 insertions(+), 57 deletions(-) > > diff --git a/src/test/fixtures/pools.yml b/src/test/fixtures/pools.yml > index 181a75b..41241f6 100644 > --- a/src/test/fixtures/pools.yml > +++ b/src/test/fixtures/pools.yml > @@ -1,100 +1,86 @@ > -one: > - id: 1 > +root_dir_pool: I like the using of meaningful names for the fixtures. It makes usage in tests much clearler. > + name: 'root' > + type: 'DirectoryPool' You don't need to wrap strings in single quotes. Everything after the colon is trimmed and treated as a string. > + lft: 1 > + rgt: 28 > + > +hw_dir_pool: > + name: 'hardware' > + type: 'DirectoryPool' > + parent_id: <%= Fixtures.identify(:root_dir_pool) %> > + lft: 2 > + rgt: 25 > + > +smart_dir_pool: > + name: 'users' > + type: 'DirectoryPool' > + parent_id: <%= Fixtures.identify(:root_dir_pool) %> > + lft: 26 > + rgt: 27 > + > +default: > name: 'default' > type: 'HardwarePool' > - parent_id: 12 > - created_at: '2008-02-13 15:42:43.417883' > - updated_at: '2008-02-14 16:41:42.417883' > + parent_id: <%= Fixtures.identify(:hw_dir_pool) %> > lft: 3 > rgt: 24 > -two: > - id: 2 > +foobar_hosts: > name: 'foobar hosts' > type: 'VmResourcePool' > - parent_id: 1 > + parent_id: <%= Fixtures.identify(:default) %> > lft: 4 > rgt: 5 > -three: > - id: 3 > +corp_com: > name: 'corp.com' > type: 'HardwarePool' > - parent_id: 1 > + parent_id: <%= Fixtures.identify(:default) %> > lft: 6 > rgt: 23 > -four: > - id: 4 > +corp_com_dev: > name: 'corp.com dev' > type: 'HardwarePool' > - parent_id: 3 > + parent_id: <%= Fixtures.identify(:corp_com) %> > lft: 7 > rgt: 8 > -five: > - id: 5 > +corp_com_qa: > name: 'corp.com qa' > type: 'HardwarePool' > - parent_id: 3 > + parent_id: <%= Fixtures.identify(:corp_com) %> > lft: 9 > rgt: 20 > -six: > - id: 6 > +corp_com_production_vms: > name: 'corp.com production vms' > type: 'VmResourcePool' > - parent_id: 3 > + parent_id: <%= Fixtures.identify(:corp_com) %> > lft: 21 > rgt: 22 > -seven: > - id: 7 > +foobar: > name: 'foobar' > type: 'VmResourcePool' > - parent_id: 5 > + parent_id: <%= Fixtures.identify(:corp_com_qa) %> > lft: 10 > rgt: 11 > -eight: > - id: 8 > +some_foobar_hardware: > name: 'some foobar hardware' > type: 'HardwarePool' > - parent_id: 5 > + parent_id: <%= Fixtures.identify(:corp_com_qa) %> > lft: 12 > rgt: 15 > -nine: > - id: 9 > +some_more_foobar_hardware: > name: 'some more foobar hardware' > type: 'HardwarePool' > - parent_id: 8 > + parent_id: <%= Fixtures.identify(:some_foobar_hardware) %> > lft: 13 > rgt: 14 > -ten: > - id: 10 > +yet_another_pool: > name: 'yet another pool' > type: 'VmResourcePool' > - parent_id: 5 > + parent_id: <%= Fixtures.identify(:corp_com_qa) %> > lft: 16 > rgt: 17 > prodops_pool: > - id: 11 > name: 'Production Operations' > type: 'HardwarePool' > - parent_id: 5 > + parent_id: <%= Fixtures.identify(:corp_com_qa) %> > lft: 18 > rgt: 19 > -hw_dir_pool: > - id: 12 > - name: 'hardware' > - type: 'DirectoryPool' > - parent_id: 13 > - lft: 2 > - rgt: 25 > -root_dir_pool: > - id: 13 > - name: 'root' > - type: 'DirectoryPool' > - lft: 1 > - rgt: 28 > -smart_dir_pool: > - id: 14 > - name: 'hardware' > - type: 'DirectoryPool' > - parent_id: 13 > - lft: 26 > - rgt: 27 > - > diff --git a/src/test/unit/pool_test.rb b/src/test/unit/pool_test.rb > index c591e58..c0ca7cc 100644 > --- a/src/test/unit/pool_test.rb > +++ b/src/test/unit/pool_test.rb > @@ -23,7 +23,11 @@ class PoolTest < Test::Unit::TestCase > fixtures :pools > > # Replace this with your real tests. > - def test_truth > - assert true > + def test_get_name > + assert_equal(pools(:prodops_pool).name, 'Production Operations') > + end > + > + def test_get_parent > + assert_equal(pools(:prodops_pool).parent.name, 'corp.com qa') > end > end - -- Darryl L. Pierce : GPG KEYID: 6C4E7F1B -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAkkTYqsACgkQjaT4DmxOfxudpQCfa9nK4RZytCCh8wc8CdXWqOjH WD0AmwWi5v5GXcZf8F4LS3xN4oW74HE3 =fqAv -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: dpierce.vcf Type: text/x-vcard Size: 319 bytes Desc: not available URL: From apevec at redhat.com Fri Nov 7 01:27:43 2008 From: apevec at redhat.com (Alan Pevec) Date: Fri, 7 Nov 2008 02:27:43 +0100 Subject: [Ovirt-devel] [PATCH ovirt-node] Creates a standalone mode entry point script. Message-ID: <1226021266-22250-1-git-send-email-apevec@redhat.com> From: Darryl L. Pierce [REPOST] split into separate patch per -config component, ws cleanup This patch includes booting to firstboot/standalone mode The script will execute only when the node is booted without the support of a server suite. If it determines that the node is running in standalone mode, it will then kick over to a node setup script. This iteration defines the general flow for the standalone mode's firstboot use case. When the node boots and determines it's in standalone mode, it goes through the following steps: 1. Prompt for an administrator password 2. Prompt the user to configure disk storage 3. Prompt the user to configure networking 4. Prompt the user to configure logging The node then continues to boot normally. Signed-off-by: Darryl L. Pierce --- Makefile.am | 6 ++++ ovirt-node.spec.in | 15 ++++++++++- scripts/ovirt-config-logging | 1 + scripts/ovirt-config-networking | 1 + scripts/ovirt-config-password | 1 + scripts/ovirt-config-setup | 23 ++++++++++++++++ scripts/ovirt-config-storage | 1 + scripts/ovirt-functions | 5 +++ scripts/ovirt-standalone-mode | 55 +++++++++++++++++++++++++++++++++++++++ 9 files changed, 107 insertions(+), 1 deletions(-) create mode 100755 scripts/ovirt-config-logging create mode 100755 scripts/ovirt-config-networking create mode 100755 scripts/ovirt-config-password create mode 100755 scripts/ovirt-config-setup create mode 100755 scripts/ovirt-config-storage create mode 100755 scripts/ovirt-standalone-mode diff --git a/Makefile.am b/Makefile.am index 4ba0bca..0005ac9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -27,10 +27,16 @@ EXTRA_DIST = \ scripts/collectd.conf.in \ scripts/ovirt \ scripts/ovirt-awake \ + scripts/ovirt-config-logging \ + scripts/ovirt-config-networking \ + scripts/ovirt-config-password \ + scripts/ovirt-config-setup \ + scripts/ovirt-config-storage \ scripts/ovirt-early \ scripts/ovirt-functions \ scripts/ovirt-post \ scripts/ovirt-process-config \ + scripts/ovirt-standalone-mode \ logrotate/ovirt-logrotate \ logrotate/ovirt-logrotate.conf diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index d029c57..10a544b 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -88,17 +88,22 @@ cd - %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-process-config %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-logging %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-networking %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-password %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-setup %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-storage %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-identify-node/ovirt-identify-node %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-listen-awake/ovirt-listen-awake %{buildroot}%{_sbindir} %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-listen-awake.init %{buildroot}%{_initrddir}/ovirt-listen-awake %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-install-node %{buildroot}%{_sbindir} %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-uninstall-node %{buildroot}%{_sbindir} - %{__install} -p -m0644 scripts/ovirt-functions %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-early %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-post %{buildroot}%{_initrddir} +%{__install} -p -m0755 scripts/ovirt-standalone-mode %{buildroot}%{_initrddir} %{__install} -p -m0644 scripts/collectd %{buildroot}%{_sysconfdir}/chkconfig.d %{__install} -p -m0644 scripts/collectd.conf.in %{buildroot}%{_sysconfdir} @@ -125,6 +130,7 @@ cd - /sbin/chkconfig --add ovirt-early /sbin/chkconfig --add ovirt /sbin/chkconfig --add ovirt-post +/sbin/chkconfig --add ovirt-standalone-mode # this is ugly; we need collectd to start *after* libvirtd, so we own the # /etc/chkconfig.d/collectd file, and then have to re-define collectd here /sbin/chkconfig --add collectd @@ -136,6 +142,7 @@ if [ "$1" = 0 ] ; then /sbin/chkconfig --del ovirt /sbin/chkconfig --del ovirt-post /sbin/chkconfig --del ovirt-listen-awake + /sbin/chkconfig --del ovirt-standalone-mode fi %post selinux @@ -159,6 +166,11 @@ fi %files %defattr(-,root,root,0755) %{_sbindir}/ovirt-awake +%{_sbindir}/ovirt-config-logging +%{_sbindir}/ovirt-config-networking +%{_sbindir}/ovirt-config-password +%{_sbindir}/ovirt-config-setup +%{_sbindir}/ovirt-config-storage %{_sbindir}/ovirt-process-config %{_sbindir}/ovirt-identify-node %{_sbindir}/ovirt-listen-awake @@ -168,6 +180,7 @@ fi %{_initrddir}/ovirt %{_initrddir}/ovirt-post %{_initrddir}/ovirt-listen-awake +%{_initrddir}/ovirt-standalone-mode %config %{_sysconfdir}/logrotate.d/ovirt-logrotate.conf %config %{_sysconfdir}/cron.hourly/ovirt-logrotate %defattr(-,root,root,0644) diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging new file mode 100755 index 0000000..8b13789 --- /dev/null +++ b/scripts/ovirt-config-logging @@ -0,0 +1 @@ + diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking new file mode 100755 index 0000000..8b13789 --- /dev/null +++ b/scripts/ovirt-config-networking @@ -0,0 +1 @@ + diff --git a/scripts/ovirt-config-password b/scripts/ovirt-config-password new file mode 100755 index 0000000..8b13789 --- /dev/null +++ b/scripts/ovirt-config-password @@ -0,0 +1 @@ + diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup new file mode 100755 index 0000000..8408d14 --- /dev/null +++ b/scripts/ovirt-config-setup @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Entry point for configuring an oVirt node when running in standalone mode. + +while true; do + PS3="Please select an option: " + # TODO should we make this optional, based on whether the password was already set? + PASSWORD_OPTION="Password" + OPTIONS="Networking Storage Logging ${PASSWORD_OPTION} Quit" + + select OPTION in $OPTIONS + do + printf "\n" + + case "$OPTION" in + "Networking") ovirt-config-networking ; break ;; + "Storage") ovirt-config-storage ; break ;; + "Logging") ovirt-config-logging ; break ;; + "Password") ovirt-config-password ; break ;; + "Quit") exit 0 ;; + esac + done +done diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage new file mode 100755 index 0000000..8b13789 --- /dev/null +++ b/scripts/ovirt-config-storage @@ -0,0 +1 @@ + diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions index e251eac..53e9f62 100644 --- a/scripts/ovirt-functions +++ b/scripts/ovirt-functions @@ -7,6 +7,11 @@ OVIRT_LABEL=OVIRT OVIRT_BACKUP_DIR=/var/lib/ovirt-backup +is_standalone() +{ + return 0 +} + find_srv() { local dnsreply diff --git a/scripts/ovirt-standalone-mode b/scripts/ovirt-standalone-mode new file mode 100755 index 0000000..fed697a --- /dev/null +++ b/scripts/ovirt-standalone-mode @@ -0,0 +1,55 @@ +#!/bin/bash +# +# ovirt-standalone-mode Starts the node in standalone mode. +# +# chkconfig: 2345 99 01 +# description: ovirt-early services +# +# Copyright (C) 2008 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. + +## Source functions library +. /etc/init.d/functions +. /etc/init.d/ovirt-functions + +start () +{ + ovirt-config-setup +} + +case "$1" in + start) + #is_standalone + #if [ $? -ne 0 ]; then + # exit 0 + #fi + + printf "Starting ovirt-standalone-mode: " + + { + start + } + + test $? == 0 && success || failure + echo + ;; + + *) + echo "Usage: ovirt-early {start}" + exit 2 +esac -- 1.5.6.5 From apevec at redhat.com Fri Nov 7 01:27:44 2008 From: apevec at redhat.com (Alan Pevec) Date: Fri, 7 Nov 2008 02:27:44 +0100 Subject: [Ovirt-devel] [PATCH ovirt-node] standalone mode - configure networking In-Reply-To: <1226021266-22250-1-git-send-email-apevec@redhat.com> References: <1226021266-22250-1-git-send-email-apevec@redhat.com> Message-ID: <1226021266-22250-2-git-send-email-apevec@redhat.com> From: Darryl L. Pierce --- scripts/ovirt-config-networking | 97 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 97 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 8b13789..705521b 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -1 +1,98 @@ +#!/bin/bash +# +# Iterates over the list of network devices on the node and prompts the user +# to configure each. +CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" + +function configure_interface +{ + NIC=$1 + FILENAME="/var/tmp/augtool-$NIC" + + printf "\nCONFIGURE INTERFACE: $NIC\n\n" + + THIS_ROOT="$CONFIG_FILE_ROOT-$NIC" + CONFIG="rm $THIS_ROOT\nset $THIS_ROOT/DEVICE $NIC" + + # Is this NIC shared? + while true; do + printf "Is $NIC a shared interface? (Y/N) " + read + case $REPLY in + Y|y) CONFIG="$CONFIG\nset $THIS_ROOT/TYPE bridge"; break ;; + N|n) bridge="N"; break ;; + esac + done + + # how do you want to configure this device? (dhcp, static IP) + while true; do + printf "Does $NIC use dynamic addressing? (Y/N) " + read + case $REPLY in + Y|y) CONFIG="$CONFIG\nset $THIS_ROOT/BOOTPROTO dhcp"; break ;; + N|n) + printf "\tIP Address: "; read; IPADDR=$REPLY + printf "\t Netmask: "; read; NETMASK=$REPLY + printf "\t Broadcast: "; read; BROADCAST=$REPLY + printf "\t Gateway: "; read; GATEWAY=$REPLY + + printf "\nIP Address: $IPADDR\nNetmask: $NETMASK\nBroadcast: $BROADCAST\nGateway: $GATEWAY\n" + printf "Is this correct? (Y/N) " + read + case $REPLY in + Y|y) + CONFIG="$CONFIG\nset $THIS_ROOT/IPADDR $IPADDR" + CONFIG="$CONFIG\nset $THIS_ROOT/BROADCAST $BROADCAST" + CONFIG="$CONFIG\nset $THIS_ROOT/NETMASK $NETMASK" + break + ;; + esac + ;; + esac + done + + if [ "$bridge" == "N" ]; then + printf "Is $NIC bridged? (Y/N) " + read + case $REPLY in + Y|y) + printf "What is the bridge name? " + read + CONFIG="$CONFIG\n set $THIS_ROOT/BRIDGE $REPLY" + ;; + esac + fi + + CONFIG="$CONFIG\nset $THIS_ROOT/ONBOOT yes" + printf "$CONFIG\n" > $FILENAME + + echo +} + +# TODO the menu doesn't redisplay unless you hit enter -- needs fixing +# get the list of network cards on this machine +NICS=$(hal-device | awk '/net.interface/ { + match($0, "= '"'"'(.*)'"'"' ", nic); printf("%s ", nic[1]); }') + +# Append a quit option +NICS="$NICS Quit" + +PS3="Please select a network interface to configure:" +select NIC in $NICS +do + case "$NIC" in + "Quit") + break + ;; + + *) + configure_interface $NIC + ;; + esac +done + +# Merge together all generated files and run augtool + +cat /var/tmp/augtool-* > /var/tmp/config-augtool +augtool < /var/tmp/config-augtool -- 1.5.6.5 From apevec at redhat.com Fri Nov 7 01:27:45 2008 From: apevec at redhat.com (Alan Pevec) Date: Fri, 7 Nov 2008 02:27:45 +0100 Subject: [Ovirt-devel] [PATCH ovirt-node] standalone mode - configure local storage (DESTRUCTIVE) In-Reply-To: <1226021266-22250-1-git-send-email-apevec@redhat.com> References: <1226021266-22250-1-git-send-email-apevec@redhat.com> Message-ID: <1226021266-22250-3-git-send-email-apevec@redhat.com> From: Darryl L. Pierce --- scripts/ovirt-config-storage | 112 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 112 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index 8b13789..91d50de 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -1 +1,113 @@ +#!/bin/bash +# +# All sizes are in gigabytes +DRIVE=$(sfdisk -s | awk '/\/dev\/([sh]da)/ { match($0, "^(.*):.*", data); printf data[1] }') +BOOT_SIZE=1 +INSTALL_SIZE=10 +CONFIG_SIZE=5 +LOGGING_SIZE=2 + +MEM_SIZE=$(cat /proc/meminfo | awk '/MemTotal/ { print $2 }') +MEM_SIZE=$(( $MEM_SIZE / ( 1024 ** 2) )) +SWAP_SIZE=$(($MEM_SIZE * 2 + 1)) + +function do_configure +{ + read -p "Swap partition size (Currently ${SWAP_SIZE})? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + SWAP_SIZE=$REPLY + else + printf "Swap value is invalid.\n" + return + fi + + read -p "Boot partition size (Currently ${SWAP_SIZE})? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + BOOT_SIZE=$REPLY + else + printf "Boot value is invalid.\n" + return + fi + +} + +function do_review +{ + printf "\n" + printf "The local disk will be repartitioned as follows:\n" + printf "================================================\n" + printf " Physical Hard Disk: ${DRIVE}\n" + printf " Boot partition size: ${BOOT_SIZE} GB\n" + printf " Swap partition size: ${SWAP_SIZE} GB\n" + printf " Installation partition size: ${INSTALL_SIZE} GB\n" + printf " Configuration partition size: ${CONFIG_SIZE} GB\n" + printf " Logging partition size: ${LOGGING_SIZE} GB\n" + printf "\n" +} + +function do_partitioning +{ + while true; do + printf "\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! If you proceed this will destroy all data on your local system, and !!WARNING!!\n" + printf "!!WARNING!! your hard disk will be irreversably reconfiguration. !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "\n" + printf "\tContinue? (Y/n) " + read + case $REPLY in + Y|y) + { + dd if=/dev/zero of=/dev/sda bs=1K count=1 + blockdev --rereadpt /dev/sda + # Boot partition + # /dev/sda1 = Boot partition + # /dev/sda2 = Swap partition + # /dev/sda4 = LVM + echo -e "n\np\n1\n\n+$(( $BOOT_SIZE * 1024))M\na\n1\n + n\np\n2\n\n+$(( $SWAP_SIZE * 1024))M\nt\n2\n82\n + n\np\n4\n\n\nt\n4\n8e\n + w\n" | fdisk $DRIVE + pvcreate /dev/sda4 + vgcreate /dev/VolGroup00 /dev/sda4 + + lvcreate --name Ovirt /dev/VolGroup00 --size ${INSTALL_SIZE}G + lvcreate --name Config /dev/VolGroup00 --size ${CONFIG_SIZE}G + lvcreate --name Logging /dev/VolGroup00 --size ${LOGGING_SIZE}G + + mkfs -t ext3 /dev/sda1 + mkfs -t ext3 /dev/VolGroup00/Ovirt + mkfs -t ext3 /dev/VolGroup00/Config + mkfs -t ext3 /dev/VolGroup00/Logging + + } > partition.log + break ;; + N|n) return ;; + esac + done +} + +while true; do + OPTIONS="Configure Review Partition Quit" + PS3="Choose an option: " + + printf "\n" + + select OPTION in $OPTIONS + do + case "$OPTION" in + "Configure") do_configure ; break ;; + "Review") do_review ; break ;; + "Partition") do_partitioning ; break ;; + "Quit") exit ;; + esac + done +done -- 1.5.6.5 From apevec at redhat.com Fri Nov 7 01:27:46 2008 From: apevec at redhat.com (Alan Pevec) Date: Fri, 7 Nov 2008 02:27:46 +0100 Subject: [Ovirt-devel] [PATCH ovirt-node] RSyslog configuration for standalone mode. In-Reply-To: <1226021266-22250-1-git-send-email-apevec@redhat.com> References: <1226021266-22250-1-git-send-email-apevec@redhat.com> Message-ID: <1226021266-22250-4-git-send-email-apevec@redhat.com> From: Bryan Kearney It looks for a DNS service locator record by default, and lets the user override if desired --- scripts/ovirt-config-logging | 124 ++++++++++++++++++++++++++++++++++++++++++ scripts/ovirt-config-setup | 2 + 2 files changed, 126 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging index 8b13789..1d9c877 100755 --- a/scripts/ovirt-config-logging +++ b/scripts/ovirt-config-logging @@ -1 +1,125 @@ +#!/bin/bash +# +# Configures the rsyslog daemon. +RSYSLOG_FILE="/etc/rsyslog.conf" + +# Creates the rsyslog file based on the following inputs +# $1 ipaddress of remote syslog server +# $2 port of remote syslog server +# $3 protocol (tcp or udp) +function ovirt_rsyslog { + +DELIM="" + +if [[ "$3" = "tcp" ]]; then + DELIM="@@" +else + DELIM="@" +fi + +cat > $RSYSLOG_FILE << EOF +#ovirt rsyslog config file + +#### MODULES #### +\$ModLoad imuxsock.so # provides support for local system logging (e.g. via logger command) +\$ModLoad imklog.so # provides kernel logging support (previously done by rklogd) + +#### GLOBAL DIRECTIVES #### +# Use default timestamp format +\$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +#### RULES #### +# Log anything (except mail) of level info or higher. +# Don't log private authentication messages! +*.info;mail.none;authpriv.none;cron.none /var/log/messages + +# The authpriv file has restricted access. +authpriv.* /var/log/secure + +# Log all the mail messages in one place. +mail.* -/var/log/maillog + +# Log cron stuff +cron.* /var/log/cron + +# Everybody gets emergency messages +*.emerg * + +# Save news errors of level crit and higher in a special file. +uucp,news.crit /var/log/spooler + +# Save boot messages also to boot.log +local7.* /var/log/boot.log + +\$WorkDirectory /var/spppl/rsyslog +\$ActionQueueFileName ovirtNode +\$ActionQueueMaxDiskSpace 10m +\$ActionQueueSaveOnShutdown on +\$ActionQueueType LinkedList +\$ActionResumeRetryCount -1 +*.* $DELIM$1:$2 +EOF + +/sbin/service rsyslog restart +} + +function prompt_user { + while true ; do + printf "\nWhat is the IP address or server name for the syslog server? " + read + SYSLOG_SERVER_IP=$REPLY + printf "\nWhat port does the syslog daemon run on? " + read + if [[ "$REPLY" =~ '^[0-9.]+$' ]]; then + SYSLOG_SERVER_PORT=$REPLY + NICS="$NICS Quit" + + PROTOCOLS="tcp udp" + PS3="Please select a the protocol to use: " + select SYSLOG_SERVER_PROTOCOL in $PROTOCOLS; + do + case $SYSLOG_SERVER_PROTOCOL in + "tcp") + break ;; + "udp") + break;; + esac + done + + printf "\nConfirm send all log messages to server '$SYSLOG_SERVER_IP' on port '$SYSLOG_SERVER_PORT' using protocol '$SYSLOG_SERVER_PROTOCOL' (Y/N)" + read + case $REPLY in + Y|y) + ovirt_rsyslog $SYSLOG_SERVER_IP $SYSLOG_SERVER_PORT $SYSLOG_SERVER_PROTOCOL + break + ;; + N|n) + printf "\nDiscarding settings" + break + ;; + esac + else + printf "\nInvalid port number" + fi + done + +} + +# check if we were called to attempt to default +# to remote logging +if [[ "$1" = "default" ]] ; then + printf "\nAttempting to locate remote syslog server..." + DEFAULT_SERVER=$(host -N 3 -t srv _syslog._udp | rev | awk '/VRS/ {print $1}' | cut -d. -f2- | rev) + DEFAULT_PORT=$(host -N 3 -t srv _syslog._udp | rev | awk '/VRS/ {print $2}' | cut -d. -f2- | rev) + if [[ "$DEFAULT_PORT" != "" ]] && [[ "$DEFAULT_SERVER" != "" ]] ; then + printf "found! Useing server '$DEFAULT_SERVER'.\n" + ovirt_rsyslog $DEFAULT_SERVER $DEFAULT_PORT "udp" + else + printf "not found!\n" + fi +else + prompt_user +fi + +exit 0 diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup index 8408d14..5850aa8 100755 --- a/scripts/ovirt-config-setup +++ b/scripts/ovirt-config-setup @@ -2,6 +2,8 @@ # # Entry point for configuring an oVirt node when running in standalone mode. +#Attempt to default the syslog setting +ovirt-config-logging "default" while true; do PS3="Please select an option: " # TODO should we make this optional, based on whether the password was already set? -- 1.5.6.5 From clalance at redhat.com Fri Nov 7 07:27:35 2008 From: clalance at redhat.com (Chris Lalancette) Date: Fri, 07 Nov 2008 08:27:35 +0100 Subject: [Ovirt-devel] [PATCH] add 'state' field to storage pools and volumes In-Reply-To: <1226003082-12718-1-git-send-email-sseago@redhat.com> References: <1226003082-12718-1-git-send-email-sseago@redhat.com> Message-ID: <4913EDE7.5080203@redhat.com> Scott Seago wrote: > I've added a state field to StoragePool and StorageVolume. When initially > created, pools and volumes are in the pending_setup state -- once taskomatic > is done they're 'available'. Upon deletion, they go into pending_deletion > until taskomatic is done. > > Taskomatic changes to take this into account have not yet been included, > since clalance's LVM patch hasn't been pushed. > This all looks reasonable, and is very much inline with what I thought it would be. At least for an initial cut, the states: STATE_PENDING_SETUP = "pending_setup" STATE_PENDING_DELETION = "pending_deletion" STATE_AVAILABLE = "available" should be sufficient to close the races we've thought of so far. We can always add more later. Oh, I'll be pushing my taskomatic LVM code today (with a few of the changes sseago suggested in his review). So then we'll be able the taskomatic side of this change. ACK -- Chris Lalancette From kraxel at redhat.com Fri Nov 7 08:09:53 2008 From: kraxel at redhat.com (Gerd Hoffmann) Date: Fri, 07 Nov 2008 09:09:53 +0100 Subject: [Ovirt-devel] oVirt console (again!) In-Reply-To: <20081106210253.GA22878@amd.home.annexia.org> References: <20081106170118.GA21838@amd.home.annexia.org> <49135B6D.9010008@redhat.com> <20081106210253.GA22878@amd.home.annexia.org> Message-ID: <4913F7D1.40407@redhat.com> Richard W.M. Jones wrote: > On Thu, Nov 06, 2008 at 10:02:37PM +0100, Gerd Hoffmann wrote: >> /me uses virt-manager for the guest consoles. Authenticates just fine >> via kerberos, using the same ticket I need for the ovirt wui anyway. > > The problem, as ever, is with Windows. It's hard to set up a Windows > client as a Kerberos client, so this won't just work. Oh, ok. I'm a bit surprised as windows uses kerberos internally as well, but maybe that requires a domain controller ... Might be worth talking to the freeipa/samba folks maybe whenever it is possible to make windows play nice here? BTW: can one connect to the WUI using a windows machine then? >> For a larger-scale setup you'll probably want build some dedicated app >> (say ovirt-viewer) which gets a list of vms from ovirt, the node they >> are running on and then goes talk to libvirt on the nodes for the vnc >> display. > > That's basically the plan for number (4). Ok, cool. But at least the linux version should be fine with kerberos, right? cheers, Gerd From berrange at redhat.com Fri Nov 7 09:33:02 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Fri, 7 Nov 2008 09:33:02 +0000 Subject: [Ovirt-devel] oVirt console (again!) In-Reply-To: <49135B6D.9010008@redhat.com> References: <20081106170118.GA21838@amd.home.annexia.org> <49135B6D.9010008@redhat.com> Message-ID: <20081107093302.GA26616@redhat.com> On Thu, Nov 06, 2008 at 10:02:37PM +0100, Gerd Hoffmann wrote: > Hi, > > > (3) Running virt-viewer or viagre as separate, standalone programs. > > This works, but requires the user to type in some very long > > and complicated command line by hand, and there are unresolved > > authentication problems. > > Authentication problems? Which authentication problems? > > /me uses virt-manager for the guest consoles. Authenticates just fine > via kerberos, using the same ticket I need for the ovirt wui anyway. Yes & no. We've actually got two authentication problems. In the virt-viewer case, you've got the libvirt auth, but in every case you've got VNC auth. > Not the most elegant solution as I'll have to add each node manually to > virt-manager. Not a big issue either with my two-node-test-setup ;) > > For a larger-scale setup you'll probably want build some dedicated app > (say ovirt-viewer) which gets a list of vms from ovirt, the node they > are running on and then goes talk to libvirt on the nodes for the vnc > display. The kerberos ticket should open all doors needed. Yes, that's the new plan. We still have to solve the VNC auth problem Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From sylvain.desbureaux at orange-ftgroup.com Fri Nov 7 10:43:11 2008 From: sylvain.desbureaux at orange-ftgroup.com (sylvain.desbureaux at orange-ftgroup.com) Date: Fri, 7 Nov 2008 11:43:11 +0100 Subject: [Ovirt-devel] problem installing the appliance Message-ID: <5A0FF108221C7C4E85738678804B567C06C0935A@ftrdmel3> Hi all, First of all, I apologize if it's not the right place to send questions about overt but this is the only mailing list I see. I've just installed ovirt-appliance 0.95.1 on fedora core 9 (not that easy because I have my own dhcp server). After the installation, I can connect to the web server but the authentication fail (http error_log says it doesn't find any KDC). Except some trick on the hypervisor to make the appliance running (stopping iptables and ip6tables, creating a new script for putting the appliance tap on the good bridge), the install is a stock one. I've took a look ? ipa.conf, krdc5.conf... but I don't see where is the problem. Any ideas ? Thanks in advance, Sylvain Desbureaux Recherche et D?veloppement, Service aux entreprises Ing?nieur concepteur d?veloppeur de services r?seaux pour les entreprises t?l. 02 96 05 13 80 sylvain.desbureaux at orange-ftgroup.com From clalance at redhat.com Fri Nov 7 12:36:32 2008 From: clalance at redhat.com (Chris Lalancette) Date: Fri, 07 Nov 2008 13:36:32 +0100 Subject: [Ovirt-devel] [PATCH server] Implement LVM taskomatic In-Reply-To: <491307C9.2040908@redhat.com> References: <> <1225900632-15279-1-git-send-email-clalance@redhat.com> <491307C9.2040908@redhat.com> Message-ID: <49143650.7010805@redhat.com> Scott Seago wrote: >> + volinfo = volptr.info >> + >> + storage_volume = StorageVolume.factory(db_pool.get_type_label) >> + storage_volume.path = volptr.path >> + storage_volume.size = volinfo.capacity / 1024 >> + storage_volume.storage_pool_id = db_pool.id >> + storage_volume.write_attribute(storage_volume.volume_name, volname) >> + storage_volume.lv_owner_perms = owner >> + storage_volume.lv_group_perms = group >> + storage_volume.lv_mode_perms = mode >> + storage_volume.save >> end >> +end >> > You should probably use save! here as we're doing elsewhere so that it > raises an exception upon failure. Done. I actually added a separate commit that changes all of the uses of .save in taskomatic to .save! >> + begin >> + lvm_libvirt_pool = LibvirtPool.factory(lvm_db_pool) >> + lvm_libvirt_pool.connect(conn) >> + >> + begin >> + libvirt_volume = lvm_libvirt_pool.lookup_vol_by_name(lvm_db_volume.lv_name) >> + # FIXME: we actually probably want to zero out the whole volume here, so >> + # we aren't potentially leaking data from one user to another. There >> + # are two problems, though: >> + # 1) I'm not sure how I would go about zero'ing the data on a remote >> + # machine, since there is no "libvirt_write_data" call >> + # 2) This could potentially take quite a while, so we want to spawn >> + # off another thread to do it >> + libvirt_volume.delete >> + >> + LvmStorageVolume.delete(lvm_db_volume.id) >> > We need to get this working with lvm_db_volume.destroy, since the error > you were getting with that might mean that it's failing to do some > necessary cleanup that delete is skipping. But we can probably do that > after pushing this patch. Yes, agreed. For now, I've added a comment here explaining that I ran into a problem with it, but it should be fixed. With the above two fixes, I've now committed and pushed this to next. Thanks for the review! -- Chris Lalancette From jguiditt at redhat.com Fri Nov 7 14:05:07 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Fri, 07 Nov 2008 09:05:07 -0500 Subject: [Ovirt-devel] [PATCH server] Feedback Requested. In-Reply-To: <491362B1.4090406@redhat.com> References: <1226006883-5633-1-git-send-email-jguiditt@redhat.com> <491362B1.4090406@redhat.com> Message-ID: <1226066707.16444.1.camel@localhost.localdomain> On Thu, 2008-11-06 at 16:33 -0500, Darryl Pierce wrote: > > + name: 'root' > > + type: 'DirectoryPool' > > You don't need to wrap strings in single quotes. Everything after the > colon is trimmed and treated as a string. > Good point, forgot that. I'll clean it up for the next rev if this gets as far as an ack. -j From dpierce at redhat.com Fri Nov 7 14:23:16 2008 From: dpierce at redhat.com (Darryl Pierce) Date: Fri, 07 Nov 2008 09:23:16 -0500 Subject: [Ovirt-devel] [PATCH server] Feedback Requested. In-Reply-To: <1226066707.16444.1.camel@localhost.localdomain> References: <1226006883-5633-1-git-send-email-jguiditt@redhat.com> <491362B1.4090406@redhat.com> <1226066707.16444.1.camel@localhost.localdomain> Message-ID: <49144F54.3050400@redhat.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jason Guiditta wrote: > On Thu, 2008-11-06 at 16:33 -0500, Darryl Pierce wrote: > >>> + name: 'root' >>> + type: 'DirectoryPool' >> You don't need to wrap strings in single quotes. Everything after the >> colon is trimmed and treated as a string. >> > Good point, forgot that. I'll clean it up for the next rev if this gets > as far as an ack. I thought you were only looking for feedback. My bad. ACK. - -- Darryl L. Pierce : GPG KEYID: 6C4E7F1B -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAkkUT1AACgkQjaT4DmxOfxufXQCdFUzzOMemtk8ANMmsOkx72IKb yBUAoNPMGs2bn20FCDoFiXGjGfXmhY7O =1WRH -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: dpierce.vcf Type: text/x-vcard Size: 319 bytes Desc: not available URL: From jim at meyering.net Fri Nov 7 14:56:57 2008 From: jim at meyering.net (Jim Meyering) Date: Fri, 07 Nov 2008 15:56:57 +0100 Subject: [Ovirt-devel] [PATCH ovirt-node] standalone mode - configure local storage (DESTRUCTIVE) In-Reply-To: <1226021266-22250-3-git-send-email-apevec@redhat.com> (Alan Pevec's message of "Fri, 7 Nov 2008 02:27:45 +0100") References: <1226021266-22250-1-git-send-email-apevec@redhat.com> <1226021266-22250-3-git-send-email-apevec@redhat.com> Message-ID: <877i7ftwhy.fsf@rho.meyering.net> Alan Pevec wrote: > From: Darryl L. Pierce > --- > scripts/ovirt-config-storage | 112 ++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 112 insertions(+), 0 deletions(-) > > diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage > index 8b13789..91d50de 100755 > --- a/scripts/ovirt-config-storage > +++ b/scripts/ovirt-config-storage > @@ -1 +1,113 @@ > +#!/bin/bash > +# > +# All sizes are in gigabytes > > +DRIVE=$(sfdisk -s | awk '/\/dev\/([sh]da)/ { match($0, "^(.*):.*", data); printf data[1] }') Hi Darryl, Is the block count from "sfdisk -s" always using a 1024-byte block? I.e., is it possible that the partition will have a different block size? Even after a quick glance through sfdisk documentation, I couldn't say. ... > +function do_review > +{ > + printf "\n" > + printf "The local disk will be repartitioned as follows:\n" > + printf "================================================\n" > + printf " Physical Hard Disk: ${DRIVE}\n" > + printf " Boot partition size: ${BOOT_SIZE} GB\n" > + printf " Swap partition size: ${SWAP_SIZE} GB\n" > + printf " Installation partition size: ${INSTALL_SIZE} GB\n" > + printf " Configuration partition size: ${CONFIG_SIZE} GB\n" > + printf " Logging partition size: ${LOGGING_SIZE} GB\n" > + printf "\n" > +} > + > +function do_partitioning > +{ > + while true; do > + printf "\n" All the warning code below is hard to read in source form, and the output wraps on my 80-column console, so how about something like this instead? sp=' ' w='!!WARNING' wb="$w"'!!' w8="$w$w$w$w$w$w$w$w" printf '%s!!\n' \ "$w8" \ "$w8" \ "$wb$sp$w" \ "$wb$sp$w" \ "$wb If you proceed, this will destroy all data on your local " \ "$wb system, and your hard disk will be irreversably reconfigured " \ "$wb$sp$w" \ "$wb$sp$w" \ "$w8" \ "$w8" > + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" > + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" > + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" > + printf "!!WARNING!! !!WARNING!!\n" > + printf "!!WARNING!! !!WARNING!!\n" > + printf "!!WARNING!! If you proceed this will destroy all data on your local system, and !!WARNING!!\n" > + printf "!!WARNING!! your hard disk will be irreversably reconfiguration. !!WARNING!!\n" > + printf "!!WARNING!! !!WARNING!!\n" > + printf "!!WARNING!! !!WARNING!!\n" > + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" > + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" > + printf "\n" > + printf "\tContinue? (Y/n) " > + read > + case $REPLY in > + Y|y) > + { > + dd if=/dev/zero of=/dev/sda bs=1K count=1 > + blockdev --rereadpt /dev/sda > + # Boot partition > + # /dev/sda1 = Boot partition > + # /dev/sda2 = Swap partition > + # /dev/sda4 = LVM > + echo -e "n\np\n1\n\n+$(( $BOOT_SIZE * 1024))M\na\n1\n > + n\np\n2\n\n+$(( $SWAP_SIZE * 1024))M\nt\n2\n82\n > + n\np\n4\n\n\nt\n4\n8e\n > + w\n" | fdisk $DRIVE Please use printf rather than echo -e. Then you can make the above more readable/maintainable, e.g., printf '%s\n' \ n p 1 '' "+$(( $BOOT_SIZE * 1024))M" a 1 '' \ n p 2 '' "+$(( $SWAP_SIZE * 1024))M" t 2 82 '' \ n p 4 '' '' t 4 8e '' \ w '' \ | fdisk $DRIVE [caution, I've merely ensured that the printf-based code produces exactly the same code as produced by the echo -e. I haven't actually run fdisk. ] I see you use $DRIVE for partitioning, yet there are also hard-coded uses of /dev/sda above, and below there are uses of /dev/sda1 and /dev/sda4. Is this a work in progress? > + pvcreate /dev/sda4 > + vgcreate /dev/VolGroup00 /dev/sda4 > + > + lvcreate --name Ovirt /dev/VolGroup00 --size ${INSTALL_SIZE}G > + lvcreate --name Config /dev/VolGroup00 --size ${CONFIG_SIZE}G > + lvcreate --name Logging /dev/VolGroup00 --size ${LOGGING_SIZE}G > + > + mkfs -t ext3 /dev/sda1 > + mkfs -t ext3 /dev/VolGroup00/Ovirt > + mkfs -t ext3 /dev/VolGroup00/Config > + mkfs -t ext3 /dev/VolGroup00/Logging > + > + } > partition.log > + break ;; > + N|n) return ;; > + esac > + done > +} > + > +while true; do > + OPTIONS="Configure Review Partition Quit" > + PS3="Choose an option: " > + > + printf "\n" > + > + select OPTION in $OPTIONS > + do > + case "$OPTION" in > + "Configure") do_configure ; break ;; > + "Review") do_review ; break ;; > + "Partition") do_partitioning ; break ;; > + "Quit") exit ;; > + esac > + done > +done From berrange at redhat.com Fri Nov 7 15:10:47 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Fri, 7 Nov 2008 15:10:47 +0000 Subject: [Ovirt-devel] [PATCH ovirt-node] standalone mode - configure local storage (DESTRUCTIVE) In-Reply-To: <1226021266-22250-3-git-send-email-apevec@redhat.com> References: <1226021266-22250-1-git-send-email-apevec@redhat.com> <1226021266-22250-3-git-send-email-apevec@redhat.com> Message-ID: <20081107151047.GB4734@redhat.com> On Fri, Nov 07, 2008 at 02:27:45AM +0100, Alan Pevec wrote: > From: Darryl L. Pierce > > --- > scripts/ovirt-config-storage | 112 ++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 112 insertions(+), 0 deletions(-) > > diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage > index 8b13789..91d50de 100755 > --- a/scripts/ovirt-config-storage > +++ b/scripts/ovirt-config-storage > @@ -1 +1,113 @@ > +#!/bin/bash > +# > +# All sizes are in gigabytes > > +DRIVE=$(sfdisk -s | awk '/\/dev\/([sh]da)/ { match($0, "^(.*):.*", data); printf data[1] }') This won't work on HP machines where you have disks named with the crack-smoking /dev/cciss/... scheme Really you should ask HAL for the list of block devices because it knows about all types of storage, and you can explicitly distinguish physical devices from device mapper. Ideally use python or something to talk to HAL over DBus, or if you really want to use shell scripts you can probaly do something evil with 'lshal'. Or (soon) you can use libvirt hard device enum code. > +BOOT_SIZE=1 > +INSTALL_SIZE=10 > +CONFIG_SIZE=5 > +LOGGING_SIZE=2 > + > +MEM_SIZE=$(cat /proc/meminfo | awk '/MemTotal/ { print $2 }') libvirt gives you a nice API for doing this, or use 'virsh nodeinfo' > + # Boot partition > + # /dev/sda1 = Boot partition > + # /dev/sda2 = Swap partition Swap should be an LVM lv too - only /boot needs to be on the raw partition. > + # /dev/sda4 = LVM > + echo -e "n\np\n1\n\n+$(( $BOOT_SIZE * 1024))M\na\n1\n > + n\np\n2\n\n+$(( $SWAP_SIZE * 1024))M\nt\n2\n82\n > + n\np\n4\n\n\nt\n4\n8e\n > + w\n" | fdisk $DRIVE > + pvcreate /dev/sda4 > + vgcreate /dev/VolGroup00 /dev/sda4 Avoid calling it VolGroup00 because this makes it almost certain that you'll clash with names used inside guests becasue VolGroup00 is anaconda default naming. I typically use 'HostVG' for a host. > + > + lvcreate --name Ovirt /dev/VolGroup00 --size ${INSTALL_SIZE}G I'd suggest 'Root' instead of 'Ovirt' since it better reflects what it is. > + lvcreate --name Config /dev/VolGroup00 --size ${CONFIG_SIZE}G > + lvcreate --name Logging /dev/VolGroup00 --size ${LOGGING_SIZE}G > + > + mkfs -t ext3 /dev/sda1 > + mkfs -t ext3 /dev/VolGroup00/Ovirt > + mkfs -t ext3 /dev/VolGroup00/Config > + mkfs -t ext3 /dev/VolGroup00/Logging You should use mke2fs instead and set a filesystem label matching the VG name, allowing for mount-by-label. Also run 'tune2fs' to set max-mount-counts=0 and interval-between-checks=0 to disable the automatic fsck. If error behaviour isn't set to 'remount-ro'automatically, that should be set too, perhaps even to 'panic' Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From jguiditt at redhat.com Fri Nov 7 15:40:59 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Fri, 7 Nov 2008 10:40:59 -0500 Subject: [Ovirt-devel] [PATCH server] Fix 2 bugs from previous refactoring. Message-ID: <1226072459-5372-1-git-send-email-jguiditt@redhat.com> * Killed last instance of OVIRT_DIR, sinc it doesn't matter. * Removed ENV['RAILS_ENV'] param to database_connect, since we set it earlier in active_record_env when the daemon is started. Still testing locally on an appliance, so please check there as well so we make sure this really works. Signed-off-by: Jason Guiditta --- src/dutils/active_record_env.rb | 6 +++--- src/script/grant_admin_privileges | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/dutils/active_record_env.rb b/src/dutils/active_record_env.rb index 07a57ec..9bda151 100644 --- a/src/dutils/active_record_env.rb +++ b/src/dutils/active_record_env.rb @@ -29,10 +29,10 @@ ENV['RAILS_ENV'] = 'production' || ENV['RAILS_ENV'] require File.dirname(__FILE__) + '/../config/boot' require "#{RAILS_ROOT}/config/environment" -def database_connect(environment) +def database_connect conf = YAML::load(File.open(File.dirname(__FILE__) + '/../config/database.yml')) - ActiveRecord::Base.establish_connection(conf[environment]) + ActiveRecord::Base.establish_connection(conf[ENV['RAILS_ENV']]) end # Open ActiveRecord connection -database_connect(ENV['RAILS_ENV']) +database_connect diff --git a/src/script/grant_admin_privileges b/src/script/grant_admin_privileges index 866fd44..4cafa74 100755 --- a/src/script/grant_admin_privileges +++ b/src/script/grant_admin_privileges @@ -1,11 +1,11 @@ #!/usr/bin/ruby - +#FIXME: this should really be a rake task, then we get half of this stuff for free $: << File.join(File.dirname(__FILE__), '../dutils') require 'active_record_env' # Get configuration options... -ldap_config = YAML::load(File.open("#{OVIRT_DIR}/config/ldap.yml")) +ldap_config = YAML::load(File.open(File.dirname(__FILE__) +"/../config/ldap.yml")) uid = ARGV[0] base, host = ldap_config["production"]["base"], ldap_config["production"]["host"] -- 1.5.6.5 From dpierce at redhat.com Fri Nov 7 15:59:17 2008 From: dpierce at redhat.com (Darryl Pierce) Date: Fri, 07 Nov 2008 10:59:17 -0500 Subject: [Ovirt-devel] [PATCH ovirt-node] standalone mode - configure local storage (DESTRUCTIVE) In-Reply-To: <20081107151047.GB4734@redhat.com> References: <1226021266-22250-1-git-send-email-apevec@redhat.com> <1226021266-22250-3-git-send-email-apevec@redhat.com> <20081107151047.GB4734@redhat.com> Message-ID: <491465D5.3070203@redhat.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Daniel P. Berrange wrote: Thank you for the feedback. I'm going to incorporate this into the patch and resend it today. - -- Darryl L. Pierce : GPG KEYID: 6C4E7F1B -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAkkUZdAACgkQjaT4DmxOfxsJ5ACgpYL0nHMHBF49ctzayRRvfEfJ lfAAn2Q7D7RLMagLq3JCs/s8a86QwYCM =ghYL -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: dpierce.vcf Type: text/x-vcard Size: 319 bytes Desc: not available URL: From dpierce at redhat.com Fri Nov 7 16:15:38 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 7 Nov 2008 11:15:38 -0500 Subject: [Ovirt-devel] [PATCH node] Added a script that runs during first boot for the node. Message-ID: <1226074538-12892-1-git-send-email-dpierce@redhat.com> Each configuration function is stubbed out. The functions are: * configure logging * configure networking * configure password * configure storage Signed-off-by: Darryl L. Pierce --- Makefile.am | 34 ++++++++++++++--------- ovirt-node.spec.in | 15 +++++++++- scripts/ovirt-config-logging | 2 + scripts/ovirt-config-networking | 2 + scripts/ovirt-config-password | 2 + scripts/ovirt-config-setup | 23 ++++++++++++++++ scripts/ovirt-config-storage | 2 + scripts/ovirt-firstboot | 56 +++++++++++++++++++++++++++++++++++++++ 8 files changed, 121 insertions(+), 15 deletions(-) create mode 100644 scripts/ovirt-config-logging create mode 100644 scripts/ovirt-config-networking create mode 100644 scripts/ovirt-config-password create mode 100755 scripts/ovirt-config-setup create mode 100644 scripts/ovirt-config-storage create mode 100755 scripts/ovirt-firstboot diff --git a/Makefile.am b/Makefile.am index 4ba0bca..fc0dbb5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,20 +18,26 @@ OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache SUBDIRS = ovirt-identify-node ovirt-listen-awake -EXTRA_DIST = \ - .gitignore \ - ovirt-node.spec \ - ovirt-node.spec.in \ - ovirt-node-selinux.te \ - scripts/collectd \ - scripts/collectd.conf.in \ - scripts/ovirt \ - scripts/ovirt-awake \ - scripts/ovirt-early \ - scripts/ovirt-functions \ - scripts/ovirt-post \ - scripts/ovirt-process-config \ - logrotate/ovirt-logrotate \ +EXTRA_DIST = \ + .gitignore \ + ovirt-node.spec \ + ovirt-node.spec.in \ + ovirt-node-selinux.te \ + scripts/collectd \ + scripts/collectd.conf.in \ + scripts/ovirt \ + scripts/ovirt-awake \ + scripts/ovirt-config-logging \ + scripts/ovirt-config-networking \ + scripts/ovirt-config-password \ + scripts/ovirt-config-setup \ + scripts/ovirt-config-storage \ + scripts/ovirt-early \ + scripts/ovirt-firstboot \ + scripts/ovirt-functions \ + scripts/ovirt-post \ + scripts/ovirt-process-config \ + logrotate/ovirt-logrotate \ logrotate/ovirt-logrotate.conf DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index d029c57..2a01b7c 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -87,6 +87,11 @@ cd - %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/logrotate.d %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-logging %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-networking %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-password %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-setup %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-storage %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-process-config %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-identify-node/ovirt-identify-node %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-listen-awake/ovirt-listen-awake %{buildroot}%{_sbindir} @@ -94,9 +99,9 @@ cd - %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-install-node %{buildroot}%{_sbindir} %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-uninstall-node %{buildroot}%{_sbindir} - %{__install} -p -m0644 scripts/ovirt-functions %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-early %{buildroot}%{_initrddir} +%{__install} -p -m0755 scripts/ovirt-firstboot %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-post %{buildroot}%{_initrddir} @@ -123,6 +128,7 @@ cd - %post /sbin/chkconfig --add ovirt-early +/sbin/chkconfig --add ovirt-firstboot /sbin/chkconfig --add ovirt /sbin/chkconfig --add ovirt-post # this is ugly; we need collectd to start *after* libvirtd, so we own the @@ -133,6 +139,7 @@ cd - %preun if [ "$1" = 0 ] ; then /sbin/chkconfig --del ovirt-early + /sbin/chkconfig --del ovirt-firstboot /sbin/chkconfig --del ovirt /sbin/chkconfig --del ovirt-post /sbin/chkconfig --del ovirt-listen-awake @@ -159,12 +166,18 @@ fi %files %defattr(-,root,root,0755) %{_sbindir}/ovirt-awake +%{_sbindir}/ovirt-config-logging +%{_sbindir}/ovirt-config-networking +%{_sbindir}/ovirt-config-password +%{_sbindir}/ovirt-config-setup +%{_sbindir}/ovirt-config-storage %{_sbindir}/ovirt-process-config %{_sbindir}/ovirt-identify-node %{_sbindir}/ovirt-listen-awake %{_sbindir}/ovirt-install-node %{_sbindir}/ovirt-uninstall-node %{_initrddir}/ovirt-early +%{_initrddir}/ovirt-firstboot %{_initrddir}/ovirt %{_initrddir}/ovirt-post %{_initrddir}/ovirt-listen-awake diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging new file mode 100644 index 0000000..c856ef1 --- /dev/null +++ b/scripts/ovirt-config-logging @@ -0,0 +1,2 @@ +#!/bin/bash +# diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking new file mode 100644 index 0000000..c856ef1 --- /dev/null +++ b/scripts/ovirt-config-networking @@ -0,0 +1,2 @@ +#!/bin/bash +# diff --git a/scripts/ovirt-config-password b/scripts/ovirt-config-password new file mode 100644 index 0000000..c856ef1 --- /dev/null +++ b/scripts/ovirt-config-password @@ -0,0 +1,2 @@ +#!/bin/bash +# diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup new file mode 100755 index 0000000..8408d14 --- /dev/null +++ b/scripts/ovirt-config-setup @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Entry point for configuring an oVirt node when running in standalone mode. + +while true; do + PS3="Please select an option: " + # TODO should we make this optional, based on whether the password was already set? + PASSWORD_OPTION="Password" + OPTIONS="Networking Storage Logging ${PASSWORD_OPTION} Quit" + + select OPTION in $OPTIONS + do + printf "\n" + + case "$OPTION" in + "Networking") ovirt-config-networking ; break ;; + "Storage") ovirt-config-storage ; break ;; + "Logging") ovirt-config-logging ; break ;; + "Password") ovirt-config-password ; break ;; + "Quit") exit 0 ;; + esac + done +done diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage new file mode 100644 index 0000000..c856ef1 --- /dev/null +++ b/scripts/ovirt-config-storage @@ -0,0 +1,2 @@ +#!/bin/bash +# diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot new file mode 100755 index 0000000..fef25ff --- /dev/null +++ b/scripts/ovirt-firstboot @@ -0,0 +1,56 @@ +#!/bin/bash +# +# ovirt-firstboot Puts the node into configuration mode. +# +# chkconfig: 2345 99 01 +# description: ovirt-early services +# +# Copyright (C) 2008 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. + +## Source functions library +. /etc/init.d/functions +. /etc/init.d/ovirt-functions + +start () +{ + ovirt-config-setup +} + +case "$1" in + start) + #is_firstboot + #if [ $? -ne 0 ]; then + # exit 0 + #fi + + printf "Starting ovirt-firstboot: " + + { + start + } + + test $? == 0 && success || failure + echo + ;; + + *) + echo "Usage: ovirt-early {start}" + exit 2 +esac + -- 1.5.6.5 From pmyers at redhat.com Fri Nov 7 16:56:12 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 07 Nov 2008 11:56:12 -0500 Subject: [Ovirt-devel] 0.95 oVirt Release Message-ID: <4914732C.7000103@redhat.com> The oVirt development team is pleased to announce the 0.95 release of both the oVirt Node and oVirt Server Suite. New features in this release include: oVirt Node: * Stateful Node http://ovirt.org/page/Node_Stateful - for running VMs on the ovirt-appliance host * libvirt-qpid agent added in Node image * ovirt-node-selinux SELinux policy for iSCSI block devices * support non-sdX block devices like cciss for Node local disk * improved configuration processing to remove the need for scripts * minor bugfixes and build process improvements oVirt Server Suite: * Upgraded to Rails 2.1.1 * Added a flash chart written in flex framework to summary pages. * Added support for booting a VM from an ISO image. * In the VM list and details pane, added a field to show what host a VM is running on. * Updated tree navigation to use a new underlying implementation and to better integrate Smart Pools into the navigation panel. * Various bug fixes including VM 'destroy' action validation, 'move' dialog fixes, and some host-browser issues. * Added Network model and refactored existing VM and Node implementation to make use of the more flexible infrastructure * Some additional node network config enhancements * More flexchart enhanceents, including tooltips, y-axis labels, and animation * Added ruby qpid demo * Integrated smart pools into search results as well as other flexigrid-based views. * Redesigned the tree widget code to make it pluggable. * Some of the model-level implementation for LVM support is in place, but actual LVM UI and actions will be in a later release * various bug fixes, including smart pool errors, tab navigation, cobbler system deletion Instructions for configuring yum to point to the ovirt.org repository: http://www.ovirt.org/download.html Instructions for using the Appliance and Nodes: http://www.ovirt.org/install-instructions.html Please download and try it out. Let us know via the mailing list or IRC if you have any suggestions for enhancements or feedback on what we've implemented so far. Also, bugs can be filed on the oVirt project at links provided on: http://www.ovirt.org/contribute.html Thanks to everyone who contributed to oVirt for this release! From jim at meyering.net Fri Nov 7 17:34:59 2008 From: jim at meyering.net (Jim Meyering) Date: Fri, 07 Nov 2008 18:34:59 +0100 Subject: [Ovirt-devel] [PATCH] ovirt-uninstall-node: sync one more warn function with the rest Message-ID: <87prl7sam4.fsf@rho.meyering.net> This sync's one warn definition with the 6 others. With this, they're all the same: (I'm looking at factoring them, now) $ g submodule -q foreach "git grep -h '^warn' || :" warn() { printf '%s: %s\n' "$ME" "$*" >&2; } warn() { printf '%s: %s\n' "$ME" "$*" >&2; } warn() { printf '%s: %s\n' "$ME" "$*" >&2; } warn() { printf '%s: %s\n' "$ME" "$*" >&2; } warn() { printf '%s: %s\n' "$ME" "$*" >&2; } warn() { printf '%s: %s\n' "$ME" "$*" >&2; } warn() { printf '%s: %s\n' "$ME" "$*" >&2; } >From d07cbd7da7b19593ca22acaf5ce6d8eee3729db2 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 7 Nov 2008 18:32:38 +0100 Subject: [PATCH] ovirt-uninstall-node: sync one more warn function with the rest --- ovirt-listen-awake/ovirt-uninstall-node | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ovirt-listen-awake/ovirt-uninstall-node b/ovirt-listen-awake/ovirt-uninstall-node index 1046a37..ea16a61 100755 --- a/ovirt-listen-awake/ovirt-uninstall-node +++ b/ovirt-listen-awake/ovirt-uninstall-node @@ -4,7 +4,7 @@ PATH=$PATH:/sbin:/usr/sbin ME=$(basename "$0") -warn() { printf "$ME: $@\n" >&2; } +warn() { printf '%s: %s\n' "$ME" "$*" >&2; } die() { warn "$@"; exit 1; } # first, check to see we are root -- 1.6.0.3.866.gc189b From sseago at redhat.com Fri Nov 7 18:39:21 2008 From: sseago at redhat.com (Scott Seago) Date: Fri, 07 Nov 2008 13:39:21 -0500 Subject: [Ovirt-devel] [PATCH server] Fix 2 bugs from previous refactoring. In-Reply-To: <1226072459-5372-1-git-send-email-jguiditt@redhat.com> References: <1226072459-5372-1-git-send-email-jguiditt@redhat.com> Message-ID: <49148B59.3040406@redhat.com> Jason Guiditta wrote: > * Killed last instance of OVIRT_DIR, sinc it doesn't matter. > * Removed ENV['RAILS_ENV'] param to database_connect, since we set it earlier in active_record_env when the daemon is started. > > Still testing locally on an appliance, so please check there as well so we make sure this really works. > Works for me. ACK Scott From bkearney at redhat.com Fri Nov 7 18:58:11 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Fri, 7 Nov 2008 13:58:11 -0500 Subject: [Ovirt-devel] [PATCH node] RSyslog configuration for standalone mode. Message-ID: <1226084291-5437-1-git-send-email-bkearney@redhat.com> It looks for a DNS service locator record by default, and lets the user override if desired. Supports setting the maximum log file size. --- scripts/ovirt-config-logging | 139 ++++++++++++++++++++++++++++++++++++++++++ scripts/ovirt-config-setup | 2 + 2 files changed, 141 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging index 8b13789..aab1dfe 100755 --- a/scripts/ovirt-config-logging +++ b/scripts/ovirt-config-logging @@ -1 +1,140 @@ +#!/bin/bash +# +# Configures the rsyslog daemon. +RSYSLOG_FILE="/etc/rsyslog.conf" + +# Creates the rsyslog file based on the following inputs +# $1 ipaddress of remote syslog server +# $2 port of remote syslog server +# $3 protocol (tcp or udp) +function ovirt_rsyslog { + +DELIM="" + +if [[ "$3" = "tcp" ]]; then + DELIM="@@" +else + DELIM="@" +fi + +cat > $RSYSLOG_FILE << EOF +#ovirt rsyslog config file + +#### MODULES #### +\$ModLoad imuxsock.so # provides support for local system logging (e.g. via logger command) +\$ModLoad imklog.so # provides kernel logging support (previously done by rklogd) + +#### GLOBAL DIRECTIVES #### +# Use default timestamp format +\$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +#### RULES #### +# Log anything (except mail) of level info or higher. +# Don't log private authentication messages! +*.info;mail.none;authpriv.none;cron.none /var/log/messages + +# The authpriv file has restricted access. +authpriv.* /var/log/secure + +# Log all the mail messages in one place. +mail.* -/var/log/maillog + +# Log cron stuff +cron.* /var/log/cron + +# Everybody gets emergency messages +*.emerg * + +# Save news errors of level crit and higher in a special file. +uucp,news.crit /var/log/spooler + +# Save boot messages also to boot.log +local7.* /var/log/boot.log + +\$WorkDirectory /var/spppl/rsyslog +\$ActionQueueFileName ovirtNode +\$ActionQueueMaxDiskSpace 10m +\$ActionQueueSaveOnShutdown on +\$ActionQueueType LinkedList +\$ActionResumeRetryCount -1 +*.* $DELIM$1:$2 +EOF + +/sbin/service rsyslog restart +} + +function prompt_user { + while true ; do + MAX_LOG_SIZE="10k" + printf "\nWhat is the max size for log files on this machine [10k]? " + read + if [[ "$REPLY" != "" ]]; then + MAX_LOG_SIZE=$REPLY + fi + printf "\nWhat is the IP address or server name for the syslog server? " + read + SYSLOG_SERVER_IP=$REPLY + printf "\nWhat port does the syslog daemon run on? " + read + if [[ "$REPLY" =~ '^[0-9.]+$' ]]; then + SYSLOG_SERVER_PORT=$REPLY + NICS="$NICS Quit" + + PROTOCOLS="tcp udp" + PS3="Please select a the protocol to use: " + select SYSLOG_SERVER_PROTOCOL in $PROTOCOLS; + do + case $SYSLOG_SERVER_PROTOCOL in + "tcp") + break ;; + "udp") + break;; + esac + done + + printf "\n" + printf "\nLogging will be configured as follows:" + printf "\n======================================" + printf "\n Max Logfile Size: $MAX_LOG_SIZE" + printf "\n Remote Server: $SYSLOG_SERVER_IP" + printf "\n Remote Port: $SYSLOG_SERVER_PORT" + printf "\n Logging Protocol: $SYSLOG_SERVER_PROTOCOL" + printf "\n" + printf "\nPlease confirm these changes (Y/N)" + read + case $REPLY in + Y|y) + ovirt_rsyslog $SYSLOG_SERVER_IP $SYSLOG_SERVER_PORT $SYSLOG_SERVER_PROTOCOL + sed -i -e "s/size=.*/size=$MAX_LOG_SIZE/" /etc/logrotate.d/ovirt-logrotate.conf + break + ;; + N|n) + printf "\nDiscarding settings" + break + ;; + esac + else + printf "\nInvalid port number" + fi + done + +} + +# check if we were called to attempt to default +# to remote logging +if [[ "$1" = "default" ]] ; then + printf "\nAttempting to locate remote syslog server..." + DEFAULT_SERVER=$(host -N 3 -t srv _syslog._udp | rev | awk '/VRS/ {print $1}' | cut -d. -f2- | rev) + DEFAULT_PORT=$(host -N 3 -t srv _syslog._udp | rev | awk '/VRS/ {print $2}' | cut -d. -f2- | rev) + if [[ "$DEFAULT_PORT" != "" ]] && [[ "$DEFAULT_SERVER" != "" ]] ; then + printf "found! Useing server '$DEFAULT_SERVER'.\n" + ovirt_rsyslog $DEFAULT_SERVER $DEFAULT_PORT "udp" + else + printf "not found!\n" + fi +else + prompt_user +fi + +exit 0 diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup index 8408d14..5850aa8 100755 --- a/scripts/ovirt-config-setup +++ b/scripts/ovirt-config-setup @@ -2,6 +2,8 @@ # # Entry point for configuring an oVirt node when running in standalone mode. +#Attempt to default the syslog setting +ovirt-config-logging "default" while true; do PS3="Please select an option: " # TODO should we make this optional, based on whether the password was already set? -- 1.5.6.5 From jim at meyering.net Fri Nov 7 20:01:30 2008 From: jim at meyering.net (Jim Meyering) Date: Fri, 07 Nov 2008 21:01:30 +0100 Subject: [Ovirt-devel] [PATCH node] RSyslog configuration for standalone mode. In-Reply-To: <1226084291-5437-1-git-send-email-bkearney@redhat.com> (Bryan Kearney's message of "Fri, 7 Nov 2008 13:58:11 -0500") References: <1226084291-5437-1-git-send-email-bkearney@redhat.com> Message-ID: <87k5bfs3tx.fsf@rho.meyering.net> Bryan Kearney wrote: > It looks for a DNS service locator record by default, and lets the > user override if desired. Supports setting the maximum log file size. > --- > scripts/ovirt-config-logging | 139 ++++++++++++++++++++++++++++++++++++++++++ > scripts/ovirt-config-setup | 2 + > 2 files changed, 141 insertions(+), 0 deletions(-) > > diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging > index 8b13789..aab1dfe 100755 > --- a/scripts/ovirt-config-logging > +++ b/scripts/ovirt-config-logging > @@ -1 +1,140 @@ > +#!/bin/bash > +# > +# Configures the rsyslog daemon. > > +RSYSLOG_FILE="/etc/rsyslog.conf" > + > +# Creates the rsyslog file based on the following inputs > +# $1 ipaddress of remote syslog server > +# $2 port of remote syslog server > +# $3 protocol (tcp or udp) > +function ovirt_rsyslog { > + > +DELIM="" No need to initialize this. > +if [[ "$3" = "tcp" ]]; then > + DELIM="@@" > +else > + DELIM="@" > +fi > + > +cat > $RSYSLOG_FILE << EOF > +#ovirt rsyslog config file > + > +#### MODULES #### > +\$ModLoad imuxsock.so # provides support for local system logging (e.g. via logger command) > +\$ModLoad imklog.so # provides kernel logging support (previously done by rklogd) > + > +#### GLOBAL DIRECTIVES #### > +# Use default timestamp format > +\$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat > + > +#### RULES #### > +# Log anything (except mail) of level info or higher. > +# Don't log private authentication messages! > +*.info;mail.none;authpriv.none;cron.none /var/log/messages > + > +# The authpriv file has restricted access. > +authpriv.* /var/log/secure > + > +# Log all the mail messages in one place. > +mail.* -/var/log/maillog > + > +# Log cron stuff > +cron.* /var/log/cron > + > +# Everybody gets emergency messages > +*.emerg * > + > +# Save news errors of level crit and higher in a special file. > +uucp,news.crit /var/log/spooler > + > +# Save boot messages also to boot.log > +local7.* /var/log/boot.log > + > +\$WorkDirectory /var/spppl/rsyslog Should that be "spool"? > +\$ActionQueueFileName ovirtNode > +\$ActionQueueMaxDiskSpace 10m > +\$ActionQueueSaveOnShutdown on > +\$ActionQueueType LinkedList > +\$ActionResumeRetryCount -1 > +*.* $DELIM$1:$2 > +EOF > + > +/sbin/service rsyslog restart > +} > + > +function prompt_user { > + while true ; do > + MAX_LOG_SIZE="10k" > + printf "\nWhat is the max size for log files on this machine [10k]? " > + read > + if [[ "$REPLY" != "" ]]; then > + MAX_LOG_SIZE=$REPLY > + fi > + printf "\nWhat is the IP address or server name for the syslog server? " > + read > + SYSLOG_SERVER_IP=$REPLY > + printf "\nWhat port does the syslog daemon run on? " > + read > + if [[ "$REPLY" =~ '^[0-9.]+$' ]]; then no need for "." in that range > + SYSLOG_SERVER_PORT=$REPLY > + NICS="$NICS Quit" You can remove that NICS= line. not used. > + PROTOCOLS="tcp udp" > + PS3="Please select a the protocol to use: " s/a // > + select SYSLOG_SERVER_PROTOCOL in $PROTOCOLS; > + do > + case $SYSLOG_SERVER_PROTOCOL in > + "tcp") > + break ;; > + "udp") > + break;; > + esac > + done > + > + printf "\n" > + printf "\nLogging will be configured as follows:" > + printf "\n======================================" > + printf "\n Max Logfile Size: $MAX_LOG_SIZE" > + printf "\n Remote Server: $SYSLOG_SERVER_IP" > + printf "\n Remote Port: $SYSLOG_SERVER_PORT" > + printf "\n Logging Protocol: $SYSLOG_SERVER_PROTOCOL" > + printf "\n" > + printf "\nPlease confirm these changes (Y/N)" > + read > + case $REPLY in > + Y|y) > + ovirt_rsyslog $SYSLOG_SERVER_IP $SYSLOG_SERVER_PORT $SYSLOG_SERVER_PROTOCOL Please wrap long lines, e.g., ovirt_rsyslog \ $SYSLOG_SERVER_IP \ $SYSLOG_SERVER_PORT \ $SYSLOG_SERVER_PROTOCOL > + sed -i -e "s/size=.*/size=$MAX_LOG_SIZE/" /etc/logrotate.d/ovirt-logrotate.conf Same here. And anchor the size= regexp, so as not to munge an "other_var_size=..." or commented out # size=... line. sed -i "s/^size=.*/size=$MAX_LOG_SIZE/" \ /etc/logrotate.d/ovirt-logrotate.conf > + break > + ;; > + N|n) > + printf "\nDiscarding settings" Put the \n at the end of the message, not at the beginning, here, since this isn't a prompt. > + break > + ;; > + esac > + else > + printf "\nInvalid port number" Likewise. > + fi > + done > + > +} > + > +# check if we were called to attempt to default > +# to remote logging > +if [[ "$1" = "default" ]] ; then > + printf "\nAttempting to locate remote syslog server..." > + DEFAULT_SERVER=$(host -N 3 -t srv _syslog._udp | rev | awk '/VRS/ {print $1}' | cut -d. -f2- | rev) > + DEFAULT_PORT=$(host -N 3 -t srv _syslog._udp | rev | awk '/VRS/ {print $2}' | cut -d. -f2- | rev) What does the output of that host command look like when there is such a record? > + if [[ "$DEFAULT_PORT" != "" ]] && [[ "$DEFAULT_SERVER" != "" ]] ; then > + printf "found! Useing server '$DEFAULT_SERVER'.\n" might as well include port #, too: printf "found! Using server:port '$DEFAULT_SERVER:$DEFAULT_PORT'.\n" > + ovirt_rsyslog $DEFAULT_SERVER $DEFAULT_PORT "udp" > + else > + printf "not found!\n" > + fi > +else > + prompt_user > +fi > + > +exit 0 > diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup > index 8408d14..5850aa8 100755 > --- a/scripts/ovirt-config-setup > +++ b/scripts/ovirt-config-setup > @@ -2,6 +2,8 @@ > # > # Entry point for configuring an oVirt node when running in standalone mode. > > +#Attempt to default the syslog setting > +ovirt-config-logging "default" > while true; do > PS3="Please select an option: " > # TODO should we make this optional, based on whether the password was already set? From dpierce at redhat.com Fri Nov 7 20:24:01 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 7 Nov 2008 15:24:01 -0500 Subject: [Ovirt-devel] [PATCH node] Added a script that runs during first boot for the node. Message-ID: <1226089441-5310-1-git-send-email-dpierce@redhat.com> Each configuration function is stubbed out. The functions are: * configure logging * configure networking * configure password * configure storage Signed-off-by: Darryl L. Pierce --- Makefile.am | 6 ++++ ovirt-node.spec.in | 15 +++++++++- scripts/ovirt-config-logging | 2 + scripts/ovirt-config-networking | 2 + scripts/ovirt-config-password | 2 + scripts/ovirt-config-setup | 23 ++++++++++++++++ scripts/ovirt-config-storage | 2 + scripts/ovirt-firstboot | 56 +++++++++++++++++++++++++++++++++++++++ 8 files changed, 107 insertions(+), 1 deletions(-) create mode 100644 scripts/ovirt-config-logging create mode 100644 scripts/ovirt-config-networking create mode 100644 scripts/ovirt-config-password create mode 100755 scripts/ovirt-config-setup create mode 100644 scripts/ovirt-config-storage create mode 100755 scripts/ovirt-firstboot diff --git a/Makefile.am b/Makefile.am index 4ba0bca..ea49b43 100644 --- a/Makefile.am +++ b/Makefile.am @@ -27,7 +27,13 @@ EXTRA_DIST = \ scripts/collectd.conf.in \ scripts/ovirt \ scripts/ovirt-awake \ + scripts/ovirt-config-logging \ + scripts/ovirt-config-networking \ + scripts/ovirt-config-password \ + scripts/ovirt-config-setup \ + scripts/ovirt-config-storage \ scripts/ovirt-early \ + scripts/ovirt-firstboot \ scripts/ovirt-functions \ scripts/ovirt-post \ scripts/ovirt-process-config \ diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index d029c57..2a01b7c 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -87,6 +87,11 @@ cd - %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/logrotate.d %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-logging %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-networking %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-password %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-setup %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-storage %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-process-config %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-identify-node/ovirt-identify-node %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-listen-awake/ovirt-listen-awake %{buildroot}%{_sbindir} @@ -94,9 +99,9 @@ cd - %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-install-node %{buildroot}%{_sbindir} %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-uninstall-node %{buildroot}%{_sbindir} - %{__install} -p -m0644 scripts/ovirt-functions %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-early %{buildroot}%{_initrddir} +%{__install} -p -m0755 scripts/ovirt-firstboot %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-post %{buildroot}%{_initrddir} @@ -123,6 +128,7 @@ cd - %post /sbin/chkconfig --add ovirt-early +/sbin/chkconfig --add ovirt-firstboot /sbin/chkconfig --add ovirt /sbin/chkconfig --add ovirt-post # this is ugly; we need collectd to start *after* libvirtd, so we own the @@ -133,6 +139,7 @@ cd - %preun if [ "$1" = 0 ] ; then /sbin/chkconfig --del ovirt-early + /sbin/chkconfig --del ovirt-firstboot /sbin/chkconfig --del ovirt /sbin/chkconfig --del ovirt-post /sbin/chkconfig --del ovirt-listen-awake @@ -159,12 +166,18 @@ fi %files %defattr(-,root,root,0755) %{_sbindir}/ovirt-awake +%{_sbindir}/ovirt-config-logging +%{_sbindir}/ovirt-config-networking +%{_sbindir}/ovirt-config-password +%{_sbindir}/ovirt-config-setup +%{_sbindir}/ovirt-config-storage %{_sbindir}/ovirt-process-config %{_sbindir}/ovirt-identify-node %{_sbindir}/ovirt-listen-awake %{_sbindir}/ovirt-install-node %{_sbindir}/ovirt-uninstall-node %{_initrddir}/ovirt-early +%{_initrddir}/ovirt-firstboot %{_initrddir}/ovirt %{_initrddir}/ovirt-post %{_initrddir}/ovirt-listen-awake diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging new file mode 100644 index 0000000..c856ef1 --- /dev/null +++ b/scripts/ovirt-config-logging @@ -0,0 +1,2 @@ +#!/bin/bash +# diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking new file mode 100644 index 0000000..c856ef1 --- /dev/null +++ b/scripts/ovirt-config-networking @@ -0,0 +1,2 @@ +#!/bin/bash +# diff --git a/scripts/ovirt-config-password b/scripts/ovirt-config-password new file mode 100644 index 0000000..c856ef1 --- /dev/null +++ b/scripts/ovirt-config-password @@ -0,0 +1,2 @@ +#!/bin/bash +# diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup new file mode 100755 index 0000000..8408d14 --- /dev/null +++ b/scripts/ovirt-config-setup @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Entry point for configuring an oVirt node when running in standalone mode. + +while true; do + PS3="Please select an option: " + # TODO should we make this optional, based on whether the password was already set? + PASSWORD_OPTION="Password" + OPTIONS="Networking Storage Logging ${PASSWORD_OPTION} Quit" + + select OPTION in $OPTIONS + do + printf "\n" + + case "$OPTION" in + "Networking") ovirt-config-networking ; break ;; + "Storage") ovirt-config-storage ; break ;; + "Logging") ovirt-config-logging ; break ;; + "Password") ovirt-config-password ; break ;; + "Quit") exit 0 ;; + esac + done +done diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage new file mode 100644 index 0000000..c856ef1 --- /dev/null +++ b/scripts/ovirt-config-storage @@ -0,0 +1,2 @@ +#!/bin/bash +# diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot new file mode 100755 index 0000000..fef25ff --- /dev/null +++ b/scripts/ovirt-firstboot @@ -0,0 +1,56 @@ +#!/bin/bash +# +# ovirt-firstboot Puts the node into configuration mode. +# +# chkconfig: 2345 99 01 +# description: ovirt-early services +# +# Copyright (C) 2008 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. + +## Source functions library +. /etc/init.d/functions +. /etc/init.d/ovirt-functions + +start () +{ + ovirt-config-setup +} + +case "$1" in + start) + #is_firstboot + #if [ $? -ne 0 ]; then + # exit 0 + #fi + + printf "Starting ovirt-firstboot: " + + { + start + } + + test $? == 0 && success || failure + echo + ;; + + *) + echo "Usage: ovirt-early {start}" + exit 2 +esac + -- 1.5.6.5 From bkearney at redhat.com Fri Nov 7 20:40:00 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Fri, 07 Nov 2008 15:40:00 -0500 Subject: [Ovirt-devel] [PATCH node] RSyslog configuration for standalone mode. In-Reply-To: <87k5bfs3tx.fsf@rho.meyering.net> References: <1226084291-5437-1-git-send-email-bkearney@redhat.com> <87k5bfs3tx.fsf@rho.meyering.net> Message-ID: <4914A7A0.7030400@redhat.com> Thank you for reviewing Jim Meyering wrote: > Bryan Kearney wrote: >> +# check if we were called to attempt to default >> +# to remote logging >> +if [[ "$1" = "default" ]] ; then >> + printf "\nAttempting to locate remote syslog server..." >> + DEFAULT_SERVER=$(host -N 3 -t srv _syslog._udp | rev | awk '/VRS/ {print $1}' | cut -d. -f2- | rev) >> + DEFAULT_PORT=$(host -N 3 -t srv _syslog._udp | rev | awk '/VRS/ {print $2}' | cut -d. -f2- | rev) > > What does the output of that host command look like > when there is such a record? Here is an example: [bkearney at faceoff ~]$ host -N 3 -t srv _ipp._tcp _ipp._tcp.rdu.redhat.com has SRV record 10 0 631 cups.rdu.redhat.com. -- bk From jim at meyering.net Fri Nov 7 21:07:04 2008 From: jim at meyering.net (Jim Meyering) Date: Fri, 07 Nov 2008 22:07:04 +0100 Subject: [Ovirt-devel] [PATCH node] RSyslog configuration for standalone mode. In-Reply-To: <4914A7A0.7030400@redhat.com> (Bryan Kearney's message of "Fri, 07 Nov 2008 15:40:00 -0500") References: <1226084291-5437-1-git-send-email-bkearney@redhat.com> <87k5bfs3tx.fsf@rho.meyering.net> <4914A7A0.7030400@redhat.com> Message-ID: <87ej1ns0sn.fsf@rho.meyering.net> Bryan Kearney wrote: > Thank you for reviewing > Jim Meyering wrote: >> Bryan Kearney wrote: > >>> +# check if we were called to attempt to default >>> +# to remote logging >>> +if [[ "$1" = "default" ]] ; then >>> + printf "\nAttempting to locate remote syslog server..." >>> + DEFAULT_SERVER=$(host -N 3 -t srv _syslog._udp | rev | awk '/VRS/ {print $1}' | cut -d. -f2- | rev) >>> + DEFAULT_PORT=$(host -N 3 -t srv _syslog._udp | rev | awk '/VRS/ {print $2}' | cut -d. -f2- | rev) >> >> What does the output of that host command look like >> when there is such a record? > > Here is an example: > > [bkearney at faceoff ~]$ host -N 3 -t srv _ipp._tcp > _ipp._tcp.rdu.redhat.com has SRV record 10 0 631 cups.rdu.redhat.com. Thanks. Then, you might want to replace the above with something like this: # Sample input: # $ host -N 3 -t srv _ipp._tcp # _ipp._tcp.rdu.redhat.com has SRV record 10 0 631 cups.rdu.redhat.com. server_port=$(host -N 3 -t srv _ipp._tcp \ | sed 's/.* \([0-9][0-9]*\) \([^ ][^ ]*\)\.$/\2 \1/') case $server_port in *' '*) printf "found! Using server:port '$DEFAULT_SERVER:$DEFAULT_PORT'.\n" eval ovirt_rsyslog $server_port udp ;; *) printf "not found!\n" ;; esac From dpierce at redhat.com Fri Nov 7 21:40:10 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 7 Nov 2008 16:40:10 -0500 Subject: [Ovirt-devel] [PATCH node] Networking configuration support. Message-ID: <1226094010-11057-1-git-send-email-dpierce@redhat.com> This script allows the user to iterate through and edit the network interfaces on the node. Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 96 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 96 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index c856ef1..705521b 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -1,2 +1,98 @@ #!/bin/bash # +# Iterates over the list of network devices on the node and prompts the user +# to configure each. + +CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" + +function configure_interface +{ + NIC=$1 + FILENAME="/var/tmp/augtool-$NIC" + + printf "\nCONFIGURE INTERFACE: $NIC\n\n" + + THIS_ROOT="$CONFIG_FILE_ROOT-$NIC" + CONFIG="rm $THIS_ROOT\nset $THIS_ROOT/DEVICE $NIC" + + # Is this NIC shared? + while true; do + printf "Is $NIC a shared interface? (Y/N) " + read + case $REPLY in + Y|y) CONFIG="$CONFIG\nset $THIS_ROOT/TYPE bridge"; break ;; + N|n) bridge="N"; break ;; + esac + done + + # how do you want to configure this device? (dhcp, static IP) + while true; do + printf "Does $NIC use dynamic addressing? (Y/N) " + read + case $REPLY in + Y|y) CONFIG="$CONFIG\nset $THIS_ROOT/BOOTPROTO dhcp"; break ;; + N|n) + printf "\tIP Address: "; read; IPADDR=$REPLY + printf "\t Netmask: "; read; NETMASK=$REPLY + printf "\t Broadcast: "; read; BROADCAST=$REPLY + printf "\t Gateway: "; read; GATEWAY=$REPLY + + printf "\nIP Address: $IPADDR\nNetmask: $NETMASK\nBroadcast: $BROADCAST\nGateway: $GATEWAY\n" + printf "Is this correct? (Y/N) " + read + case $REPLY in + Y|y) + CONFIG="$CONFIG\nset $THIS_ROOT/IPADDR $IPADDR" + CONFIG="$CONFIG\nset $THIS_ROOT/BROADCAST $BROADCAST" + CONFIG="$CONFIG\nset $THIS_ROOT/NETMASK $NETMASK" + break + ;; + esac + ;; + esac + done + + if [ "$bridge" == "N" ]; then + printf "Is $NIC bridged? (Y/N) " + read + case $REPLY in + Y|y) + printf "What is the bridge name? " + read + CONFIG="$CONFIG\n set $THIS_ROOT/BRIDGE $REPLY" + ;; + esac + fi + + CONFIG="$CONFIG\nset $THIS_ROOT/ONBOOT yes" + printf "$CONFIG\n" > $FILENAME + + echo +} + +# TODO the menu doesn't redisplay unless you hit enter -- needs fixing +# get the list of network cards on this machine +NICS=$(hal-device | awk '/net.interface/ { + match($0, "= '"'"'(.*)'"'"' ", nic); printf("%s ", nic[1]); }') + +# Append a quit option +NICS="$NICS Quit" + +PS3="Please select a network interface to configure:" +select NIC in $NICS +do + case "$NIC" in + "Quit") + break + ;; + + *) + configure_interface $NIC + ;; + esac +done + +# Merge together all generated files and run augtool + +cat /var/tmp/augtool-* > /var/tmp/config-augtool +augtool < /var/tmp/config-augtool -- 1.5.6.5 From apevec at gmail.com Fri Nov 7 22:11:44 2008 From: apevec at gmail.com (Alan Pevec) Date: Fri, 7 Nov 2008 23:11:44 +0100 Subject: [Ovirt-devel] [PATCH node] RSyslog configuration for standalone mode. In-Reply-To: <87ej1ns0sn.fsf@rho.meyering.net> References: <1226084291-5437-1-git-send-email-bkearney@redhat.com> <87k5bfs3tx.fsf@rho.meyering.net> <4914A7A0.7030400@redhat.com> <87ej1ns0sn.fsf@rho.meyering.net> Message-ID: <2be7262f0811071411mf2eb5f3h16077e442d8e4d8@mail.gmail.com> On Fri, Nov 7, 2008 at 10:07 PM, Jim Meyering wrote: > >>> +# check if we were called to attempt to default > >>> +# to remote logging > >>> +if [[ "$1" = "default" ]] ; then > >>> + printf "\nAttempting to locate remote syslog server..." > >>> + DEFAULT_SERVER=$(host -N 3 -t srv _syslog._udp | rev | awk '/VRS/ > {print $1}' | cut -d. -f2- | rev) > >>> + DEFAULT_PORT=$(host -N 3 -t srv _syslog._udp | rev | awk '/VRS/ > {print $2}' | cut -d. -f2- | rev) > please use find_srv from ovirt-functions, see examples in other ovirt startup scripts. I'll add this doc comment in ovirt-functions to help it's reuse: # find_srv SERVICE PROTO # reads DNS SRV record # sets SRV_HOST and SRV_PORT if DNS SRV record found, clears them if not # example: # find_srv ovirt tcp # if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then # echo "oVirt Server found" # else # echo "no oVirt Server available, running standalone" # fi -------------- next part -------------- An HTML attachment was scrubbed... URL: From pmyers at redhat.com Sat Nov 8 08:48:19 2008 From: pmyers at redhat.com (Perry Myers) Date: Sat, 8 Nov 2008 03:48:19 -0500 Subject: [Ovirt-devel] [PATCH node-image] Add convenience script for editing a Node livecd Message-ID: <1226134099-2054-1-git-send-email-pmyers@redhat.com> Also add script for creating fake nodes using a livecd for boot Signed-off-by: Perry Myers --- Makefile.am | 4 +- create-ovirt-iso-nodes | 96 +++++++++++++++++++++++++++++++++++++++++ edit-livecd | 107 ++++++++++++++++++++++++++++++++++++++++++++++ ovirt-node-image.spec.in | 4 ++ 4 files changed, 210 insertions(+), 1 deletions(-) create mode 100755 create-ovirt-iso-nodes create mode 100755 edit-livecd diff --git a/Makefile.am b/Makefile.am index a3d4828..ab0623f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -31,7 +31,9 @@ EXTRA_DIST = \ ovirt-flash \ ovirt-flash-static \ ovirt-node-image.ks \ - ovirt-pxe + ovirt-pxe \ + edit-livecd \ + create-ovirt-iso-nodes DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz diff --git a/create-ovirt-iso-nodes b/create-ovirt-iso-nodes new file mode 100755 index 0000000..5864439 --- /dev/null +++ b/create-ovirt-iso-nodes @@ -0,0 +1,96 @@ +#!/bin/bash +# +# Create fake oVirt Nodes for testing CDROM boot +# Copyright 2008 Red Hat, Inc. +# Written by Perry Myers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +PATH=$PATH:/sbin:/usr/sbin + +ME=$(basename "$0") +warn() { printf '%s: %s\n' "$ME" "$*" >&2; } +try_h() { printf "Try \`$ME -h' for more information.\n" >&2; } +die() { warn "$@"; try_h; exit 1; } + +BRIDGENAME=ovirtbr0 +IMGDIR_DEFAULT=/var/lib/libvirt/images +NODEIMG_DEFAULT=$(rpm --eval='%_datadir')/$(rpm -q --qf '%{name}' ovirt-node-image)/ovirt-node-image.iso +imgdir=$IMGDIR_DEFAULT +nodeimg=$NODEIMG_DEFAULT + +# first, check to see we are root +if [ $( id -u ) -ne 0 ]; then + die "Must run as root" +fi + +gen_fake_managed_node() { + local num=$1 + local nodeimg=$2 + local last_mac=$(( 54 + $num )) + + echo "Creating fake node$num using $nodeimg..." + virsh destroy node$num > /dev/null 2>&1 + virsh undefine node$num > /dev/null 2>&1 + virt-install --name=node$num --ram=512 --vcpus=1 \ + --file $imgdir/node${i}-sda.raw --file-size=.15 \ + --network=bridge:$BRIDGENAME --mac=00:16:3e:12:34:$last_mac \ + --cdrom=$nodeimg \ + --vnc --accelerate --hvm --noacpi --noautoconsole \ + --os-type=linux --os-variant=fedora8 \ + --force --noreboot + virsh destroy node$num > /dev/null 2>&1 + TMPXML=$(mktemp) || exit 1 + virsh dumpxml node$num | sed \ + -e "s/boot dev='.*'/boot dev='cdrom'/" \ + -e "s^\(device='cdrom'>\)^\1\n^" > $TMPXML + virsh define $TMPXML + rm -f $TMPXML + echo "node$num created" +} + +usage() { + case $# in 1) warn "$1"; try_h; exit 1;; esac + cat < +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +#!/bin/bash + +# exit after any error: +set -e + +export PATH=$PATH:/sbin:/usr/sbin + +# first, check to see we are root +if [ $( id -u ) -ne 0 ]; then + echo "Must run as root" + exit 1 +fi + +if [[ $# < 2 ]]; then + echo "usage: $0 livecd.iso script" + exit 1 +fi + +CD=$1 +SCRIPT=$2 + +which mkisofs mksquashfs sed + +WDIR=`mktemp -d $PWD/livecd.XXXXXXXXXX` +ISO="${CD##*/}" +ISO="${ISO%.iso}-custom.iso" +EXIT="" + +function addExit() { + EXIT="$@ ; $EXIT" + trap "$EXIT" EXIT HUP TERM INT QUIT +} + +function mnt() { + local margs="$1" ; shift + local mp="$WDIR/$1" + for D in "$@" ; do + mkdir -v -p "$WDIR/$D" + done + mount -v $margs "$mp" + addExit "df | grep $mp > /dev/null 2>&1 && umount -v $mp" +} + +LABEL=$(isoinfo -d -i $CD | awk -F ": " '/Volume id:/ {print $2}') + +# mount the CD image +mnt "-t auto $CD -o loop,ro" cd + +# mount compressed filesystem +mnt "-t squashfs $WDIR/cd/LiveOS/squashfs.img -o ro,loop" sq + +# create writable copy of the new filesystem for the CD +cp -a $WDIR/cd $WDIR/cd-w + +# create writable copy of the filesystem for the new compressed squashfs filesystem +cp -a $WDIR/sq $WDIR/sq-w + +# mount ext3 filesystem +mnt "-t auto $WDIR/sq-w/LiveOS/ext3fs.img -o rw,loop" ex + +echo ">>> Updating CD content" + +cp -av $SCRIPT $WDIR/ex +pushd $WDIR/ex +./$SCRIPT +popd +rm -f $WDIR/ex/$SCRIPT + +echo ">>> Unmounting ext3fs" +umount $WDIR/ex + +echo ">>> Compressing filesystem" +mksquashfs $WDIR/sq-w/ $WDIR/cd-w/LiveOS/squashfs.img -noappend + +echo ">>> Recomputing MD5 sums" +( cd $WDIR/cd-w && find . -type f -not -name md5sum.txt -not -path '*/isolinux/*' -print0 | xargs -0 -- md5sum > md5sum.txt ) + +echo ">>> Creating ISO image $ISO" +mkisofs \ + -V "$LABEL" \ + -r -cache-inodes -J -l \ + -b isolinux/isolinux.bin \ + -c isolinux/boot.cat \ + -no-emul-boot -boot-load-size 4 -boot-info-table \ + -o "$ISO" \ + $WDIR/cd-w + +# The trap ... callbacks will unmount everything. +set +e diff --git a/ovirt-node-image.spec.in b/ovirt-node-image.spec.in index 086dff6..fff4210 100644 --- a/ovirt-node-image.spec.in +++ b/ovirt-node-image.spec.in @@ -67,6 +67,8 @@ mkdir %{buildroot} %{__install} -p -m0755 ovirt-pxe %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-flash %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-flash-static %{buildroot}%{_sbindir} +%{__install} -p -m0755 edit-livecd %{buildroot}%{_sbindir} +%{__install} -p -m0755 create-ovirt-iso-nodes %{buildroot}%{_sbindir} %clean %{__rm} -rf %{buildroot} @@ -81,6 +83,8 @@ cobbler sync > /dev/null 2>&1 || : %{_sbindir}/ovirt-pxe %{_sbindir}/ovirt-flash %{_sbindir}/ovirt-flash-static +%{_sbindir}/edit-livecd +%{_sbindir}/create-ovirt-iso-nodes %files pxe %defattr(-,root,root,0644) -- 1.6.0.3 From rjones at redhat.com Sat Nov 8 13:14:12 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Sat, 8 Nov 2008 13:14:12 +0000 Subject: [Ovirt-devel] Re: oVirt console (again!) In-Reply-To: <49149FB6.6050108@felter.org> References: <20081106170118.GA21838@amd.home.annexia.org> <49149FB6.6050108@felter.org> Message-ID: <20081108131412.GB15992@amd.home.annexia.org> On Fri, Nov 07, 2008 at 02:06:14PM -0600, Wes Felter wrote: > Richard W.M. Jones wrote: >> Previous discussion: >> https://www.redhat.com/archives/ovirt-devel/2008-August/msg00004.html >> >> Back to the oVirt console issue. > > Have y'all considered a Flash VNC client? I sent this suggestion to the > list months ago, but looking at the archives it looks like it didn't go > through (probably because I'm not a subscriber). The basic problem is that I don't have much experience building Flash programs. There are Flash VNC clients out there, but we'd have to modify them anyway to support Kerberos (or some form of encryption) plus any other VNC extensions that Gtk-VNC supports. Who knows if it's possible to support Kerberos / SASL / encryption / extensions from a Flash program? I'm reasonably confident that we can build a standalone Windows client, because we've in fact already done that (virt-viewer[1][2]). Extending the protocol is well-understood: it involves writing more C code and possibly porting more C libraries, both things that we now have plenty of experience with doing[3]. Rich. [1] http://camltastic.blogspot.com/2008/10/mingw-compile-software-for-windows.html [2] http://hg.et.redhat.com/applications/virt/applications/virt-tools-win32--devel [3] http://hg.et.redhat.com/misc/fedora-mingw--devel -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v From pmyers at redhat.com Sat Nov 8 15:13:48 2008 From: pmyers at redhat.com (Perry Myers) Date: Sat, 8 Nov 2008 10:13:48 -0500 (EST) Subject: [Ovirt-devel] Re: Documentation patch In-Reply-To: <2075496168.1378061226156982109.JavaMail.root@zmail01.collab.prod.int.phx2.redhat.com> Message-ID: <1246959914.1378091226157228564.JavaMail.root@zmail01.collab.prod.int.phx2.redhat.com> ----- "Susan Burgess" wrote: > Hi Perry, > > Here's the latest patch for the doc. I've added conditional text so > that > it can be built for either online help or a user guide. > Omitting the CONDITION clause results in everything being generated, > the > same result as earlier versions. > > To build the online help > make CONDITION="olh" html-en-US > > To build the online manual > make CONDITION="guide" html-en-US > > To build a pdf > make CONDITION="guide" pdf-en-US > > To take a look at how help for a desktop app would look > make html-desktop-en-US > (I've raised a ticket for a similar one to be created for web apps) I can't get this patch to apply to the tip of the ovirt-docs repo. Here's the error I get: [pmyers at mithlond docs]$ git am ~/Download/0040-Image-changes-to-Ch-1-4.patch Applying: Image changes to Ch 1-4 fatal: git diff header lacks filename information (line 448) Patch failed at 0001. When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort". Can you fix this and resend? Thanks, Perry From hbrock at redhat.com Sat Nov 8 21:11:14 2008 From: hbrock at redhat.com (Hugh O. Brock) Date: Sat, 8 Nov 2008 16:11:14 -0500 Subject: [Ovirt-devel] Re: oVirt console (again!) In-Reply-To: <20081108131412.GB15992@amd.home.annexia.org> References: <20081106170118.GA21838@amd.home.annexia.org> <49149FB6.6050108@felter.org> <20081108131412.GB15992@amd.home.annexia.org> Message-ID: <20081108211113.GW32206@redhat.com> On Sat, Nov 08, 2008 at 01:14:12PM +0000, Richard W.M. Jones wrote: > On Fri, Nov 07, 2008 at 02:06:14PM -0600, Wes Felter wrote: > > Richard W.M. Jones wrote: > >> Previous discussion: > >> https://www.redhat.com/archives/ovirt-devel/2008-August/msg00004.html > >> > >> Back to the oVirt console issue. > > > > Have y'all considered a Flash VNC client? I sent this suggestion to the > > list months ago, but looking at the archives it looks like it didn't go > > through (probably because I'm not a subscriber). > > The basic problem is that I don't have much experience building Flash > programs. There are Flash VNC clients out there, but we'd have to > modify them anyway to support Kerberos (or some form of encryption) > plus any other VNC extensions that Gtk-VNC supports. Who knows if > it's possible to support Kerberos / SASL / encryption / extensions > from a Flash program? > > I'm reasonably confident that we can build a standalone Windows > client, because we've in fact already done that (virt-viewer[1][2]). > Extending the protocol is well-understood: it involves writing more C > code and possibly porting more C libraries, both things that we now > have plenty of experience with doing[3]. Interestingly, we do now have a guy (Steve Linabery) who has some experience building Flash programs... (Look out for that bus, Steve!) We should look a bit further at this as an option, I guess. Take care, --Hugh From pmyers at redhat.com Sat Nov 8 22:49:20 2008 From: pmyers at redhat.com (Perry Myers) Date: Sat, 8 Nov 2008 17:49:20 -0500 Subject: [Ovirt-devel] [PATCH node-image] Added script for creating fake oVirt Nodes for testing Message-ID: <1226184560-10575-1-git-send-email-pmyers@redhat.com> Nodes are created via virt-install and are booted off of node ISO image present in the RPM Signed-off-by: Perry Myers --- Makefile.am | 3 +- create-ovirt-iso-nodes | 90 ++++++++++++++++++++++++++++++++++++++++++++++ ovirt-node-image.spec.in | 2 + 3 files changed, 94 insertions(+), 1 deletions(-) create mode 100755 create-ovirt-iso-nodes diff --git a/Makefile.am b/Makefile.am index a3d4828..8f7d7b9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -31,7 +31,8 @@ EXTRA_DIST = \ ovirt-flash \ ovirt-flash-static \ ovirt-node-image.ks \ - ovirt-pxe + ovirt-pxe \ + create-ovirt-iso-nodes DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz diff --git a/create-ovirt-iso-nodes b/create-ovirt-iso-nodes new file mode 100755 index 0000000..6cb76f6 --- /dev/null +++ b/create-ovirt-iso-nodes @@ -0,0 +1,90 @@ +#!/bin/bash +# +# Create fake oVirt Nodes for testing CDROM boot +# Copyright 2008 Red Hat, Inc. +# Written by Perry Myers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +PATH=$PATH:/sbin:/usr/sbin + +ME=$(basename "$0") +warn() { printf '%s: %s\n' "$ME" "$*" >&2; } +try_h() { printf "Try \`$ME -h' for more information.\n" >&2; } +die() { warn "$@"; try_h; exit 1; } + +BRIDGENAME=ovirtbr0 +IMGDIR_DEFAULT=/var/lib/libvirt/images +imgdir=$IMGDIR_DEFAULT + +gen_fake_managed_node() { + local num=$1 + local nodeimg=$2 + local last_mac=$(( 54 + $num )) + + echo "Creating fake node$num using $nodeimg..." + virsh destroy node$num > /dev/null 2>&1 + virsh undefine node$num > /dev/null 2>&1 + # FIXME: virt-install should be changed to have a --nostart parameter + # that just defines the VM w/o starting it. + virt-install --name=node$num --ram=512 --vcpus=1 \ + --disk path=$imgdir/node${i}-sda.raw,size=.15 \ + --cdrom=$nodeimg --livecd \ + --network=bridge:$BRIDGENAME --mac=00:16:3e:12:34:$last_mac \ + --vnc --accelerate --hvm --noautoconsole \ + --os-type=linux --os-variant=fedora9 \ + --force --noreboot + virsh destroy node$num > /dev/null 2>&1 + echo "node$num created" +} + +usage() { + case $# in 1) warn "$1"; try_h; exit 1;; esac + cat < /dev/null 2>&1 || : %{_sbindir}/ovirt-pxe %{_sbindir}/ovirt-flash %{_sbindir}/ovirt-flash-static +%{_sbindir}/create-ovirt-iso-nodes %files pxe %defattr(-,root,root,0644) -- 1.6.0.3 From apevec at redhat.com Sun Nov 9 00:11:58 2008 From: apevec at redhat.com (Alan Pevec) Date: Sun, 09 Nov 2008 01:11:58 +0100 Subject: [Ovirt-devel] Re: [PATCH node-image] Added script for creating fake oVirt Nodes for testing In-Reply-To: <1226184560-10575-1-git-send-email-pmyers@redhat.com> References: <1226184560-10575-1-git-send-email-pmyers@redhat.com> Message-ID: <49162ACE.7080508@redhat.com> Perry Myers wrote: > Nodes are created via virt-install and are booted off of node ISO image ACK All: this requires updated python-virtinst 0.400 - so you need to: yum --enablerepo=ovirt update From pmyers at redhat.com Sun Nov 9 02:51:12 2008 From: pmyers at redhat.com (Perry Myers) Date: Sat, 8 Nov 2008 21:51:12 -0500 Subject: [Ovirt-devel] [PATCH node-image] Add passwd/userlib back in and fix pam to not need cracklib Message-ID: <1226199072-12411-1-git-send-email-pmyers@redhat.com> This will allow the passwd utility to work during node runtime Signed-off-by: Perry Myers --- common-blacklist.ks | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/common-blacklist.ks b/common-blacklist.ks index 2fa2d82..4c98ac9 100644 --- a/common-blacklist.ks +++ b/common-blacklist.ks @@ -1,4 +1,9 @@ +# -*-Shell-script-*- %post + +echo "Fixing pam to remove dependency on cracklib" +sed -i -e '/pam_cracklib/d' -e 's/use_authtok//' /etc/pam.d/system-auth + echo "Removing excess RPMs" RPM="rpm -v -e --nodeps" @@ -14,7 +19,7 @@ $RPM -e kpartx mkinitrd isomd5sum dmraid python python-libs $RPM -e checkpolicy # Remove additional RPMs forcefully -$RPM gamin pm-utils kbd libuser passwd usermode \ +$RPM gamin pm-utils kbd usermode \ vbetool ConsoleKit hdparm \ efibootmgr krb5-workstation linux-atm-libs fedora-release-notes \ slang psmisc gdbm cryptsetup-luks pciutils mtools syslinux db4 \ -- 1.6.0.3 From pmyers at redhat.com Sun Nov 9 02:52:38 2008 From: pmyers at redhat.com (Perry Myers) Date: Sat, 8 Nov 2008 21:52:38 -0500 Subject: [Ovirt-devel] [PATCH node-image] Added script for opening up livecd (Node) images to edit/add files Message-ID: <1226199158-12446-1-git-send-email-pmyers@redhat.com> This script is useful for people who don't have the development and yum infrastructure set up to build nodes from scratch. Changes to packaging and binaries should always be done by modifying kickstart and rebuilding via livecd-creator. But if all you want to do is add a config file, public key for SSH or change the root password this can be done with the edit-livecd script. Included a simple script to be used in conjunction with edit-livecd that allows you to set the root password and provide an authorized_keys file to be embedded in the Node. It can be used as follows: sudo edit-livecd /usr/share/ovirt-node-image/ovirt-node-image.iso \ /usr/sbin/livecd-setauth This will output a file in the current working directory called: ovirt-node-image-custom.iso Which can then be added to a fake node with: sudo create-ovirt-iso-nodes -n ovirt-node-image-custom.iso Signed-off-by: Perry Myers --- Makefile.am | 4 +- edit-livecd | 128 ++++++++++++++++++++++++++++++++++++++++++++++ livecd-setauth | 50 ++++++++++++++++++ ovirt-node-image.spec.in | 4 ++ 4 files changed, 185 insertions(+), 1 deletions(-) create mode 100755 edit-livecd create mode 100755 livecd-setauth diff --git a/Makefile.am b/Makefile.am index 8f7d7b9..575e95d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,7 +32,9 @@ EXTRA_DIST = \ ovirt-flash-static \ ovirt-node-image.ks \ ovirt-pxe \ - create-ovirt-iso-nodes + create-ovirt-iso-nodes \ + edit-livecd \ + livecd-setauth DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz diff --git a/edit-livecd b/edit-livecd new file mode 100755 index 0000000..d9e995f --- /dev/null +++ b/edit-livecd @@ -0,0 +1,128 @@ +#!/bin/bash +# +# Edit a livecd to insert files +# Copyright 2008 Red Hat, Inc. +# Written by Perry Myers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +#!/bin/bash + +PATH=$PATH:/sbin:/usr/sbin + +ME=$(basename "$0") +warn() { printf '%s: %s\n' "$ME" "$*" >&2; } +try_h() { printf "Try \`$ME -h' for more information.\n" >&2; } +die() { warn "$@"; try_h; exit 1; } + +usage() { + case $# in 1) warn "$1"; try_h; exit 1;; esac + cat < /dev/null 2>&1 + +WDIR=`mktemp -d $PWD/livecd.XXXXXXXXXX` +ISO="${CD##*/}" +ISO="${ISO%.iso}-custom.iso" + +function addExit() { + EXIT="$@ ; $EXIT" + trap "$EXIT" EXIT HUP TERM INT QUIT +} + +function mnt() { + local margs="$1" ; shift + local mp="$WDIR/$1" + for D in "$@" ; do + mkdir -v -p "$WDIR/$D" + done + mount -v $margs "$mp" + addExit "df | grep $mp > /dev/null 2>&1 && umount -v $mp" +} + +addExit "rm -Rf $WDIR" + +LABEL=$(isoinfo -d -i $CD | awk -F ": " '/Volume id:/ {print $2}') + +# mount the CD image +mnt "-t auto $CD -o loop,ro" cd + +# mount compressed filesystem +mnt "-t squashfs $WDIR/cd/LiveOS/squashfs.img -o ro,loop" sq + +# create writable copy of the new filesystem for the CD +cp -a $WDIR/cd $WDIR/cd-w + +# create writable copy of the filesystem for the new compressed squashfs filesystem +cp -a $WDIR/sq $WDIR/sq-w + +# mount ext3 filesystem +mnt "-t auto $WDIR/sq-w/LiveOS/ext3fs.img -o rw,loop" ex + +echo ">>> Updating CD content" +cp -av $PROG $WDIR/ex +pushd $WDIR/ex +set +e +./$PROG +set -e +popd +rm -f $WDIR/ex/$PROG + +echo ">>> Unmounting ext3fs" +umount $WDIR/ex + +echo ">>> Compressing filesystem" +mksquashfs $WDIR/sq-w/ $WDIR/cd-w/LiveOS/squashfs.img -noappend + +echo ">>> Recomputing MD5 sums" +( cd $WDIR/cd-w && find . -type f -not -name md5sum.txt -not -path '*/isolinux/*' -print0 | xargs -0 -- md5sum > md5sum.txt ) + +echo ">>> Creating ISO image $ISO" +mkisofs \ + -V "$LABEL" \ + -r -cache-inodes -J -l \ + -b isolinux/isolinux.bin \ + -c isolinux/boot.cat \ + -no-emul-boot -boot-load-size 4 -boot-info-table \ + -o "$ISO" \ + $WDIR/cd-w + +# The trap ... callbacks will unmount everything. +set +e + diff --git a/livecd-setauth b/livecd-setauth new file mode 100755 index 0000000..eb8922f --- /dev/null +++ b/livecd-setauth @@ -0,0 +1,50 @@ +#!/bin/bash +# +# Script to interactively add root password and authorized_keys file +# to a livecd +# Copyright 2008 Red Hat, Inc. +# Written by Perry Myers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +DEFAULT_AUTH=~/.ssh/authorized_keys + +printf "Do you want to set a root password? [y/N]: " +read yesno +if [ "$yesno" = "y" -o "$yesno" = "Y" ]; then + chroot . passwd root +fi + +printf "Do you want to set an authorized_keys file? [y/N]: " +read yesno +if [ "$yesno" = "y" -o "$yesno" = "Y" ]; then + echo "Enter the location of the authorized_keys file [default: $DEFAULT_AUTH]: " + read -e authkeys + if [ -z "$authkeys" ]; then + authkeys=$DEFAULT_AUTH + fi + + authkeys=$(eval echo $authkeys) + if [ -f $authkeys ]; then + SSH=root/.ssh + AUTH=$SSH/authorized_keys + + mkdir -p $SSH + chmod 755 $SSH + cp -v $authkeys $AUTH + chmod 644 $AUTH + else + echo "$authkeys not found, skipping" + fi +fi diff --git a/ovirt-node-image.spec.in b/ovirt-node-image.spec.in index 138f4a4..440ba2f 100644 --- a/ovirt-node-image.spec.in +++ b/ovirt-node-image.spec.in @@ -68,6 +68,8 @@ mkdir %{buildroot} %{__install} -p -m0755 ovirt-flash %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-flash-static %{buildroot}%{_sbindir} %{__install} -p -m0755 create-ovirt-iso-nodes %{buildroot}%{_sbindir} +%{__install} -p -m0755 edit-livecd %{buildroot}%{_sbindir} +%{__install} -p -m0755 livecd-setauth %{buildroot}%{_sbindir} %clean %{__rm} -rf %{buildroot} @@ -83,6 +85,8 @@ cobbler sync > /dev/null 2>&1 || : %{_sbindir}/ovirt-flash %{_sbindir}/ovirt-flash-static %{_sbindir}/create-ovirt-iso-nodes +%{_sbindir}/edit-livecd +%{_sbindir}/livecd-setauth %files pxe %defattr(-,root,root,0644) -- 1.6.0.3 From pmyers at redhat.com Sun Nov 9 04:00:21 2008 From: pmyers at redhat.com (Perry Myers) Date: Sat, 8 Nov 2008 23:00:21 -0500 Subject: [Ovirt-devel] [PATCH recipe] Remove ftp service from appliance as it is not necessary Message-ID: <1226203221-13742-1-git-send-email-pmyers@redhat.com> Signed-off-by: Perry Myers --- appliances/ovirt/ovirt.pp.in | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/appliances/ovirt/ovirt.pp.in b/appliances/ovirt/ovirt.pp.in index 9d8fb4b..e06f72c 100644 --- a/appliances/ovirt/ovirt.pp.in +++ b/appliances/ovirt/ovirt.pp.in @@ -190,5 +190,3 @@ file_append{"ovirt_cobbler_user": line => "ovirt:Cobbler:68db208a546dcedf34edf0b4fe0ab1f2", } -file {"/etc/vsftpd": ensure => directory} -file {"/etc/vsftpd/vsftpd.conf": ensure => exists} -- 1.6.0.3 From pmyers at redhat.com Sun Nov 9 07:45:58 2008 From: pmyers at redhat.com (Perry Myers) Date: Sun, 9 Nov 2008 02:45:58 -0500 Subject: [Ovirt-devel] [PATCH] Move logic for appliance setup from kickstart to recipe Message-ID: <1226216760-15794-1-git-send-email-pmyers@redhat.com> From pmyers at redhat.com Sun Nov 9 07:45:59 2008 From: pmyers at redhat.com (Perry Myers) Date: Sun, 9 Nov 2008 02:45:59 -0500 Subject: [Ovirt-devel] [PATCH recipe] Move logic for appliance setup from kickstart to recipe In-Reply-To: <1226216760-15794-1-git-send-email-pmyers@redhat.com> References: <1226216760-15794-1-git-send-email-pmyers@redhat.com> Message-ID: <1226216760-15794-2-git-send-email-pmyers@redhat.com> The only logic left in the kickstart is generic appliance setup information Signed-off-by: Perry Myers --- appliances/ovirt/files/cobbler-import | 46 +++++++++++++++ appliances/ovirt/files/ovirt-server-appliance | 2 +- appliances/ovirt/ovirt.pp.in | 33 ++++++----- .../templates/ovirt-server-appliance-setup.erb | 60 ++++++++++++++++++++ 4 files changed, 126 insertions(+), 15 deletions(-) create mode 100644 appliances/ovirt/files/cobbler-import diff --git a/appliances/ovirt/files/cobbler-import b/appliances/ovirt/files/cobbler-import new file mode 100644 index 0000000..5695f12 --- /dev/null +++ b/appliances/ovirt/files/cobbler-import @@ -0,0 +1,46 @@ +#!/bin/sh + +# Import Cobbler profiles on first boot + +url=http://download.fedora.redhat.com/pub/fedora/linux +ksdir=/var/www/cobbler/ks_mirror + +set -x +for dir in $ksdir/* ; do + base=$(basename $dir) + os=$(echo $base | cut -d '-' -f 1) + ver=$(echo $base | cut -d '-' -f 2) + arch=$(echo $base | cut -d '-' -f 2) + + test -z "$os" -o -z "$ver" -o -z "$arch" + && { echo "Skipping $dir, not a valid cobbler profile" ; continue ; } + + cobbler import --name=$os-$ver --arch=$arch \ + --path=$dir + cobbler repo add --name=f$ver-$arch --arch=$arch --mirror-locally=0 \ + --mirror=$url/releases/$ver/Everything/$arch/os + cobbler repo add --name=f$ver-$arch-updates --arch=$arch --mirror-locally=0 \ + --mirror=$url/updates/$ver/$arch.newkey + sed -e 's#^reboot.*#poweroff#' /etc/cobbler/sample_end.ks \ + > /etc/cobbler/sample-$os-$ver-$arch.ks + cobbler profile edit --name=$os-$ver-$arch \ + --repos="f$ver-$arch f$ver-$arch-updates" \ + --kickstart=/etc/cobbler/sample-$os-$ver-$arch.ks +done + +# TODO extract Node boot params from /var/lib/tftboot/pxelinux.cfg/default +# before Cobbler overwrites it +cobbler distro add --name="oVirt-Node-$arch" --arch=$arch \ + --initrd=/var/lib/tftpboot/initrd0.img --kernel=/var/lib/tftpboot/vmlinuz0 \ + --kopts="rootflags=loop root=/ovirt-node-image.iso rootfstype=iso9660 ro console=ttyS0,115200n8 console=tty0" +cobbler profile add --name=oVirt-Node-$arch --distro=oVirt-Node-$arch +cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$arch \ + --name=node3 --mac=00:16:3e:12:34:57 +cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$arch \ + --name=node4 --mac=00:16:3e:12:34:58 --kopts="ovirt_init=scsi ovirt_local_boot" +cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$arch \ + --name=node5 --mac=00:16:3e:12:34:59 --kopts="ovirt_init=scsi" + +set +x +echo "Add new oVirt Nodes as Cobbler systems to make them PXE boot oVirt Node image directly." +echo "oVirt-Node-$arch is also default boot option in Cobbler menu" diff --git a/appliances/ovirt/files/ovirt-server-appliance b/appliances/ovirt/files/ovirt-server-appliance index e7ba7bd..5cf530d 100644 --- a/appliances/ovirt/files/ovirt-server-appliance +++ b/appliances/ovirt/files/ovirt-server-appliance @@ -2,7 +2,7 @@ # # ovirt-server-appliance oVirt Server Appliance service # -# chkconfig: 3 60 40 +# chkconfig: 3 96 4 # description: ovirt server appliance service # diff --git a/appliances/ovirt/ovirt.pp.in b/appliances/ovirt/ovirt.pp.in index e06f72c..299a11d 100644 --- a/appliances/ovirt/ovirt.pp.in +++ b/appliances/ovirt/ovirt.pp.in @@ -136,17 +136,6 @@ file_replacement{"nat_forwarding" : notify => Service[network] } -file {"/etc/init.d/ovirt-server-appliance": - source => "puppet:///ovirt/ovirt-server-appliance", - mode => 755 -} - -service {"ovirt-server-appliance": - ensure => "running", - enable => true , - require => [File["/etc/init.d/ovirt-server-appliance"], Service["network"], Service["httpd"]] -} - service {"nfs": ensure => "running", enable => true, @@ -169,15 +158,31 @@ file {"/usr/sbin/ovirt-server-appliance-setup": mode => 755 } +file {"/usr/sbin/cobbler-import": + source => "puppet:///ovirt/cobbler-import", + mode => 755 +} + single_exec {"ovirt_appliance_installation": command => "/usr/sbin/ovirt-server-appliance-setup >> /var/log/ovirt-server-appliance-setup.log", - require => [File["/usr/sbin/ovirt-server-appliance-setup"], Service["ovirt-server-appliance"], - Exec["reload-firewall"]] + require => [File["/usr/sbin/ovirt-server-appliance-setup"], Exec["reload-firewall"]] +} + +file {"/etc/init.d/ovirt-server-appliance": + source => "puppet:///ovirt/ovirt-server-appliance", + mode => 755 +} + +service {"ovirt-server-appliance": + ensure => "running", + enable => true , + require => [File["/etc/init.d/ovirt-server-appliance"], Service["network"], Service["httpd"], + Single_exec["ovirt_appliance_installation"]] } single_exec {"ovirt_installation": command => "/usr/sbin/ovirt-server-install >> /var/log/ovirt-server-install.log", - require => [Service["postgresql"],Single_exec["ovirt_appliance_installation"]] + require => [Service["postgresql"],Service["ovirt-server-appliance"]] } # diff --git a/appliances/ovirt/templates/ovirt-server-appliance-setup.erb b/appliances/ovirt/templates/ovirt-server-appliance-setup.erb index 5fbf67a..fd080b3 100644 --- a/appliances/ovirt/templates/ovirt-server-appliance-setup.erb +++ b/appliances/ovirt/templates/ovirt-server-appliance-setup.erb @@ -1,5 +1,15 @@ #!/bin/bash export PATH=/usr/kerberos/bin:$PATH + +# make sure to update the /etc/hosts with the list of all possible DHCP +# addresses we can hand out; dnsmasq uses this +sed -i -e 's/management\.priv\.ovirt\.org//' /etc/hosts +echo "192.168.50.1 physical.priv.ovirt.org" >> /etc/hosts +echo "192.168.50.2 management.priv.ovirt.org" >> /etc/hosts +for i in `seq 3 252` ; do + echo "192.168.50.$i node$i.priv.ovirt.org" >> /etc/hosts +done + # workaround for https://bugzilla.redhat.com/show_bug.cgi?id=451936 sed -i '/\[kdcdefaults\]/a \ kdc_ports = 88' /usr/share/ipa/kdc.conf.template # set up freeipa @@ -31,6 +41,56 @@ ipa-adduser -f Ovirt -l Admin -p <%= password %> <%= principal %> ipa-modgroup -a ovirtadmin admins ipa-moduser --setattr krbPasswordExpiration=19700101000000Z <%= principal %> +# the code to contact the host we are running on and make it configure itself +# note that this has to be done in rc.local (as opposed to ovirt-wui-dev) +# because when ovirt-wui-dev starts, the host-browser is not yet running +cat >> /etc/rc.d/rc.local << \EOF +# Try to contact the host we are running on; if we succeed, we'll use it as +# one of the managed nodes; if not, no big deal +(exec 3<> /dev/tcp/192.168.50.1/7777 && echo "AWAKE" 1>&3 \ + && exec 3<> /dev/tcp/192.168.50.1/7777 && echo "IDENTIFY" 1>&3) || : +EOF + +# Create sparse files for iSCSI backing stores +mkdir -p /mnt/data/ovirtiscsi +mkdir -p /ovirtiscsi +echo "/mnt/data/ovirtiscsi /ovirtiscsi bind bind 0 0" >> /etc/fstab +mount /ovirtiscsi +for i in `seq 1 5`; do + dd if=/dev/null of=/ovirtiscsi/iSCSI$i bs=1 count=1 seek=5G +done + +# make an NFS directory with some small, fake disks and export them via NFS +# to show off the NFS part of the WUI +mkdir -p /mnt/data/ovirtnfs +mkdir -p /ovirtnfs +echo "/mnt/data/ovirtnfs /ovirtnfs bind bind 0 0" >> /etc/fstab +mount /ovirtnfs +for i in `seq 1 5`; do + dd if=/dev/zero of=/ovirtnfs/disk$i.dsk bs=1 count=1 seek=5G +done +echo "/ovirtnfs 192.168.50.0/24(rw,no_root_squash)" >> /etc/exports + +# add an NFS directory to use for Cobbler image storage +mkdir -p /mnt/data/cobblernfs +mkdir -p /cobblernfs +echo "/mnt/data/cobblernfs /cobblernfs bind bind 0 0" >> /etc/fstab +mount /cobblernfs +echo "/cobblernfs 192.168.50.0/24(rw,no_root_squash)" >> /etc/exports + +# Import cobbler profiles +/usr/sbin/cobbler-import + +# TODO use Augeas 0.3.0 Inifile lens +sed -i -e "s/^module = authn_denyall.*/module = authn_configfile/" \ + /etc/cobbler/modules.conf +sed -i -e "s/^server:.*/server: '192.168.50.2'/" \ + -e "s/^next_server:.*/next_server: '192.168.50.2'/" \ + /etc/cobbler/settings +sed -i -e '/kernel /a \\tIPAPPEND 2' /etc/cobbler/pxesystem.template +sed -i -e "s/^ONTIMEOUT.*/ONTIMEOUT $(cat /tmp/cobbler-default)/" \ + /etc/cobbler/pxedefault.template + # Turn off ace on appliance restarts until we make the installation scripts # reentrant chkconfig ace off -- 1.6.0.3 From pmyers at redhat.com Sun Nov 9 07:46:00 2008 From: pmyers at redhat.com (Perry Myers) Date: Sun, 9 Nov 2008 02:46:00 -0500 Subject: [Ovirt-devel] [PATCH appliance] Move logic for appliance setup from kickstart to recipe In-Reply-To: <1226216760-15794-2-git-send-email-pmyers@redhat.com> References: <1226216760-15794-1-git-send-email-pmyers@redhat.com> <1226216760-15794-2-git-send-email-pmyers@redhat.com> Message-ID: <1226216760-15794-3-git-send-email-pmyers@redhat.com> The only logic left in the kickstart is generic appliance setup information Signed-off-by: Perry Myers --- ovirt-appliance.ks | 100 +-------------------------------------------------- 1 files changed, 2 insertions(+), 98 deletions(-) diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks index dd56ee5..e34ab87 100644 --- a/ovirt-appliance.ks +++ b/ovirt-appliance.ks @@ -33,46 +33,8 @@ ovirt-recipe lokkit %post -# cleanup rpmdb to allow non-matching host and chroot RPM versions -rm -f /var/lib/rpm/__db* - exec > /root/kickstart-post.log 2>&1 - - # the code to contact the host we are running on and make it configure itself - # note that this has to be done in rc.local (as opposed to ovirt-wui-dev) - # because when ovirt-wui-dev starts, the host-browser is not yet running - cat >> /etc/rc.d/rc.local << \EOF -# Try to contact the host we are running on; if we succeed, we'll use it as -# one of the managed nodes; if not, no big deal -(exec 3<> /dev/tcp/192.168.50.1/7777 && echo "AWAKE" 1>&3 \ - && exec 3<> /dev/tcp/192.168.50.1/7777 && echo "IDENTIFY" 1>&3) || : -EOF - - # make sure to update the /etc/hosts with the list of all possible DHCP - # addresses we can hand out; dnsmasq uses this - sed -i -e 's/management\.priv\.ovirt\.org//' /etc/hosts - echo "192.168.50.1 physical.priv.ovirt.org" >> /etc/hosts - echo "192.168.50.2 management.priv.ovirt.org" >> /etc/hosts - for i in `seq 3 252` ; do - echo "192.168.50.$i node$i.priv.ovirt.org" >> /etc/hosts - done - - # Create sparse files for iSCSI backing stores - mkdir -p /ovirtiscsi - for i in `seq 3 5`; do - dd if=/dev/null of=/ovirtiscsi/iSCSI$i bs=1 count=1 seek=3G - done - - # make an NFS directory with some small, fake disks and export them via NFS - # to show off the NFS part of the WUI - mkdir -p /ovirtnfs - for i in `seq 1 3`; do - dd if=/dev/zero of=/ovirtnfs/disk$i.dsk bs=1 count=1 seek=3G - done - echo "/ovirtnfs 192.168.50.0/24(rw,no_root_squash)" >> /etc/exports - - # add an NFS directory to use for Cobbler image storage - mkdir -p /cobblernfs - echo "/cobblernfs 192.168.50.0/24(rw,no_root_squash)" >> /etc/exports + # cleanup rpmdb to allow non-matching host and chroot RPM versions + rm -f /var/lib/rpm/__db* # The ace stuff. /sbin/chkconfig --level 35 ace on @@ -96,63 +58,5 @@ print "%s %s %s" % (family, version, arch)' | ( read os ver arch dest=$INSTALL_ROOT/var/www/cobbler/ks_mirror/$os-$ver-$arch printf "Importing $os-$ver-$arch ..." cp -a tmp/tree $dest - url=http://download.fedora.redhat.com/pub/fedora/linux - cat >> $INSTALL_ROOT/etc/rc.d/rc.cobbler-import << EOF -#!/bin/sh -# Import Cobbler profiles on first boot - -exec > /root/cobbler-import.log 2>&1 - -# run only once -chmod -x \$0 -set -x - -cobbler import --name=$os-$ver --arch=$arch \ - --path=/var/www/cobbler/ks_mirror/$os-$ver-$arch -cobbler repo add --name=f9-$arch --arch=$arch --mirror-locally=0 \ - --mirror=$url/releases/9/Everything/$arch/os -cobbler repo add --name=f9-$arch-updates --arch=$arch --mirror-locally=0 \ - --mirror=$url/updates/9/$arch.newkey -sed -e 's#^reboot.*#poweroff#' /etc/cobbler/sample_end.ks \ - > /etc/cobbler/sample-$os-$ver-$arch.ks -cobbler profile edit --name=$os-$ver-$arch \ - --repos="f9-$arch f9-$arch-updates" \ - --kickstart=/etc/cobbler/sample-$os-$ver-$arch.ks - -# TODO extract Node boot params from /var/lib/tftboot/pxelinux.cfg/default -# before Cobbler overwrites it -cobbler distro add --name="oVirt-Node-$arch" --arch=$arch \ - --initrd=/var/lib/tftpboot/initrd0.img --kernel=/var/lib/tftpboot/vmlinuz0 \ - --kopts="rootflags=loop root=/ovirt-node-image.iso rootfstype=iso9660 ro console=ttyS0,115200n8 console=tty0" -cobbler profile add --name=oVirt-Node-$arch --distro=oVirt-Node-$arch -cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$arch \ - --name=node3 --mac=00:16:3e:12:34:57 -cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$arch \ - --name=node4 --mac=00:16:3e:12:34:58 --kopts="ovirt_init=scsi ovirt_local_boot" -cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$arch \ - --name=node5 --mac=00:16:3e:12:34:59 --kopts="ovirt_init=scsi" -set +x -echo "Add new oVirt Nodes as Cobbler systems to make them PXE boot oVirt Node image directly." -echo "oVirt-Node-$arch is also default boot option in Cobbler menu" -EOF - chmod +x $INSTALL_ROOT/etc/rc.d/rc.cobbler-import - echo "[ -x /etc/rc.d/rc.cobbler-import ] && /etc/rc.d/rc.cobbler-import" \ - >> $INSTALL_ROOT/etc/rc.d/rc.local - printf "oVirt-Node-$arch" > $INSTALL_ROOT/tmp/cobbler-default - echo done ) %end - -# Cobbler configuration -%post - exec >> /root/kickstart-post.log 2>&1 - # TODO use Augeas 0.3.0 Inifile lens - sed -i -e "s/^module = authn_denyall.*/module = authn_configfile/" \ - /etc/cobbler/modules.conf - sed -i -e "s/^server:.*/server: '192.168.50.2'/" \ - -e "s/^next_server:.*/next_server: '192.168.50.2'/" \ - /etc/cobbler/settings - sed -i -e '/kernel /a \\tIPAPPEND 2' /etc/cobbler/pxesystem.template - sed -i -e "s/^ONTIMEOUT.*/ONTIMEOUT $(cat /tmp/cobbler-default)/" \ - /etc/cobbler/pxedefault.template -%end -- 1.6.0.3 From pmyers at redhat.com Sun Nov 9 07:48:00 2008 From: pmyers at redhat.com (Perry Myers) Date: Sun, 9 Nov 2008 02:48:00 -0500 Subject: [Ovirt-devel] [PATCH appliance] Configure appliance to enable serial console for grub/kernel by default Message-ID: <1226216880-15842-1-git-send-email-pmyers@redhat.com> Signed-off-by: Perry Myers --- ovirt-appliance.ks | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks index e34ab87..7ecfb6d 100644 --- a/ovirt-appliance.ks +++ b/ovirt-appliance.ks @@ -11,7 +11,7 @@ services --disabled=libvirtd,postgresql --enabled=network,tgtd,nfs,iptables timezone --utc UTC text -bootloader --location=mbr --driveorder=sda +bootloader --location=mbr --driveorder=sda --append="console=tty0 console=ttyS0,115200" # The following is the partition information you requested # Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is @@ -36,6 +36,9 @@ lokkit # cleanup rpmdb to allow non-matching host and chroot RPM versions rm -f /var/lib/rpm/__db* + # set up serial console + sed -i 's/hiddenmenu/hiddenmenu\nserial --unit=0 --speed=115200\nterminal --timeout=5 serial console/' /boot/grub/grub.conf + # The ace stuff. /sbin/chkconfig --level 35 ace on mkdir /etc/sysconfig/ace -- 1.6.0.3 From pmyers at redhat.com Sun Nov 9 07:48:38 2008 From: pmyers at redhat.com (Perry Myers) Date: Sun, 9 Nov 2008 02:48:38 -0500 Subject: [Ovirt-devel] [PATCH appliance] Create separate data disk for storing iSCSI and NFS for appliance Message-ID: <1226216918-15875-1-git-send-email-pmyers@redhat.com> Signed-off-by: Perry Myers --- ovirt-appliance.ks | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks index 7ecfb6d..d7e0892 100644 --- a/ovirt-appliance.ks +++ b/ovirt-appliance.ks @@ -11,16 +11,13 @@ services --disabled=libvirtd,postgresql --enabled=network,tgtd,nfs,iptables timezone --utc UTC text -bootloader --location=mbr --driveorder=sda --append="console=tty0 console=ttyS0,115200" -# The following is the partition information you requested -# Note that any partitions you deleted are not expressed -# here so unless you clear all partitions first, this is -# not guaranteed to work +bootloader --location=mbr --driveorder=sda,sdb --append="console=tty0 console=ttyS0,115200" zerombr -clearpart --all --drives=sda +clearpart --all --drives=sda,sdb part /boot --ondisk=sda --fstype=ext3 --size=100 -part / --ondisk=sda --fstype=ext3 --size=20000 +part / --ondisk=sda --fstype=ext3 --size=2000 part swap --ondisk=sda --fstype=swap --size=512 +part /mnt/data --ondisk=sdb --fstype=ext3 --size=20000 reboot network --device=eth1 --bootproto=static --ip=192.168.50.2 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.50.2 --hostname=management.priv.ovirt.org -- 1.6.0.3 From pmyers at redhat.com Sun Nov 9 07:49:12 2008 From: pmyers at redhat.com (Perry Myers) Date: Sun, 9 Nov 2008 02:49:12 -0500 Subject: [Ovirt-devel] [PATCH appliance] Move appliance creation out of spec file to Makefile Message-ID: <1226216952-15907-1-git-send-email-pmyers@redhat.com> The appliance-creator RPM is now just used to store the create-ovirt-appliance script and contains dependencies for installing and running the appliance. The appliance is also modified to be packaged in zip format. Qcow2 format for the disks is used until appliance-tools support tar. Signed-off-by: Perry Myers --- Makefile.am | 105 ++++++++++++++++++++++++++++++++++++++++------- ovirt-appliance.spec.in | 70 ++----------------------------- 2 files changed, 95 insertions(+), 80 deletions(-) diff --git a/Makefile.am b/Makefile.am index b464da0..61df672 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,16 +16,28 @@ # also available at http://www.gnu.org/copyleft/gpl.html. OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache +OVIRT_LOCAL_REPO ?= file://$(OVIRT_CACHE_DIR)/ovirt +OVIRT_URL ?= http://ovirt.org/repos/ovirt +THINCRUST_URL ?= http://thincrust.org/repo +PKG_FMT = zip +DISK_FMT ?= qcow2 + +FEDORA = $(shell rpm --eval '%{fedora}') +ARCH = $(shell rpm --eval '%{_arch}') + +NVR = $(PACKAGE)-$(VERSION)-$(ARCH) EXTRA_DIST = \ .gitignore \ - create-ovirt-appliance \ + create-$(PACKAGE) \ gettree.sh \ - ovirt-appliance.ks \ - ovirt-appliance.spec \ - ovirt-appliance.spec.in + $(PACKAGE).ks \ + $(PACKAGE).spec \ + $(PACKAGE).spec.in -DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz +DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz \ + $(NVR).$(PKG_FMT) \ + $(NVR).$(PKG_FMT).md5sum # For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT- # annotated rpm version strings. @@ -38,15 +50,78 @@ GIT_RELEASE = $$(date --utc +%Y%m%d%H%M%S)git$(git_head) RPMDIR = $$(rpm --eval '%{_rpmdir}') RPM_FLAGS = --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)" RPM_FLAGS += $(if $(_ovirt_dev),--define "extra_release .$(GIT_RELEASE)") -# FEDORA_URL env var can be set to the root of a fedora mirror -RPM_FLAGS += $(if $(FEDORA_URL),--define "fedora_url $(FEDORA_URL)") -# OVIRT_URL env var can be set to the root of an ovirt.org mirror -RPM_FLAGS += $(if $(OVIRT_URL),--define "ovirt_url $(OVIRT_URL)") -# THINCRUST_URL env var can be set to the root of an thincrust.net mirror -# FIXME: This is temporary until thincrust RPMS are in Fedora 9 Updates -RPM_FLAGS += $(if $(THINCRUST_URL),--define "thincrust_url $(THINCRUST_URL)") - -rpms: dist + +FEDORA_MIRROR = http://mirrors.fedoraproject.org/mirrorlist +FEDORA_URL_DEF = http://download.fedoraproject.org/pub/fedora/linux +CUR_RAWHIDE = 10 + +repos.ks: + ( \ + if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \ + FEDORA_REPO=rawhide ;\ + FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/development/$(ARCH)/os,--mirrorlist=$(FEDORA_MIRROR)?repo=rawhide&arch=$(ARCH))" ;\ + OVIRT_DISTRO=development ;\ + else \ + FEDORA_REPO=f$(FEDORA) ;\ + FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/$(ARCH)/os,--mirrorlist=$(FEDORA_MIRROR)?repo=fedora-$(FEDORA)&arch=$(ARCH))" ;\ + OVIRT_DISTRO=$(FEDORA) ;\ + UPDATE_REPO_LINE="repo --name=$${FEDORA_REPO}-updates-newkey $(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/updates/$(FEDORA)/$(ARCH).newkey,--mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-f$(FEDORA).newkey&arch=$(ARCH))" ;\ + fi ;\ + echo "repo --name=$${FEDORA_REPO} $${FEDORA_REPO_LOC}" > $@ ;\ + echo "repo --name=ovirt-org --baseurl=$(OVIRT_URL)/$${OVIRT_DISTRO}/$(ARCH)" >> $@ ;\ + echo "repo --name=thincrust-org --baseurl=$(THINCRUST_URL)/noarch" >> $@ ;\ + echo "$${UPDATE_REPO_LINE}" >> $@ ;\ + echo "repo --name=ovirt-local --baseurl=$(OVIRT_LOCAL_REPO)" >> $@ \ + ) + +SELINUX_ENFORCING=$(shell /usr/sbin/getenforce) +$(NVR).$(PKG_FMT): repos.ks + mkdir -p $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree + mkdir -p $(OVIRT_CACHE_DIR)/yum + ( \ + case $(SELINUX_ENFORCING) in \ + Enforcing) sudo /usr/sbin/setenforce Permissive ;; \ + Permissive) ;; \ + *) if ksflatten $(PACKAGE).ks 2>/dev/null \ + | grep -q '^selinux --disabled'; then \ + echo WARNING: SELinux disabled in kickstart ;\ + else \ + echo ERROR: SELinux enabled in kickstart, \ + but disabled on the build machine ;\ + exit 1 ;\ + fi ;; \ + esac ;\ + if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \ + FEDORA_TREE_URL="$(if $(FEDORA_URL),$(FEDORA_URL)/development/$(ARCH)/os,$(FEDORA_URL_DEF)/development/$(ARCH)/os)" ;\ + else \ + FEDORA_TREE_URL="$(if $(FEDORA_URL),$(FEDORA_URL)/releases/$(FEDORA)/Fedora/$(ARCH)/os,$(FEDORA_URL_DEF)/releases/$(FEDORA)/Fedora/$(ARCH)/os)" ;\ + fi ;\ + ./gettree.sh $${FEDORA_TREE_URL} $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree ;\ + ) + + ln -s $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp tmp + sudo -E appliance-creator --config $(PACKAGE).ks \ + --name $(PACKAGE) -f $(DISK_FMT) -p $(PKG_FMT) -d -v \ + --tmpdir='$(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp' \ + --cache='$(OVIRT_CACHE_DIR)/yum' \ + --vmem=768 + sudo chown $${USER} $(PACKAGE).$(PKG_FMT) + ( \ + if [ $(SELINUX_ENFORCING) = Enforcing ]; then \ + sudo /usr/sbin/setenforce Enforcing || exit 1 ;\ + fi \ + ) + + mv $(PACKAGE).$(PKG_FMT) $(NVR).$(PKG_FMT) + zip -u $(NVR).$(PKG_FMT) create-$(PACKAGE) create-ovirt-nodes \ + create-ovirt-network $(PACKAGE)-functions get-$(PACKAGE) + +$(NVR).$(PKG_FMT).md5sum: $(NVR).$(PKG_FMT) + md5sum $(NVR).$(PKG_FMT) > $(NVR).$(PKG_FMT).md5sum + +appliance: $(NVR).$(PKG_FMT).md5sum + +rpms: dist appliance rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz publish: rpms @@ -55,4 +130,4 @@ publish: rpms rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src/ createrepo $(OVIRT_CACHE_DIR)/ovirt -.PHONY: rpms publish +.PHONY: rpms publish $(NVR).$(PKG_FMT).md5sum $(NVR).$(PKG_FMT) diff --git a/ovirt-appliance.spec.in b/ovirt-appliance.spec.in index fdf942f..df02a85 100644 --- a/ovirt-appliance.spec.in +++ b/ovirt-appliance.spec.in @@ -1,12 +1,3 @@ -%{!?ovirt_cache_dir: %define ovirt_cache_dir /var/tmp/ovirt-cache} -%{!?ovirt_local_repo: %define ovirt_local_repo file://%{ovirt_cache_dir}/ovirt} -%{!?ovirt_url: %define ovirt_url http://ovirt.org/repos/ovirt} -%{!?thincrust_url: %define thincrust_url http://www.thincrust.net/repo} -%{?fedora_url: %define fedora_tree_url %{fedora_url}/releases/%{fedora}/Fedora/%{_arch}/os} -%{!?fedora_tree_url: %define fedora_tree_url http://download.fedoraproject.org/pub/fedora/linux/releases/%{fedora}/Fedora/%{_arch}/os} -%{!?bad_pkgs: %define bad_pkgs ""} -%define fedora_mirror http://mirrors.fedoraproject.org/mirrorlist - Summary: oVirt Appliance Name: ovirt-appliance Version: @VERSION@ @@ -15,12 +6,8 @@ Source0: %{name}-%{version}.tar.gz License: GPLv2+ Group: Applications/System BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot +BuildArch: noarch URL: http://ovirt.org/ -BuildRequires: appliance-tools appliance-os -BuildRequires: livecd-tools >= 017 -BuildRequires: syslinux -BuildRequires: qemu-img -BuildRequires: wget # FIXME: libvirt and kvm require ovirt specific patches presently due to # the fact that migration has not been fixed upstream. Once upstream migration # is fixed, these Requires should be fixed. @@ -35,59 +22,12 @@ Requires: augeas %define debug_package %{nil} %description -The oVirt Appliance image and scripts to install on a Fedora Host +The oVirt Appliance scripts to install on a Fedora Host %prep %setup -q %build -%if 0%{?fedora} == 010 - # XXX current rawhide - %if "%{?fedora_url}" == "" -cat > repos.ks << EOF -repo --name=rawhide --mirrorlist=%{fedora_mirror}?repo=rawhide&arch=%{_arch} -EOF - %else -cat > repos.ks << EOF -repo --name=rawhide --baseurl=%{fedora_url}/development/%{_arch}/os -EOF - %endif -cat >> repos.ks << EOF -repo --name=ovirt-org --baseurl=%{ovirt_url}/development/%{_arch} -EOF -%else - %if "%{?fedora_url}" == "" -cat > repos.ks << EOF -repo --name=f%{fedora} --mirrorlist=%{fedora_mirror}?repo=fedora-%{fedora}&arch=%{_arch} -repo --name=f%{fedora}-updates-newkey --mirrorlist=%{fedora_mirror}?repo=updates-released-f%{fedora}.newkey&arch=%{_arch} --excludepkgs=%{bad_pkgs} -EOF - %else -cat > repos.ks << EOF -repo --name=f%{fedora} --baseurl=%{fedora_url}/releases/%{fedora}/Everything/%{_arch}/os -repo --name=f%{fedora}-updates-newkey --baseurl=%{fedora_url}/updates/%{fedora}/%{_arch}.newkey --excludepkgs=%{bad_pkgs} -EOF - %endif -cat >> repos.ks << EOF -repo --name=ovirt-org --baseurl=%{ovirt_url}/%{fedora}/%{_arch} -EOF -%endif - -cat >> repos.ks << EOF -repo --name=ovirt-local --baseurl=%{ovirt_local_repo} -repo --name=thincrust-org --baseurl=%{thincrust_url}/noarch - -EOF - -mkdir -p %{ovirt_cache_dir}/appliance-tmp/tree -mkdir -p %{ovirt_cache_dir}/yum -./gettree.sh %{fedora_tree_url} %{ovirt_cache_dir}/appliance-tmp/tree -ln -s %{ovirt_cache_dir}/appliance-tmp tmp -sudo su - -c "cd $(pwd) && appliance-creator --config ovirt-appliance.ks \ - --name %{name} -f qcow2 -d -v \ - --tmpdir='%{ovirt_cache_dir}/appliance-tmp' \ - --cache='%{ovirt_cache_dir}/yum'" -sudo su - -c "cd $(pwd) && chown -R $USER ." -mv %{name}-sda.qcow2 %{name}.img %install %{__rm} -rf %{buildroot} @@ -95,8 +35,6 @@ mkdir %{buildroot} %{__install} -d -m0755 %{buildroot}%{app_root} %{__install} -p -m0644 COPYING %{buildroot}%{app_root} -%{__install} -d -m0755 %{buildroot}%{_localstatedir}/lib/libvirt/images -%{__install} -p -m0644 %{name}.img %{buildroot}%{_localstatedir}/lib/libvirt/images %{__install} -d -m0755 %{buildroot}%{_sbindir} %{__install} -p -m0755 create-%{name} %{buildroot}%{_sbindir} @@ -106,11 +44,13 @@ mkdir %{buildroot} %files %defattr(-,root,root,0644) %{app_root}/COPYING -%{_localstatedir}/lib/libvirt/images/%{name}.img %defattr(-,root,root,0755) %{_sbindir}/create-%{name} %changelog +* Wed Nov 05 2008 Perry Myers 0.96 +- Removed appliance building from rpm. RPM now just contains tools to + download image and install it * Sun Sep 14 2008 Perry Myers 0.92-1 - Added Requires on libvirt/kvm * Fri Sep 05 2008 Perry Myers 0.92-1 -- 1.6.0.3 From pmyers at redhat.com Sun Nov 9 07:49:41 2008 From: pmyers at redhat.com (Perry Myers) Date: Sun, 9 Nov 2008 02:49:41 -0500 Subject: [Ovirt-devel] [PATCH appliance] Update kvm/libvirt deps to newer versions in ovirt.org repo Message-ID: <1226216981-15936-1-git-send-email-pmyers@redhat.com> Also remove ovirt specific tags in the version strings Signed-off-by: Perry Myers --- ovirt-appliance.spec.in | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ovirt-appliance.spec.in b/ovirt-appliance.spec.in index df02a85..c35530b 100644 --- a/ovirt-appliance.spec.in +++ b/ovirt-appliance.spec.in @@ -11,8 +11,8 @@ URL: http://ovirt.org/ # FIXME: libvirt and kvm require ovirt specific patches presently due to # the fact that migration has not been fixed upstream. Once upstream migration # is fixed, these Requires should be fixed. -Requires: libvirt >= 0.4.4-2ovirt2 -Requires: kvm >= 72-3ovirt3 +Requires: libvirt >= 0.4.6-2 +Requires: kvm >= 78-4 Requires: /usr/bin/qemu-img Requires: augeas -- 1.6.0.3 From pmyers at redhat.com Sun Nov 9 07:50:35 2008 From: pmyers at redhat.com (Perry Myers) Date: Sun, 9 Nov 2008 02:50:35 -0500 Subject: [Ovirt-devel] [PATCH recipe] Changes to support removal of second network interface on the appliance In-Reply-To: <--compose> References: <--compose> Message-ID: <1226217037-15973-1-git-send-email-pmyers@redhat.com> Old appliance had: eth0 - libvirt default network (used for forwarding and upstream access) eth1 - ovirtbr0 for fake node access and bridging to oVirt network The forwarding/NAT and upstream access has been merged into ovirtbr0 eliminating the need for eth0/default. So eth0 becomes bridged to ovirtbr0 and eth1 is removed. To support this, the create-ovirt-appliance script needs to be modified to set up the host network appropriately. This is done in a related patch in the ovirt-appliance repo. The appliance is no longer used as a gateway, the host is the default gateway. So the sections for NAT are removed from the puppet config. Signed-off-by: Perry Myers --- appliances/ovirt/files/ovirt-server-appliance | 6 +++--- appliances/ovirt/ovirt.pp.in | 19 ++----------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/appliances/ovirt/files/ovirt-server-appliance b/appliances/ovirt/files/ovirt-server-appliance index 5cf530d..4dabce0 100644 --- a/appliances/ovirt/files/ovirt-server-appliance +++ b/appliances/ovirt/files/ovirt-server-appliance @@ -12,7 +12,7 @@ TARGET_ID=32101 start() { echo -n "Starting ovirt-server-appliance: " - dnsmasq -i eth1 -F 192.168.50.6,192.168.50.252 \ + dnsmasq -i eth0 -F 192.168.50.6,192.168.50.252 \ -G 00:16:3e:12:34:57,192.168.50.3 -G 00:16:3e:12:34:58,192.168.50.4 \ -G 00:16:3e:12:34:59,192.168.50.5 \ -s priv.ovirt.org \ @@ -23,9 +23,9 @@ start() { -W _qpidd._tcp,management.priv.ovirt.org,5672 \ -W _identify._tcp,management.priv.ovirt.org,12120 \ --enable-tftp --tftp-root=/var/lib/tftpboot -M pxelinux.0 \ - -O option:router,192.168.50.2 -O option:ntp-server,192.168.50.2 \ + -O option:router,192.168.50.1 -O option:ntp-server,192.168.50.2 \ --dhcp-option=12 \ - -R --local /priv.ovirt.org/ --server 192.168.122.1 + -R --local /priv.ovirt.org/ --server 192.168.50.1 # Set up the fake iscsi target tgtadm --lld iscsi --op new --mode target --tid $TARGET_ID \ diff --git a/appliances/ovirt/ovirt.pp.in b/appliances/ovirt/ovirt.pp.in index 299a11d..ab52d57 100644 --- a/appliances/ovirt/ovirt.pp.in +++ b/appliances/ovirt/ovirt.pp.in @@ -46,8 +46,8 @@ postgres::setup{$appliance_name:} firewall::setup{$appliance_name: status => "enabled"} $net_changes = [ - "set /files/etc/sysconfig/network-scripts/ifcfg-eth0/PEERDNS no", - "set /files/etc/sysconfig/network-scripts/ifcfg-eth1/DNS1 192.168.50.2" + "set /files/etc/sysconfig/network-scripts/ifcfg-eth0/DNS1 192.168.50.2", + "set /files/etc/sysconfig/network-scripts/ifcfg-eth0/GATEWAY 192.168.50.1" ] augeas {"network_scripts": @@ -96,14 +96,6 @@ file {"/boot/grub/splash.xpm.gz": source => "puppet:///ovirt/ovirt-splash.xpm.gz" } -firewall_rule {"ovirt_nat": - table => "nat", - chain => "POSTROUTING", - out_interface => "eth0", - action => "MASQUERADE", - protocol => '' -} - firewall_rule {"ssh": destination_port => '22'} firewall_rule {"http": destination_port => '80'} firewall_rule {"https": destination_port => '443'} @@ -129,13 +121,6 @@ firewall_rule {"krb5kdc": destination_port => '88', protocol => 'udp'} firewall_rule {"cobblerd": destination_port => "25150"} firewall_rule {"cobblerd-mgmt": destination_port => "25151"} -file_replacement{"nat_forwarding" : - file => "/etc/sysctl.conf", - pattern => "^net.ipv4.ip_forward = .*", - replacement => "net.ipv4.ip_forward = 1", - notify => Service[network] -} - service {"nfs": ensure => "running", enable => true, -- 1.6.0.3 From pmyers at redhat.com Sun Nov 9 07:50:37 2008 From: pmyers at redhat.com (Perry Myers) Date: Sun, 9 Nov 2008 02:50:37 -0500 Subject: [Ovirt-devel] [PATCH release] Created update-app target for installing appliance image from image archive In-Reply-To: <1226217037-15973-2-git-send-email-pmyers@redhat.com> References: <--compose> <1226217037-15973-1-git-send-email-pmyers@redhat.com> <1226217037-15973-2-git-send-email-pmyers@redhat.com> Message-ID: <1226217037-15973-3-git-send-email-pmyers@redhat.com> Signed-off-by: Perry Myers --- ovirt.mk | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/ovirt.mk b/ovirt.mk index 5814b03..d053e18 100644 --- a/ovirt.mk +++ b/ovirt.mk @@ -85,6 +85,9 @@ update-host: ovirt-release ovirt-build ovirt-appliance ovirt-node ovirt-docs \ ovirt-node-selinux +update-app: update-host + sudo get-ovirt-appliance -l appliance + tar-src: @mkdir -p $(OVIRT_CACHE_DIR) @sudo chown -R $(USER) $(OVIRT_CACHE_DIR) -- 1.6.0.3 From pmyers at redhat.com Sun Nov 9 07:50:36 2008 From: pmyers at redhat.com (Perry Myers) Date: Sun, 9 Nov 2008 02:50:36 -0500 Subject: [Ovirt-devel] [PATCH appliance] Refactor the create-ovirt-appliance script into several scripts In-Reply-To: <1226217037-15973-1-git-send-email-pmyers@redhat.com> References: <--compose> <1226217037-15973-1-git-send-email-pmyers@redhat.com> Message-ID: <1226217037-15973-2-git-send-email-pmyers@redhat.com> Separated out several independent functions from ovirt-create-appliance: - installing the appliance image from the appliance packaging - creating the appliance in libvirt - creating the fake nodes - setting up the host networking to support running the appliance Along with these changes also made it so that the appliance and fake nodes are created using virt-image from the appliance-creator or from virt-install and changed so that only a single network (ovirtbr0) is required for the appliance and fake nodes. Signed-off-by: Perry Myers --- Makefile.am | 4 + create-ovirt-appliance | 329 ++++---------------------------------------- create-ovirt-network | 139 +++++++++++++++++++ create-ovirt-nodes | 49 +++++++ get-ovirt-appliance | 93 +++++++++++++ ovirt-appliance-functions | 169 +++++++++++++++++++++++ ovirt-appliance.ks | 4 +- 7 files changed, 485 insertions(+), 302 deletions(-) create mode 100755 create-ovirt-network create mode 100755 create-ovirt-nodes create mode 100755 get-ovirt-appliance create mode 100644 ovirt-appliance-functions diff --git a/Makefile.am b/Makefile.am index 61df672..f6a9b69 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,6 +30,10 @@ NVR = $(PACKAGE)-$(VERSION)-$(ARCH) EXTRA_DIST = \ .gitignore \ create-$(PACKAGE) \ + create-ovirt-network \ + create-ovirt-nodes \ + get-$(PACKAGE) \ + $(PACKAGE)-functions \ gettree.sh \ $(PACKAGE).ks \ $(PACKAGE).spec \ diff --git a/create-ovirt-appliance b/create-ovirt-appliance index 9454377..3d6fae9 100755 --- a/create-ovirt-appliance +++ b/create-ovirt-appliance @@ -1,44 +1,42 @@ #!/bin/bash - -PATH=$PATH:/sbin:/usr/sbin - -ME=$(basename "$0") -warn() { printf '%s: %s\n' "$ME" "$*" >&2; } -try_h() { printf "Try \`$ME -h' for more information.\n" >&2; } -die() { warn "$@"; try_h; exit 1; } - -RAM=768 - -IMGDIR_DEFAULT=/var/lib/libvirt/images -NAME_DEFAULT=ovirt-appliance -NET_SCRIPTS=/etc/sysconfig/network-scripts -BRIDGENAME=ovirtbr0 -NET_TYPE=network - -NODE_DISK_SIZE=128M -NODE_DISK_FMT=raw - -imgdir=$IMGDIR_DEFAULT -name=$NAME_DEFAULT +# +# Create oVirt Appliance +# Copyright 2008 Red Hat, Inc. +# Written by Perry Myers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +. $(dirname $0)/ovirt-appliance-functions usage() { case $# in 1) warn "$1"; try_h; exit 1;; esac cat < - $name - - - -EOF -} - -gen_fake_managed_node() { - local num=$1 - local disk=$2 - local last_mac=$(( 54 + $num )) - - cat < - node$num - 25ab2490-7c4c-099f-b647-${num}5ff8efa73f6 - 524288 - 524288 - 1 - - hvm - - - - destroy - restart - destroy - - $KVM_BINARY - - - - - - - - - - - - - - - - - - -EOF -} - -gen_app() { - local name=$1 - local disk=$2 - local ram=$3 - - cat< - $name - $(( $ram * 1024 )) - $(( $ram * 1024 )) - 1 - - hvm - - - - destroy - restart - destroy - - $KVM_BINARY - - - - - - - - - - - - - - - - - - - - - - -EOF -} - -net_debug() { - # Some output for debugging problems - echo "Currently active bridges:" - echo "-------------------------" - brctl show - echo - echo "Currently defined libvirt networks:" - echo "-----------------------------------" - virsh net-list --all - echo -} - -# first, check to see we are root -if [ $( id -u ) -ne 0 ]; then - die "Must run as root" -fi - -# now make sure the packages we need are installed -if [ -e /etc/redhat-release ]; then - # We rely on RPM deps for this in Red Hat/Fedora systems - CHECK=0 - KVM_BINARY=/usr/bin/qemu-kvm -elif [ -e /etc/debian_version ]; then - # Works in Ubuntu 8.04. Still needs testing in Debian - PACKAGES="libvirt0 libvirt-bin kvm qemu" - CHECK=$(dpkg -l $PACKAGES &> /dev/null; echo $?) - KVM_BINARY=/usr/bin/kvm -else - die "Not a supported system" -fi - -if [ $CHECK -ne 0 ]; then - # one of the previous packages wasn't installed; bail out - die "Must have the $PACKAGES packages installed" -fi - -service libvirtd status > /dev/null 2>&1 \ - || service libvirtd start > /dev/null 2>&1 -chkconfig libvirtd on - -# Cleanup to handle older version of script that used these bridge names -{ - virsh net-destroy dummybridge - virsh net-undefine dummybridge - brctl delif eth1bridge eth1 - virsh net-destroy eth1bridge - virsh net-undefine eth1bridge - old_bridge=$(brctl show \ - | awk -v BRIDGENAME=ovirtbr '$1==BRIDGENAME {print $4}') - if [ -n "$old_bridge" ]; then - ifconfig $old_bridge down - fi - brctl delif ovirtbr $old_bridge - virsh net-destroy ovirtbr - virsh net-undefine ovirtbr - sed -i "/# ovirtbr$/d" /etc/rc.d/rc.local -} > /dev/null 2>&1 - -net_debug - -# If we're bridging to a physical network, run some checks to make sure the -# choice of physical eth device is sane -if [ -n "$bridge" ]; then - NET_TYPE=bridge - # Check to see if the physical device is present - ifconfig $bridge > /dev/null 2>&1 ; bridge_dev_present=$? - test $bridge_dev_present != 0 \ - && die "$bridge device not present, aborting!" - - # Check to see if the eth device is already tied to a non oVirt bridge - attached_bridge=$(brctl show \ - | awk -v BRIDGE=$bridge '$4~BRIDGE {print $1}') - test -n "$attached_bridge" -a "$attached_bridge" != "$BRIDGENAME" \ - && die "$bridge already attached to other bridge $attached_bridge" - - # Check to make sure that the system is not already using the interface - if test -f $NET_SCRIPTS/ifcfg-$bridge ; then - echo "$NET_SCRIPTS/ifcfg-$bridge is present, are you sure you wish to" - echo "overwrite this file? [y/N]? " - read yesno - - if [ "$yesno" != "y" -a "$yesno" != "Y" ]; then - exit 2 - fi - fi -fi - mkdir -p $imgdir -# define the fake managed nodes we will use. -for i in `seq 3 5` ; do - imgname="node${i}.img" - if [ ! -f $imgdir/$imgname ]; then - qemu-img create -f $NODE_DISK_FMT $imgdir/$imgname $NODE_DISK_SIZE - fi - virsh destroy node$i >& /dev/null - virsh undefine node$i >& /dev/null - TMPXML=$(mktemp) - gen_fake_managed_node $i $imgdir/$imgname > $TMPXML - virsh define $TMPXML - rm $TMPXML -done - -# Remove old bridge device if it exists -sed -i "/# $BRIDGENAME/d" /etc/rc.d/rc.local -old_bridge=$(brctl show \ - | awk -v BRIDGENAME=$BRIDGENAME '$1==BRIDGENAME {print $4}') -if [ -n "$old_bridge" ]; then - echo "Removing old bridge $old_bridge" - ifconfig $old_bridge down - brctl delif $BRIDGENAME $old_bridge - rm -f $NET_SCRIPTS/ifcfg-$old_bridge -fi - -{ -echo "Removing $BRIDGENAME" -virsh net-destroy $BRIDGENAME -virsh net-undefine $BRIDGENAME -ifconfig $BRIDGENAME down -brctl delbr $BRIDGENAME -rm -fv $NET_SCRIPTS/ifcfg-$BRIDGENAME -echo "Done Removing $BRIDGENAME" -} 2> /dev/null - -if [ -n "$bridge" ]; then - # real external bridge, use distro networking scripts - ifconfig $bridge down 2> /dev/null - TMPAUG=$(mktemp) || exit 1 - cat > $TMPAUG < $TMPXML - virsh net-define $TMPXML - rm $TMPXML - virsh net-start $BRIDGENAME - virsh net-autostart $BRIDGENAME -fi - -net_debug - -# Cleanup to handle older version of script that used these domain names -{ - virsh destroy developer - virsh undefine developer - virsh destroy bundled - virsh undefine bundled -} > /dev/null 2>&1 +appdisk=$name-sda.$DISK_FMT +datadisk=$name-sdb.$DISK_FMT -imgname=$name.img -test ! -r $imgdir/$imgname && die "Disk image not found at $imgdir/$imgname" +test ! -r $imgdir/$appdisk && die "Disk image not found at $imgdir/$appdisk" +test ! -r $imgdir/$datadisk && die "Disk image not found at $imgdir/$datadisk" virsh destroy $name > /dev/null 2>&1 virsh undefine $name > /dev/null 2>&1 -TMPXML=$(mktemp) || exit 1 -# FIXME virt-image to define the appliance instance -gen_app $name $imgdir/$imgname $RAM > $TMPXML -virsh define $TMPXML -rm $TMPXML -echo "Application defined using disk located at $imgdir/$imgname." -echo "Run virsh start $name to start the appliance" +virt-image -b $BRIDGENAME $imgdir/$name.xml +test $console = 1 && virsh console $name diff --git a/create-ovirt-network b/create-ovirt-network new file mode 100755 index 0000000..a8c67c7 --- /dev/null +++ b/create-ovirt-network @@ -0,0 +1,139 @@ +#!/bin/bash + +. $(dirname $0)/ovirt-appliance-functions + +usage() { + case $# in 1) warn "$1"; try_h; exit 1;; esac + cat < /dev/null 2>&1 ; bridge_dev_present=$? + test $bridge_dev_present != 0 \ + && die "$bridge device not present, aborting!" + + # Check to see if the eth device is already tied to a non oVirt bridge + attached_bridge=$(brctl show \ + | awk -v BRIDGE=$bridge '$4~BRIDGE {print $1}') + test -n "$attached_bridge" -a "$attached_bridge" != "$BRIDGENAME" \ + && die "$bridge already attached to other bridge $attached_bridge" + + # Check to make sure that the system is not already using the interface + if test -f $NET_SCRIPTS/ifcfg-$bridge ; then + echo "$NET_SCRIPTS/ifcfg-$bridge is present, are you sure you wish to" + echo "overwrite this file? [y/N]? " + read yesno + + if [ "$yesno" != "y" -a "$yesno" != "Y" ]; then + exit 2 + fi + fi +fi + +# Remove old bridge device if it exists +sed -i "/# $BRIDGENAME/d" /etc/rc.d/rc.local +old_bridge=$(brctl show \ + | awk -v BRIDGENAME=$BRIDGENAME '$1==BRIDGENAME {print $4}') +if [ -n "$old_bridge" ]; then + echo "Removing old bridge $old_bridge" + ifconfig $old_bridge down + brctl delif $BRIDGENAME $old_bridge + rm -f $NET_SCRIPTS/ifcfg-$old_bridge +fi + +{ +echo "Removing $BRIDGENAME" +virsh net-destroy $BRIDGENAME +virsh net-undefine $BRIDGENAME +ifconfig $BRIDGENAME down +brctl delbr $BRIDGENAME +rm -fv $NET_SCRIPTS/ifcfg-$BRIDGENAME +rm -fv /etc/sysconfig/iptables-$BRIDGENAME-filter +rm -fv /etc/sysconfig/iptables-$BRIDGENAME-nat +sed -i "/iptables-$BRIDGENAME/d" /etc/sysconfig/system-config-firewall +lokkit --update +echo "Done Removing $BRIDGENAME" +} 2> /dev/null + +if [ -n "$bridge" ]; then + # real external bridge, use distro networking scripts + ifconfig $bridge down 2> /dev/null + TMPAUG=$(mktemp) || exit 1 + cat > $TMPAUG < /etc/sysconfig/iptables-$BRIDGENAME-filter < /etc/sysconfig/iptables-$BRIDGENAME-nat < $TMPXML + virsh net-define $TMPXML + rm $TMPXML + virsh net-start $BRIDGENAME + virsh net-autostart $BRIDGENAME +fi + +# Set up dnsmasq on $BRIDGENAME just for DNS forwarding +cat < /etc/dnsmasq.d/$BRIDGENAME.conf +bind-interfaces +interface=$BRIDGENAME +except-interface=lo +EOF +chkconfig dnsmasq on +service dnsmasq restart + +net_debug diff --git a/create-ovirt-nodes b/create-ovirt-nodes new file mode 100755 index 0000000..89ad7ad --- /dev/null +++ b/create-ovirt-nodes @@ -0,0 +1,49 @@ +#!/bin/bash +# +# Create fake oVirt Nodes that PXE boot to the Appliance Server +# Copyright 2008 Red Hat, Inc. +# Written by Perry Myers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +. $(dirname $0)/ovirt-appliance-functions + +usage() { + case $# in 1) warn "$1"; try_h; exit 1;; esac + cat < +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +. $(dirname $0)/ovirt-appliance-functions + +usage() { + case $# in 1) warn "$1"; try_h; exit 1;; esac + cat < /dev/null 2>&1 ; then + echo "Using http at $app_loc to retrieve appliance" + + if verify_md5 $zipfile $md5file ; then + app_loc=$(pwd) + else + wget -c $app_loc/$md5file || die "error downloading $app_loc/$md5file" + wget -c $app_loc/$zipfile || die "error downloading $app_loc/$zipfile" + if verify_md5 $zipfile $md5file ; then + app_loc=$(pwd) + else + die "appliance files not available, aborting" + fi + fi +else + echo "Using local files in $app_loc for appliance" + + if [ -d $app_loc ]; then + if ! verify_md5 $app_loc/$zipfile $app_loc/$md5file ; then + die "appliance files not available, aborting" + fi + elif [ -f $app_loc -a -f $app_loc.md5sum ]; then + if ! verify_md5 $app_loc $app_loc.md5sum ; then + die "appliance files not available, aborting" + fi + fi +fi + +mkdir -p $imgdir + +appdisk=$name-sda.$DISK_FMT +datadisk=$name-sdb.$DISK_FMT + +unzip -o $app_loc/$zipfile $name\* -d $imgdir + +test ! -r $imgdir/$appdisk && die "Disk image not found at $imgdir/$appdisk" +test ! -r $imgdir/$datadisk && die "Disk image not found at $imgdir/$datadisk" + +echo "Appliance Disks installed to $imgdir" +echo "Run create-ovirt-appliance to define and start the appliance" diff --git a/ovirt-appliance-functions b/ovirt-appliance-functions new file mode 100644 index 0000000..218f362 --- /dev/null +++ b/ovirt-appliance-functions @@ -0,0 +1,169 @@ +# -*-Shell-script-*- +# +# Common functions for the oVirt Appliance scripts +# Copyright 2008 Red Hat, Inc. +# Written by Perry Myers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +PATH=$PATH:/sbin:/usr/sbin + +ME=$(basename "$0") +warn() { printf '%s: %s\n' "$ME" "$*" >&2; } +try_h() { printf "Try \`$ME -h' for more information.\n" >&2; } +die() { warn "$@"; try_h; exit 1; } + +IMGDIR_DEFAULT=/var/lib/libvirt/images +NAME_DEFAULT=ovirt-appliance +NET_SCRIPTS=/etc/sysconfig/network-scripts + +BRIDGENAME=ovirtbr0 +NETWORK=192.168.50.0 +NETMASK=255.255.255.0 + +DISK_FMT=qcow2 +OVIRT_URL=http://ovirt.org/download + +imgdir=$IMGDIR_DEFAULT +name=$NAME_DEFAULT + +# first, check to see we are root +if [ $( id -u ) -ne 0 ]; then + die "Must run as root" +fi + +# now make sure the packages we need are installed +if [ -e /etc/redhat-release ]; then + # We rely on RPM deps for this in Red Hat/Fedora systems + CHECK=0 + KVM_BINARY=/usr/bin/qemu-kvm + version=$(rpm -q --qf '%{version}' ovirt-appliance) +elif [ -e /etc/debian_version ]; then + # Works in Ubuntu 8.04. Still needs testing in Debian + PACKAGES="libvirt0 libvirt-bin kvm qemu" + CHECK=$(dpkg -l $PACKAGES &> /dev/null; echo $?) + KVM_BINARY=/usr/bin/kvm + version=LATEST +else + die "Not a supported system" +fi + +if [ $CHECK -ne 0 ]; then + # one of the previous packages wasn't installed; bail out + die "Must have the $PACKAGES packages installed" +fi + +service NetworkManager status > /dev/null 2>&1 \ + && die "NetworkManager is running, disable and use standard network scripts before proceeding" + +service iptables status > /dev/null 2>&1 \ + || service iptables start > /dev/null 2>&1 +chkconfig iptables on + +service libvirtd status > /dev/null 2>&1 \ + || service libvirtd start > /dev/null 2>&1 +chkconfig libvirtd on + +gen_bridge() { + cat << EOF + + $BRIDGENAME + + + + +EOF +} + +gen_fake_managed_node() { + local num=$1 + local last_mac=$(( 54 + $num )) + + echo "Creating fake node$num..." + virsh destroy node$num > /dev/null 2>&1 + virsh undefine node$num > /dev/null 2>&1 + # FIXME: virt-install should be changed to have a --nostart parameter + # that just defines the VM w/o starting it. + virt-install --name=node$num --ram=512 --vcpus=1 \ + --disk path=$imgdir/node${i}-sda.raw,size=.15 \ + --network=bridge:$BRIDGENAME --mac=00:16:3e:12:34:$last_mac \ + --vnc --accelerate --hvm --noautoconsole \ + --os-type=linux --os-variant=fedora9 \ + --force --noreboot --pxe + virsh destroy node$num > /dev/null 2>&1 + # FIXME: virt-install should be changed to allow network boot + # to be a permanent selection + TMPXML=$(mktemp) || exit 1 + virsh dumpxml node$num | sed "s/boot dev='.*'/boot dev='network'/" > $TMPXML + virsh define $TMPXML + rm -f $TMPXML + echo "node$num created" +} + +net_debug() { + # Some output for debugging problems + echo "Currently active bridges:" + echo "-------------------------" + brctl show + echo + echo "Currently defined libvirt networks:" + echo "-----------------------------------" + virsh net-list --all + echo +} + +cleanup_old_apps() { + # Cleanup to handle older version of script that used these domain names + virsh destroy developer + virsh undefine developer + virsh destroy bundled + virsh undefine bundled +} > /dev/null 2>&1 + +cleanup_old_nets() { + # Cleanup to handle older version of script that used these bridge names + virsh net-destroy dummybridge + virsh net-undefine dummybridge + brctl delif eth1bridge eth1 + virsh net-destroy eth1bridge + virsh net-undefine eth1bridge + old_bridge=$(brctl show \ + | awk -v BRIDGENAME=ovirtbr '$1==BRIDGENAME {print $4}') + if [ -n "$old_bridge" ]; then + ifconfig $old_bridge down + fi + brctl delif ovirtbr $old_bridge + virsh net-destroy ovirtbr + virsh net-undefine ovirtbr + sed -i "/# ovirtbr$/d" /etc/rc.d/rc.local +} > /dev/null 2>&1 + +verify_md5() { + local zipfile=$1 + local md5file=$2 + + test ! -f $md5file && { echo "$md5file not found" ; return 1 ; } + test ! -f $zipfile && { echo "$zipfile not found" ; return 1 ; } + + local actual_md5=$(md5sum $zipfile | awk '{print $1}') + local expect_md5=$(awk '{print $1}' $md5file) + + if [ "$actual_md5" = "$expect_md5" ]; then + echo "md5sum verified" + return 0 + else + echo "md5sum failed" + return 1 + fi +} diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks index d7e0892..8801fb7 100644 --- a/ovirt-appliance.ks +++ b/ovirt-appliance.ks @@ -2,7 +2,7 @@ install lang en_US.UTF-8 keyboard us -network --device eth0 --bootproto dhcp +network --device=eth0 --bootproto=static --ip=192.168.50.2 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.50.2 --hostname=management.priv.ovirt.org rootpw --iscrypted Xa8QeYfWrtscM firewall --disabled authconfig --enableshadow --enablemd5 @@ -20,8 +20,6 @@ part swap --ondisk=sda --fstype=swap --size=512 part /mnt/data --ondisk=sdb --fstype=ext3 --size=20000 reboot -network --device=eth1 --bootproto=static --ip=192.168.50.2 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.50.2 --hostname=management.priv.ovirt.org - %include repos.ks %packages --nobase -- 1.6.0.3 From pmyers at redhat.com Sun Nov 9 08:24:07 2008 From: pmyers at redhat.com (Perry Myers) Date: Sun, 9 Nov 2008 03:24:07 -0500 Subject: [Ovirt-devel] [PATCH appliance] Refactor the create-ovirt-appliance script into several scripts Message-ID: <1226219047-16238-1-git-send-email-pmyers@redhat.com> Separated out several independent functions from ovirt-create-appliance: - installing the appliance image from the appliance packaging - creating the appliance in libvirt - creating the fake nodes - setting up the host networking to support running the appliance Along with these changes also made it so that the appliance and fake nodes are created using virt-image from the appliance-creator or from virt-install and changed so that only a single network (ovirtbr0) is required for the appliance and fake nodes. Signed-off-by: Perry Myers --- Makefile.am | 4 + create-ovirt-appliance | 329 ++++---------------------------------------- create-ovirt-network | 139 +++++++++++++++++++ create-ovirt-nodes | 49 +++++++ get-ovirt-appliance | 93 +++++++++++++ ovirt-appliance-functions | 169 +++++++++++++++++++++++ ovirt-appliance.ks | 4 +- ovirt-appliance.spec.in | 9 ++ 8 files changed, 494 insertions(+), 302 deletions(-) create mode 100755 create-ovirt-network create mode 100755 create-ovirt-nodes create mode 100755 get-ovirt-appliance create mode 100644 ovirt-appliance-functions diff --git a/Makefile.am b/Makefile.am index 61df672..f6a9b69 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,6 +30,10 @@ NVR = $(PACKAGE)-$(VERSION)-$(ARCH) EXTRA_DIST = \ .gitignore \ create-$(PACKAGE) \ + create-ovirt-network \ + create-ovirt-nodes \ + get-$(PACKAGE) \ + $(PACKAGE)-functions \ gettree.sh \ $(PACKAGE).ks \ $(PACKAGE).spec \ diff --git a/create-ovirt-appliance b/create-ovirt-appliance index 9454377..3d6fae9 100755 --- a/create-ovirt-appliance +++ b/create-ovirt-appliance @@ -1,44 +1,42 @@ #!/bin/bash - -PATH=$PATH:/sbin:/usr/sbin - -ME=$(basename "$0") -warn() { printf '%s: %s\n' "$ME" "$*" >&2; } -try_h() { printf "Try \`$ME -h' for more information.\n" >&2; } -die() { warn "$@"; try_h; exit 1; } - -RAM=768 - -IMGDIR_DEFAULT=/var/lib/libvirt/images -NAME_DEFAULT=ovirt-appliance -NET_SCRIPTS=/etc/sysconfig/network-scripts -BRIDGENAME=ovirtbr0 -NET_TYPE=network - -NODE_DISK_SIZE=128M -NODE_DISK_FMT=raw - -imgdir=$IMGDIR_DEFAULT -name=$NAME_DEFAULT +# +# Create oVirt Appliance +# Copyright 2008 Red Hat, Inc. +# Written by Perry Myers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +. $(dirname $0)/ovirt-appliance-functions usage() { case $# in 1) warn "$1"; try_h; exit 1;; esac cat < - $name - - - -EOF -} - -gen_fake_managed_node() { - local num=$1 - local disk=$2 - local last_mac=$(( 54 + $num )) - - cat < - node$num - 25ab2490-7c4c-099f-b647-${num}5ff8efa73f6 - 524288 - 524288 - 1 - - hvm - - - - destroy - restart - destroy - - $KVM_BINARY - - - - - - - - - - - - - - - - - - -EOF -} - -gen_app() { - local name=$1 - local disk=$2 - local ram=$3 - - cat< - $name - $(( $ram * 1024 )) - $(( $ram * 1024 )) - 1 - - hvm - - - - destroy - restart - destroy - - $KVM_BINARY - - - - - - - - - - - - - - - - - - - - - - -EOF -} - -net_debug() { - # Some output for debugging problems - echo "Currently active bridges:" - echo "-------------------------" - brctl show - echo - echo "Currently defined libvirt networks:" - echo "-----------------------------------" - virsh net-list --all - echo -} - -# first, check to see we are root -if [ $( id -u ) -ne 0 ]; then - die "Must run as root" -fi - -# now make sure the packages we need are installed -if [ -e /etc/redhat-release ]; then - # We rely on RPM deps for this in Red Hat/Fedora systems - CHECK=0 - KVM_BINARY=/usr/bin/qemu-kvm -elif [ -e /etc/debian_version ]; then - # Works in Ubuntu 8.04. Still needs testing in Debian - PACKAGES="libvirt0 libvirt-bin kvm qemu" - CHECK=$(dpkg -l $PACKAGES &> /dev/null; echo $?) - KVM_BINARY=/usr/bin/kvm -else - die "Not a supported system" -fi - -if [ $CHECK -ne 0 ]; then - # one of the previous packages wasn't installed; bail out - die "Must have the $PACKAGES packages installed" -fi - -service libvirtd status > /dev/null 2>&1 \ - || service libvirtd start > /dev/null 2>&1 -chkconfig libvirtd on - -# Cleanup to handle older version of script that used these bridge names -{ - virsh net-destroy dummybridge - virsh net-undefine dummybridge - brctl delif eth1bridge eth1 - virsh net-destroy eth1bridge - virsh net-undefine eth1bridge - old_bridge=$(brctl show \ - | awk -v BRIDGENAME=ovirtbr '$1==BRIDGENAME {print $4}') - if [ -n "$old_bridge" ]; then - ifconfig $old_bridge down - fi - brctl delif ovirtbr $old_bridge - virsh net-destroy ovirtbr - virsh net-undefine ovirtbr - sed -i "/# ovirtbr$/d" /etc/rc.d/rc.local -} > /dev/null 2>&1 - -net_debug - -# If we're bridging to a physical network, run some checks to make sure the -# choice of physical eth device is sane -if [ -n "$bridge" ]; then - NET_TYPE=bridge - # Check to see if the physical device is present - ifconfig $bridge > /dev/null 2>&1 ; bridge_dev_present=$? - test $bridge_dev_present != 0 \ - && die "$bridge device not present, aborting!" - - # Check to see if the eth device is already tied to a non oVirt bridge - attached_bridge=$(brctl show \ - | awk -v BRIDGE=$bridge '$4~BRIDGE {print $1}') - test -n "$attached_bridge" -a "$attached_bridge" != "$BRIDGENAME" \ - && die "$bridge already attached to other bridge $attached_bridge" - - # Check to make sure that the system is not already using the interface - if test -f $NET_SCRIPTS/ifcfg-$bridge ; then - echo "$NET_SCRIPTS/ifcfg-$bridge is present, are you sure you wish to" - echo "overwrite this file? [y/N]? " - read yesno - - if [ "$yesno" != "y" -a "$yesno" != "Y" ]; then - exit 2 - fi - fi -fi - mkdir -p $imgdir -# define the fake managed nodes we will use. -for i in `seq 3 5` ; do - imgname="node${i}.img" - if [ ! -f $imgdir/$imgname ]; then - qemu-img create -f $NODE_DISK_FMT $imgdir/$imgname $NODE_DISK_SIZE - fi - virsh destroy node$i >& /dev/null - virsh undefine node$i >& /dev/null - TMPXML=$(mktemp) - gen_fake_managed_node $i $imgdir/$imgname > $TMPXML - virsh define $TMPXML - rm $TMPXML -done - -# Remove old bridge device if it exists -sed -i "/# $BRIDGENAME/d" /etc/rc.d/rc.local -old_bridge=$(brctl show \ - | awk -v BRIDGENAME=$BRIDGENAME '$1==BRIDGENAME {print $4}') -if [ -n "$old_bridge" ]; then - echo "Removing old bridge $old_bridge" - ifconfig $old_bridge down - brctl delif $BRIDGENAME $old_bridge - rm -f $NET_SCRIPTS/ifcfg-$old_bridge -fi - -{ -echo "Removing $BRIDGENAME" -virsh net-destroy $BRIDGENAME -virsh net-undefine $BRIDGENAME -ifconfig $BRIDGENAME down -brctl delbr $BRIDGENAME -rm -fv $NET_SCRIPTS/ifcfg-$BRIDGENAME -echo "Done Removing $BRIDGENAME" -} 2> /dev/null - -if [ -n "$bridge" ]; then - # real external bridge, use distro networking scripts - ifconfig $bridge down 2> /dev/null - TMPAUG=$(mktemp) || exit 1 - cat > $TMPAUG < $TMPXML - virsh net-define $TMPXML - rm $TMPXML - virsh net-start $BRIDGENAME - virsh net-autostart $BRIDGENAME -fi - -net_debug - -# Cleanup to handle older version of script that used these domain names -{ - virsh destroy developer - virsh undefine developer - virsh destroy bundled - virsh undefine bundled -} > /dev/null 2>&1 +appdisk=$name-sda.$DISK_FMT +datadisk=$name-sdb.$DISK_FMT -imgname=$name.img -test ! -r $imgdir/$imgname && die "Disk image not found at $imgdir/$imgname" +test ! -r $imgdir/$appdisk && die "Disk image not found at $imgdir/$appdisk" +test ! -r $imgdir/$datadisk && die "Disk image not found at $imgdir/$datadisk" virsh destroy $name > /dev/null 2>&1 virsh undefine $name > /dev/null 2>&1 -TMPXML=$(mktemp) || exit 1 -# FIXME virt-image to define the appliance instance -gen_app $name $imgdir/$imgname $RAM > $TMPXML -virsh define $TMPXML -rm $TMPXML -echo "Application defined using disk located at $imgdir/$imgname." -echo "Run virsh start $name to start the appliance" +virt-image -b $BRIDGENAME $imgdir/$name.xml +test $console = 1 && virsh console $name diff --git a/create-ovirt-network b/create-ovirt-network new file mode 100755 index 0000000..a8c67c7 --- /dev/null +++ b/create-ovirt-network @@ -0,0 +1,139 @@ +#!/bin/bash + +. $(dirname $0)/ovirt-appliance-functions + +usage() { + case $# in 1) warn "$1"; try_h; exit 1;; esac + cat < /dev/null 2>&1 ; bridge_dev_present=$? + test $bridge_dev_present != 0 \ + && die "$bridge device not present, aborting!" + + # Check to see if the eth device is already tied to a non oVirt bridge + attached_bridge=$(brctl show \ + | awk -v BRIDGE=$bridge '$4~BRIDGE {print $1}') + test -n "$attached_bridge" -a "$attached_bridge" != "$BRIDGENAME" \ + && die "$bridge already attached to other bridge $attached_bridge" + + # Check to make sure that the system is not already using the interface + if test -f $NET_SCRIPTS/ifcfg-$bridge ; then + echo "$NET_SCRIPTS/ifcfg-$bridge is present, are you sure you wish to" + echo "overwrite this file? [y/N]? " + read yesno + + if [ "$yesno" != "y" -a "$yesno" != "Y" ]; then + exit 2 + fi + fi +fi + +# Remove old bridge device if it exists +sed -i "/# $BRIDGENAME/d" /etc/rc.d/rc.local +old_bridge=$(brctl show \ + | awk -v BRIDGENAME=$BRIDGENAME '$1==BRIDGENAME {print $4}') +if [ -n "$old_bridge" ]; then + echo "Removing old bridge $old_bridge" + ifconfig $old_bridge down + brctl delif $BRIDGENAME $old_bridge + rm -f $NET_SCRIPTS/ifcfg-$old_bridge +fi + +{ +echo "Removing $BRIDGENAME" +virsh net-destroy $BRIDGENAME +virsh net-undefine $BRIDGENAME +ifconfig $BRIDGENAME down +brctl delbr $BRIDGENAME +rm -fv $NET_SCRIPTS/ifcfg-$BRIDGENAME +rm -fv /etc/sysconfig/iptables-$BRIDGENAME-filter +rm -fv /etc/sysconfig/iptables-$BRIDGENAME-nat +sed -i "/iptables-$BRIDGENAME/d" /etc/sysconfig/system-config-firewall +lokkit --update +echo "Done Removing $BRIDGENAME" +} 2> /dev/null + +if [ -n "$bridge" ]; then + # real external bridge, use distro networking scripts + ifconfig $bridge down 2> /dev/null + TMPAUG=$(mktemp) || exit 1 + cat > $TMPAUG < /etc/sysconfig/iptables-$BRIDGENAME-filter < /etc/sysconfig/iptables-$BRIDGENAME-nat < $TMPXML + virsh net-define $TMPXML + rm $TMPXML + virsh net-start $BRIDGENAME + virsh net-autostart $BRIDGENAME +fi + +# Set up dnsmasq on $BRIDGENAME just for DNS forwarding +cat < /etc/dnsmasq.d/$BRIDGENAME.conf +bind-interfaces +interface=$BRIDGENAME +except-interface=lo +EOF +chkconfig dnsmasq on +service dnsmasq restart + +net_debug diff --git a/create-ovirt-nodes b/create-ovirt-nodes new file mode 100755 index 0000000..89ad7ad --- /dev/null +++ b/create-ovirt-nodes @@ -0,0 +1,49 @@ +#!/bin/bash +# +# Create fake oVirt Nodes that PXE boot to the Appliance Server +# Copyright 2008 Red Hat, Inc. +# Written by Perry Myers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +. $(dirname $0)/ovirt-appliance-functions + +usage() { + case $# in 1) warn "$1"; try_h; exit 1;; esac + cat < +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +. $(dirname $0)/ovirt-appliance-functions + +usage() { + case $# in 1) warn "$1"; try_h; exit 1;; esac + cat < /dev/null 2>&1 ; then + echo "Using http at $app_loc to retrieve appliance" + + if verify_md5 $zipfile $md5file ; then + app_loc=$(pwd) + else + wget -c $app_loc/$md5file || die "error downloading $app_loc/$md5file" + wget -c $app_loc/$zipfile || die "error downloading $app_loc/$zipfile" + if verify_md5 $zipfile $md5file ; then + app_loc=$(pwd) + else + die "appliance files not available, aborting" + fi + fi +else + echo "Using local files in $app_loc for appliance" + + if [ -d $app_loc ]; then + if ! verify_md5 $app_loc/$zipfile $app_loc/$md5file ; then + die "appliance files not available, aborting" + fi + elif [ -f $app_loc -a -f $app_loc.md5sum ]; then + if ! verify_md5 $app_loc $app_loc.md5sum ; then + die "appliance files not available, aborting" + fi + fi +fi + +mkdir -p $imgdir + +appdisk=$name-sda.$DISK_FMT +datadisk=$name-sdb.$DISK_FMT + +unzip -o $app_loc/$zipfile $name\* -d $imgdir + +test ! -r $imgdir/$appdisk && die "Disk image not found at $imgdir/$appdisk" +test ! -r $imgdir/$datadisk && die "Disk image not found at $imgdir/$datadisk" + +echo "Appliance Disks installed to $imgdir" +echo "Run create-ovirt-appliance to define and start the appliance" diff --git a/ovirt-appliance-functions b/ovirt-appliance-functions new file mode 100644 index 0000000..218f362 --- /dev/null +++ b/ovirt-appliance-functions @@ -0,0 +1,169 @@ +# -*-Shell-script-*- +# +# Common functions for the oVirt Appliance scripts +# Copyright 2008 Red Hat, Inc. +# Written by Perry Myers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +PATH=$PATH:/sbin:/usr/sbin + +ME=$(basename "$0") +warn() { printf '%s: %s\n' "$ME" "$*" >&2; } +try_h() { printf "Try \`$ME -h' for more information.\n" >&2; } +die() { warn "$@"; try_h; exit 1; } + +IMGDIR_DEFAULT=/var/lib/libvirt/images +NAME_DEFAULT=ovirt-appliance +NET_SCRIPTS=/etc/sysconfig/network-scripts + +BRIDGENAME=ovirtbr0 +NETWORK=192.168.50.0 +NETMASK=255.255.255.0 + +DISK_FMT=qcow2 +OVIRT_URL=http://ovirt.org/download + +imgdir=$IMGDIR_DEFAULT +name=$NAME_DEFAULT + +# first, check to see we are root +if [ $( id -u ) -ne 0 ]; then + die "Must run as root" +fi + +# now make sure the packages we need are installed +if [ -e /etc/redhat-release ]; then + # We rely on RPM deps for this in Red Hat/Fedora systems + CHECK=0 + KVM_BINARY=/usr/bin/qemu-kvm + version=$(rpm -q --qf '%{version}' ovirt-appliance) +elif [ -e /etc/debian_version ]; then + # Works in Ubuntu 8.04. Still needs testing in Debian + PACKAGES="libvirt0 libvirt-bin kvm qemu" + CHECK=$(dpkg -l $PACKAGES &> /dev/null; echo $?) + KVM_BINARY=/usr/bin/kvm + version=LATEST +else + die "Not a supported system" +fi + +if [ $CHECK -ne 0 ]; then + # one of the previous packages wasn't installed; bail out + die "Must have the $PACKAGES packages installed" +fi + +service NetworkManager status > /dev/null 2>&1 \ + && die "NetworkManager is running, disable and use standard network scripts before proceeding" + +service iptables status > /dev/null 2>&1 \ + || service iptables start > /dev/null 2>&1 +chkconfig iptables on + +service libvirtd status > /dev/null 2>&1 \ + || service libvirtd start > /dev/null 2>&1 +chkconfig libvirtd on + +gen_bridge() { + cat << EOF + + $BRIDGENAME + + + + +EOF +} + +gen_fake_managed_node() { + local num=$1 + local last_mac=$(( 54 + $num )) + + echo "Creating fake node$num..." + virsh destroy node$num > /dev/null 2>&1 + virsh undefine node$num > /dev/null 2>&1 + # FIXME: virt-install should be changed to have a --nostart parameter + # that just defines the VM w/o starting it. + virt-install --name=node$num --ram=512 --vcpus=1 \ + --disk path=$imgdir/node${i}-sda.raw,size=.15 \ + --network=bridge:$BRIDGENAME --mac=00:16:3e:12:34:$last_mac \ + --vnc --accelerate --hvm --noautoconsole \ + --os-type=linux --os-variant=fedora9 \ + --force --noreboot --pxe + virsh destroy node$num > /dev/null 2>&1 + # FIXME: virt-install should be changed to allow network boot + # to be a permanent selection + TMPXML=$(mktemp) || exit 1 + virsh dumpxml node$num | sed "s/boot dev='.*'/boot dev='network'/" > $TMPXML + virsh define $TMPXML + rm -f $TMPXML + echo "node$num created" +} + +net_debug() { + # Some output for debugging problems + echo "Currently active bridges:" + echo "-------------------------" + brctl show + echo + echo "Currently defined libvirt networks:" + echo "-----------------------------------" + virsh net-list --all + echo +} + +cleanup_old_apps() { + # Cleanup to handle older version of script that used these domain names + virsh destroy developer + virsh undefine developer + virsh destroy bundled + virsh undefine bundled +} > /dev/null 2>&1 + +cleanup_old_nets() { + # Cleanup to handle older version of script that used these bridge names + virsh net-destroy dummybridge + virsh net-undefine dummybridge + brctl delif eth1bridge eth1 + virsh net-destroy eth1bridge + virsh net-undefine eth1bridge + old_bridge=$(brctl show \ + | awk -v BRIDGENAME=ovirtbr '$1==BRIDGENAME {print $4}') + if [ -n "$old_bridge" ]; then + ifconfig $old_bridge down + fi + brctl delif ovirtbr $old_bridge + virsh net-destroy ovirtbr + virsh net-undefine ovirtbr + sed -i "/# ovirtbr$/d" /etc/rc.d/rc.local +} > /dev/null 2>&1 + +verify_md5() { + local zipfile=$1 + local md5file=$2 + + test ! -f $md5file && { echo "$md5file not found" ; return 1 ; } + test ! -f $zipfile && { echo "$zipfile not found" ; return 1 ; } + + local actual_md5=$(md5sum $zipfile | awk '{print $1}') + local expect_md5=$(awk '{print $1}' $md5file) + + if [ "$actual_md5" = "$expect_md5" ]; then + echo "md5sum verified" + return 0 + else + echo "md5sum failed" + return 1 + fi +} diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks index d7e0892..8801fb7 100644 --- a/ovirt-appliance.ks +++ b/ovirt-appliance.ks @@ -2,7 +2,7 @@ install lang en_US.UTF-8 keyboard us -network --device eth0 --bootproto dhcp +network --device=eth0 --bootproto=static --ip=192.168.50.2 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.50.2 --hostname=management.priv.ovirt.org rootpw --iscrypted Xa8QeYfWrtscM firewall --disabled authconfig --enableshadow --enablemd5 @@ -20,8 +20,6 @@ part swap --ondisk=sda --fstype=swap --size=512 part /mnt/data --ondisk=sdb --fstype=ext3 --size=20000 reboot -network --device=eth1 --bootproto=static --ip=192.168.50.2 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.50.2 --hostname=management.priv.ovirt.org - %include repos.ks %packages --nobase diff --git a/ovirt-appliance.spec.in b/ovirt-appliance.spec.in index c35530b..191fc2d 100644 --- a/ovirt-appliance.spec.in +++ b/ovirt-appliance.spec.in @@ -37,6 +37,10 @@ mkdir %{buildroot} %{__install} -p -m0644 COPYING %{buildroot}%{app_root} %{__install} -d -m0755 %{buildroot}%{_sbindir} %{__install} -p -m0755 create-%{name} %{buildroot}%{_sbindir} +%{__install} -p -m0755 create-ovirt-network %{buildroot}%{_sbindir} +%{__install} -p -m0755 create-ovirt-nodes %{buildroot}%{_sbindir} +%{__install} -p -m0755 get-%{name} %{buildroot}%{_sbindir} +%{__install} -p -m0644 %{name}-functions %{buildroot}%{_sbindir} %clean %{__rm} -rf %{buildroot} @@ -46,6 +50,11 @@ mkdir %{buildroot} %{app_root}/COPYING %defattr(-,root,root,0755) %{_sbindir}/create-%{name} +%{_sbindir}/create-ovirt-network +%{_sbindir}/create-ovirt-nodes +%{_sbindir}/get-%{name} +%defattr(-,root,root,0644) +%{_sbindir}/%{name}-functions %changelog * Wed Nov 05 2008 Perry Myers 0.96 -- 1.6.0.3 From dpierce at redhat.com Mon Nov 10 14:01:38 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Mon, 10 Nov 2008 09:01:38 -0500 Subject: [Ovirt-devel] [PATCH node] Added a script that runs during first boot for the node. Message-ID: <1226325698-4569-1-git-send-email-dpierce@redhat.com> Each configuration function is stubbed out. The functions are: * configure logging * configure networking * configure password * configure storage Signed-off-by: Darryl L. Pierce --- Makefile.am | 6 ++++ ovirt-node.spec.in | 15 +++++++++- scripts/ovirt-config-logging | 2 + scripts/ovirt-config-networking | 2 + scripts/ovirt-config-password | 2 + scripts/ovirt-config-setup | 23 ++++++++++++++++ scripts/ovirt-config-storage | 2 + scripts/ovirt-firstboot | 56 +++++++++++++++++++++++++++++++++++++++ 8 files changed, 107 insertions(+), 1 deletions(-) create mode 100755 scripts/ovirt-config-logging create mode 100755 scripts/ovirt-config-networking create mode 100755 scripts/ovirt-config-password create mode 100755 scripts/ovirt-config-setup create mode 100755 scripts/ovirt-config-storage create mode 100755 scripts/ovirt-firstboot diff --git a/Makefile.am b/Makefile.am index 4ba0bca..ea49b43 100644 --- a/Makefile.am +++ b/Makefile.am @@ -27,7 +27,13 @@ EXTRA_DIST = \ scripts/collectd.conf.in \ scripts/ovirt \ scripts/ovirt-awake \ + scripts/ovirt-config-logging \ + scripts/ovirt-config-networking \ + scripts/ovirt-config-password \ + scripts/ovirt-config-setup \ + scripts/ovirt-config-storage \ scripts/ovirt-early \ + scripts/ovirt-firstboot \ scripts/ovirt-functions \ scripts/ovirt-post \ scripts/ovirt-process-config \ diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index d029c57..2a01b7c 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -87,6 +87,11 @@ cd - %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/logrotate.d %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-logging %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-networking %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-password %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-setup %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-storage %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-process-config %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-identify-node/ovirt-identify-node %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-listen-awake/ovirt-listen-awake %{buildroot}%{_sbindir} @@ -94,9 +99,9 @@ cd - %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-install-node %{buildroot}%{_sbindir} %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-uninstall-node %{buildroot}%{_sbindir} - %{__install} -p -m0644 scripts/ovirt-functions %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-early %{buildroot}%{_initrddir} +%{__install} -p -m0755 scripts/ovirt-firstboot %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-post %{buildroot}%{_initrddir} @@ -123,6 +128,7 @@ cd - %post /sbin/chkconfig --add ovirt-early +/sbin/chkconfig --add ovirt-firstboot /sbin/chkconfig --add ovirt /sbin/chkconfig --add ovirt-post # this is ugly; we need collectd to start *after* libvirtd, so we own the @@ -133,6 +139,7 @@ cd - %preun if [ "$1" = 0 ] ; then /sbin/chkconfig --del ovirt-early + /sbin/chkconfig --del ovirt-firstboot /sbin/chkconfig --del ovirt /sbin/chkconfig --del ovirt-post /sbin/chkconfig --del ovirt-listen-awake @@ -159,12 +166,18 @@ fi %files %defattr(-,root,root,0755) %{_sbindir}/ovirt-awake +%{_sbindir}/ovirt-config-logging +%{_sbindir}/ovirt-config-networking +%{_sbindir}/ovirt-config-password +%{_sbindir}/ovirt-config-setup +%{_sbindir}/ovirt-config-storage %{_sbindir}/ovirt-process-config %{_sbindir}/ovirt-identify-node %{_sbindir}/ovirt-listen-awake %{_sbindir}/ovirt-install-node %{_sbindir}/ovirt-uninstall-node %{_initrddir}/ovirt-early +%{_initrddir}/ovirt-firstboot %{_initrddir}/ovirt %{_initrddir}/ovirt-post %{_initrddir}/ovirt-listen-awake diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging new file mode 100755 index 0000000..c856ef1 --- /dev/null +++ b/scripts/ovirt-config-logging @@ -0,0 +1,2 @@ +#!/bin/bash +# diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking new file mode 100755 index 0000000..c856ef1 --- /dev/null +++ b/scripts/ovirt-config-networking @@ -0,0 +1,2 @@ +#!/bin/bash +# diff --git a/scripts/ovirt-config-password b/scripts/ovirt-config-password new file mode 100755 index 0000000..c856ef1 --- /dev/null +++ b/scripts/ovirt-config-password @@ -0,0 +1,2 @@ +#!/bin/bash +# diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup new file mode 100755 index 0000000..8408d14 --- /dev/null +++ b/scripts/ovirt-config-setup @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Entry point for configuring an oVirt node when running in standalone mode. + +while true; do + PS3="Please select an option: " + # TODO should we make this optional, based on whether the password was already set? + PASSWORD_OPTION="Password" + OPTIONS="Networking Storage Logging ${PASSWORD_OPTION} Quit" + + select OPTION in $OPTIONS + do + printf "\n" + + case "$OPTION" in + "Networking") ovirt-config-networking ; break ;; + "Storage") ovirt-config-storage ; break ;; + "Logging") ovirt-config-logging ; break ;; + "Password") ovirt-config-password ; break ;; + "Quit") exit 0 ;; + esac + done +done diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage new file mode 100755 index 0000000..c856ef1 --- /dev/null +++ b/scripts/ovirt-config-storage @@ -0,0 +1,2 @@ +#!/bin/bash +# diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot new file mode 100755 index 0000000..cb58dab --- /dev/null +++ b/scripts/ovirt-firstboot @@ -0,0 +1,56 @@ +#!/bin/bash +# +# ovirt-firstboot Puts the node into configuration mode. +# +# chkconfig: 2345 99 01 +# description: ovirt-firstboot node configuration script +# +# Copyright (C) 2008 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. + +## Source functions library +. /etc/init.d/functions +. /etc/init.d/ovirt-functions + +start () +{ + ovirt-config-setup +} + +case "$1" in + start) + #is_firstboot + #if [ $? -ne 0 ]; then + # exit 0 + #fi + + printf "Starting ovirt-firstboot: " + + { + start + } + + test $? == 0 && success || failure + echo + ;; + + *) + echo "Usage: ovirt-firstboot {start}" + exit 2 +esac + -- 1.5.6.5 From apevec at redhat.com Mon Nov 10 14:16:18 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 10 Nov 2008 15:16:18 +0100 Subject: [Ovirt-devel] Re: [PATCH appliance] Move appliance creation out of spec file to Makefile In-Reply-To: <1226216952-15907-1-git-send-email-pmyers@redhat.com> References: <1226216952-15907-1-git-send-email-pmyers@redhat.com> Message-ID: <49184232.3040602@redhat.com> Perry Myers wrote: > -ln -s %{ovirt_cache_dir}/appliance-tmp tmp > + ln -s $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp tmp ln -snf ... otherwise it fails 2nd time prolly not worth optimizing, but due to tmpdir name change (appliance-tmp -> ovirt-appliance-tmp) Fedora image will be re-downloaded ( ~100MB ) > -sudo su - -c "cd $(pwd) && appliance-creator --config ovirt-appliance.ks \ > + sudo -E appliance-creator --config $(PACKAGE).ks \ appliance-creator assumes grub in PATH, so this fails when installing grub. Until appliance-tools is fixed, workaround could be to modify PATH before running sudo From pmyers at redhat.com Mon Nov 10 14:24:37 2008 From: pmyers at redhat.com (Perry Myers) Date: Mon, 10 Nov 2008 09:24:37 -0500 Subject: [Ovirt-devel] Re: [PATCH appliance] Move appliance creation out of spec file to Makefile In-Reply-To: <49184232.3040602@redhat.com> References: <1226216952-15907-1-git-send-email-pmyers@redhat.com> <49184232.3040602@redhat.com> Message-ID: <49184425.5040708@redhat.com> Alan Pevec wrote: > Perry Myers wrote: >> -ln -s %{ovirt_cache_dir}/appliance-tmp tmp >> + ln -s $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp tmp > > ln -snf ... otherwise it fails 2nd time I stole that from your Makefile in ovirt-node :) So it'll need to be fixed there as well. > prolly not worth optimizing, but due to tmpdir name change > (appliance-tmp -> ovirt-appliance-tmp) Fedora image will be > re-downloaded ( ~100MB ) Yeah, it's a one time thing. And if someone is concerned they can just move appliance-tmp to ovirt-appliance-tmp. > >> -sudo su - -c "cd $(pwd) && appliance-creator --config >> ovirt-appliance.ks \ >> + sudo -E appliance-creator --config $(PACKAGE).ks \ > > appliance-creator assumes grub in PATH, so this fails when installing > grub. Until appliance-tools is fixed, workaround could be to modify PATH > before running sudo > Odd, I didn't have any problems with this. Probably because I have /sbin in my build user's path. I'll add PATH setting to the Makefile to fix this. Perry -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=| From bkearney at redhat.com Mon Nov 10 14:46:25 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Mon, 10 Nov 2008 09:46:25 -0500 Subject: [Ovirt-devel] [PATCH node] RSyslog configuration for standalone mode. Message-ID: <1226328385-20013-1-git-send-email-bkearney@redhat.com> It looks for a DNS service locator record by default, and lets the user override if desired. Supports setting the maximum log file size. Includes comments from Alan Pevec and Jim Meyering. --- scripts/ovirt-config-logging | 143 ++++++++++++++++++++++++++++++++++++++++++ scripts/ovirt-config-setup | 2 + 2 files changed, 145 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging index 8b13789..fb5f96e 100755 --- a/scripts/ovirt-config-logging +++ b/scripts/ovirt-config-logging @@ -1 +1,144 @@ +#!/bin/bash +# +# Configures the rsyslog daemon. +# Source functions library +. /etc/init.d/functions +. /etc/init.d/ovirt-functions + + +RSYSLOG_FILE="/etc/rsyslog.conf" + +# Creates the rsyslog file based on the following inputs +# $1 ipaddress of remote syslog server +# $2 port of remote syslog server +# $3 protocol (tcp or udp) +function ovirt_rsyslog { + +if [[ "$3" = "tcp" ]]; then + DELIM="@@" +else + DELIM="@" +fi + +cat > $RSYSLOG_FILE << EOF +#ovirt rsyslog config file + +#### MODULES #### +\$ModLoad imuxsock.so # provides support for local system logging (e.g. via logger command) +\$ModLoad imklog.so # provides kernel logging support (previously done by rklogd) + +#### GLOBAL DIRECTIVES #### +# Use default timestamp format +\$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +#### RULES #### +# Log anything (except mail) of level info or higher. +# Don't log private authentication messages! +*.info;mail.none;authpriv.none;cron.none /var/log/messages + +# The authpriv file has restricted access. +authpriv.* /var/log/secure + +# Log all the mail messages in one place. +mail.* -/var/log/maillog + +# Log cron stuff +cron.* /var/log/cron + +# Everybody gets emergency messages +*.emerg * + +# Save news errors of level crit and higher in a special file. +uucp,news.crit /var/log/spooler + +# Save boot messages also to boot.log +local7.* /var/log/boot.log + +\$WorkDirectory /var/spool/rsyslog +\$ActionQueueFileName ovirtNode +\$ActionQueueMaxDiskSpace 10m +\$ActionQueueSaveOnShutdown on +\$ActionQueueType LinkedList +\$ActionResumeRetryCount -1 +*.* $DELIM$1:$2 +EOF + +/sbin/service rsyslog restart +} + +function prompt_user { + while true ; do + MAX_LOG_SIZE="10k" + printf "\nWhat is the max size for log files on this machine [10k]? " + read + if [[ "$REPLY" != "" ]]; then + MAX_LOG_SIZE=$REPLY + fi + printf "\nWhat is the IP address or server name for the syslog server? " + read + SYSLOG_SERVER_IP=$REPLY + printf "\nWhat port does the syslog daemon run on? " + read + if [[ "$REPLY" =~ '^[0-9]+$' ]]; then + SYSLOG_SERVER_PORT=$REPLY + + PROTOCOLS="tcp udp" + PS3="Please select the protocol to use: " + select SYSLOG_SERVER_PROTOCOL in $PROTOCOLS; + do + case $SYSLOG_SERVER_PROTOCOL in + "tcp") + break ;; + "udp") + break;; + esac + done + + printf "\n" + printf "\nLogging will be configured as follows:" + printf "\n======================================" + printf "\n Max Logfile Size: $MAX_LOG_SIZE" + printf "\n Remote Server: $SYSLOG_SERVER_IP" + printf "\n Remote Port: $SYSLOG_SERVER_PORT" + printf "\n Logging Protocol: $SYSLOG_SERVER_PROTOCOL" + printf "\n" + printf "\nPlease confirm these changes (Y/N)" + read + case $REPLY in + Y|y) + ovirt_rsyslog $SYSLOG_SERVER_IP \ + $SYSLOG_SERVER_PORT \ + $SYSLOG_SERVER_PROTOCOL + sed -i -e "s/^size=.*/size=$MAX_LOG_SIZE/" \ + /etc/logrotate.d/ovirt-logrotate.conf + break + ;; + N|n) + printf "Discarding settings\n" + break + ;; + esac + else + printf "Invalid port number\n" + fi + done + +} + +# check if we were called to attempt to default +# to remote logging +if [[ "$1" = "default" ]] ; then + printf "\nAttempting to locate remote syslog server..." + find_srv syslog udp + if [[ "$SRV_PORT" != "" ]] && [[ "$SRV_SERVER" != "" ]] ; then + printf "found! Useing server '$DEFAULT_SERVER:$DEFAULT_PORT'.\n" + ovirt_rsyslog $DEFAULT_SERVER $DEFAULT_PORT "udp" + else + printf "not found!\n" + fi +else + prompt_user +fi + +exit 0 diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup index 8408d14..5850aa8 100755 --- a/scripts/ovirt-config-setup +++ b/scripts/ovirt-config-setup @@ -2,6 +2,8 @@ # # Entry point for configuring an oVirt node when running in standalone mode. +#Attempt to default the syslog setting +ovirt-config-logging "default" while true; do PS3="Please select an option: " # TODO should we make this optional, based on whether the password was already set? -- 1.5.6.5 From dhuff at redhat.com Mon Nov 10 14:51:17 2008 From: dhuff at redhat.com (David Huff) Date: Mon, 10 Nov 2008 09:51:17 -0500 Subject: [Ovirt-devel] Re: [PATCH appliance] Move appliance creation out of spec file to Makefile In-Reply-To: <49184425.5040708@redhat.com> References: <1226216952-15907-1-git-send-email-pmyers@redhat.com> <49184232.3040602@redhat.com> <49184425.5040708@redhat.com> Message-ID: <49184A65.7020803@redhat.com> Perry Myers wrote: > Alan Pevec wrote: >> Perry Myers wrote: >>> -ln -s %{ovirt_cache_dir}/appliance-tmp tmp >>> + ln -s $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp tmp >> >> ln -snf ... otherwise it fails 2nd time > > I stole that from your Makefile in ovirt-node :) So it'll need to be > fixed there as well. > >> prolly not worth optimizing, but due to tmpdir name change >> (appliance-tmp -> ovirt-appliance-tmp) Fedora image will be >> re-downloaded ( ~100MB ) > > Yeah, it's a one time thing. And if someone is concerned they can just > move appliance-tmp to ovirt-appliance-tmp. > >> >>> -sudo su - -c "cd $(pwd) && appliance-creator --config >>> ovirt-appliance.ks \ >>> + sudo -E appliance-creator --config $(PACKAGE).ks \ >> >> appliance-creator assumes grub in PATH, so this fails when installing >> grub. Until appliance-tools is fixed, workaround could be to modify >> PATH before running sudo >> > > Odd, I didn't have any problems with this. Probably because I have > /sbin in my build user's path. I'll add PATH setting to the Makefile to > fix this. > > Perry > This issues is only on a F9 build systems. In F-10 they added sbin to the standard users path. -D From pmyers at redhat.com Mon Nov 10 15:10:21 2008 From: pmyers at redhat.com (Perry Myers) Date: Mon, 10 Nov 2008 10:10:21 -0500 Subject: [Ovirt-devel] [PATCH appliance] Move appliance creation out of spec file to Makefile In-Reply-To: <--thread> References: <--thread> Message-ID: <1226329821-19972-1-git-send-email-pmyers@redhat.com> The appliance-creator RPM is now just used to store the create-ovirt-appliance script and contains dependencies for installing and running the appliance. The appliance is also modified to be packaged in zip format. Qcow2 format for the disks is used until appliance-tools support tar. Signed-off-by: Perry Myers --- Makefile.am | 105 ++++++++++++++++++++++++++++++++++++++++------- ovirt-appliance.spec.in | 70 ++----------------------------- 2 files changed, 95 insertions(+), 80 deletions(-) diff --git a/Makefile.am b/Makefile.am index b464da0..add3f79 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,16 +16,28 @@ # also available at http://www.gnu.org/copyleft/gpl.html. OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache +OVIRT_LOCAL_REPO ?= file://$(OVIRT_CACHE_DIR)/ovirt +OVIRT_URL ?= http://ovirt.org/repos/ovirt +THINCRUST_URL ?= http://thincrust.org/repo +PKG_FMT = zip +DISK_FMT ?= qcow2 + +FEDORA = $(shell rpm --eval '%{fedora}') +ARCH = $(shell rpm --eval '%{_arch}') + +NVR = $(PACKAGE)-$(VERSION)-$(ARCH) EXTRA_DIST = \ .gitignore \ - create-ovirt-appliance \ + create-$(PACKAGE) \ gettree.sh \ - ovirt-appliance.ks \ - ovirt-appliance.spec \ - ovirt-appliance.spec.in + $(PACKAGE).ks \ + $(PACKAGE).spec \ + $(PACKAGE).spec.in -DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz +DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz \ + $(NVR).$(PKG_FMT) \ + $(NVR).$(PKG_FMT).md5sum # For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT- # annotated rpm version strings. @@ -38,15 +50,78 @@ GIT_RELEASE = $$(date --utc +%Y%m%d%H%M%S)git$(git_head) RPMDIR = $$(rpm --eval '%{_rpmdir}') RPM_FLAGS = --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)" RPM_FLAGS += $(if $(_ovirt_dev),--define "extra_release .$(GIT_RELEASE)") -# FEDORA_URL env var can be set to the root of a fedora mirror -RPM_FLAGS += $(if $(FEDORA_URL),--define "fedora_url $(FEDORA_URL)") -# OVIRT_URL env var can be set to the root of an ovirt.org mirror -RPM_FLAGS += $(if $(OVIRT_URL),--define "ovirt_url $(OVIRT_URL)") -# THINCRUST_URL env var can be set to the root of an thincrust.net mirror -# FIXME: This is temporary until thincrust RPMS are in Fedora 9 Updates -RPM_FLAGS += $(if $(THINCRUST_URL),--define "thincrust_url $(THINCRUST_URL)") - -rpms: dist + +FEDORA_MIRROR = http://mirrors.fedoraproject.org/mirrorlist +FEDORA_URL_DEF = http://download.fedoraproject.org/pub/fedora/linux +CUR_RAWHIDE = 10 + +repos.ks: + ( \ + if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \ + FEDORA_REPO=rawhide ;\ + FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/development/$(ARCH)/os,--mirrorlist=$(FEDORA_MIRROR)?repo=rawhide&arch=$(ARCH))" ;\ + OVIRT_DISTRO=development ;\ + else \ + FEDORA_REPO=f$(FEDORA) ;\ + FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/$(ARCH)/os,--mirrorlist=$(FEDORA_MIRROR)?repo=fedora-$(FEDORA)&arch=$(ARCH))" ;\ + OVIRT_DISTRO=$(FEDORA) ;\ + UPDATE_REPO_LINE="repo --name=$${FEDORA_REPO}-updates-newkey $(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/updates/$(FEDORA)/$(ARCH).newkey,--mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-f$(FEDORA).newkey&arch=$(ARCH))" ;\ + fi ;\ + echo "repo --name=$${FEDORA_REPO} $${FEDORA_REPO_LOC}" > $@ ;\ + echo "repo --name=ovirt-org --baseurl=$(OVIRT_URL)/$${OVIRT_DISTRO}/$(ARCH)" >> $@ ;\ + echo "repo --name=thincrust-org --baseurl=$(THINCRUST_URL)/noarch" >> $@ ;\ + echo "$${UPDATE_REPO_LINE}" >> $@ ;\ + echo "repo --name=ovirt-local --baseurl=$(OVIRT_LOCAL_REPO)" >> $@ \ + ) + +SELINUX_ENFORCING=$(shell /usr/sbin/getenforce) +$(NVR).$(PKG_FMT): repos.ks + mkdir -p $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree + mkdir -p $(OVIRT_CACHE_DIR)/yum + ( \ + case $(SELINUX_ENFORCING) in \ + Enforcing) sudo /usr/sbin/setenforce Permissive ;; \ + Permissive) ;; \ + *) if ksflatten $(PACKAGE).ks 2>/dev/null \ + | grep -q '^selinux --disabled'; then \ + echo WARNING: SELinux disabled in kickstart ;\ + else \ + echo ERROR: SELinux enabled in kickstart, \ + but disabled on the build machine ;\ + exit 1 ;\ + fi ;; \ + esac ;\ + if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \ + FEDORA_TREE_URL="$(if $(FEDORA_URL),$(FEDORA_URL)/development/$(ARCH)/os,$(FEDORA_URL_DEF)/development/$(ARCH)/os)" ;\ + else \ + FEDORA_TREE_URL="$(if $(FEDORA_URL),$(FEDORA_URL)/releases/$(FEDORA)/Fedora/$(ARCH)/os,$(FEDORA_URL_DEF)/releases/$(FEDORA)/Fedora/$(ARCH)/os)" ;\ + fi ;\ + ./gettree.sh $${FEDORA_TREE_URL} $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree ;\ + ) + + ln -snf $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp tmp + sudo su - -c "cd $(PWD) && appliance-creator --config $(PACKAGE).ks \ + --name $(PACKAGE) -f $(DISK_FMT) -p $(PKG_FMT) -d -v \ + --tmpdir='$(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp' \ + --cache='$(OVIRT_CACHE_DIR)/yum' \ + --vmem=768" + sudo chown $${USER} $(PACKAGE).$(PKG_FMT) + ( \ + if [ $(SELINUX_ENFORCING) = Enforcing ]; then \ + sudo /usr/sbin/setenforce Enforcing || exit 1 ;\ + fi \ + ) + + mv $(PACKAGE).$(PKG_FMT) $(NVR).$(PKG_FMT) + zip -u $(NVR).$(PKG_FMT) create-$(PACKAGE) create-ovirt-nodes \ + create-ovirt-network $(PACKAGE)-functions get-$(PACKAGE) + +$(NVR).$(PKG_FMT).md5sum: $(NVR).$(PKG_FMT) + md5sum $(NVR).$(PKG_FMT) > $(NVR).$(PKG_FMT).md5sum + +appliance: $(NVR).$(PKG_FMT).md5sum + +rpms: dist appliance rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz publish: rpms @@ -55,4 +130,4 @@ publish: rpms rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src/ createrepo $(OVIRT_CACHE_DIR)/ovirt -.PHONY: rpms publish +.PHONY: rpms publish $(NVR).$(PKG_FMT).md5sum $(NVR).$(PKG_FMT) diff --git a/ovirt-appliance.spec.in b/ovirt-appliance.spec.in index fdf942f..df02a85 100644 --- a/ovirt-appliance.spec.in +++ b/ovirt-appliance.spec.in @@ -1,12 +1,3 @@ -%{!?ovirt_cache_dir: %define ovirt_cache_dir /var/tmp/ovirt-cache} -%{!?ovirt_local_repo: %define ovirt_local_repo file://%{ovirt_cache_dir}/ovirt} -%{!?ovirt_url: %define ovirt_url http://ovirt.org/repos/ovirt} -%{!?thincrust_url: %define thincrust_url http://www.thincrust.net/repo} -%{?fedora_url: %define fedora_tree_url %{fedora_url}/releases/%{fedora}/Fedora/%{_arch}/os} -%{!?fedora_tree_url: %define fedora_tree_url http://download.fedoraproject.org/pub/fedora/linux/releases/%{fedora}/Fedora/%{_arch}/os} -%{!?bad_pkgs: %define bad_pkgs ""} -%define fedora_mirror http://mirrors.fedoraproject.org/mirrorlist - Summary: oVirt Appliance Name: ovirt-appliance Version: @VERSION@ @@ -15,12 +6,8 @@ Source0: %{name}-%{version}.tar.gz License: GPLv2+ Group: Applications/System BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot +BuildArch: noarch URL: http://ovirt.org/ -BuildRequires: appliance-tools appliance-os -BuildRequires: livecd-tools >= 017 -BuildRequires: syslinux -BuildRequires: qemu-img -BuildRequires: wget # FIXME: libvirt and kvm require ovirt specific patches presently due to # the fact that migration has not been fixed upstream. Once upstream migration # is fixed, these Requires should be fixed. @@ -35,59 +22,12 @@ Requires: augeas %define debug_package %{nil} %description -The oVirt Appliance image and scripts to install on a Fedora Host +The oVirt Appliance scripts to install on a Fedora Host %prep %setup -q %build -%if 0%{?fedora} == 010 - # XXX current rawhide - %if "%{?fedora_url}" == "" -cat > repos.ks << EOF -repo --name=rawhide --mirrorlist=%{fedora_mirror}?repo=rawhide&arch=%{_arch} -EOF - %else -cat > repos.ks << EOF -repo --name=rawhide --baseurl=%{fedora_url}/development/%{_arch}/os -EOF - %endif -cat >> repos.ks << EOF -repo --name=ovirt-org --baseurl=%{ovirt_url}/development/%{_arch} -EOF -%else - %if "%{?fedora_url}" == "" -cat > repos.ks << EOF -repo --name=f%{fedora} --mirrorlist=%{fedora_mirror}?repo=fedora-%{fedora}&arch=%{_arch} -repo --name=f%{fedora}-updates-newkey --mirrorlist=%{fedora_mirror}?repo=updates-released-f%{fedora}.newkey&arch=%{_arch} --excludepkgs=%{bad_pkgs} -EOF - %else -cat > repos.ks << EOF -repo --name=f%{fedora} --baseurl=%{fedora_url}/releases/%{fedora}/Everything/%{_arch}/os -repo --name=f%{fedora}-updates-newkey --baseurl=%{fedora_url}/updates/%{fedora}/%{_arch}.newkey --excludepkgs=%{bad_pkgs} -EOF - %endif -cat >> repos.ks << EOF -repo --name=ovirt-org --baseurl=%{ovirt_url}/%{fedora}/%{_arch} -EOF -%endif - -cat >> repos.ks << EOF -repo --name=ovirt-local --baseurl=%{ovirt_local_repo} -repo --name=thincrust-org --baseurl=%{thincrust_url}/noarch - -EOF - -mkdir -p %{ovirt_cache_dir}/appliance-tmp/tree -mkdir -p %{ovirt_cache_dir}/yum -./gettree.sh %{fedora_tree_url} %{ovirt_cache_dir}/appliance-tmp/tree -ln -s %{ovirt_cache_dir}/appliance-tmp tmp -sudo su - -c "cd $(pwd) && appliance-creator --config ovirt-appliance.ks \ - --name %{name} -f qcow2 -d -v \ - --tmpdir='%{ovirt_cache_dir}/appliance-tmp' \ - --cache='%{ovirt_cache_dir}/yum'" -sudo su - -c "cd $(pwd) && chown -R $USER ." -mv %{name}-sda.qcow2 %{name}.img %install %{__rm} -rf %{buildroot} @@ -95,8 +35,6 @@ mkdir %{buildroot} %{__install} -d -m0755 %{buildroot}%{app_root} %{__install} -p -m0644 COPYING %{buildroot}%{app_root} -%{__install} -d -m0755 %{buildroot}%{_localstatedir}/lib/libvirt/images -%{__install} -p -m0644 %{name}.img %{buildroot}%{_localstatedir}/lib/libvirt/images %{__install} -d -m0755 %{buildroot}%{_sbindir} %{__install} -p -m0755 create-%{name} %{buildroot}%{_sbindir} @@ -106,11 +44,13 @@ mkdir %{buildroot} %files %defattr(-,root,root,0644) %{app_root}/COPYING -%{_localstatedir}/lib/libvirt/images/%{name}.img %defattr(-,root,root,0755) %{_sbindir}/create-%{name} %changelog +* Wed Nov 05 2008 Perry Myers 0.96 +- Removed appliance building from rpm. RPM now just contains tools to + download image and install it * Sun Sep 14 2008 Perry Myers 0.92-1 - Added Requires on libvirt/kvm * Fri Sep 05 2008 Perry Myers 0.92-1 -- 1.6.0.3 From apevec at redhat.com Mon Nov 10 15:23:37 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 10 Nov 2008 16:23:37 +0100 Subject: [Ovirt-devel] Re: [PATCH appliance] Refactor the create-ovirt-appliance script into several scripts In-Reply-To: <1226219047-16238-1-git-send-email-pmyers@redhat.com> References: <1226219047-16238-1-git-send-email-pmyers@redhat.com> Message-ID: <491851F9.4070908@redhat.com> Perry Myers wrote: > +++ b/get-ovirt-appliance > +Usage: $ME [-d image_dir] [-n name] [-l appliance location] > + -d: directory to place virtual disk (default: $IMGDIR_DEFAULT) > + -n: appliance name (default: $NAME_DEFAULT) > + -l: directory or url to get appliance zip and md5sum files (default: $OVIRT_URL) > + this can either be http:// url or relative/absolute path I would make . (current dir) default when -l is not given and $OVIRT_URL default if -l is given but w/o value. From pmyers at redhat.com Mon Nov 10 15:29:52 2008 From: pmyers at redhat.com (Perry Myers) Date: Mon, 10 Nov 2008 10:29:52 -0500 Subject: [Ovirt-devel] Re: [PATCH appliance] Refactor the create-ovirt-appliance script into several scripts In-Reply-To: <491851F9.4070908@redhat.com> References: <1226219047-16238-1-git-send-email-pmyers@redhat.com> <491851F9.4070908@redhat.com> Message-ID: <49185370.3020009@redhat.com> Alan Pevec wrote: > Perry Myers wrote: >> +++ b/get-ovirt-appliance >> +Usage: $ME [-d image_dir] [-n name] [-l appliance location] >> + -d: directory to place virtual disk (default: $IMGDIR_DEFAULT) >> + -n: appliance name (default: $NAME_DEFAULT) >> + -l: directory or url to get appliance zip and md5sum files >> (default: $OVIRT_URL) >> + this can either be http:// url or relative/absolute path > > I would make . (current dir) default when -l is not given and $OVIRT_URL > default if -l is given but w/o value. > Good suggestion, will make it so. Perry -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=| From apevec at redhat.com Mon Nov 10 16:53:59 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 10 Nov 2008 17:53:59 +0100 Subject: [Ovirt-devel] Re: [PATCH appliance] Configure appliance to enable serial console for grub/kernel by default In-Reply-To: <1226216880-15842-1-git-send-email-pmyers@redhat.com> References: <1226216880-15842-1-git-send-email-pmyers@redhat.com> Message-ID: <49186727.2090306@redhat.com> ACK - excellent, this will help debugging firstboot errors I can retire that qemu-nbd dance from http://ovirt.org/page/TroubleShooting#Debugging_oVirt_Appliance_firstboot From apevec at redhat.com Mon Nov 10 17:23:46 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 10 Nov 2008 18:23:46 +0100 Subject: [Ovirt-devel] Re: [PATCH appliance] Create separate data disk for storing iSCSI and NFS for appliance In-Reply-To: <1226216918-15875-1-git-send-email-pmyers@redhat.com> References: <1226216918-15875-1-git-send-email-pmyers@redhat.com> Message-ID: <49186E22.1040004@redhat.com> ACK virt-image XML has storage/disk at use='scratch' attribute which could be used here for sdb, but then we would need firstboot logic to initialize it (mkfs, mkdirs etc.) Maybe not worth it, since sdb disk-image is <100kB compressed in ZIP archive. From apevec at redhat.com Mon Nov 10 17:41:34 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 10 Nov 2008 18:41:34 +0100 Subject: [Ovirt-devel] Re: [PATCH appliance] Move appliance creation out of spec file to Makefile In-Reply-To: <1226329821-19972-1-git-send-email-pmyers@redhat.com> References: <--thread> <1226329821-19972-1-git-send-email-pmyers@redhat.com> Message-ID: <4918724E.5090902@redhat.com> Perry Myers wrote: > + sudo su - -c "cd $(PWD) && appliance-creator --config $(PACKAGE).ks \ > + --name $(PACKAGE) -f $(DISK_FMT) -p $(PKG_FMT) -d -v \ > + --tmpdir='$(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp' \ > + --cache='$(OVIRT_CACHE_DIR)/yum' \ > + --vmem=768" Resulting appliance doesn't use virtio for neither NIC or disk. AFAICT image XML doesn't carry info about NIC/disk model and I don't see the option to specify virtio as virt-image parameter. Any ideas? Running the appliance w/o virtio would bring a performance regression. From apevec at redhat.com Mon Nov 10 17:44:39 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 10 Nov 2008 18:44:39 +0100 Subject: [Ovirt-devel] Re: [PATCH appliance] Update kvm/libvirt deps to newer versions in ovirt.org repo In-Reply-To: <1226216981-15936-1-git-send-email-pmyers@redhat.com> References: <1226216981-15936-1-git-send-email-pmyers@redhat.com> Message-ID: <49187307.5030705@redhat.com> ACK From apevec at redhat.com Mon Nov 10 17:45:37 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 10 Nov 2008 18:45:37 +0100 Subject: [Ovirt-devel] Re: [PATCH release] Created update-app target for installing appliance image from image archive In-Reply-To: <1226217037-15973-3-git-send-email-pmyers@redhat.com> References: <--compose> <1226217037-15973-1-git-send-email-pmyers@redhat.com> <1226217037-15973-2-git-send-email-pmyers@redhat.com> <1226217037-15973-3-git-send-email-pmyers@redhat.com> Message-ID: <49187341.8000302@redhat.com> ACK From pmyers at redhat.com Mon Nov 10 17:46:45 2008 From: pmyers at redhat.com (Perry Myers) Date: Mon, 10 Nov 2008 12:46:45 -0500 Subject: [Ovirt-devel] [PATCH appliance] Refactor the create-ovirt-appliance script into several scripts Message-ID: <1226339205-21288-1-git-send-email-pmyers@redhat.com> Separated out several independent functions from ovirt-create-appliance: - installing the appliance image from the appliance packaging - creating the appliance in libvirt - creating the fake nodes - setting up the host networking to support running the appliance Along with these changes also made it so that the appliance and fake nodes are created using virt-image from the appliance-creator or from virt-install and changed so that only a single network (ovirtbr0) is required for the appliance and fake nodes. Signed-off-by: Perry Myers --- Makefile.am | 4 + create-ovirt-appliance | 329 +++++---------------------------------------- create-ovirt-network | 141 +++++++++++++++++++ create-ovirt-nodes | 51 +++++++ get-ovirt-appliance | 95 +++++++++++++ ovirt-appliance-functions | 171 +++++++++++++++++++++++ ovirt-appliance.ks | 4 +- ovirt-appliance.spec.in | 9 ++ 8 files changed, 503 insertions(+), 301 deletions(-) create mode 100755 create-ovirt-network create mode 100755 create-ovirt-nodes create mode 100755 get-ovirt-appliance create mode 100644 ovirt-appliance-functions diff --git a/Makefile.am b/Makefile.am index 61df672..f6a9b69 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,6 +30,10 @@ NVR = $(PACKAGE)-$(VERSION)-$(ARCH) EXTRA_DIST = \ .gitignore \ create-$(PACKAGE) \ + create-ovirt-network \ + create-ovirt-nodes \ + get-$(PACKAGE) \ + $(PACKAGE)-functions \ gettree.sh \ $(PACKAGE).ks \ $(PACKAGE).spec \ diff --git a/create-ovirt-appliance b/create-ovirt-appliance index 9454377..92c61ee 100755 --- a/create-ovirt-appliance +++ b/create-ovirt-appliance @@ -1,44 +1,42 @@ #!/bin/bash - -PATH=$PATH:/sbin:/usr/sbin - -ME=$(basename "$0") -warn() { printf '%s: %s\n' "$ME" "$*" >&2; } -try_h() { printf "Try \`$ME -h' for more information.\n" >&2; } -die() { warn "$@"; try_h; exit 1; } - -RAM=768 - -IMGDIR_DEFAULT=/var/lib/libvirt/images -NAME_DEFAULT=ovirt-appliance -NET_SCRIPTS=/etc/sysconfig/network-scripts -BRIDGENAME=ovirtbr0 -NET_TYPE=network - -NODE_DISK_SIZE=128M -NODE_DISK_FMT=raw - -imgdir=$IMGDIR_DEFAULT -name=$NAME_DEFAULT +# +# Create oVirt Appliance +# Copyright 2008 Red Hat, Inc. +# Written by Perry Myers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +. $(dirname $0)/ovirt-appliance-functions usage() { case $# in 1) warn "$1"; try_h; exit 1;; esac cat < - $name - - - -EOF -} - -gen_fake_managed_node() { - local num=$1 - local disk=$2 - local last_mac=$(( 54 + $num )) - - cat < - node$num - 25ab2490-7c4c-099f-b647-${num}5ff8efa73f6 - 524288 - 524288 - 1 - - hvm - - - - destroy - restart - destroy - - $KVM_BINARY - - - - - - - - - - - - - - - - - - -EOF -} - -gen_app() { - local name=$1 - local disk=$2 - local ram=$3 - - cat< - $name - $(( $ram * 1024 )) - $(( $ram * 1024 )) - 1 - - hvm - - - - destroy - restart - destroy - - $KVM_BINARY - - - - - - - - - - - - - - - - - - - - - - -EOF -} - -net_debug() { - # Some output for debugging problems - echo "Currently active bridges:" - echo "-------------------------" - brctl show - echo - echo "Currently defined libvirt networks:" - echo "-----------------------------------" - virsh net-list --all - echo -} - -# first, check to see we are root -if [ $( id -u ) -ne 0 ]; then - die "Must run as root" -fi - -# now make sure the packages we need are installed -if [ -e /etc/redhat-release ]; then - # We rely on RPM deps for this in Red Hat/Fedora systems - CHECK=0 - KVM_BINARY=/usr/bin/qemu-kvm -elif [ -e /etc/debian_version ]; then - # Works in Ubuntu 8.04. Still needs testing in Debian - PACKAGES="libvirt0 libvirt-bin kvm qemu" - CHECK=$(dpkg -l $PACKAGES &> /dev/null; echo $?) - KVM_BINARY=/usr/bin/kvm -else - die "Not a supported system" -fi - -if [ $CHECK -ne 0 ]; then - # one of the previous packages wasn't installed; bail out - die "Must have the $PACKAGES packages installed" -fi - -service libvirtd status > /dev/null 2>&1 \ - || service libvirtd start > /dev/null 2>&1 -chkconfig libvirtd on - -# Cleanup to handle older version of script that used these bridge names -{ - virsh net-destroy dummybridge - virsh net-undefine dummybridge - brctl delif eth1bridge eth1 - virsh net-destroy eth1bridge - virsh net-undefine eth1bridge - old_bridge=$(brctl show \ - | awk -v BRIDGENAME=ovirtbr '$1==BRIDGENAME {print $4}') - if [ -n "$old_bridge" ]; then - ifconfig $old_bridge down - fi - brctl delif ovirtbr $old_bridge - virsh net-destroy ovirtbr - virsh net-undefine ovirtbr - sed -i "/# ovirtbr$/d" /etc/rc.d/rc.local -} > /dev/null 2>&1 - -net_debug - -# If we're bridging to a physical network, run some checks to make sure the -# choice of physical eth device is sane -if [ -n "$bridge" ]; then - NET_TYPE=bridge - # Check to see if the physical device is present - ifconfig $bridge > /dev/null 2>&1 ; bridge_dev_present=$? - test $bridge_dev_present != 0 \ - && die "$bridge device not present, aborting!" - - # Check to see if the eth device is already tied to a non oVirt bridge - attached_bridge=$(brctl show \ - | awk -v BRIDGE=$bridge '$4~BRIDGE {print $1}') - test -n "$attached_bridge" -a "$attached_bridge" != "$BRIDGENAME" \ - && die "$bridge already attached to other bridge $attached_bridge" - - # Check to make sure that the system is not already using the interface - if test -f $NET_SCRIPTS/ifcfg-$bridge ; then - echo "$NET_SCRIPTS/ifcfg-$bridge is present, are you sure you wish to" - echo "overwrite this file? [y/N]? " - read yesno - - if [ "$yesno" != "y" -a "$yesno" != "Y" ]; then - exit 2 - fi - fi -fi +do_checks mkdir -p $imgdir -# define the fake managed nodes we will use. -for i in `seq 3 5` ; do - imgname="node${i}.img" - if [ ! -f $imgdir/$imgname ]; then - qemu-img create -f $NODE_DISK_FMT $imgdir/$imgname $NODE_DISK_SIZE - fi - virsh destroy node$i >& /dev/null - virsh undefine node$i >& /dev/null - TMPXML=$(mktemp) - gen_fake_managed_node $i $imgdir/$imgname > $TMPXML - virsh define $TMPXML - rm $TMPXML -done - -# Remove old bridge device if it exists -sed -i "/# $BRIDGENAME/d" /etc/rc.d/rc.local -old_bridge=$(brctl show \ - | awk -v BRIDGENAME=$BRIDGENAME '$1==BRIDGENAME {print $4}') -if [ -n "$old_bridge" ]; then - echo "Removing old bridge $old_bridge" - ifconfig $old_bridge down - brctl delif $BRIDGENAME $old_bridge - rm -f $NET_SCRIPTS/ifcfg-$old_bridge -fi - -{ -echo "Removing $BRIDGENAME" -virsh net-destroy $BRIDGENAME -virsh net-undefine $BRIDGENAME -ifconfig $BRIDGENAME down -brctl delbr $BRIDGENAME -rm -fv $NET_SCRIPTS/ifcfg-$BRIDGENAME -echo "Done Removing $BRIDGENAME" -} 2> /dev/null - -if [ -n "$bridge" ]; then - # real external bridge, use distro networking scripts - ifconfig $bridge down 2> /dev/null - TMPAUG=$(mktemp) || exit 1 - cat > $TMPAUG < $TMPXML - virsh net-define $TMPXML - rm $TMPXML - virsh net-start $BRIDGENAME - virsh net-autostart $BRIDGENAME -fi - -net_debug - -# Cleanup to handle older version of script that used these domain names -{ - virsh destroy developer - virsh undefine developer - virsh destroy bundled - virsh undefine bundled -} > /dev/null 2>&1 +appdisk=$name-sda.$DISK_FMT +datadisk=$name-sdb.$DISK_FMT -imgname=$name.img -test ! -r $imgdir/$imgname && die "Disk image not found at $imgdir/$imgname" +test ! -r $imgdir/$appdisk && die "Disk image not found at $imgdir/$appdisk" +test ! -r $imgdir/$datadisk && die "Disk image not found at $imgdir/$datadisk" virsh destroy $name > /dev/null 2>&1 virsh undefine $name > /dev/null 2>&1 -TMPXML=$(mktemp) || exit 1 -# FIXME virt-image to define the appliance instance -gen_app $name $imgdir/$imgname $RAM > $TMPXML -virsh define $TMPXML -rm $TMPXML -echo "Application defined using disk located at $imgdir/$imgname." -echo "Run virsh start $name to start the appliance" +virt-image -b $BRIDGENAME $imgdir/$name.xml +test $console = 1 && virsh console $name diff --git a/create-ovirt-network b/create-ovirt-network new file mode 100755 index 0000000..00b56ba --- /dev/null +++ b/create-ovirt-network @@ -0,0 +1,141 @@ +#!/bin/bash + +. $(dirname $0)/ovirt-appliance-functions + +usage() { + case $# in 1) warn "$1"; try_h; exit 1;; esac + cat < /dev/null 2>&1 ; bridge_dev_present=$? + test $bridge_dev_present != 0 \ + && die "$bridge device not present, aborting!" + + # Check to see if the eth device is already tied to a non oVirt bridge + attached_bridge=$(brctl show \ + | awk -v BRIDGE=$bridge '$4~BRIDGE {print $1}') + test -n "$attached_bridge" -a "$attached_bridge" != "$BRIDGENAME" \ + && die "$bridge already attached to other bridge $attached_bridge" + + # Check to make sure that the system is not already using the interface + if test -f $NET_SCRIPTS/ifcfg-$bridge ; then + echo "$NET_SCRIPTS/ifcfg-$bridge is present, are you sure you wish to" + echo "overwrite this file? [y/N]? " + read yesno + + if [ "$yesno" != "y" -a "$yesno" != "Y" ]; then + exit 2 + fi + fi +fi + +# Remove old bridge device if it exists +sed -i "/# $BRIDGENAME/d" /etc/rc.d/rc.local +old_bridge=$(brctl show \ + | awk -v BRIDGENAME=$BRIDGENAME '$1==BRIDGENAME {print $4}') +if [ -n "$old_bridge" ]; then + echo "Removing old bridge $old_bridge" + ifconfig $old_bridge down + brctl delif $BRIDGENAME $old_bridge + rm -f $NET_SCRIPTS/ifcfg-$old_bridge +fi + +{ +echo "Removing $BRIDGENAME" +virsh net-destroy $BRIDGENAME +virsh net-undefine $BRIDGENAME +ifconfig $BRIDGENAME down +brctl delbr $BRIDGENAME +rm -fv $NET_SCRIPTS/ifcfg-$BRIDGENAME +rm -fv /etc/sysconfig/iptables-$BRIDGENAME-filter +rm -fv /etc/sysconfig/iptables-$BRIDGENAME-nat +sed -i "/iptables-$BRIDGENAME/d" /etc/sysconfig/system-config-firewall +lokkit --update +echo "Done Removing $BRIDGENAME" +} 2> /dev/null + +if [ -n "$bridge" ]; then + # real external bridge, use distro networking scripts + ifconfig $bridge down 2> /dev/null + TMPAUG=$(mktemp) || exit 1 + cat > $TMPAUG < /etc/sysconfig/iptables-$BRIDGENAME-filter < /etc/sysconfig/iptables-$BRIDGENAME-nat < $TMPXML + virsh net-define $TMPXML + rm $TMPXML + virsh net-start $BRIDGENAME + virsh net-autostart $BRIDGENAME +fi + +# Set up dnsmasq on $BRIDGENAME just for DNS forwarding +cat < /etc/dnsmasq.d/$BRIDGENAME.conf +bind-interfaces +interface=$BRIDGENAME +except-interface=lo +EOF +chkconfig dnsmasq on +service dnsmasq restart + +net_debug diff --git a/create-ovirt-nodes b/create-ovirt-nodes new file mode 100755 index 0000000..0ac5fd0 --- /dev/null +++ b/create-ovirt-nodes @@ -0,0 +1,51 @@ +#!/bin/bash +# +# Create fake oVirt Nodes that PXE boot to the Appliance Server +# Copyright 2008 Red Hat, Inc. +# Written by Perry Myers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +. $(dirname $0)/ovirt-appliance-functions + +usage() { + case $# in 1) warn "$1"; try_h; exit 1;; esac + cat < +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +. $(dirname $0)/ovirt-appliance-functions + +usage() { + case $# in 1) warn "$1"; try_h; exit 1;; esac + cat < /dev/null 2>&1 ; then + echo "Using http at $app_loc to retrieve appliance" + + if verify_md5 $zipfile $md5file ; then + app_loc=$(pwd) + else + wget -c $app_loc/$md5file || die "error downloading $app_loc/$md5file" + wget -c $app_loc/$zipfile || die "error downloading $app_loc/$zipfile" + if verify_md5 $zipfile $md5file ; then + app_loc=$(pwd) + else + die "appliance files not available, aborting" + fi + fi +else + echo "Using local files in $app_loc for appliance" + + if [ -d $app_loc ]; then + if ! verify_md5 $app_loc/$zipfile $app_loc/$md5file ; then + die "appliance files not available, aborting" + fi + elif [ -f $app_loc -a -f $app_loc.md5sum ]; then + if ! verify_md5 $app_loc $app_loc.md5sum ; then + die "appliance files not available, aborting" + fi + fi +fi + +mkdir -p $imgdir + +appdisk=$name-sda.$DISK_FMT +datadisk=$name-sdb.$DISK_FMT + +unzip -o $app_loc/$zipfile $name\* -d $imgdir + +test ! -r $imgdir/$appdisk && die "Disk image not found at $imgdir/$appdisk" +test ! -r $imgdir/$datadisk && die "Disk image not found at $imgdir/$datadisk" + +echo "Appliance Disks installed to $imgdir" +echo "Run create-ovirt-appliance to define and start the appliance" diff --git a/ovirt-appliance-functions b/ovirt-appliance-functions new file mode 100644 index 0000000..819859b --- /dev/null +++ b/ovirt-appliance-functions @@ -0,0 +1,171 @@ +# -*-Shell-script-*- +# +# Common functions for the oVirt Appliance scripts +# Copyright 2008 Red Hat, Inc. +# Written by Perry Myers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +PATH=$PATH:/sbin:/usr/sbin + +ME=$(basename "$0") +warn() { printf '%s: %s\n' "$ME" "$*" >&2; } +try_h() { printf "Try \`$ME -h' for more information.\n" >&2; } +die() { warn "$@"; try_h; exit 1; } + +IMGDIR_DEFAULT=/var/lib/libvirt/images +NAME_DEFAULT=ovirt-appliance +NET_SCRIPTS=/etc/sysconfig/network-scripts + +BRIDGENAME=ovirtbr0 +NETWORK=192.168.50.0 +NETMASK=255.255.255.0 + +DISK_FMT=qcow2 +OVIRT_URL=http://ovirt.org/download + +imgdir=$IMGDIR_DEFAULT +name=$NAME_DEFAULT + +do_checks() { + # first, check to see we are root + if [ $( id -u ) -ne 0 ]; then + die "Must run as root" + fi + + # now make sure the packages we need are installed + if [ -e /etc/redhat-release ]; then + # We rely on RPM deps for this in Red Hat/Fedora systems + CHECK=0 + KVM_BINARY=/usr/bin/qemu-kvm + version=$(rpm -q --qf '%{version}' ovirt-appliance) + elif [ -e /etc/debian_version ]; then + # Works in Ubuntu 8.04. Still needs testing in Debian + PACKAGES="libvirt0 libvirt-bin kvm qemu" + CHECK=$(dpkg -l $PACKAGES &> /dev/null; echo $?) + KVM_BINARY=/usr/bin/kvm + version=LATEST + else + die "Not a supported system" + fi + + if [ $CHECK -ne 0 ]; then + # one of the previous packages wasn't installed; bail out + die "Must have the $PACKAGES packages installed" + fi + + service NetworkManager status > /dev/null 2>&1 \ + && die "NetworkManager is running, disable and use standard network scripts before proceeding" + + service iptables status > /dev/null 2>&1 \ + || service iptables start > /dev/null 2>&1 + chkconfig iptables on + + service libvirtd status > /dev/null 2>&1 \ + || service libvirtd start > /dev/null 2>&1 + chkconfig libvirtd on +} + +gen_bridge() { + cat << EOF + + $BRIDGENAME + + + + +EOF +} + +gen_fake_managed_node() { + local num=$1 + local last_mac=$(( 54 + $num )) + + echo "Creating fake node$num..." + virsh destroy node$num > /dev/null 2>&1 + virsh undefine node$num > /dev/null 2>&1 + # FIXME: virt-install should be changed to have a --nostart parameter + # that just defines the VM w/o starting it. + virt-install --name=node$num --ram=512 --vcpus=1 \ + --disk path=$imgdir/node${i}-sda.raw,size=.15 \ + --network=bridge:$BRIDGENAME --mac=00:16:3e:12:34:$last_mac \ + --vnc --accelerate --hvm --noautoconsole \ + --os-type=linux --os-variant=fedora9 \ + --force --noreboot --pxe + virsh destroy node$num > /dev/null 2>&1 + # FIXME: virt-install should be changed to allow network boot + # to be a permanent selection + TMPXML=$(mktemp) || exit 1 + virsh dumpxml node$num | sed "s/boot dev='.*'/boot dev='network'/" > $TMPXML + virsh define $TMPXML + rm -f $TMPXML + echo "node$num created" +} + +net_debug() { + # Some output for debugging problems + echo "Currently active bridges:" + echo "-------------------------" + brctl show + echo + echo "Currently defined libvirt networks:" + echo "-----------------------------------" + virsh net-list --all + echo +} + +cleanup_old_apps() { + # Cleanup to handle older version of script that used these domain names + virsh destroy developer + virsh undefine developer + virsh destroy bundled + virsh undefine bundled +} > /dev/null 2>&1 + +cleanup_old_nets() { + # Cleanup to handle older version of script that used these bridge names + virsh net-destroy dummybridge + virsh net-undefine dummybridge + brctl delif eth1bridge eth1 + virsh net-destroy eth1bridge + virsh net-undefine eth1bridge + old_bridge=$(brctl show \ + | awk -v BRIDGENAME=ovirtbr '$1==BRIDGENAME {print $4}') + if [ -n "$old_bridge" ]; then + ifconfig $old_bridge down + fi + brctl delif ovirtbr $old_bridge + virsh net-destroy ovirtbr + virsh net-undefine ovirtbr + sed -i "/# ovirtbr$/d" /etc/rc.d/rc.local +} > /dev/null 2>&1 + +verify_md5() { + local zipfile=$1 + local md5file=$2 + + test ! -f $md5file && { echo "$md5file not found" ; return 1 ; } + test ! -f $zipfile && { echo "$zipfile not found" ; return 1 ; } + + local actual_md5=$(md5sum $zipfile | awk '{print $1}') + local expect_md5=$(awk '{print $1}' $md5file) + + if [ "$actual_md5" = "$expect_md5" ]; then + echo "md5sum verified" + return 0 + else + echo "md5sum failed" + return 1 + fi +} diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks index d7e0892..8801fb7 100644 --- a/ovirt-appliance.ks +++ b/ovirt-appliance.ks @@ -2,7 +2,7 @@ install lang en_US.UTF-8 keyboard us -network --device eth0 --bootproto dhcp +network --device=eth0 --bootproto=static --ip=192.168.50.2 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.50.2 --hostname=management.priv.ovirt.org rootpw --iscrypted Xa8QeYfWrtscM firewall --disabled authconfig --enableshadow --enablemd5 @@ -20,8 +20,6 @@ part swap --ondisk=sda --fstype=swap --size=512 part /mnt/data --ondisk=sdb --fstype=ext3 --size=20000 reboot -network --device=eth1 --bootproto=static --ip=192.168.50.2 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.50.2 --hostname=management.priv.ovirt.org - %include repos.ks %packages --nobase diff --git a/ovirt-appliance.spec.in b/ovirt-appliance.spec.in index c35530b..191fc2d 100644 --- a/ovirt-appliance.spec.in +++ b/ovirt-appliance.spec.in @@ -37,6 +37,10 @@ mkdir %{buildroot} %{__install} -p -m0644 COPYING %{buildroot}%{app_root} %{__install} -d -m0755 %{buildroot}%{_sbindir} %{__install} -p -m0755 create-%{name} %{buildroot}%{_sbindir} +%{__install} -p -m0755 create-ovirt-network %{buildroot}%{_sbindir} +%{__install} -p -m0755 create-ovirt-nodes %{buildroot}%{_sbindir} +%{__install} -p -m0755 get-%{name} %{buildroot}%{_sbindir} +%{__install} -p -m0644 %{name}-functions %{buildroot}%{_sbindir} %clean %{__rm} -rf %{buildroot} @@ -46,6 +50,11 @@ mkdir %{buildroot} %{app_root}/COPYING %defattr(-,root,root,0755) %{_sbindir}/create-%{name} +%{_sbindir}/create-ovirt-network +%{_sbindir}/create-ovirt-nodes +%{_sbindir}/get-%{name} +%defattr(-,root,root,0644) +%{_sbindir}/%{name}-functions %changelog * Wed Nov 05 2008 Perry Myers 0.96 -- 1.6.0.3 From apevec at redhat.com Mon Nov 10 17:53:51 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 10 Nov 2008 18:53:51 +0100 Subject: [Ovirt-devel] Re: [PATCH appliance] Refactor the create-ovirt-appliance script into several scripts In-Reply-To: <1226339205-21288-1-git-send-email-pmyers@redhat.com> References: <1226339205-21288-1-git-send-email-pmyers@redhat.com> Message-ID: <4918752F.1070900@redhat.com> ACK From pmyers at redhat.com Mon Nov 10 17:55:26 2008 From: pmyers at redhat.com (Perry Myers) Date: Mon, 10 Nov 2008 12:55:26 -0500 Subject: [Ovirt-devel] Re: [PATCH appliance] Move appliance creation out of spec file to Makefile In-Reply-To: <4918724E.5090902@redhat.com> References: <--thread> <1226329821-19972-1-git-send-email-pmyers@redhat.com> <4918724E.5090902@redhat.com> Message-ID: <4918758E.6080408@redhat.com> Alan Pevec wrote: > Perry Myers wrote: >> + sudo su - -c "cd $(PWD) && appliance-creator --config >> $(PACKAGE).ks \ >> + --name $(PACKAGE) -f $(DISK_FMT) -p $(PKG_FMT) -d -v \ >> + --tmpdir='$(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp' \ >> + --cache='$(OVIRT_CACHE_DIR)/yum' \ >> + --vmem=768" > > Resulting appliance doesn't use virtio for neither NIC or disk. > AFAICT image XML doesn't carry info about NIC/disk model and I don't see > the option to specify virtio as virt-image parameter. Any ideas? > Running the appliance w/o virtio would bring a performance regression. That doesn't affect this patch exactly, but does affect the patch where I refactor create-ovirt-appliance to use virt-image instead of XML templates. I could switch from virt-image to virt-install in the short term until virt-image/appliance-creator fixes virtio situation. Perry -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=| From mmorsi at redhat.com Mon Nov 10 19:18:20 2008 From: mmorsi at redhat.com (Mohammed Morsi) Date: Mon, 10 Nov 2008 14:18:20 -0500 Subject: [Ovirt-devel] [PATCH server] build correct db using configured rails env in ovirt-server-install Message-ID: <1226344700-19450-1-git-send-email-mmorsi@redhat.com> set RAILS_ENV in conf/ovirt-rails.sysconf before building --- scripts/ovirt-server-install | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/scripts/ovirt-server-install b/scripts/ovirt-server-install index 055ff4c..afa2a64 100755 --- a/scripts/ovirt-server-install +++ b/scripts/ovirt-server-install @@ -5,6 +5,13 @@ OVIRT_CFG=/etc/ovirt-server DATABASE=ovirt USERNAME=ovirt +[ -r /etc/sysconfig/ovirt-rails ] && . /etc/sysconfig/ovirt-rails +if [ ! -z "$RAILS_ENV" ]; then + DATABASE="$DATABASE"_"$RAILS_ENV" + export RAILS_ENV +else + export RAILS_ENV="production" +fi EXISTS_FILE=${OVIRT_CFG}/db/exists PW_FILE=${OVIRT_CFG}/db/dbaccess @@ -186,7 +193,7 @@ touch $EXISTS_FILE cd ${OVIRT_DIR} mkdir -p log -export RAILS_ENV="production" && rake db:migrate +rake db:migrate cd - ${OVIRT_DIR}/script/grant_admin_privileges ovirtadmin -- 1.5.6.5 From bkearney at redhat.com Mon Nov 10 19:22:13 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Mon, 10 Nov 2008 14:22:13 -0500 Subject: [Ovirt-devel] [PATCH node] Password configuration script for the root password and sasl users Message-ID: <1226344933-11105-1-git-send-email-bkearney@redhat.com> --- scripts/ovirt-config-password | 92 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 92 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-password b/scripts/ovirt-config-password index 8b13789..af99915 100755 --- a/scripts/ovirt-config-password +++ b/scripts/ovirt-config-password @@ -1 +1,93 @@ +#!/bin/bash +# +# Set the root password and others + +ROOT_PASSWORD="" + +function sasl_password { + printf "adding user $1 to the sasl list for libvirt\n" + echo $2 | saslpasswd2 -a libvirt -p $1 +} + +function set_root_password { + while true; do + printf "\nPlease enter the new root password (hit return to skip) " + read -s + if [[ $REPLY == "" ]]; then + return 1 + fi + ROOT_PASSWORD=$REPLY + printf "\nPlease enter again to confirm " + read -s + ROOT_PASSWORD_CONFIRM=$REPLY + if [[ $ROOT_PASSWORD == $ROOT_PASSWORD_CONFIRM ]]; then + echo $ROOT_PASSWORD | passwd --stdin root + sasl_password root $ROOT_PASSWORD + break + else + printf "\nPaswords did not match. Please try again" + fi + done + return 0 +} + +# Prompts the user for a single username, password combo +function prompt_sasl_user { + while true; do + printf "\nPlease enter a new user (hit return to skip) " + read + if [[ $REPLY == "" ]]; then + break + fi + SASL_USER=$REPLY + printf "\nPlease enter the password for $SASL_USER (hit return to skip) " + read -s + if [[ $REPLY == "" ]]; then + return 1 + fi + SASL_PASSWORD=$REPLY + printf "\nPlease enter again to confirm " + read -s + SASL_PASSWORD_CONFIRM=$REPLY + if [[ $SASL_PASSWORD == $SASL_PASSWORD_CONFIRM ]]; then + sasl_password $SASL_USER $SASL_PASSWORD + break + else + printf "\nPaswords did not match. Please try again" + fi + done + +} + +#Check for the root user first +while true ; do + printf "\nWould you like to set the root password (Y|N) " + read + case $REPLY in + Y|y) + set_root_password + if [[ $? == 0 ]] ; then + break ; + fi + ;; + N|n) + break ; + ;; + esac +done + +#Check for any sasl users +while true ; do + printf "\nWould you like to add a new sasl user for libvirt (Y|N) " + read + case $REPLY in + Y|y) + prompt_sasl_user + ;; + N|n) + break ; + ;; + esac +done + -- 1.5.6.5 From mmorsi at redhat.com Mon Nov 10 19:29:50 2008 From: mmorsi at redhat.com (Mohammed Morsi) Date: Mon, 10 Nov 2008 14:29:50 -0500 Subject: [Ovirt-devel] Re: [PATCH server] build correct db using configured rails env in ovirt-server-install In-Reply-To: <1226344700-19450-1-git-send-email-mmorsi@redhat.com> References: <1226344700-19450-1-git-send-email-mmorsi@redhat.com> Message-ID: <49188BAE.8070407@redhat.com> Mohammed Morsi wrote: > set RAILS_ENV in conf/ovirt-rails.sysconf before building > --- > This patch is needed to fix the test suite and useful just for general development. After it is applied, anyone (including autobuild) can set their server to be in the 'development' or any other mode as when building a new rpm. oVirt will pick this up and create / configure the appropriate database and set rails to run in the proper environment. Many of the 'rake' features, particularly those relating to testing, default to generating a schema from the 'development' database before creating the test one. This will fix selenium and a few other tests as well, since the environment can be set to development during the build phase, the application's user, as defined in the application controller, will be statically set to ovirtadmin, thus manual authentication will not be required (obviously a problem for autobuild) -Mo From apevec at redhat.com Mon Nov 10 20:39:27 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 10 Nov 2008 21:39:27 +0100 Subject: [Ovirt-devel] Re: [PATCH recipe] Changes to support removal of second network interface on the appliance In-Reply-To: <1226217037-15973-1-git-send-email-pmyers@redhat.com> References: <--compose> <1226217037-15973-1-git-send-email-pmyers@redhat.com> Message-ID: <49189BFF.8000506@redhat.com> ACK - this simplifies setup and gives better performance, avoiding additional hop through appliance Only thing to note is that you need to run ovirt-create-network on the host machine to get necessary iptables changes. From apevec at redhat.com Mon Nov 10 20:44:25 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 10 Nov 2008 21:44:25 +0100 Subject: [Ovirt-devel] Re: [PATCH appliance] Move appliance creation out of spec file to Makefile In-Reply-To: <4918758E.6080408@redhat.com> References: <--thread> <1226329821-19972-1-git-send-email-pmyers@redhat.com> <4918724E.5090902@redhat.com> <4918758E.6080408@redhat.com> Message-ID: <49189D29.7010103@redhat.com> Perry Myers wrote: >> Resulting appliance doesn't use virtio for neither NIC or disk. >> AFAICT image XML doesn't carry info about NIC/disk model and I don't >> see the option to specify virtio as virt-image parameter. Any ideas? >> Running the appliance w/o virtio would bring a performance regression. > > That doesn't affect this patch exactly, but does affect the patch where > I refactor create-ovirt-appliance to use virt-image instead of XML > templates. right, then ACK here > I could switch from virt-image to virt-install in the short term until > virt-image/appliance-creator fixes virtio situation. and make ACK for "Refactor the create-ovirt-appliance script into several scripts" conditional on that change From apevec at redhat.com Mon Nov 10 20:46:06 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 10 Nov 2008 21:46:06 +0100 Subject: [Ovirt-devel] Re: [PATCH recipe] Remove ftp service from appliance as it is not necessary In-Reply-To: <1226203221-13742-1-git-send-email-pmyers@redhat.com> References: <1226203221-13742-1-git-send-email-pmyers@redhat.com> Message-ID: <49189D8E.4010401@redhat.com> ACK From apevec at redhat.com Mon Nov 10 21:18:23 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 10 Nov 2008 22:18:23 +0100 Subject: [Ovirt-devel] Re: [PATCH recipe] Move logic for appliance setup from kickstart to recipe In-Reply-To: <1226216760-15794-2-git-send-email-pmyers@redhat.com> References: <1226216760-15794-1-git-send-email-pmyers@redhat.com> <1226216760-15794-2-git-send-email-pmyers@redhat.com> Message-ID: <4918A51F.7000701@redhat.com> Perry Myers wrote: > --- /dev/null > +++ b/appliances/ovirt/files/cobbler-import this new file needs to be added to EXTRA_DIST otherwise it doesn't end up For a good measure, please list all files individually in %files section, that would catch such issues during RPM build. From apevec at redhat.com Mon Nov 10 21:18:54 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 10 Nov 2008 22:18:54 +0100 Subject: [Ovirt-devel] Re: [PATCH appliance] Move logic for appliance setup from kickstart to recipe In-Reply-To: <1226216760-15794-3-git-send-email-pmyers@redhat.com> References: <1226216760-15794-1-git-send-email-pmyers@redhat.com> <1226216760-15794-2-git-send-email-pmyers@redhat.com> <1226216760-15794-3-git-send-email-pmyers@redhat.com> Message-ID: <4918A53E.6000003@redhat.com> ACK From apevec at redhat.com Mon Nov 10 21:19:20 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 10 Nov 2008 22:19:20 +0100 Subject: [Ovirt-devel] Re: [PATCH node-image] Add passwd/userlib back in and fix pam to not need cracklib In-Reply-To: <1226199072-12411-1-git-send-email-pmyers@redhat.com> References: <1226199072-12411-1-git-send-email-pmyers@redhat.com> Message-ID: <4918A558.9030308@redhat.com> ACK From pmyers at redhat.com Mon Nov 10 21:25:46 2008 From: pmyers at redhat.com (Perry Myers) Date: Mon, 10 Nov 2008 16:25:46 -0500 Subject: [Ovirt-devel] Re: [PATCH recipe] Move logic for appliance setup from kickstart to recipe In-Reply-To: <4918A51F.7000701@redhat.com> References: <1226216760-15794-1-git-send-email-pmyers@redhat.com> <1226216760-15794-2-git-send-email-pmyers@redhat.com> <4918A51F.7000701@redhat.com> Message-ID: <4918A6DA.3060207@redhat.com> Alan Pevec wrote: > Perry Myers wrote: >> --- /dev/null >> +++ b/appliances/ovirt/files/cobbler-import > > this new file needs to be added to EXTRA_DIST otherwise it doesn't end up > For a good measure, please list all files individually in %files > section, that would catch such issues during RPM build. > Added to EXTRA_DISK, will fix the spec file as separate patch Perry -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=| From dhuff at redhat.com Mon Nov 10 22:47:16 2008 From: dhuff at redhat.com (David Huff) Date: Mon, 10 Nov 2008 17:47:16 -0500 Subject: [Ovirt-devel] [PATCH appliance] Move appliance creation out of spec file to Makefile In-Reply-To: <1226329821-19972-1-git-send-email-pmyers@redhat.com> References: <--thread> <1226329821-19972-1-git-send-email-pmyers@redhat.com> Message-ID: <4918B9F4.8080207@redhat.com> Perry Myers wrote: > The appliance-creator RPM is now just used to store the > create-ovirt-appliance script and contains dependencies for > installing and running the appliance. > > The appliance is also modified to be packaged in zip format. > Qcow2 format for the disks is used until appliance-tools support > tar. new build that adds tar support is available in koji however is not available in updates repos as of yet. F-10: https://koji.fedoraproject.org/koji/buildinfo?buildID=69115 F-9: https://koji.fedoraproject.org/koji/buildinfo?buildID=69122\ -D From sburgess at redhat.com Mon Nov 10 23:10:52 2008 From: sburgess at redhat.com (Susan Burgess) Date: Tue, 11 Nov 2008 09:10:52 +1000 Subject: [Ovirt-devel] Status Report - Susan Burgess - 11/11/2008 Message-ID: <4918BF7C.5050404@redhat.com> * RHCT study - frantic this weeks course cancelled * Preparing UI to olh linkmap, to assist in context-senstivity * Updated OSS UI Usage doc, to no avail, due to git problems: * Solutions and help from Chris and Jim * New problems occur *UI coming together nicely, but looking forward to it stabilising. *Helping new authors with joys of docbook Next Week * Continue work on updating oVirt Usage Guide/s I will be putting in 9-10 hour days to ensure that latest versions are available for the Nov/Dec releases. * RHCT study Thanks Susan -- Susan Burgess Content Author Red Hat APAC Level 1, 193 North Quay Brisbane, QLD 4000 Australia Phone +61 7 3514 8179 Fax +61 7 3514 8199 Mail sburgess at redhat.com From mmorsi at redhat.com Mon Nov 10 23:15:54 2008 From: mmorsi at redhat.com (Mohammed Morsi) Date: Mon, 10 Nov 2008 18:15:54 -0500 Subject: [Ovirt-devel] [PATCH appliance] removed extraneous / incorrect setting of rails env Message-ID: <1226358955-9555-1-git-send-email-mmorsi@redhat.com> --- autobuild.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/autobuild.sh b/autobuild.sh index 07ea1db..61ea6c6 100755 --- a/autobuild.sh +++ b/autobuild.sh @@ -108,4 +108,4 @@ for i in $(seq 1 10); do sleep 10 done -$ssh_cmd "cd /usr/share/ovirt-server && export RAILS_ENV=test && rake test" +$ssh_cmd "cd /usr/share/ovirt-server && rake test" -- 1.5.6.5 From mmorsi at redhat.com Mon Nov 10 23:15:55 2008 From: mmorsi at redhat.com (Mohammed Morsi) Date: Mon, 10 Nov 2008 18:15:55 -0500 Subject: [Ovirt-devel] [PATCH server] put autobuild generated server into dev mode In-Reply-To: <1226358955-9555-1-git-send-email-mmorsi@redhat.com> References: <1226358955-9555-1-git-send-email-mmorsi@redhat.com> Message-ID: <1226358955-9555-2-git-send-email-mmorsi@redhat.com> --- autobuild.sh | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/autobuild.sh b/autobuild.sh index 85e3e7a..3f3d74a 100755 --- a/autobuild.sh +++ b/autobuild.sh @@ -25,9 +25,8 @@ set -v test -f Makefile && make -k distclean || : -# set ovirt to initialize / use test db -sed -i "s/DATABASE=ovirt/DATABASE=ovirt_test/" scripts/ovirt-server-install -sed -i "s/rake/export RAILS_ENV=test\\nrake/" scripts/ovirt-server-install +# put rails in development mode +echo "RAILS_ENV=development" >> conf/ovirt-rails.sysconf ./autogen.sh --prefix=$AUTOBUILD_INSTALL_ROOT make dist -- 1.5.6.5 From jim at meyering.net Tue Nov 11 09:00:27 2008 From: jim at meyering.net (Jim Meyering) Date: Tue, 11 Nov 2008 10:00:27 +0100 Subject: [Ovirt-devel] [PATCH node] RSyslog configuration for standalone mode. In-Reply-To: <1226328385-20013-1-git-send-email-bkearney@redhat.com> (Bryan Kearney's message of "Mon, 10 Nov 2008 09:46:25 -0500") References: <1226328385-20013-1-git-send-email-bkearney@redhat.com> Message-ID: <87d4h2iqms.fsf@rho.meyering.net> Bryan Kearney wrote: > It looks for a DNS service locator record by default, and lets the > user override if desired. Supports setting the maximum log file size. Includes comments from Alan Pevec and Jim Meyering. > --- > scripts/ovirt-config-logging | 143 ++++++++++++++++++++++++++++++++++++++++++ > scripts/ovirt-config-setup | 2 + > 2 files changed, 145 insertions(+), 0 deletions(-) ACK, modulo two nits: > +function prompt_user { > + while true ; do ... > + printf "\n Max Logfile Size: $MAX_LOG_SIZE" <<< The trailing blanks above would make your "push" fail. ... > + printf "found! Useing server '$DEFAULT_SERVER:$DEFAULT_PORT'.\n" s/ei/i/ From bkearney at redhat.com Tue Nov 11 14:07:50 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Tue, 11 Nov 2008 09:07:50 -0500 Subject: [Ovirt-devel] Updates for the ACK'ed patch Message-ID: <1226412471-8428-1-git-send-email-bkearney@redhat.com> -- bk From bkearney at redhat.com Tue Nov 11 14:07:51 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Tue, 11 Nov 2008 09:07:51 -0500 Subject: [Ovirt-devel] [PATCH node] RSyslog configuration for standalone mode. In-Reply-To: <1226412471-8428-1-git-send-email-bkearney@redhat.com> References: <1226412471-8428-1-git-send-email-bkearney@redhat.com> Message-ID: <1226412471-8428-2-git-send-email-bkearney@redhat.com> It looks for a DNS service locator record by default, and lets the user override if desired. Supports setting the maximum log file size. Includes comments from Alan Pevec and Jim Meyering. --- scripts/ovirt-config-logging | 143 ++++++++++++++++++++++++++++++++++++++++++ scripts/ovirt-config-setup | 2 + 2 files changed, 145 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging index 8b13789..fb5f96e 100755 --- a/scripts/ovirt-config-logging +++ b/scripts/ovirt-config-logging @@ -1 +1,144 @@ +#!/bin/bash +# +# Configures the rsyslog daemon. +# Source functions library +. /etc/init.d/functions +. /etc/init.d/ovirt-functions + + +RSYSLOG_FILE="/etc/rsyslog.conf" + +# Creates the rsyslog file based on the following inputs +# $1 ipaddress of remote syslog server +# $2 port of remote syslog server +# $3 protocol (tcp or udp) +function ovirt_rsyslog { + +if [[ "$3" = "tcp" ]]; then + DELIM="@@" +else + DELIM="@" +fi + +cat > $RSYSLOG_FILE << EOF +#ovirt rsyslog config file + +#### MODULES #### +\$ModLoad imuxsock.so # provides support for local system logging (e.g. via logger command) +\$ModLoad imklog.so # provides kernel logging support (previously done by rklogd) + +#### GLOBAL DIRECTIVES #### +# Use default timestamp format +\$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +#### RULES #### +# Log anything (except mail) of level info or higher. +# Don't log private authentication messages! +*.info;mail.none;authpriv.none;cron.none /var/log/messages + +# The authpriv file has restricted access. +authpriv.* /var/log/secure + +# Log all the mail messages in one place. +mail.* -/var/log/maillog + +# Log cron stuff +cron.* /var/log/cron + +# Everybody gets emergency messages +*.emerg * + +# Save news errors of level crit and higher in a special file. +uucp,news.crit /var/log/spooler + +# Save boot messages also to boot.log +local7.* /var/log/boot.log + +\$WorkDirectory /var/spool/rsyslog +\$ActionQueueFileName ovirtNode +\$ActionQueueMaxDiskSpace 10m +\$ActionQueueSaveOnShutdown on +\$ActionQueueType LinkedList +\$ActionResumeRetryCount -1 +*.* $DELIM$1:$2 +EOF + +/sbin/service rsyslog restart +} + +function prompt_user { + while true ; do + MAX_LOG_SIZE="10k" + printf "\nWhat is the max size for log files on this machine [10k]? " + read + if [[ "$REPLY" != "" ]]; then + MAX_LOG_SIZE=$REPLY + fi + printf "\nWhat is the IP address or server name for the syslog server? " + read + SYSLOG_SERVER_IP=$REPLY + printf "\nWhat port does the syslog daemon run on? " + read + if [[ "$REPLY" =~ '^[0-9]+$' ]]; then + SYSLOG_SERVER_PORT=$REPLY + + PROTOCOLS="tcp udp" + PS3="Please select the protocol to use: " + select SYSLOG_SERVER_PROTOCOL in $PROTOCOLS; + do + case $SYSLOG_SERVER_PROTOCOL in + "tcp") + break ;; + "udp") + break;; + esac + done + + printf "\n" + printf "\nLogging will be configured as follows:" + printf "\n======================================" + printf "\n Max Logfile Size: $MAX_LOG_SIZE" + printf "\n Remote Server: $SYSLOG_SERVER_IP" + printf "\n Remote Port: $SYSLOG_SERVER_PORT" + printf "\n Logging Protocol: $SYSLOG_SERVER_PROTOCOL" + printf "\n" + printf "\nPlease confirm these changes (Y/N)" + read + case $REPLY in + Y|y) + ovirt_rsyslog $SYSLOG_SERVER_IP \ + $SYSLOG_SERVER_PORT \ + $SYSLOG_SERVER_PROTOCOL + sed -i -e "s/^size=.*/size=$MAX_LOG_SIZE/" \ + /etc/logrotate.d/ovirt-logrotate.conf + break + ;; + N|n) + printf "Discarding settings\n" + break + ;; + esac + else + printf "Invalid port number\n" + fi + done + +} + +# check if we were called to attempt to default +# to remote logging +if [[ "$1" = "default" ]] ; then + printf "\nAttempting to locate remote syslog server..." + find_srv syslog udp + if [[ "$SRV_PORT" != "" ]] && [[ "$SRV_SERVER" != "" ]] ; then + printf "found! Useing server '$DEFAULT_SERVER:$DEFAULT_PORT'.\n" + ovirt_rsyslog $DEFAULT_SERVER $DEFAULT_PORT "udp" + else + printf "not found!\n" + fi +else + prompt_user +fi + +exit 0 diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup index 8408d14..5850aa8 100755 --- a/scripts/ovirt-config-setup +++ b/scripts/ovirt-config-setup @@ -2,6 +2,8 @@ # # Entry point for configuring an oVirt node when running in standalone mode. +#Attempt to default the syslog setting +ovirt-config-logging "default" while true; do PS3="Please select an option: " # TODO should we make this optional, based on whether the password was already set? -- 1.5.6.5 From bkearney at redhat.com Tue Nov 11 14:09:13 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Tue, 11 Nov 2008 09:09:13 -0500 Subject: [Ovirt-devel] Updates for the ACK'ed patch In-Reply-To: <1226412471-8428-1-git-send-email-bkearney@redhat.com> References: <1226412471-8428-1-git-send-email-bkearney@redhat.com> Message-ID: <49199209.2040608@redhat.com> Durn it. THis has the changes which Jim asked for in the ACK email. Darryl.. can you please push when you push your main patch. Thank you! -- bk Bryan Kearney wrote: > -- bk > > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel From kraxel at redhat.com Tue Nov 11 15:48:04 2008 From: kraxel at redhat.com (Gerd Hoffmann) Date: Tue, 11 Nov 2008 16:48:04 +0100 Subject: [Ovirt-devel] oVirt console (again!) In-Reply-To: <4913F7D1.40407@redhat.com> References: <20081106170118.GA21838@amd.home.annexia.org> <49135B6D.9010008@redhat.com> <20081106210253.GA22878@amd.home.annexia.org> <4913F7D1.40407@redhat.com> Message-ID: <4919A934.1000207@redhat.com> Gerd Hoffmann wrote: > Richard W.M. Jones wrote: >> The problem, as ever, is with Windows. It's hard to set up a Windows >> client as a Kerberos client, so this won't just work. > Might be worth talking to the freeipa/samba folks maybe whenever it is > possible to make windows play nice here? Some doc reading and experiments later ... With MIT Kerberos for Windows installed the Windows machine can authenticate against freeipa. Setup is pretty straight forward and described at the freeipa website. Requires that the applications support gssapi though. Firefox can handle both ways (sspi == native windows with ADC, gssapi == MIT). To get the WUI on a windows box this must be setup anyway. Then have libvirt auth via MIT-gssapi too should work nicely and probably without too much coding effort as gssapi at linux code is there already ... cheers, Gerd From rjones at redhat.com Tue Nov 11 16:09:45 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Tue, 11 Nov 2008 16:09:45 +0000 Subject: [Ovirt-devel] oVirt console (again!) In-Reply-To: <4919A934.1000207@redhat.com> References: <20081106170118.GA21838@amd.home.annexia.org> <49135B6D.9010008@redhat.com> <20081106210253.GA22878@amd.home.annexia.org> <4913F7D1.40407@redhat.com> <4919A934.1000207@redhat.com> Message-ID: <20081111160945.GA20175@amd.home.annexia.org> On Tue, Nov 11, 2008 at 04:48:04PM +0100, Gerd Hoffmann wrote: > Gerd Hoffmann wrote: > > Richard W.M. Jones wrote: > >> The problem, as ever, is with Windows. It's hard to set up a Windows > >> client as a Kerberos client, so this won't just work. > > > Might be worth talking to the freeipa/samba folks maybe whenever it is > > possible to make windows play nice here? > > Some doc reading and experiments later ... > > With MIT Kerberos for Windows installed the Windows machine can > authenticate against freeipa. Setup is pretty straight forward and > described at the freeipa website. > > Requires that the applications support gssapi though. Firefox can > handle both ways (sspi == native windows with ADC, gssapi == MIT). > > To get the WUI on a windows box this must be setup anyway. Then have > libvirt auth via MIT-gssapi too should work nicely and probably without > too much coding effort as gssapi at linux code is there already ... I've been banging my head against NSS/NSPR all morning, so crypto libraries & Mozilla are both generally driving me around the bend :-( However last weekend I did find that someone has ported a part of Cyrus SASL to Windows. Good news that at least it's possible! Unfortunately bad news that there's no source for their port (so we'll have to recreate the techniques) and I suspect that it's only a partial port and key bits may be missing. Not looked into it in great detail yet, but the binary is here: http://developer.pidgin.im/wiki/BuildingWinPidgin Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 68 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora From jguiditt at redhat.com Tue Nov 11 16:25:25 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Tue, 11 Nov 2008 11:25:25 -0500 Subject: [Ovirt-devel] [PATCH] add 'state' field to storage pools and volumes In-Reply-To: <1226003082-12718-1-git-send-email-sseago@redhat.com> References: <1226003082-12718-1-git-send-email-sseago@redhat.com> Message-ID: <1226420725.5686.8.camel@physical.priv.ovirt.org> On Thu, 2008-11-06 at 20:24 +0000, Scott Seago wrote: > I've added a state field to StoragePool and StorageVolume. When initially created, pools and volumes are in the pending_setup state -- once taskomatic is done they're 'available'. Upon deletion, they go into pending_deletion until taskomatic is done. > > Taskomatic changes to take this into account have not yet been included, since clalance's LVM patch hasn't been pushed. > > Signed-off-by: Scott Seago > --- > src/app/controllers/storage_controller.rb | 4 +- > src/app/controllers/vm_controller.rb | 2 +- > src/app/models/hardware_pool.rb | 17 +++++++++-- > src/app/models/storage_pool.rb | 33 ++++++++++++++++++----- > src/app/models/storage_volume.rb | 33 ++++++++++++++++++----- > src/app/views/storage/show.rhtml | 2 + > src/app/views/storage/show_volume.rhtml | 2 + > src/db/migrate/029_storage_state_field.rb | 42 +++++++++++++++++++++++++++++ > src/test/fixtures/storage_pools.yml | 10 +++++++ > src/test/fixtures/storage_volumes.yml | 6 ++++ > 10 files changed, 131 insertions(+), 20 deletions(-) > create mode 100644 src/db/migrate/029_storage_state_field.rb > > diff --git a/src/app/controllers/storage_controller.rb b/src/app/controllers/storage_controller.rb > index 75058cd..e3e5522 100644 > --- a/src/app/controllers/storage_controller.rb > +++ b/src/app/controllers/storage_controller.rb > @@ -442,9 +442,9 @@ class StorageController < ApplicationController > vm_list = volume.vms.collect {|vm| vm.description}.join(", ") > ["Storage Volume #{name} must be unattached from VMs (#{vm_list}) before deleting it.", > false] > - #FIXME: create delete volume task. include metadata in task > else > - #FIXME: need to set volume to 'unavailable' state once we have states > + volume.state=StorageVolume::STATE_PENDING_DELETION > + volume.save! > @task = StorageVolumeTask.new({ :user => @user, > :task_target => volume, > :action => StorageVolumeTask::ACTION_DELETE_VOLUME, > diff --git a/src/app/controllers/vm_controller.rb b/src/app/controllers/vm_controller.rb > index ee956da..ff74a37 100644 > --- a/src/app/controllers/vm_controller.rb > +++ b/src/app/controllers/vm_controller.rb > @@ -81,7 +81,7 @@ class VmController < ApplicationController > end > > def edit > - @storage_tree = @vm.vm_resource_pool.get_hardware_pool.storage_tree(@vm).to_json > + @storage_tree = @vm.vm_resource_pool.get_hardware_pool.storage_tree(:vm_to_include => @vm).to_json > render :layout => 'popup' > end > > diff --git a/src/app/models/hardware_pool.rb b/src/app/models/hardware_pool.rb > index 6780329..d39d8e7 100644 > --- a/src/app/models/hardware_pool.rb > +++ b/src/app/models/hardware_pool.rb > @@ -101,10 +101,21 @@ class HardwarePool < Pool > return {:total => total, :labels => labels} > end > > - def storage_tree(vm_to_include=nil) > + # params accepted: > + # :vm_to_include - if specified, storage used by this VM is included in the tree > + # :filter_unavailable - if true, don't include Storage not currently available > + # :include_used - include all storage pools/volumes, even those in use > + def storage_tree(params = {}) > + vm_to_include=params.fetch(:vm_to_include, nil) > + filter_unavailable = params.fetch(:filter_unavailable, true) > + include_used = params.fetch(:include_used, false) > + conditions = "type != 'LvmStoragePool'" > + if filter_unavailable > + conditions = "(#{conditions}) and (storage_pools.state = '#{StoragePool::STATE_AVAILABLE}')" > + end > storage_pools.find(:all, > - :conditions => "type != 'LvmStoragePool'").collect do |pool| > - pool.storage_tree_element(vm_to_include) > + :conditions => conditions).collect do |pool| > + pool.storage_tree_element(params) > end > end > end > diff --git a/src/app/models/storage_pool.rb b/src/app/models/storage_pool.rb > index 9c550b8..9c80f54 100644 > --- a/src/app/models/storage_pool.rb > +++ b/src/app/models/storage_pool.rb > @@ -50,7 +50,12 @@ class StoragePool < ActiveRecord::Base > LVM => "Lvm" } > STORAGE_TYPE_PICKLIST = STORAGE_TYPES.keys - [LVM] > > - def self.factory(type, params = nil) > + STATE_PENDING_SETUP = "pending_setup" > + STATE_PENDING_DELETION = "pending_deletion" > + STATE_AVAILABLE = "available" > + > + def self.factory(type, params = {}) > + params[:state] = STATE_PENDING_SETUP unless params[:state] > case type > when ISCSI > return IscsiStoragePool.new(params) > @@ -82,7 +87,10 @@ class StoragePool < ActiveRecord::Base > false > end > > - def storage_tree_element(vm_to_include=nil) > + def storage_tree_element(params = {}) > + vm_to_include=params.fetch(:vm_to_include, nil) > + filter_unavailable = params.fetch(:filter_unavailable, true) > + include_used = params.fetch(:include_used, false) > return_hash = { :id => id, > :type => self[:type], > :text => display_name, > @@ -90,14 +98,25 @@ class StoragePool < ActiveRecord::Base > :available => false, > :create_volume => user_subdividable, > :selected => false} > - condition = "vms.id is null" > - if (vm_to_include and vm_to_include.id) > - condition +=" or vms.id=#{vm_to_include.id}" > + conditions = nil > + unless include_used > + conditions = "vms.id is null" > + if (vm_to_include and vm_to_include.id) > + conditions +=" or vms.id=#{vm_to_include.id}" > + end > + end > + if filter_unavailable > + availability_conditions = "storage_volumes.state = '#{StoragePool::STATE_AVAILABLE}'" > + if conditions.nil? > + conditions = availability_conditions > + else > + conditions ="(#{conditions}) and (#{availability_conditions})" > + end > end > return_hash[:children] = storage_volumes.find(:all, > :include => :vms, > - :conditions => condition).collect do |volume| > - volume.storage_tree_element(vm_to_include) > + :conditions => conditions).collect do |volume| > + volume.storage_tree_element(params) > end > return_hash > end > diff --git a/src/app/models/storage_volume.rb b/src/app/models/storage_volume.rb > index 6f14c4d..56cdcef 100644 > --- a/src/app/models/storage_volume.rb > +++ b/src/app/models/storage_volume.rb > @@ -32,7 +32,12 @@ class StorageVolume < ActiveRecord::Base > end > end > > - def self.factory(type, params = nil) > + STATE_PENDING_SETUP = "pending_setup" > + STATE_PENDING_DELETION = "pending_deletion" > + STATE_AVAILABLE = "available" > + > + def self.factory(type, params = {}) > + params[:state] = STATE_PENDING_SETUP unless params[:state] > case type > when StoragePool::ISCSI > return IscsiStorageVolume.new(params) > @@ -75,7 +80,10 @@ class StorageVolume < ActiveRecord::Base > return false > end > > - def storage_tree_element(vm_to_include=nil) > + def storage_tree_element(params = {}) > + vm_to_include=params.fetch(:vm_to_include, nil) > + filter_unavailable = params.fetch(:filter_unavailable, true) > + include_used = params.fetch(:include_used, false) > vm_ids = vms.collect {|vm| vm.id} > return_hash = { :id => id, > :type => self[:type], > @@ -92,14 +100,25 @@ class StorageVolume < ActiveRecord::Base > if return_hash[:available] > return_hash[:available] = lvm_storage_pool.storage_volumes.full_vm_list.empty? > end > - condition = "vms.id is null" > - if (vm_to_include and vm_to_include.id) > - condition +=" or vms.id=#{vm_to_include.id}" > + conditions = nil > + unless include_used > + conditions = "vms.id is null" > + if (vm_to_include and vm_to_include.id) > + conditions +=" or vms.id=#{vm_to_include.id}" > + end > + end > + if filter_unavailable > + availability_conditions = "storage_volumes.state = '#{StoragePool::STATE_AVAILABLE}'" > + if conditions.nil? > + conditions = availability_conditions > + else > + conditions ="(#{conditions}) and (#{availability_conditions})" > + end > end > return_hash[:children] = lvm_storage_pool.storage_volumes.find(:all, > :include => :vms, > - :conditions => condition).collect do |volume| > - volume.storage_tree_element(vm_to_include) > + :conditions => conditions).collect do |volume| > + volume.storage_tree_element(params) > end > else > return_hash[:children] = [] > diff --git a/src/app/views/storage/show.rhtml b/src/app/views/storage/show.rhtml > index a84dc62..123cf20 100644 > --- a/src/app/views/storage/show.rhtml > +++ b/src/app/views/storage/show.rhtml > @@ -26,6 +26,7 @@ > Export path:
> <% end %> > Type:
> + State:
> >
> <%=h @storage_pool.ip_addr %>
> @@ -36,6 +37,7 @@ > <%=h @storage_pool.export_path %>
> <% end %> > <%=h @storage_pool.get_type_label %>
> + <%=h @storage_pool.state %>
>
> <%- content_for :right do -%> >
Volumes
> diff --git a/src/app/views/storage/show_volume.rhtml b/src/app/views/storage/show_volume.rhtml > index e39c10e..c1cb66a 100644 > --- a/src/app/views/storage/show_volume.rhtml > +++ b/src/app/views/storage/show_volume.rhtml > @@ -28,6 +28,7 @@ > Export path:
> <% end %> > Type:
> + State:
> Path:
> <% if @storage_volume[:type] == "IscsiStorageVolume" %> > LUN:
> @@ -45,6 +46,7 @@ > <%=h @storage_volume.storage_pool.export_path %>
> <% end %> > <%=h @storage_volume.storage_pool.get_type_label %>
> + <%=h @storage_volume.state %>
> <%=h @storage_volume.path %>
> <% if @storage_volume[:type] == "IscsiStorageVolume" %> > <%=h @storage_volume.lun %>
> diff --git a/src/db/migrate/029_storage_state_field.rb b/src/db/migrate/029_storage_state_field.rb > new file mode 100644 > index 0000000..d8f3ab1 > --- /dev/null > +++ b/src/db/migrate/029_storage_state_field.rb > @@ -0,0 +1,42 @@ > +# > +# Copyright (C) 2008 Red Hat, Inc. > +# Written by Scott Seago > +# > +# 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 StorageStateField < ActiveRecord::Migration > + def self.up > + add_column :storage_pools, :state, :string > + add_column :storage_volumes, :state, :string > + begin > + StoragePool.transaction do > + StoragePool.find(:all).each do |pool| > + pool.state = 'available' > + pool.save! > + end > + StorageVolume.find(:all).each do |volume| > + volume.state = 'available' > + volume.save! > + end > + end > + end > + end > + > + def self.down > + remove_column :storage_pools, :state > + remove_column :storage_volumes, :state > + end > +end > diff --git a/src/test/fixtures/storage_pools.yml b/src/test/fixtures/storage_pools.yml > index ac042a0..d52bf51 100644 > --- a/src/test/fixtures/storage_pools.yml > +++ b/src/test/fixtures/storage_pools.yml > @@ -5,18 +5,21 @@ one: > type: 'IscsiStoragePool' > port: 53 > target: 'footarget' > + state: 'available' > two: > id: 2 > hardware_pool_id: 4 > type: 'NfsStoragePool' > ip_addr: '127.0.0.1' > export_path: '/tmp/foopath' > + state: 'available' > three: > id: 3 > hardware_pool_id: 4 > type: 'NfsStoragePool' > ip_addr: '192.168.50.1' > export_path: '/tmp/barpath' > + state: 'available' > four: > id: 4 > hardware_pool_id: 9 > @@ -25,24 +28,28 @@ four: > ip_addr: '192.168.50.1' > target: 'rubarb' > hardware_pool_id: 1 > + state: 'available' > five: > id: 5 > hardware_pool_id: 9 > type: 'NfsStoragePool' > ip_addr: '192.168.50.2' > export_path: '/tmp/thepath' > + state: 'available' > six: > id: 6 > hardware_pool_id: 9 > type: 'NfsStoragePool' > ip_addr: '192.168.50.3' > export_path: '/tmp/anotherpath' > + state: 'available' > seven: > id: 7 > hardware_pool_id: 9 > type: 'NfsStoragePool' > ip_addr: '192.168.50.4' > export_path: '/tmp/apath' > + state: 'available' > eight: > id: 8 > hardware_pool_id: 9 > @@ -50,12 +57,14 @@ eight: > type: 'IscsiStoragePool' > port: 531 > target: 'bartarget' > + state: 'available' > nine: > id: 9 > hardware_pool_id: 9 > type: 'NfsStoragePool' > ip_addr: '1.2.3.4' > export_path: '/tmp/somepath' > + state: 'available' > ten: > id: 10 > hardware_pool_id: 9 > @@ -63,3 +72,4 @@ ten: > ip_addr: '192.168.50.3' > port: 539 > target: 'stayontarget' > + state: 'available' > diff --git a/src/test/fixtures/storage_volumes.yml b/src/test/fixtures/storage_volumes.yml > index 1c49ace..4761d95 100644 > --- a/src/test/fixtures/storage_volumes.yml > +++ b/src/test/fixtures/storage_volumes.yml > @@ -6,6 +6,7 @@ one: > path: '/tmp/foobar' > storage_pool_id: 1 > type: 'IscsiStorageVolume' > + state: 'available' > two: > id: 2 > size: '20485760' > @@ -13,6 +14,7 @@ two: > storage_pool_id: 2 > type: 'NfsStorageVolume' > filename: 'secretstuff' > + state: 'available' > three: > id: 3 > lun: 'abcd' > @@ -20,21 +22,25 @@ three: > path: > storage_pool_id: 1 > type: 'IscsiStorageVolume' > + state: 'available' > four: > id: 4 > lun: '49723e4d-32e6-469e-8019-913a3dc1bb5d' > size: '01223542' > storage_pool_id: 4 > type: 'IscsiStorageVolume' > + state: 'available' > five: > id: 5 > size: '42424242' > storage_pool_id: 2 > type: 'NfsStorageVolume' > filename: 'foobar' > + state: 'available' > six: > id: 6 > size: '007007' > storage_pool_id: 6 > type: 'NfsStorageVolume' > filename: 'barfoo' > + state: 'available' ACK, with, as usual, a little feedback. I tested this by manually changing the state of storage volumes and pools. They updated appropriately in both the detail areas (showing correct state) and the storage tree for new vm creation (only appearing in the list when state=available). Now for the feedback. I am currently reworking to fixtures to fit rails 2.1 standards/features, so this could be before or after I finish that, but I think we should really try to start writing unit tests for things like this. There are some fairly complicated bits that could be pretty easily misunderstood and broken by someone else trying to add functionality to this code. Unit tests on each of these methods asserting what should come back would easily allow another developer to see quickly if they unintentionally broke something. Like I said, I am fine with waiting on this one until my upcoming changes are in, but I would like to see us get in the habit of writing more tests, especially since there are so many moving pieces and possible points of failure. -j From apevec at redhat.com Tue Nov 11 16:49:28 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 11 Nov 2008 17:49:28 +0100 Subject: [Ovirt-devel] Re: [PATCH] ovirt-uninstall-node: sync one more warn function with the rest In-Reply-To: <87prl7sam4.fsf@rho.meyering.net> References: <87prl7sam4.fsf@rho.meyering.net> Message-ID: <4919B798.2020006@redhat.com> Jim Meyering wrote: > This sync's one warn definition with the 6 others. ACK looking forward to git-submodularized setup :) From apevec at redhat.com Tue Nov 11 16:58:26 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 11 Nov 2008 17:58:26 +0100 Subject: [Ovirt-devel] Re: [PATCH appliance] Move appliance creation out of spec file to Makefile In-Reply-To: <4918B9F4.8080207@redhat.com> References: <--thread> <1226329821-19972-1-git-send-email-pmyers@redhat.com> <4918B9F4.8080207@redhat.com> Message-ID: <4919B9B2.70907@redhat.com> David Huff wrote: > Perry Myers wrote: >> The appliance-creator RPM is now just used to store the >> create-ovirt-appliance script and contains dependencies for >> installing and running the appliance. >> >> The appliance is also modified to be packaged in zip format. >> Qcow2 format for the disks is used until appliance-tools support >> tar. > > new build that adds tar support is available in koji however is not > available in updates repos as of yet. Thanks David! I've uploaded appliance-tools-002-5 to ovirt.org YUM repo, I'll remove it when Fedora bodhi/mirrors catch up. From mmorsi at redhat.com Tue Nov 11 17:29:46 2008 From: mmorsi at redhat.com (Mohammed Morsi) Date: Tue, 11 Nov 2008 12:29:46 -0500 Subject: [Ovirt-devel] [PATCH server] removed lingering, deprecated templates Message-ID: <1226424586-3443-1-git-send-email-mmorsi@redhat.com> --- src/app/views/layouts/_header.rhtml | 6 ---- src/app/views/layouts/default.rhtml | 48 ----------------------------------- 2 files changed, 0 insertions(+), 54 deletions(-) delete mode 100644 src/app/views/layouts/_header.rhtml delete mode 100644 src/app/views/layouts/default.rhtml diff --git a/src/app/views/layouts/_header.rhtml b/src/app/views/layouts/_header.rhtml deleted file mode 100644 index df55d3f..0000000 --- a/src/app/views/layouts/_header.rhtml +++ /dev/null @@ -1,6 +0,0 @@ - - diff --git a/src/app/views/layouts/default.rhtml b/src/app/views/layouts/default.rhtml deleted file mode 100644 index 81df246..0000000 --- a/src/app/views/layouts/default.rhtml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - <%= yield :title -%> - <%= stylesheet_link_tag 'default' %> - <%= javascript_include_tag "prototype" -%> - - <%= stylesheet_link_tag '/javascripts/jquery-treeview/jquery.treeview.css' %> - <%= javascript_include_tag "jquery.pack.js" -%> - <%= javascript_include_tag "jquery-treeview/jquery.treeview.js" -%> - <%= javascript_include_tag "jquery-treeview/jquery.treeview.async.js" -%> - <%= yield :scripts -%> - - - - -
<%= link_to image_tag("ovirt_logo.png", :class_name => "logo"), :controller => "resources", :action => "list" -%>Logged in as: <%= @controller.get_login_user -%>
-
 
-
 
- - - -
- - <%= render :partial => '/layouts/tree' %> - -
<%= yield :title -%>
- - <%= yield %> <% # the rest of the center and right hand side %> - -
- - - - - -- 1.5.6.5 From pmyers at redhat.com Tue Nov 11 17:59:06 2008 From: pmyers at redhat.com (Perry Myers) Date: Tue, 11 Nov 2008 12:59:06 -0500 Subject: [Ovirt-devel] Re: [PATCH appliance] Move appliance creation out of spec file to Makefile In-Reply-To: <4919B9B2.70907@redhat.com> References: <--thread> <1226329821-19972-1-git-send-email-pmyers@redhat.com> <4918B9F4.8080207@redhat.com> <4919B9B2.70907@redhat.com> Message-ID: <4919C7EA.8020200@redhat.com> Alan Pevec wrote: > David Huff wrote: >> Perry Myers wrote: >>> The appliance-creator RPM is now just used to store the >>> create-ovirt-appliance script and contains dependencies for >>> installing and running the appliance. >>> >>> The appliance is also modified to be packaged in zip format. >>> Qcow2 format for the disks is used until appliance-tools support >>> tar. >> >> new build that adds tar support is available in koji however is not >> available in updates repos as of yet. > > Thanks David! I've uploaded appliance-tools-002-5 to ovirt.org YUM repo, > I'll remove it when Fedora bodhi/mirrors catch up. > Hmm. My patch uses zip as the packaging format and qcow as the disk format since that's all appliance-creator supported at the time. Now that we have tar (gz/bz2) what format should we settle on? I'd rather get this right the first time than patch to use zip and then later change. Perry -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=| From apevec at redhat.com Tue Nov 11 18:13:05 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 11 Nov 2008 19:13:05 +0100 Subject: [Ovirt-devel] [PATCH node] RSyslog configuration for standalone mode. In-Reply-To: <1226412471-8428-2-git-send-email-bkearney@redhat.com> References: <1226412471-8428-2-git-send-email-bkearney@redhat.com> Message-ID: <1226427185-9261-1-git-send-email-apevec@redhat.com> From: Bryan Kearney It looks for a DNS service locator record by default, and lets the user override if desired. Supports setting the maximum log file size. Includes comments from Alan Pevec and Jim Meyering. --- scripts/ovirt-config-logging | 141 ++++++++++++++++++++++++++++++++++++++++++ scripts/ovirt-config-setup | 2 + 2 files changed, 143 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging index c856ef1..f17bf6b 100755 --- a/scripts/ovirt-config-logging +++ b/scripts/ovirt-config-logging @@ -1,2 +1,143 @@ #!/bin/bash # +# Configures the rsyslog daemon. +# Source functions library +. /etc/init.d/functions +. /etc/init.d/ovirt-functions + + +RSYSLOG_FILE="/etc/rsyslog.conf" + +# Creates the rsyslog file based on the following inputs +# $1 ipaddress of remote syslog server +# $2 port of remote syslog server +# $3 protocol (tcp or udp) +function ovirt_rsyslog { + +if [[ "$3" = "tcp" ]]; then + DELIM="@@" +else + DELIM="@" +fi + +cat > $RSYSLOG_FILE << EOF +#ovirt rsyslog config file + +#### MODULES #### +\$ModLoad imuxsock.so # provides support for local system logging (e.g. via logger command) +\$ModLoad imklog.so # provides kernel logging support (previously done by rklogd) + +#### GLOBAL DIRECTIVES #### +# Use default timestamp format +\$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +#### RULES #### +# Log anything (except mail) of level info or higher. +# Don't log private authentication messages! +*.info;mail.none;authpriv.none;cron.none /var/log/messages + +# The authpriv file has restricted access. +authpriv.* /var/log/secure + +# Log all the mail messages in one place. +mail.* -/var/log/maillog + +# Log cron stuff +cron.* /var/log/cron + +# Everybody gets emergency messages +*.emerg * + +# Save news errors of level crit and higher in a special file. +uucp,news.crit /var/log/spooler + +# Save boot messages also to boot.log +local7.* /var/log/boot.log + +\$WorkDirectory /var/spool/rsyslog +\$ActionQueueFileName ovirtNode +\$ActionQueueMaxDiskSpace 10m +\$ActionQueueSaveOnShutdown on +\$ActionQueueType LinkedList +\$ActionResumeRetryCount -1 +*.* $DELIM$1:$2 +EOF + +/sbin/service rsyslog restart +} + +function prompt_user { + while true ; do + MAX_LOG_SIZE="10k" + printf "\nWhat is the max size for log files on this machine [10k]? " + read + if [[ "$REPLY" != "" ]]; then + MAX_LOG_SIZE=$REPLY + fi + printf "\nWhat is the IP address or server name for the syslog server? " + read + SYSLOG_SERVER_IP=$REPLY + printf "\nWhat port does the syslog daemon run on? " + read + if [[ "$REPLY" =~ '^[0-9]+$' ]]; then + SYSLOG_SERVER_PORT=$REPLY + + PROTOCOLS="tcp udp" + PS3="Please select the protocol to use: " + select SYSLOG_SERVER_PROTOCOL in $PROTOCOLS; + do + case $SYSLOG_SERVER_PROTOCOL in + "tcp") + break ;; + "udp") + break;; + esac + done + + printf "\n" + printf "\nLogging will be configured as follows:" + printf "\n======================================" + printf "\n Max Logfile Size: $MAX_LOG_SIZE" + printf "\n Remote Server: $SYSLOG_SERVER_IP" + printf "\n Remote Port: $SYSLOG_SERVER_PORT" + printf "\n Logging Protocol: $SYSLOG_SERVER_PROTOCOL" + printf "\n" + printf "\nPlease confirm these changes (Y/N)" + read + case $REPLY in + Y|y) + ovirt_rsyslog $SYSLOG_SERVER_IP \ + $SYSLOG_SERVER_PORT \ + $SYSLOG_SERVER_PROTOCOL + sed -i -e "s/^size=.*/size=$MAX_LOG_SIZE/" \ + /etc/logrotate.d/ovirt-logrotate.conf + break + ;; + N|n) + printf "Discarding settings\n" + break + ;; + esac + else + printf "Invalid port number\n" + fi + done + +} + +# check if we were called to attempt to default +# to remote logging +if [[ "$1" = "default" ]] ; then + printf "\nAttempting to locate remote syslog server..." + find_srv syslog udp + if [[ "$SRV_PORT" != "" ]] && [[ "$SRV_SERVER" != "" ]] ; then + printf "found! Using server '$DEFAULT_SERVER:$DEFAULT_PORT'.\n" + ovirt_rsyslog $DEFAULT_SERVER $DEFAULT_PORT "udp" + else + printf "not found!\n" + fi +else + prompt_user +fi + +exit 0 diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup index 8408d14..5850aa8 100755 --- a/scripts/ovirt-config-setup +++ b/scripts/ovirt-config-setup @@ -2,6 +2,8 @@ # # Entry point for configuring an oVirt node when running in standalone mode. +#Attempt to default the syslog setting +ovirt-config-logging "default" while true; do PS3="Please select an option: " # TODO should we make this optional, based on whether the password was already set? -- 1.5.6.5 From dennisml at conversis.de Tue Nov 11 18:31:48 2008 From: dennisml at conversis.de (Dennis J.) Date: Tue, 11 Nov 2008 19:31:48 +0100 Subject: [Ovirt-devel] ovirt-appliance panic on boot Message-ID: <4919CF94.2080302@conversis.de> Hi, I just installed ovirt version 0.95 and when I start the appliance it panics with the following message: RAMDISK: Couldn't find valid RAM disk image starting at 0. VFS: Cannot open root device "sda2" or unknown-block(0,0) Please append a correct "root=" boot option; here are the available partitions: Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) Is this a known issue and how can I get the appliance to boot up properly? Regards, Dennis From pmyers at redhat.com Tue Nov 11 18:38:58 2008 From: pmyers at redhat.com (Perry Myers) Date: Tue, 11 Nov 2008 13:38:58 -0500 Subject: [Ovirt-devel] Re: [PATCH appliance] Move appliance creation out of spec file to Makefile In-Reply-To: <4919C7EA.8020200@redhat.com> References: <--thread> <1226329821-19972-1-git-send-email-pmyers@redhat.com> <4918B9F4.8080207@redhat.com> <4919B9B2.70907@redhat.com> <4919C7EA.8020200@redhat.com> Message-ID: <4919D142.7060307@redhat.com> Perry Myers wrote: > Alan Pevec wrote: >> David Huff wrote: >>> Perry Myers wrote: >>>> The appliance-creator RPM is now just used to store the >>>> create-ovirt-appliance script and contains dependencies for >>>> installing and running the appliance. >>>> >>>> The appliance is also modified to be packaged in zip format. >>>> Qcow2 format for the disks is used until appliance-tools support >>>> tar. >>> >>> new build that adds tar support is available in koji however is not >>> available in updates repos as of yet. >> >> Thanks David! I've uploaded appliance-tools-002-5 to ovirt.org YUM >> repo, I'll remove it when Fedora bodhi/mirrors catch up. >> > > Hmm. My patch uses zip as the packaging format and qcow as the disk > format since that's all appliance-creator supported at the time. > > Now that we have tar (gz/bz2) what format should we settle on? I'd > rather get this right the first time than patch to use zip and then > later change. Ok, talked to David about this a bit and I think what we're going to standardize on is tar.bz2 with raw disk images. It works in a wide variety of OSes and for Windows we'll just say that WinZIP or 7-zip need to be installed. Perry From thomas.vonsteiger at bluewin.ch Tue Nov 11 18:56:55 2008 From: thomas.vonsteiger at bluewin.ch (Thomas von Steiger) Date: Tue, 11 Nov 2008 19:56:55 +0100 Subject: [Ovirt-devel] ovirt-appliance panic on boot In-Reply-To: <4919CF94.2080302@conversis.de> References: <4919CF94.2080302@conversis.de> Message-ID: Hi, I get the same problem with version 0.95. Thomas On 11.11.2008, at 19:31, Dennis J. wrote: > Hi, > I just installed ovirt version 0.95 and when I start the appliance > it panics with the following message: > > RAMDISK: Couldn't find valid RAM disk image starting at 0. > VFS: Cannot open root device "sda2" or unknown-block(0,0) > Please append a correct "root=" boot option; here are the available > partitions: > Kernel panic - not syncing: VFS: Unable to mount root fs on unknown- > block(0,0) > > Is this a known issue and how can I get the appliance to boot up > properly? > > Regards, > Dennis > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel From apevec at redhat.com Tue Nov 11 19:57:43 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 11 Nov 2008 20:57:43 +0100 Subject: [Ovirt-devel] Re: ovirt-appliance panic on boot In-Reply-To: References: <4919CF94.2080302@conversis.de> Message-ID: <4919E3B7.8070500@redhat.com> Thomas von Steiger wrote: > I get the same problem with version 0.95. > > Thomas > > On 11.11.2008, at 19:31, Dennis J. wrote: > >> Hi, >> I just installed ovirt version 0.95 and when I start the appliance it >> panics with the following message: >> >> RAMDISK: Couldn't find valid RAM disk image starting at 0. >> VFS: Cannot open root device "sda2" or unknown-block(0,0) >> Please append a correct "root=" boot option; here are the available >> partitions: >> Kernel panic - not syncing: VFS: Unable to mount root fs on >> unknown-block(0,0) >> >> Is this a known issue and how can I get the appliance to boot up >> properly? is this i386 or x86_64 ? From dennisml at conversis.de Tue Nov 11 20:24:39 2008 From: dennisml at conversis.de (Dennis J.) Date: Tue, 11 Nov 2008 21:24:39 +0100 Subject: [Ovirt-devel] Re: ovirt-appliance panic on boot In-Reply-To: <4919E3B7.8070500@redhat.com> References: <4919CF94.2080302@conversis.de> <4919E3B7.8070500@redhat.com> Message-ID: <4919EA07.4030407@conversis.de> On 11/11/2008 08:57 PM, Alan Pevec wrote: > Thomas von Steiger wrote: >> I get the same problem with version 0.95. >> >> Thomas >> >> On 11.11.2008, at 19:31, Dennis J. wrote: >> >>> Hi, >>> I just installed ovirt version 0.95 and when I start the appliance it >>> panics with the following message: >>> >>> RAMDISK: Couldn't find valid RAM disk image starting at 0. >>> VFS: Cannot open root device "sda2" or unknown-block(0,0) >>> Please append a correct "root=" boot option; here are the available >>> partitions: >>> Kernel panic - not syncing: VFS: Unable to mount root fs on >>> unknown-block(0,0) >>> >>> Is this a known issue and how can I get the appliance to boot up >>> properly? > > is this i386 or x86_64 ? > For me it is i386. Regards, Dennis From jguiditt at redhat.com Tue Nov 11 21:38:39 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Tue, 11 Nov 2008 16:38:39 -0500 Subject: [Ovirt-devel] Re: [PATCH server] build correct db using configured rails env in ovirt-server-install In-Reply-To: <49188BAE.8070407@redhat.com> References: <1226344700-19450-1-git-send-email-mmorsi@redhat.com> <49188BAE.8070407@redhat.com> Message-ID: <1226439519.5686.17.camel@physical.priv.ovirt.org> On Mon, 2008-11-10 at 14:29 -0500, Mohammed Morsi wrote: > Mohammed Morsi wrote: > > set RAILS_ENV in conf/ovirt-rails.sysconf before building > > --- > > > > This patch is needed to fix the test suite and useful just for general > development. > > After it is applied, anyone (including autobuild) can set their server > to be in the 'development' or any other mode as when building a new rpm. > oVirt will pick this up and create / configure the appropriate database > and set rails to run in the proper environment. Many of the 'rake' > features, particularly those relating to testing, default to generating > a schema from the 'development' database before creating the test one. > > This will fix selenium and a few other tests as well, since the > environment can be set to development during the build phase, the > application's user, as defined in the application controller, will be > statically set to ovirtadmin, thus manual authentication will not be > required (obviously a problem for autobuild) > > -Mo I can't speak to the code style for the script, but ACK to functionality. I tested this both in default (production) configuration and development mode, both worked fine, created the appropriate db and wui was usable. -j From jguiditt at redhat.com Tue Nov 11 21:44:49 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Tue, 11 Nov 2008 16:44:49 -0500 Subject: [Ovirt-devel] [PATCH server] removed lingering, deprecated templates In-Reply-To: <1226424586-3443-1-git-send-email-mmorsi@redhat.com> References: <1226424586-3443-1-git-send-email-mmorsi@redhat.com> Message-ID: <1226439889.5686.21.camel@physical.priv.ovirt.org> On Tue, 2008-11-11 at 12:29 -0500, Mohammed Morsi wrote: > --- > src/app/views/layouts/_header.rhtml | 6 ---- > src/app/views/layouts/default.rhtml | 48 ----------------------------------- > 2 files changed, 0 insertions(+), 54 deletions(-) > delete mode 100644 src/app/views/layouts/_header.rhtml > delete mode 100644 src/app/views/layouts/default.rhtml > > diff --git a/src/app/views/layouts/_header.rhtml b/src/app/views/layouts/_header.rhtml > deleted file mode 100644 > index df55d3f..0000000 > --- a/src/app/views/layouts/_header.rhtml > +++ /dev/null > @@ -1,6 +0,0 @@ > - > - > diff --git a/src/app/views/layouts/default.rhtml b/src/app/views/layouts/default.rhtml > deleted file mode 100644 > index 81df246..0000000 > --- a/src/app/views/layouts/default.rhtml > +++ /dev/null > @@ -1,48 +0,0 @@ > - - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > - > - > - > - > - <%= yield :title -%> > - <%= stylesheet_link_tag 'default' %> > - <%= javascript_include_tag "prototype" -%> > - > - <%= stylesheet_link_tag '/javascripts/jquery-treeview/jquery.treeview.css' %> > - <%= javascript_include_tag "jquery.pack.js" -%> > - <%= javascript_include_tag "jquery-treeview/jquery.treeview.js" -%> > - <%= javascript_include_tag "jquery-treeview/jquery.treeview.async.js" -%> > - <%= yield :scripts -%> > - > - > - > - > -
<%= link_to image_tag("ovirt_logo.png", :class_name => "logo"), :controller => "resources", :action => "list" -%>Logged in as: <%= @controller.get_login_user -%>
> -
 
> -
 
> - > - > - > -
> - > - <%= render :partial => '/layouts/tree' %> > - > -
<%= yield :title -%>
> - > - <%= yield %> <% # the rest of the center and right hand side %> > - > -
> - > - > - > - > - I am ok with the sentiment here, but what really should be removed is the 'redux' versions. I think this is a fine first step though, we can rename redux in the near future and get all its refs in that patch. So, ACK. -j From apevec at redhat.com Tue Nov 11 22:15:17 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 11 Nov 2008 23:15:17 +0100 Subject: [Ovirt-devel] [PATCH node] Password configuration script for the root password and sasl users In-Reply-To: <1226344933-11105-1-git-send-email-bkearney@redhat.com> References: <1226344933-11105-1-git-send-email-bkearney@redhat.com> Message-ID: <1226441717-21203-1-git-send-email-apevec@redhat.com> From: Bryan Kearney REPOST - removed whitespaces and rebased to apply after mcpierce's script stubs from [PATCH node] Added a script that runs during first boot for the node. --- scripts/ovirt-config-password | 90 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 90 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-password b/scripts/ovirt-config-password index c856ef1..1dcc336 100755 --- a/scripts/ovirt-config-password +++ b/scripts/ovirt-config-password @@ -1,2 +1,92 @@ #!/bin/bash # +# Set the root password and others + +ROOT_PASSWORD="" + +function sasl_password { + printf "adding user $1 to the sasl list for libvirt\n" + echo $2 | saslpasswd2 -a libvirt -p $1 +} + +function set_root_password { + while true; do + printf "\nPlease enter the new root password (hit return to skip) " + read -s + if [[ $REPLY == "" ]]; then + return 1 + fi + ROOT_PASSWORD=$REPLY + printf "\nPlease enter again to confirm " + read -s + ROOT_PASSWORD_CONFIRM=$REPLY + if [[ $ROOT_PASSWORD == $ROOT_PASSWORD_CONFIRM ]]; then + echo $ROOT_PASSWORD | passwd --stdin root + sasl_password root $ROOT_PASSWORD + break + else + printf "\nPaswords did not match. Please try again" + fi + done + return 0 +} + +# Prompts the user for a single username, password combo +function prompt_sasl_user { + while true; do + printf "\nPlease enter a new user (hit return to skip) " + read + if [[ $REPLY == "" ]]; then + break + fi + SASL_USER=$REPLY + printf "\nPlease enter the password for $SASL_USER (hit return to skip) " + read -s + if [[ $REPLY == "" ]]; then + return 1 + fi + SASL_PASSWORD=$REPLY + printf "\nPlease enter again to confirm " + read -s + SASL_PASSWORD_CONFIRM=$REPLY + if [[ $SASL_PASSWORD == $SASL_PASSWORD_CONFIRM ]]; then + sasl_password $SASL_USER $SASL_PASSWORD + break + else + printf "\nPaswords did not match. Please try again" + fi + done + +} + +#Check for the root user first +while true ; do + printf "\nWould you like to set the root password (Y|N) " + read + case $REPLY in + Y|y) + set_root_password + if [[ $? == 0 ]] ; then + break ; + fi + ;; + N|n) + break ; + ;; + esac +done + +#Check for any sasl users +while true ; do + printf "\nWould you like to add a new sasl user for libvirt (Y|N) " + read + case $REPLY in + Y|y) + prompt_sasl_user + ;; + N|n) + break ; + ;; + esac +done + -- 1.5.6.5 From thomas.vonsteiger at bluewin.ch Wed Nov 12 07:45:24 2008 From: thomas.vonsteiger at bluewin.ch (Thomas von Steiger) Date: Wed, 12 Nov 2008 08:45:24 +0100 Subject: [Ovirt-devel] Re: ovirt-appliance panic on boot In-Reply-To: <4919E3B7.8070500@redhat.com> References: <4919CF94.2080302@conversis.de> <4919E3B7.8070500@redhat.com> Message-ID: <620ABF68-1C17-4A4C-8AD3-91F658523505@bluewin.ch> On 11.11.2008, at 20:57, Alan Pevec wrote: > Thomas von Steiger wrote: >> I get the same problem with version 0.95. >> Thomas >> On 11.11.2008, at 19:31, Dennis J. wrote: >>> Hi, >>> I just installed ovirt version 0.95 and when I start the appliance >>> it panics with the following message: >>> >>> RAMDISK: Couldn't find valid RAM disk image starting at 0. >>> VFS: Cannot open root device "sda2" or unknown-block(0,0) >>> Please append a correct "root=" boot option; here are the >>> available partitions: >>> Kernel panic - not syncing: VFS: Unable to mount root fs on >>> unknown-block(0,0) >>> >>> Is this a known issue and how can I get the appliance to boot up >>> properly? > > is this i386 or x86_64 ? > it's i386. Thomas From sander at hoentjen.eu Wed Nov 12 09:09:08 2008 From: sander at hoentjen.eu (Sander Hoentjen) Date: Wed, 12 Nov 2008 10:09:08 +0100 Subject: [Ovirt-devel] oVirt console (again!) In-Reply-To: <20081111160945.GA20175@amd.home.annexia.org> References: <20081106170118.GA21838@amd.home.annexia.org> <49135B6D.9010008@redhat.com> <20081106210253.GA22878@amd.home.annexia.org> <4913F7D1.40407@redhat.com> <4919A934.1000207@redhat.com> <20081111160945.GA20175@amd.home.annexia.org> Message-ID: <1226480948.5299.8.camel@peecee.hoentjen.eu> On Tue, 2008-11-11 at 16:09 +0000, Richard W.M. Jones wrote: > On Tue, Nov 11, 2008 at 04:48:04PM +0100, Gerd Hoffmann wrote: > > Gerd Hoffmann wrote: > > > Richard W.M. Jones wrote: > > >> The problem, as ever, is with Windows. It's hard to set up a Windows > > >> client as a Kerberos client, so this won't just work. > > > > > Might be worth talking to the freeipa/samba folks maybe whenever it is > > > possible to make windows play nice here? > > > > Some doc reading and experiments later ... > > > > With MIT Kerberos for Windows installed the Windows machine can > > authenticate against freeipa. Setup is pretty straight forward and > > described at the freeipa website. > > > > Requires that the applications support gssapi though. Firefox can > > handle both ways (sspi == native windows with ADC, gssapi == MIT). > > > > To get the WUI on a windows box this must be setup anyway. Then have > > libvirt auth via MIT-gssapi too should work nicely and probably without > > too much coding effort as gssapi at linux code is there already ... > > I've been banging my head against NSS/NSPR all morning, so crypto > libraries & Mozilla are both generally driving me around the bend :-( > > However last weekend I did find that someone has ported a part of > Cyrus SASL to Windows. Good news that at least it's possible! > Unfortunately bad news that there's no source for their port (so we'll > have to recreate the techniques) and I suspect that it's only a > partial port and key bits may be missing. Not looked into it in great > detail yet, but the binary is here: > > http://developer.pidgin.im/wiki/BuildingWinPidgin > > Rich. > I think they get it from Did you ask Pidgin for the source code? It seems strange to me that they would keep this part closed. HTH Sander From berrange at redhat.com Wed Nov 12 10:12:33 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Wed, 12 Nov 2008 10:12:33 +0000 Subject: [Ovirt-devel] oVirt console (again!) In-Reply-To: <1226480948.5299.8.camel@peecee.hoentjen.eu> References: <20081106170118.GA21838@amd.home.annexia.org> <49135B6D.9010008@redhat.com> <20081106210253.GA22878@amd.home.annexia.org> <4913F7D1.40407@redhat.com> <4919A934.1000207@redhat.com> <20081111160945.GA20175@amd.home.annexia.org> <1226480948.5299.8.camel@peecee.hoentjen.eu> Message-ID: <20081112101233.GB22738@redhat.com> On Wed, Nov 12, 2008 at 10:09:08AM +0100, Sander Hoentjen wrote: > On Tue, 2008-11-11 at 16:09 +0000, Richard W.M. Jones wrote: > > On Tue, Nov 11, 2008 at 04:48:04PM +0100, Gerd Hoffmann wrote: > > > Gerd Hoffmann wrote: > > > > Richard W.M. Jones wrote: > > > >> The problem, as ever, is with Windows. It's hard to set up a Windows > > > >> client as a Kerberos client, so this won't just work. > > > > > > > Might be worth talking to the freeipa/samba folks maybe whenever it is > > > > possible to make windows play nice here? > > > > > > Some doc reading and experiments later ... > > > > > > With MIT Kerberos for Windows installed the Windows machine can > > > authenticate against freeipa. Setup is pretty straight forward and > > > described at the freeipa website. > > > > > > Requires that the applications support gssapi though. Firefox can > > > handle both ways (sspi == native windows with ADC, gssapi == MIT). > > > > > > To get the WUI on a windows box this must be setup anyway. Then have > > > libvirt auth via MIT-gssapi too should work nicely and probably without > > > too much coding effort as gssapi at linux code is there already ... > > > > I've been banging my head against NSS/NSPR all morning, so crypto > > libraries & Mozilla are both generally driving me around the bend :-( > > > > However last weekend I did find that someone has ported a part of > > Cyrus SASL to Windows. Good news that at least it's possible! > > Unfortunately bad news that there's no source for their port (so we'll > > have to recreate the techniques) and I suspect that it's only a > > partial port and key bits may be missing. Not looked into it in great > > detail yet, but the binary is here: > > > > http://developer.pidgin.im/wiki/BuildingWinPidgin > > > > Rich. > > > I think they get it from > > Did you ask Pidgin for the source code? It seems strange to me that they > would keep this part closed. Yes, it'd be worth a try - they probably just don't realize anyone cares about the windows build source. I imagine they kept it somewhere though because they'd have to do period updates to the SASL build for Win32 Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From apevec at redhat.com Wed Nov 12 12:47:11 2008 From: apevec at redhat.com (Alan Pevec) Date: Wed, 12 Nov 2008 13:47:11 +0100 Subject: [Ovirt-devel] Re: [PATCH recipe] Move logic for appliance setup from kickstart to recipe In-Reply-To: <1226216760-15794-2-git-send-email-pmyers@redhat.com> References: <1226216760-15794-1-git-send-email-pmyers@redhat.com> <1226216760-15794-2-git-send-email-pmyers@redhat.com> Message-ID: <491AD04F.5070609@redhat.com> Perry Myers wrote: > +++ b/appliances/ovirt/templates/ovirt-server-appliance-setup.erb ... > +# Import cobbler profiles > +/usr/sbin/cobbler-import > + > +# TODO use Augeas 0.3.0 Inifile lens > +sed -i -e "s/^module = authn_denyall.*/module = authn_configfile/" \ > + /etc/cobbler/modules.conf > +sed -i -e "s/^server:.*/server: '192.168.50.2'/" \ > + -e "s/^next_server:.*/next_server: '192.168.50.2'/" \ > + /etc/cobbler/settings > +sed -i -e '/kernel /a \\tIPAPPEND 2' /etc/cobbler/pxesystem.template > +sed -i -e "s/^ONTIMEOUT.*/ONTIMEOUT $(cat /tmp/cobbler-default)/" \ > + /etc/cobbler/pxedefault.template few issues here: - cobbler-import needs cobbler running and ACE runs at 95 while cobbler comes later at 99 previously we were doing cobbler-import in S99local - cobbler-import should be run _after_ cobbler config is modified - /tmp/cobbler-default is MIA, previously it was set in ks %post From dpierce at redhat.com Wed Nov 12 13:42:52 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 12 Nov 2008 08:42:52 -0500 Subject: [Ovirt-devel] [PATCH node] Added support for local storage configuration. Message-ID: <1226497372-7792-1-git-send-email-dpierce@redhat.com> This patch wipes out the entire disk on the node and replaces it with a set of partitions. The partitions are a raw partition to hold the bootable kernel, and the rest of the disk is taken up as an physical volume. On the physical volume is created the following logical volumes: * SWAP - swap partition * ROOT - to host the node image * CONFIG - to hold node configuration data * LOGGING - to hold local logs * DATA - to hold VM images Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-storage | 156 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 156 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index c856ef1..e30c36e 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -1,2 +1,158 @@ #!/bin/bash # +# All sizes are in megabytes + +DRIVE=$(for drive in `hal-find-by-capability --capability storage`; do + info=$(lshal -u $drive -s) + if [[ $info =~ "storage.drive_type = 'disk'" ]]; then + lshal -u $drive -s | awk ' /block.device/ { + match($0, "block.device = *'"'"'(.*)'"'"'", device) + printf "%s", device[1] + }' + fi +done) + +SPACE=$(for drive in `hal-find-by-capability --capability storage`; do + info=$(lshal -u $drive -s) + if [[ $info =~ "storage.drive_type = 'disk'" ]]; then + lshal -u $drive -s | awk ' /storage.size/ { + match($0, "storage.size *= *([0-9]+)", device) + printf "%s", device[1] + }' + fi +done) + +SPACE=$(echo "scale=0; $SPACE / (1024 * 1024)" | bc -l) +BOOT_SIZE="256" +ROOT_SIZE="256" +CONFIG_SIZE="5" +LOGGING_SIZE="256" + +MEM_SIZE=$(virsh -c qemu:///system nodeinfo | awk '/Memory size/ { print $3 }') +MEM_SIZE=$(echo "scale=0; $MEM_SIZE / 1024" | bc -l) +SWAP_SIZE=$MEM_SIZE + +function do_resolve_sizes +{ + DATA_SIZE=$(echo "scale=0; ($SPACE - $BOOT_SIZE - $SWAP_SIZE - $ROOT_SIZE - $CONFIG_SIZE - $LOGGING_SIZE)" | bc -l) +} + +function do_configure +{ + read -p "Swap partition size (Currently ${SWAP_SIZE} MB)? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + SWAP_SIZE=$REPLY + else + printf "Swap value is invalid: retaining ${SWAP_SIZE} MB.\n" + fi + + read -p "Boot partition size (Currently ${BOOT_SIZE} MB)? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + BOOT_SIZE=$REPLY + else + printf "Boot value is invalid: retaining ${BOOT_SIZE}.\n" + fi + + read -p "Root partition size (Current ${ROOT_SIZE} MB)? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + ROOT_SIZE=$REPLY + else + printf "Install size is invalid: retaining ${ROOT_SIZE} MB.\n" + fi + + do_resolve_sizes +} + +function do_review +{ + printf "\n" + printf "The local disk will be repartitioned as follows:\n" + printf "================================================\n" + printf " Physical Hard Disk: ${DRIVE}\n" + printf " Total storage available: ${SPACE} MB\n" + printf " Boot partition size: ${BOOT_SIZE} MB\n" + printf " Swap partition size: ${SWAP_SIZE} MB\n" + printf " Installation partition size: ${ROOT_SIZE} MB\n" + printf " Configuration partition size: ${CONFIG_SIZE} MB\n" + printf " Logging partition size: ${LOGGING_SIZE} MB\n" + printf " Data partition size: ${DATA_SIZE} MB\n" + printf "\n" +} + +function do_partitioning +{ + while true; do + printf "\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! If you proceed this will destroy all data on your local system, and !!WARNING!!\n" + printf "!!WARNING!! your hard disk will be irreversably reconfiguration. !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "\n" + printf "\tContinue? (Y/n) " + read + case $REPLY in + Y|y) + printf "Preparing local storage. Please wait..." + + { + vgroups=$(vgdisplay -C | awk '{ print $1" "; }') + vgremove -f $vgroups + + dd if=/dev/zero of=$DRIVE bs=1K count=1 + blockdev --rereadpt $DRIVE + partprobe -s $DRIVE + + parted $DRIVE -s "mklabel msdos" + parted $DRIVE -s "mkpart primary ext2 0.0 ${BOOT_SIZE}M" + parted $DRIVE -s "mkpart primary ext2 ${BOOT_SIZE}M -1s" + parted $DRIVE -s "set 2 lvm on" + + pvcreate "${DRIVE}2" + pvck + vgcreate /dev/HostVG "${DRIVE}2" + + lvcreate --name Swap /dev/HostVG --size ${SWAP_SIZE}M + lvcreate --name Root /dev/HostVG --size ${ROOT_SIZE}M + lvcreate --name Config /dev/HostVG --size ${CONFIG_SIZE}M + lvcreate --name Logging /dev/HostVG --size ${LOGGING_SIZE}M + lvcreate --name Data /dev/HostVG --size ${DATA_SIZE}M + + mke2fs -T ext2 "${DRIVE}1" -L "BOOT" + mke2fs -T swap /dev/HostVG/Swap + mke2fs -T ext2 /dev/HostVG/Root -L "ROOT" + mke2fs -T ext3 /dev/HostVG/Config -L "CONFIG" + mke2fs -T ext3 /dev/HostVG/Logging -L "LOGGING" + mke2fs -T ext3 /dev/HostVG/Data -L "DATA" + } > partition.log 2>&1 + + printf "Completed!\n\n" + break ;; + N|n) return ;; + esac + done +} + +while true; do + do_resolve_sizes + + OPTIONS="Configure Review Partition Quit" + PS3="Choose an option: " + + printf "\n" + + select OPTION in $OPTIONS + do + case "$OPTION" in + "Configure") do_configure ; break ;; + "Review") do_review ; break ;; + "Partition") do_partitioning ; break ;; + "Quit") exit ;; + esac + done +done -- 1.5.6.5 From pmyers at redhat.com Wed Nov 12 13:48:21 2008 From: pmyers at redhat.com (Perry Myers) Date: Wed, 12 Nov 2008 08:48:21 -0500 Subject: [Ovirt-devel] Re: [PATCH recipe] Move logic for appliance setup from kickstart to recipe In-Reply-To: <491AD04F.5070609@redhat.com> References: <1226216760-15794-1-git-send-email-pmyers@redhat.com> <1226216760-15794-2-git-send-email-pmyers@redhat.com> <491AD04F.5070609@redhat.com> Message-ID: <491ADEA5.4060402@redhat.com> Alan Pevec wrote: > Perry Myers wrote: >> +++ b/appliances/ovirt/templates/ovirt-server-appliance-setup.erb > ... >> +# Import cobbler profiles >> +/usr/sbin/cobbler-import >> + >> +# TODO use Augeas 0.3.0 Inifile lens >> +sed -i -e "s/^module = authn_denyall.*/module = authn_configfile/" \ >> + /etc/cobbler/modules.conf >> +sed -i -e "s/^server:.*/server: '192.168.50.2'/" \ >> + -e "s/^next_server:.*/next_server: '192.168.50.2'/" \ >> + /etc/cobbler/settings >> +sed -i -e '/kernel /a \\tIPAPPEND 2' /etc/cobbler/pxesystem.template >> +sed -i -e "s/^ONTIMEOUT.*/ONTIMEOUT $(cat /tmp/cobbler-default)/" \ >> + /etc/cobbler/pxedefault.template > > few issues here: > - cobbler-import needs cobbler running and ACE runs at 95 while cobbler > comes later at 99 > previously we were doing cobbler-import in S99local > - cobbler-import should be run _after_ cobbler config is modified > - /tmp/cobbler-default is MIA, previously it was set in ks %post > Whoops. Missed that in my smoke testing. I'll fix these post patch to correct. Thanks, Perry -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=| From berrange at redhat.com Wed Nov 12 13:51:06 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Wed, 12 Nov 2008 13:51:06 +0000 Subject: [Ovirt-devel] [PATCH node] Added support for local storage configuration. In-Reply-To: <1226497372-7792-1-git-send-email-dpierce@redhat.com> References: <1226497372-7792-1-git-send-email-dpierce@redhat.com> Message-ID: <20081112135106.GD22738@redhat.com> On Wed, Nov 12, 2008 at 08:42:52AM -0500, Darryl L. Pierce wrote: > This patch wipes out the entire disk on the node and replaces it with > a set of partitions. The partitions are a raw partition to hold the bootable > kernel, and the rest of the disk is taken up as an physical volume. > + Y|y) > + printf "Preparing local storage. Please wait..." > + > + { > + vgroups=$(vgdisplay -C | awk '{ print $1" "; }') > + vgremove -f $vgroups > + > + dd if=/dev/zero of=$DRIVE bs=1K count=1 > + blockdev --rereadpt $DRIVE > + partprobe -s $DRIVE > + > + parted $DRIVE -s "mklabel msdos" Since we've no particular need for MS DOS compatability, how about we just use GPT partitions, avoiding the whole 2TB limit. > + parted $DRIVE -s "mkpart primary ext2 0.0 ${BOOT_SIZE}M" > + parted $DRIVE -s "mkpart primary ext2 ${BOOT_SIZE}M -1s" > + parted $DRIVE -s "set 2 lvm on" > + > + pvcreate "${DRIVE}2" > + pvck > + vgcreate /dev/HostVG "${DRIVE}2" > + > + lvcreate --name Swap /dev/HostVG --size ${SWAP_SIZE}M > + lvcreate --name Root /dev/HostVG --size ${ROOT_SIZE}M > + lvcreate --name Config /dev/HostVG --size ${CONFIG_SIZE}M > + lvcreate --name Logging /dev/HostVG --size ${LOGGING_SIZE}M > + lvcreate --name Data /dev/HostVG --size ${DATA_SIZE}M > + > + mke2fs -T ext2 "${DRIVE}1" -L "BOOT" Why no journal on /boot. This means if the host shuts down uncleanly it'll have todo a full fsck. > + mke2fs -T swap /dev/HostVG/Swap That isn't the way you create a swap partition. You want mkswap. And still need to disable the various auto-fsck settings on all partitions Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From jboggs at redhat.com Wed Nov 12 14:57:53 2008 From: jboggs at redhat.com (Joey Boggs) Date: Wed, 12 Nov 2008 09:57:53 -0500 Subject: [Ovirt-devel] ovirt installation issues Message-ID: <491AEEF1.8030303@redhat.com> I'm working on the installer puppet classes for ovirt-server. For the most part I'm gonna try and hit almost any potential install issue a customer can on bare metal. Here's what I'm running into. - freeipa is setup and I've created my ovirt "admin" user - ovirt-server-install ran - pxe environment setup using dnsmasq and node-image-pxe rpm - nodes can pxe boot My nodes aren't registering with the server, the nodes claim the registration service isn't available are these related?ovi From host-status.log /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:860:in `connect': could not connect to server: Connection refused (PGError) Is the server running on host "localhost" and accepting TCP/IP connections on port 5432? Postgres is setup and is running and I can connect to the database. From apevec at redhat.com Wed Nov 12 18:22:07 2008 From: apevec at redhat.com (Alan Pevec) Date: Wed, 12 Nov 2008 19:22:07 +0100 Subject: [Ovirt-devel] Re: [PATCH node] Networking configuration support. In-Reply-To: <1226094010-11057-1-git-send-email-dpierce@redhat.com> References: <1226094010-11057-1-git-send-email-dpierce@redhat.com> Message-ID: <491B1ECF.6020008@redhat.com> Darryl L. Pierce wrote: > +# Iterates over the list of network devices on the node and prompts the user > +# to configure each. Could we make it conceptually similar to WUI NIC configuration, so instead of iterating NICs, ask user to define networks and then assign NICs to networks (via VLANs/bonds/bridges). Right now I'm confused how to replicate, using this tool, current default Node network config: eth0 ensalved to DHCP-ed ovirtbr0 ... > + # Is this NIC shared? > + while true; do > + printf "Is $NIC a shared interface? (Y/N) " > + read > + case $REPLY in > + Y|y) CONFIG="$CONFIG\nset $THIS_ROOT/TYPE bridge"; break ;; What does it mean "shared" ? > + if [ "$bridge" == "N" ]; then > + printf "Is $NIC bridged? (Y/N) " Where is bridge defined? > +# Merge together all generated files and run augtool > + > +cat /var/tmp/augtool-* > /var/tmp/config-augtool > +augtool < /var/tmp/config-augtool must appened "save" command at the end to actually save the changes also service network restart for change to take effect From apevec at redhat.com Wed Nov 12 18:24:15 2008 From: apevec at redhat.com (Alan Pevec) Date: Wed, 12 Nov 2008 19:24:15 +0100 Subject: [Ovirt-devel] [PATCH node-image] add boot entry for oVirt Node standalone mode Message-ID: <1226514255-11179-1-git-send-email-apevec@redhat.com> Signed-off-by: Alan Pevec --- ovirt-node-image.ks | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/ovirt-node-image.ks b/ovirt-node-image.ks index 5af154b..20ec36c 100644 --- a/ovirt-node-image.ks +++ b/ovirt-node-image.ks @@ -19,7 +19,22 @@ touch /.autorelabel %include common-blacklist.ks %post --nochroot +echo "Fixing boot menu" # remove quiet from Node bootparams, added by livecd-creator sed -i -e 's/ quiet//' $LIVE_ROOT/isolinux/isolinux.cfg +# add standalone boot entry +awk ' +/label linux0/ { linux0=1 } +linux0=1 && /append / { append0=$0 } +/label check0/ { + print "label standalone0" + print " menu label Boot in standalone mode" + print " kernel vmlinuz0" + print append0" ovirt_standalone" +} +{ print } +' $LIVE_ROOT/isolinux/isolinux.cfg > $LIVE_ROOT/isolinux/isolinux.cfg.standalone +mv $LIVE_ROOT/isolinux/isolinux.cfg.standalone $LIVE_ROOT/isolinux/isolinux.cfg + %end -- 1.5.6.5 From apevec at redhat.com Wed Nov 12 18:28:01 2008 From: apevec at redhat.com (Alan Pevec) Date: Wed, 12 Nov 2008 19:28:01 +0100 Subject: [Ovirt-devel] [PATCH node] additional oVirt Node boot parameters for standalone mode Message-ID: <1226514482-11496-1-git-send-email-apevec@redhat.com> These are used as the default values by ovirt-config-* scripts If all required values are supplied, automatic configuration can be performed. local partition sizes in GB ovirt_vol=BOOT_GB:SWAP_GB:INSTALL_GB:CONFIG_GB:LOGGING_GB force oVirt Node standalone mode ovirt_standalone static network configuration pxelinux format: ip=::: anaconda format: ip= netmask= gateway= ipv6=dhcp|auto default syslog server syslog=server[:port] Signed-off-by: Alan Pevec --- scripts/ovirt | 3 + scripts/ovirt-early | 135 ++++++++++++++++++++++++++++++++++++++-------- scripts/ovirt-functions | 19 +++++++ scripts/ovirt-post | 3 + 4 files changed, 136 insertions(+), 24 deletions(-) diff --git a/scripts/ovirt b/scripts/ovirt index 3c120a0..81733a5 100644 --- a/scripts/ovirt +++ b/scripts/ovirt @@ -33,6 +33,9 @@ start() { fi umount $ovirt && rmdir $ovirt + if is_standalone; then + exit 0 + fi find_srv ipa tcp if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then krb5_conf=/etc/krb5.conf diff --git a/scripts/ovirt-early b/scripts/ovirt-early index 1a14220..394fce5 100755 --- a/scripts/ovirt-early +++ b/scripts/ovirt-early @@ -104,10 +104,11 @@ find_disk() { return 1 } -# local_install $local_os $target -# local_os - 1=install LiveOS and boot loader -# 0=initialize oVirt partition only -# target - target disk to hold the oVirt partition +# TODO move to ovirt-config-storage +# local_install $local_boot $local_disk $bootparams +# local_boot - 1=install LiveOS and boot loader +# 0=initialize oVirt partition only +# local_disk - local disk to hold the oVirt partition # =usb|scsi[:serial#] # bootparams - extra boot parameters like console= # @@ -118,8 +119,8 @@ find_disk() { # /LiveOS - oVirt Node compressed livecd image local_install() { - local local_os=$1 - local target=$2 + local local_boot=$1 + local local_disk=$2 local bootparams=$3 local disk local part @@ -140,7 +141,7 @@ local_install() { if [ "$ovirt_disk" = "$ovirt_part" ]; then ovirt_disk= fi - if [ -z "$target" ]; then + if [ -z "$local_disk" ]; then if [ -z "$ovirt_disk" ]; then return 1 fi @@ -149,7 +150,7 @@ local_install() { disk=$ovirt_disk part=$ovirt_part else - case "$target" in + case "$local_disk" in =) # empty ovirt_init, use current live image device mode=update @@ -158,12 +159,12 @@ local_install() { ;; =scsi*) bus=scsi - serial=${target#=scsi:} + serial=${local_disk#=scsi:} mode=install ;; =usb*) bus=usb - serial=${target#=usb:} + serial=${local_disk#=usb:} mode=install ;; *) @@ -177,12 +178,12 @@ local_install() { disk=$(find_disk $bus $serial $live_disk) rc=$? if [ $rc -ne 0 ]; then - echo "target disk '$target' not available" + echo "local disk '$local_disk' not available" return 1 fi if [ -n "$ovirt_disk" ]; then if [ "$disk" = "$ovirt_disk" ]; then - # target disk contains oVirt partition, select it for update + # local disk contains oVirt partition, select it for update # TODO force reinstall option mode=update part=$ovirt_part @@ -219,7 +220,7 @@ local_install() { fi ovirt=$(mktemp -d) if [ "$part" = "$live_part" ]; then - # ovirt_init w/o specified target + # ovirt_init w/o local disk specified # setup /config on live disk, if writeable # TODO mlabel/e2label (check fs2 type or just blindly try?) mount -r $part $ovirt && mount -o remount,rw $ovirt \ @@ -236,7 +237,7 @@ local_install() { fi mount $part $ovirt if [ $? -ne 0 ]; then - echo "target mount failed" + echo "local disk mount failed" umount $live && rmdir $live rmdir $ovirt return 1 @@ -249,7 +250,7 @@ local_install() { || echo "config copy failed" fi - if [ $local_os = 0 ]; then + if [ $local_boot = 0 ]; then # config update only, cleanup and continue booting umount $ovirt && rmdir $ovirt umount $live && rmdir $live @@ -314,7 +315,14 @@ start() { # oVirt boot parameters # BOOTIF= (appended by pxelinux) # ovirt_init=usb|scsi[:serial#] + # ovirt_vol=BOOT_GB:SWAP_GB:INSTALL_GB:CONFIG_GB:LOGGING_GB # ovirt_local_boot + # ovirt_standalone + # pxelinux format: ip=::: + # anaconda format: ip= netmask= gateway= + # ipv6=dhcp|auto + # syslog=server[:port] + # TBD logrotate maxsize # BOOTIF= (appended by pxelinux) # network boot interface is assumed to be on management network where @@ -329,11 +337,38 @@ start() { # serial# - select exact disk using serial number, as reported by # udev ID_SERIAL # e.g. ovirt_init=usb:Generic_STORAGE_DEVICE_0000145418-0:0 - target= + ovirt_init= + + # ovirt_vol=BOOT_GB:SWAP_GB:INSTALL_GB:CONFIG_GB:LOGGING_GB + # local partition sizes in GB + ovirt_vol_boot= + ovirt_vol_install= + ovirt_vol_config= + ovirt_vol_logging= # ovirt_local_boot # install/update oVirt Node image on the local installation target disk - local_os=0 + ovirt_local_boot=0 + + # ovirt_standalone + # force oVirt Node standalone mode + ovirt_standalone=0 + + # pxelinux format: ip=::: + # anaconda format: ip= netmask= gateway= + # ipv6=dhcp|auto + # static network configuration + ip_address= + ip_gateway= + ip_netmask= + netmask= + gateway= + ipv6= + + # syslog=server[:port] + # default syslog server + syslog_server= + syslog_port= # save boot parameters like console= for local disk boot menu bootparams= @@ -345,31 +380,82 @@ start() { bootif=$(grep -il $(echo $i|sed 's/-/:/g') /sys/class/net/eth*/address|rev|cut -d/ -f2|rev) ;; ovirt_init*) - target=${i#ovirt_init} - if [ -z "$target" ]; then - target='=' + ovirt_init=${i#ovirt_init} + if [ -z "$ovirt_init" ]; then + ovirt_init='=' fi ;; + ovirt_vol=*) + i=${i#ovirt_vol=} + eval $(printf $i|awk -F: '{print "ovirt_vol_boot="$1; print "ovirt_vol_install="$2; print "ovirt_vol_config="$3; print "ovirt_vol_logging="$4;}') + ;; ovirt_local_boot*) - local_os=1 + ovirt_local_boot=1 + ;; + ovirt_standalone*) + ovirt_standalone=1 + ;; + ip=*) + i=${i#ip=} + eval $(printf $i|awk -F: '{print "ip_address="$1; print "ip_gateway="$3; print "ip_netmask="$4}') + ;; + netmask=*) + netmask=${i#netmask=} + ;; + gateway=*) + gateway=${i#gateway=} + ;; + ipv6=*) + ipv6=${i#ipv6=} + ;; + syslog=*) + i=${i#syslog=} + eval $(printf $i|awk -F: '{print "syslog_server="$1; print "syslog_port="$2;}') ;; console=*) bootparams="$bootparams $i" ;; esac done + # save boot parameters as defaults for ovirt-config-* + if [ -z "$ip_netmask" ]; then + ip_netmask=$netmask + fi + if [ -z "$ip_gateway" ]; then + ip_gateway=$gateway + fi + cat > $OVIRT_DEFAULTS </dev/null` # now LVM partitions @@ -389,6 +475,7 @@ start() { swapon $device fi done +# END - move to ovirt-config-storage } case "$1" in diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions index f6818ba..bdb0629 100644 --- a/scripts/ovirt-functions +++ b/scripts/ovirt-functions @@ -4,9 +4,28 @@ OVIRT_LOGFILE=/var/log/ovirt.log # label of the oVirt partition OVIRT_LABEL=OVIRT +# configuration defaults +OVIRT_DEFAULTS=/etc/sysconfig/ovirt +if [ -f $OVIRT_DEFAULTS ]; then + . $OVIRT_DEFAULTS +fi +# fallback defaults when sysconfig is empty +OVIRT_STANDALONE=${OVIRT_STANDALONE:-0} OVIRT_BACKUP_DIR=/var/lib/ovirt-backup +# is_managed +# return 1 if oVirt Node is running in standalone mode +# return 0 if oVirt Node is managed by the oVirt Server +is_managed() { + return $OVIRT_STANDALONE +} + +# is_standalone = not is_managed +is_standalone() { + if is_managed; then return 1; else return 0; fi +} + # find_srv SERVICE PROTO # # reads DNS SRV record diff --git a/scripts/ovirt-post b/scripts/ovirt-post index 046a2c0..06506b7 100644 --- a/scripts/ovirt-post +++ b/scripts/ovirt-post @@ -17,6 +17,9 @@ start() { /etc/libvirt/krb5.tab \ /etc/ssh/ssh_host*_key* + if is_standalone; then + exit 0 + fi find_srv identify tcp if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then ovirt-identify-node -s $SRV_HOST -p $SRV_PORT -- 1.5.6.5 From apevec at redhat.com Wed Nov 12 18:28:02 2008 From: apevec at redhat.com (Alan Pevec) Date: Wed, 12 Nov 2008 19:28:02 +0100 Subject: [Ovirt-devel] [PATCH node] Added a script that runs during first boot for the node. In-Reply-To: <1226514482-11496-1-git-send-email-apevec@redhat.com> References: <1226514482-11496-1-git-send-email-apevec@redhat.com> Message-ID: <1226514482-11496-2-git-send-email-apevec@redhat.com> From: Darryl L. Pierce Each configuration function is stubbed out. The functions are: * configure logging * configure networking * configure password * configure storage Signed-off-by: Darryl L. Pierce --- Makefile.am | 6 ++++ ovirt-node.spec.in | 15 ++++++++++- scripts/ovirt-config-logging | 2 + scripts/ovirt-config-networking | 2 + scripts/ovirt-config-password | 2 + scripts/ovirt-config-setup | 23 ++++++++++++++++ scripts/ovirt-config-storage | 2 + scripts/ovirt-firstboot | 55 +++++++++++++++++++++++++++++++++++++++ 8 files changed, 106 insertions(+), 1 deletions(-) create mode 100755 scripts/ovirt-config-logging create mode 100755 scripts/ovirt-config-networking create mode 100755 scripts/ovirt-config-password create mode 100755 scripts/ovirt-config-setup create mode 100755 scripts/ovirt-config-storage create mode 100755 scripts/ovirt-firstboot diff --git a/Makefile.am b/Makefile.am index 4ba0bca..ea49b43 100644 --- a/Makefile.am +++ b/Makefile.am @@ -27,7 +27,13 @@ EXTRA_DIST = \ scripts/collectd.conf.in \ scripts/ovirt \ scripts/ovirt-awake \ + scripts/ovirt-config-logging \ + scripts/ovirt-config-networking \ + scripts/ovirt-config-password \ + scripts/ovirt-config-setup \ + scripts/ovirt-config-storage \ scripts/ovirt-early \ + scripts/ovirt-firstboot \ scripts/ovirt-functions \ scripts/ovirt-post \ scripts/ovirt-process-config \ diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index d029c57..2a01b7c 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -87,6 +87,11 @@ cd - %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/logrotate.d %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-logging %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-networking %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-password %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-setup %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-storage %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-process-config %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-identify-node/ovirt-identify-node %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-listen-awake/ovirt-listen-awake %{buildroot}%{_sbindir} @@ -94,9 +99,9 @@ cd - %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-install-node %{buildroot}%{_sbindir} %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-uninstall-node %{buildroot}%{_sbindir} - %{__install} -p -m0644 scripts/ovirt-functions %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-early %{buildroot}%{_initrddir} +%{__install} -p -m0755 scripts/ovirt-firstboot %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-post %{buildroot}%{_initrddir} @@ -123,6 +128,7 @@ cd - %post /sbin/chkconfig --add ovirt-early +/sbin/chkconfig --add ovirt-firstboot /sbin/chkconfig --add ovirt /sbin/chkconfig --add ovirt-post # this is ugly; we need collectd to start *after* libvirtd, so we own the @@ -133,6 +139,7 @@ cd - %preun if [ "$1" = 0 ] ; then /sbin/chkconfig --del ovirt-early + /sbin/chkconfig --del ovirt-firstboot /sbin/chkconfig --del ovirt /sbin/chkconfig --del ovirt-post /sbin/chkconfig --del ovirt-listen-awake @@ -159,12 +166,18 @@ fi %files %defattr(-,root,root,0755) %{_sbindir}/ovirt-awake +%{_sbindir}/ovirt-config-logging +%{_sbindir}/ovirt-config-networking +%{_sbindir}/ovirt-config-password +%{_sbindir}/ovirt-config-setup +%{_sbindir}/ovirt-config-storage %{_sbindir}/ovirt-process-config %{_sbindir}/ovirt-identify-node %{_sbindir}/ovirt-listen-awake %{_sbindir}/ovirt-install-node %{_sbindir}/ovirt-uninstall-node %{_initrddir}/ovirt-early +%{_initrddir}/ovirt-firstboot %{_initrddir}/ovirt %{_initrddir}/ovirt-post %{_initrddir}/ovirt-listen-awake diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging new file mode 100755 index 0000000..c856ef1 --- /dev/null +++ b/scripts/ovirt-config-logging @@ -0,0 +1,2 @@ +#!/bin/bash +# diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking new file mode 100755 index 0000000..c856ef1 --- /dev/null +++ b/scripts/ovirt-config-networking @@ -0,0 +1,2 @@ +#!/bin/bash +# diff --git a/scripts/ovirt-config-password b/scripts/ovirt-config-password new file mode 100755 index 0000000..c856ef1 --- /dev/null +++ b/scripts/ovirt-config-password @@ -0,0 +1,2 @@ +#!/bin/bash +# diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup new file mode 100755 index 0000000..8408d14 --- /dev/null +++ b/scripts/ovirt-config-setup @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Entry point for configuring an oVirt node when running in standalone mode. + +while true; do + PS3="Please select an option: " + # TODO should we make this optional, based on whether the password was already set? + PASSWORD_OPTION="Password" + OPTIONS="Networking Storage Logging ${PASSWORD_OPTION} Quit" + + select OPTION in $OPTIONS + do + printf "\n" + + case "$OPTION" in + "Networking") ovirt-config-networking ; break ;; + "Storage") ovirt-config-storage ; break ;; + "Logging") ovirt-config-logging ; break ;; + "Password") ovirt-config-password ; break ;; + "Quit") exit 0 ;; + esac + done +done diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage new file mode 100755 index 0000000..c856ef1 --- /dev/null +++ b/scripts/ovirt-config-storage @@ -0,0 +1,2 @@ +#!/bin/bash +# diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot new file mode 100755 index 0000000..82d9e48 --- /dev/null +++ b/scripts/ovirt-firstboot @@ -0,0 +1,55 @@ +#!/bin/bash +# +# ovirt-firstboot Puts the node into configuration mode. +# +# chkconfig: 2345 99 01 +# description: ovirt-firstboot node configuration script +# +# Copyright (C) 2008 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. + +## Source functions library +. /etc/init.d/functions +. /etc/init.d/ovirt-functions + +start () +{ + ovirt-config-setup +} + +case "$1" in + start) + if is_managed; then + exit 0 + fi + + printf "Starting ovirt-firstboot: " + + { + start + } + + test $? == 0 && success || failure + echo + ;; + + *) + echo "Usage: ovirt-firstboot {start}" + exit 2 +esac + -- 1.5.6.5 From pmyers at redhat.com Wed Nov 12 18:32:15 2008 From: pmyers at redhat.com (Perry Myers) Date: Wed, 12 Nov 2008 13:32:15 -0500 Subject: [Ovirt-devel] [PATCH appliance] Fix packaging for appliance due to change in appliance-tools default behavior Message-ID: <1226514735-24872-1-git-send-email-pmyers@redhat.com> appliance-tools used to put disk images directly in $PWD but now they get put in a subdir with the same name as the appliance. Need to adjust the script in %build to account for this as well as make the current version of appliance-tools the minimum version required since the api between versions changed. Signed-off-by: Perry Myers --- ovirt-appliance.spec.in | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ovirt-appliance.spec.in b/ovirt-appliance.spec.in index ce9a4d4..f84d5e6 100644 --- a/ovirt-appliance.spec.in +++ b/ovirt-appliance.spec.in @@ -16,7 +16,8 @@ License: GPLv2+ Group: Applications/System BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot URL: http://ovirt.org/ -BuildRequires: appliance-tools appliance-os +BuildRequires: appliance-tools >= 002-5 +BuildRequires: appliance-os BuildRequires: livecd-tools >= 017 BuildRequires: syslinux BuildRequires: qemu-img @@ -87,7 +88,7 @@ sudo su - -c "cd $(pwd) && appliance-creator --config ovirt-appliance.ks \ --tmpdir='%{ovirt_cache_dir}/appliance-tmp' \ --cache='%{ovirt_cache_dir}/yum'" sudo su - -c "cd $(pwd) && chown -R $USER ." -mv %{name}-sda.qcow2 %{name}.img +mv %{name}/%{name}-sda.qcow2 %{name}.img %install %{__rm} -rf %{buildroot} -- 1.6.0.3 From dpierce at redhat.com Wed Nov 12 18:40:51 2008 From: dpierce at redhat.com (Darryl Pierce) Date: Wed, 12 Nov 2008 13:40:51 -0500 Subject: [Ovirt-devel] [PATCH node-image] add boot entry for oVirt Node standalone mode In-Reply-To: <1226514255-11179-1-git-send-email-apevec@redhat.com> References: <1226514255-11179-1-git-send-email-apevec@redhat.com> Message-ID: <491B2333.9000305@redhat.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Alan Pevec wrote: > Signed-off-by: Alan Pevec > --- > ovirt-node-image.ks | 15 +++++++++++++++ > 1 files changed, 15 insertions(+), 0 deletions(-) > > diff --git a/ovirt-node-image.ks b/ovirt-node-image.ks > index 5af154b..20ec36c 100644 > --- a/ovirt-node-image.ks > +++ b/ovirt-node-image.ks > @@ -19,7 +19,22 @@ touch /.autorelabel > %include common-blacklist.ks > > %post --nochroot > +echo "Fixing boot menu" > # remove quiet from Node bootparams, added by livecd-creator > sed -i -e 's/ quiet//' $LIVE_ROOT/isolinux/isolinux.cfg > > +# add standalone boot entry > +awk ' > +/label linux0/ { linux0=1 } > +linux0=1 && /append / { append0=$0 } > +/label check0/ { > + print "label standalone0" > + print " menu label Boot in standalone mode" > + print " kernel vmlinuz0" > + print append0" ovirt_standalone" > +} > +{ print } > +' $LIVE_ROOT/isolinux/isolinux.cfg > $LIVE_ROOT/isolinux/isolinux.cfg.standalone > +mv $LIVE_ROOT/isolinux/isolinux.cfg.standalone $LIVE_ROOT/isolinux/isolinux.cfg > + > %end ACK. Applied and I see the ovirt_standalone entry in /proc/cmdline as expected. - -- Darryl L. Pierce : GPG KEYID: 6C4E7F1B -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAkkbIy4ACgkQjaT4DmxOfxti/wCdHnjX0c5q5jlGN/zRxG/ff6lz yooAoNlcjZMuFY3IPMnANMBkCuy4/roG =2Ffu -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: dpierce.vcf Type: text/x-vcard Size: 319 bytes Desc: not available URL: From dpierce at redhat.com Wed Nov 12 19:51:36 2008 From: dpierce at redhat.com (Darryl Pierce) Date: Wed, 12 Nov 2008 14:51:36 -0500 Subject: [Ovirt-devel] [PATCH node] additional oVirt Node boot parameters for standalone mode In-Reply-To: <1226514482-11496-1-git-send-email-apevec@redhat.com> References: <1226514482-11496-1-git-send-email-apevec@redhat.com> Message-ID: <491B33C8.3090504@redhat.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Alan Pevec wrote: > These are used as the default values by ovirt-config-* scripts > If all required values are supplied, automatic configuration can be performed. > > local partition sizes in GB > ovirt_vol=BOOT_GB:SWAP_GB:INSTALL_GB:CONFIG_GB:LOGGING_GB > > force oVirt Node standalone mode > ovirt_standalone > > static network configuration > pxelinux format: ip=::: > anaconda format: ip= netmask= gateway= > ipv6=dhcp|auto > > default syslog server > syslog=server[:port] > > Signed-off-by: Alan Pevec > --- ACK. - -- Darryl L. Pierce : GPG KEYID: 6C4E7F1B -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAkkbM8UACgkQjaT4DmxOfxtZUACgz633wstRNUd+j6n7ipihDeFh UFIAnj9bQ9lPfIG1qgs/zwowHI5mOipj =spcV -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: dpierce.vcf Type: text/x-vcard Size: 319 bytes Desc: not available URL: From dpierce at redhat.com Wed Nov 12 21:16:48 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 12 Nov 2008 16:16:48 -0500 Subject: [Ovirt-devel] [PATCH node] Networking configuration support. Message-ID: <1226524608-2012-1-git-send-email-dpierce@redhat.com> This script allows the user to iterate through and edit the network interfaces on the node. Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 96 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 96 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index c856ef1..705521b 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -1,2 +1,98 @@ #!/bin/bash # +# Iterates over the list of network devices on the node and prompts the user +# to configure each. + +CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" + +function configure_interface +{ + NIC=$1 + FILENAME="/var/tmp/augtool-$NIC" + + printf "\nCONFIGURE INTERFACE: $NIC\n\n" + + THIS_ROOT="$CONFIG_FILE_ROOT-$NIC" + CONFIG="rm $THIS_ROOT\nset $THIS_ROOT/DEVICE $NIC" + + # Is this NIC shared? + while true; do + printf "Is $NIC a shared interface? (Y/N) " + read + case $REPLY in + Y|y) CONFIG="$CONFIG\nset $THIS_ROOT/TYPE bridge"; break ;; + N|n) bridge="N"; break ;; + esac + done + + # how do you want to configure this device? (dhcp, static IP) + while true; do + printf "Does $NIC use dynamic addressing? (Y/N) " + read + case $REPLY in + Y|y) CONFIG="$CONFIG\nset $THIS_ROOT/BOOTPROTO dhcp"; break ;; + N|n) + printf "\tIP Address: "; read; IPADDR=$REPLY + printf "\t Netmask: "; read; NETMASK=$REPLY + printf "\t Broadcast: "; read; BROADCAST=$REPLY + printf "\t Gateway: "; read; GATEWAY=$REPLY + + printf "\nIP Address: $IPADDR\nNetmask: $NETMASK\nBroadcast: $BROADCAST\nGateway: $GATEWAY\n" + printf "Is this correct? (Y/N) " + read + case $REPLY in + Y|y) + CONFIG="$CONFIG\nset $THIS_ROOT/IPADDR $IPADDR" + CONFIG="$CONFIG\nset $THIS_ROOT/BROADCAST $BROADCAST" + CONFIG="$CONFIG\nset $THIS_ROOT/NETMASK $NETMASK" + break + ;; + esac + ;; + esac + done + + if [ "$bridge" == "N" ]; then + printf "Is $NIC bridged? (Y/N) " + read + case $REPLY in + Y|y) + printf "What is the bridge name? " + read + CONFIG="$CONFIG\n set $THIS_ROOT/BRIDGE $REPLY" + ;; + esac + fi + + CONFIG="$CONFIG\nset $THIS_ROOT/ONBOOT yes" + printf "$CONFIG\n" > $FILENAME + + echo +} + +# TODO the menu doesn't redisplay unless you hit enter -- needs fixing +# get the list of network cards on this machine +NICS=$(hal-device | awk '/net.interface/ { + match($0, "= '"'"'(.*)'"'"' ", nic); printf("%s ", nic[1]); }') + +# Append a quit option +NICS="$NICS Quit" + +PS3="Please select a network interface to configure:" +select NIC in $NICS +do + case "$NIC" in + "Quit") + break + ;; + + *) + configure_interface $NIC + ;; + esac +done + +# Merge together all generated files and run augtool + +cat /var/tmp/augtool-* > /var/tmp/config-augtool +augtool < /var/tmp/config-augtool -- 1.5.6.5 From dpierce at redhat.com Wed Nov 12 21:17:01 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 12 Nov 2008 16:17:01 -0500 Subject: [Ovirt-devel] [PATCH node-image] Delists necessary but blacklisted exes and includes bc. Message-ID: <1226524621-2059-1-git-send-email-dpierce@redhat.com> hal-device is needed for standalone mode to run. bc is added as a requirement. Signed-off-by: Darryl L. Pierce --- common-blacklist.ks | 2 +- common-pkgs.ks | 1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/common-blacklist.ks b/common-blacklist.ks index 662d67b..cf9159c 100644 --- a/common-blacklist.ks +++ b/common-blacklist.ks @@ -94,7 +94,7 @@ blacklist_lib="/usr/lib{,64}/python2.5 /usr/lib{,64}/gconv \ blacklist_pango="/usr/lib{,64}/pango /usr/lib{,64}/libpango* \ /etc/pango /usr/bin/pango*" blacklist_hal="/usr/bin/hal-disable-polling \ - /usr/bin/hal-find-by-capability /usr/bin/hal-find-by-property \ + /usr/bin/hal-find-by-property \ /usr/bin/hal-is-caller-locked-out /usr/bin/hal-is-caller-privileged \ /usr/bin/hal-lock /usr/bin/hal-set-property /usr/bin/hal-setup-keymap" blacklist_ssh="/usr/bin/sftp /usr/bin/slogin /usr/bin/ssh /usr/bin/ssh-add \ diff --git a/common-pkgs.ks b/common-pkgs.ks index 9f9e277..b417fe2 100644 --- a/common-pkgs.ks +++ b/common-pkgs.ks @@ -1,4 +1,5 @@ @core +bc kernel hwdata passwd -- 1.5.6.5 From dpierce at redhat.com Wed Nov 12 21:24:16 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 12 Nov 2008 16:24:16 -0500 Subject: [Ovirt-devel] [PATCH node] Added support for local storage configuration. Message-ID: <1226525056-2764-1-git-send-email-dpierce@redhat.com> This patch wipes out the entire disk on the node and replaces it with a set of partitions. The partitions are a raw partition to hold the bootable kernel, and the rest of the disk is taken up as an physical volume. On the physical volume is created the following logical volumes: * SWAP - swap partition * ROOT - to host the node image * CONFIG - to hold node configuration data * LOGGING - to hold local logs * DATA - to hold VM images Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-storage | 156 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 156 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index c856ef1..e30c36e 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -1,2 +1,158 @@ #!/bin/bash # +# All sizes are in megabytes + +DRIVE=$(for drive in `hal-find-by-capability --capability storage`; do + info=$(lshal -u $drive -s) + if [[ $info =~ "storage.drive_type = 'disk'" ]]; then + lshal -u $drive -s | awk ' /block.device/ { + match($0, "block.device = *'"'"'(.*)'"'"'", device) + printf "%s", device[1] + }' + fi +done) + +SPACE=$(for drive in `hal-find-by-capability --capability storage`; do + info=$(lshal -u $drive -s) + if [[ $info =~ "storage.drive_type = 'disk'" ]]; then + lshal -u $drive -s | awk ' /storage.size/ { + match($0, "storage.size *= *([0-9]+)", device) + printf "%s", device[1] + }' + fi +done) + +SPACE=$(echo "scale=0; $SPACE / (1024 * 1024)" | bc -l) +BOOT_SIZE="256" +ROOT_SIZE="256" +CONFIG_SIZE="5" +LOGGING_SIZE="256" + +MEM_SIZE=$(virsh -c qemu:///system nodeinfo | awk '/Memory size/ { print $3 }') +MEM_SIZE=$(echo "scale=0; $MEM_SIZE / 1024" | bc -l) +SWAP_SIZE=$MEM_SIZE + +function do_resolve_sizes +{ + DATA_SIZE=$(echo "scale=0; ($SPACE - $BOOT_SIZE - $SWAP_SIZE - $ROOT_SIZE - $CONFIG_SIZE - $LOGGING_SIZE)" | bc -l) +} + +function do_configure +{ + read -p "Swap partition size (Currently ${SWAP_SIZE} MB)? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + SWAP_SIZE=$REPLY + else + printf "Swap value is invalid: retaining ${SWAP_SIZE} MB.\n" + fi + + read -p "Boot partition size (Currently ${BOOT_SIZE} MB)? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + BOOT_SIZE=$REPLY + else + printf "Boot value is invalid: retaining ${BOOT_SIZE}.\n" + fi + + read -p "Root partition size (Current ${ROOT_SIZE} MB)? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + ROOT_SIZE=$REPLY + else + printf "Install size is invalid: retaining ${ROOT_SIZE} MB.\n" + fi + + do_resolve_sizes +} + +function do_review +{ + printf "\n" + printf "The local disk will be repartitioned as follows:\n" + printf "================================================\n" + printf " Physical Hard Disk: ${DRIVE}\n" + printf " Total storage available: ${SPACE} MB\n" + printf " Boot partition size: ${BOOT_SIZE} MB\n" + printf " Swap partition size: ${SWAP_SIZE} MB\n" + printf " Installation partition size: ${ROOT_SIZE} MB\n" + printf " Configuration partition size: ${CONFIG_SIZE} MB\n" + printf " Logging partition size: ${LOGGING_SIZE} MB\n" + printf " Data partition size: ${DATA_SIZE} MB\n" + printf "\n" +} + +function do_partitioning +{ + while true; do + printf "\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! If you proceed this will destroy all data on your local system, and !!WARNING!!\n" + printf "!!WARNING!! your hard disk will be irreversably reconfiguration. !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "\n" + printf "\tContinue? (Y/n) " + read + case $REPLY in + Y|y) + printf "Preparing local storage. Please wait..." + + { + vgroups=$(vgdisplay -C | awk '{ print $1" "; }') + vgremove -f $vgroups + + dd if=/dev/zero of=$DRIVE bs=1K count=1 + blockdev --rereadpt $DRIVE + partprobe -s $DRIVE + + parted $DRIVE -s "mklabel msdos" + parted $DRIVE -s "mkpart primary ext2 0.0 ${BOOT_SIZE}M" + parted $DRIVE -s "mkpart primary ext2 ${BOOT_SIZE}M -1s" + parted $DRIVE -s "set 2 lvm on" + + pvcreate "${DRIVE}2" + pvck + vgcreate /dev/HostVG "${DRIVE}2" + + lvcreate --name Swap /dev/HostVG --size ${SWAP_SIZE}M + lvcreate --name Root /dev/HostVG --size ${ROOT_SIZE}M + lvcreate --name Config /dev/HostVG --size ${CONFIG_SIZE}M + lvcreate --name Logging /dev/HostVG --size ${LOGGING_SIZE}M + lvcreate --name Data /dev/HostVG --size ${DATA_SIZE}M + + mke2fs -T ext2 "${DRIVE}1" -L "BOOT" + mke2fs -T swap /dev/HostVG/Swap + mke2fs -T ext2 /dev/HostVG/Root -L "ROOT" + mke2fs -T ext3 /dev/HostVG/Config -L "CONFIG" + mke2fs -T ext3 /dev/HostVG/Logging -L "LOGGING" + mke2fs -T ext3 /dev/HostVG/Data -L "DATA" + } > partition.log 2>&1 + + printf "Completed!\n\n" + break ;; + N|n) return ;; + esac + done +} + +while true; do + do_resolve_sizes + + OPTIONS="Configure Review Partition Quit" + PS3="Choose an option: " + + printf "\n" + + select OPTION in $OPTIONS + do + case "$OPTION" in + "Configure") do_configure ; break ;; + "Review") do_review ; break ;; + "Partition") do_partitioning ; break ;; + "Quit") exit ;; + esac + done +done -- 1.5.6.5 From dpierce at redhat.com Wed Nov 12 21:39:34 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 12 Nov 2008 16:39:34 -0500 Subject: [Ovirt-devel] [PATCH node] Networking configuration support. Message-ID: <1226525974-3852-1-git-send-email-dpierce@redhat.com> This script allows the user to iterate through and edit the network interfaces on the node. Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 96 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 96 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index c856ef1..705521b 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -1,2 +1,98 @@ #!/bin/bash # +# Iterates over the list of network devices on the node and prompts the user +# to configure each. + +CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" + +function configure_interface +{ + NIC=$1 + FILENAME="/var/tmp/augtool-$NIC" + + printf "\nCONFIGURE INTERFACE: $NIC\n\n" + + THIS_ROOT="$CONFIG_FILE_ROOT-$NIC" + CONFIG="rm $THIS_ROOT\nset $THIS_ROOT/DEVICE $NIC" + + # Is this NIC shared? + while true; do + printf "Is $NIC a shared interface? (Y/N) " + read + case $REPLY in + Y|y) CONFIG="$CONFIG\nset $THIS_ROOT/TYPE bridge"; break ;; + N|n) bridge="N"; break ;; + esac + done + + # how do you want to configure this device? (dhcp, static IP) + while true; do + printf "Does $NIC use dynamic addressing? (Y/N) " + read + case $REPLY in + Y|y) CONFIG="$CONFIG\nset $THIS_ROOT/BOOTPROTO dhcp"; break ;; + N|n) + printf "\tIP Address: "; read; IPADDR=$REPLY + printf "\t Netmask: "; read; NETMASK=$REPLY + printf "\t Broadcast: "; read; BROADCAST=$REPLY + printf "\t Gateway: "; read; GATEWAY=$REPLY + + printf "\nIP Address: $IPADDR\nNetmask: $NETMASK\nBroadcast: $BROADCAST\nGateway: $GATEWAY\n" + printf "Is this correct? (Y/N) " + read + case $REPLY in + Y|y) + CONFIG="$CONFIG\nset $THIS_ROOT/IPADDR $IPADDR" + CONFIG="$CONFIG\nset $THIS_ROOT/BROADCAST $BROADCAST" + CONFIG="$CONFIG\nset $THIS_ROOT/NETMASK $NETMASK" + break + ;; + esac + ;; + esac + done + + if [ "$bridge" == "N" ]; then + printf "Is $NIC bridged? (Y/N) " + read + case $REPLY in + Y|y) + printf "What is the bridge name? " + read + CONFIG="$CONFIG\n set $THIS_ROOT/BRIDGE $REPLY" + ;; + esac + fi + + CONFIG="$CONFIG\nset $THIS_ROOT/ONBOOT yes" + printf "$CONFIG\n" > $FILENAME + + echo +} + +# TODO the menu doesn't redisplay unless you hit enter -- needs fixing +# get the list of network cards on this machine +NICS=$(hal-device | awk '/net.interface/ { + match($0, "= '"'"'(.*)'"'"' ", nic); printf("%s ", nic[1]); }') + +# Append a quit option +NICS="$NICS Quit" + +PS3="Please select a network interface to configure:" +select NIC in $NICS +do + case "$NIC" in + "Quit") + break + ;; + + *) + configure_interface $NIC + ;; + esac +done + +# Merge together all generated files and run augtool + +cat /var/tmp/augtool-* > /var/tmp/config-augtool +augtool < /var/tmp/config-augtool -- 1.5.6.5 From berrange at redhat.com Wed Nov 12 21:41:12 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Wed, 12 Nov 2008 21:41:12 +0000 Subject: [Ovirt-devel] [PATCH node] Added support for local storage configuration. In-Reply-To: <1226525056-2764-1-git-send-email-dpierce@redhat.com> References: <1226525056-2764-1-git-send-email-dpierce@redhat.com> Message-ID: <20081112214112.GF15639@redhat.com> On Wed, Nov 12, 2008 at 04:24:16PM -0500, Darryl L. Pierce wrote: > This patch wipes out the entire disk on the node and replaces it with > + case $REPLY in > + Y|y) > + printf "Preparing local storage. Please wait..." > + > + { > + vgroups=$(vgdisplay -C | awk '{ print $1" "; }') > + vgremove -f $vgroups > + > + dd if=/dev/zero of=$DRIVE bs=1K count=1 > + blockdev --rereadpt $DRIVE > + partprobe -s $DRIVE > + > + parted $DRIVE -s "mklabel msdos" > + parted $DRIVE -s "mkpart primary ext2 0.0 ${BOOT_SIZE}M" > + parted $DRIVE -s "mkpart primary ext2 ${BOOT_SIZE}M -1s" > + parted $DRIVE -s "set 2 lvm on" > + > + pvcreate "${DRIVE}2" > + pvck > + vgcreate /dev/HostVG "${DRIVE}2" > + > + lvcreate --name Swap /dev/HostVG --size ${SWAP_SIZE}M > + lvcreate --name Root /dev/HostVG --size ${ROOT_SIZE}M > + lvcreate --name Config /dev/HostVG --size ${CONFIG_SIZE}M > + lvcreate --name Logging /dev/HostVG --size ${LOGGING_SIZE}M > + lvcreate --name Data /dev/HostVG --size ${DATA_SIZE}M > + > + mke2fs -T ext2 "${DRIVE}1" -L "BOOT" > + mke2fs -T swap /dev/HostVG/Swap This is still broken as per my previous mail > + mke2fs -T ext2 /dev/HostVG/Root -L "ROOT" > + mke2fs -T ext3 /dev/HostVG/Config -L "CONFIG" > + mke2fs -T ext3 /dev/HostVG/Logging -L "LOGGING" > + mke2fs -T ext3 /dev/HostVG/Data -L "DATA" > + } > partition.log 2>&1 > + Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From dpierce at redhat.com Wed Nov 12 22:26:57 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 12 Nov 2008 17:26:57 -0500 Subject: [Ovirt-devel] [PATCH node] Networking configuration support. Message-ID: <1226528817-7073-1-git-send-email-dpierce@redhat.com> This script allows the user to iterate through and edit the network interfaces on the node. Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 88 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 88 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index c856ef1..f86dcf1 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -1,2 +1,90 @@ #!/bin/bash # +# Iterates over the list of network devices on the node and prompts the user +# to configure each. + +CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" + +function configure_interface +{ + NIC=$1 + BRIDGE=ovirtbr`echo $NIC | cut -b4-` + IF_FILENAME="/var/tmp/augtool-$NIC" + BR_FILENAME="/var/tmp/augtool-$BRIDGE" + + printf "\nCONFIGURE $NIC ON $BRIDGE\n\n" + + IF_ROOT="$CONFIG_FILE_ROOT-$NIC" + IF_CONFIG="rm $IF_ROOT\nset $IF_ROOT/DEVICE $NIC" + + BR_ROOT="$CONFIG_FILE_ROOT-$BRIDGE" + BR_CONFIG="rm $BR_ROOT\nset $BR_ROOT/DEVICE $BRIDGE" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/TYPE bridge" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/PEERNTP yes" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/DELAY 0" + IF_CONFIG="$IF_CONFIG\nset $IF_ROOT/BRIDGE $BRIDGE" + + # how do you want to configure this device? (dhcp, static IP) + while true; do + printf "Does this bridge use dynamic addressing? (Y/N) " + read + case $REPLY in + Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp"; break ;; + N|n) + printf "\tIP Address: "; read; IPADDR=$REPLY + printf "\t Netmask: "; read; NETMASK=$REPLY + printf "\t Broadcast: "; read; BROADCAST=$REPLY + printf "\t Gateway: "; read; GATEWAY=$REPLY + + printf "\nIP Address: $IPADDR\nNetmask: $NETMASK\nBroadcast: $BROADCAST\nGateway: $GATEWAY\n" + printf "Is this correct? (Y/N) " + read + case $REPLY in + Y|y) + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPADDR $IPADDR" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BROADCAST $BROADCAST" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/NETMASK $NETMASK" + break + ;; + esac + ;; + esac + done + + IF_CONFIG="$IF_CONFIG\nset $IF_ROOT/ONBOOT yes" + IF_CONFIG="$IF_CONFIG\nsave" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/ONBOOT yes" + BR_CONFIG="$BR_CONFIG\nsave" + + printf "$IF_CONFIG\n" > $IF_FILENAME + printf "$BR_CONFIG\n" > $BR_FILENAME + + echo +} + +# TODO the menu doesn't redisplay unless you hit enter -- needs fixing +# get the list of network cards on this machine +NICS=$(hal-device | awk '/net.interface/ { + match($0, "= '"'"'(.*)'"'"' ", nic); printf("%s ", nic[1]); }') + +# Append a quit option +NICS="$NICS Quit" + +PS3="Please select a network interface to configure:" +select NIC in $NICS +do + case "$NIC" in + "Quit") + break + ;; + + *) + configure_interface $NIC $IFACE_NUMBER + ;; + esac +done + +# Merge together all generated files and run augtool + +cat /var/tmp/augtool-* > /var/tmp/config-augtool +augtool < /var/tmp/config-augtool -- 1.5.6.5 From apevec at redhat.com Wed Nov 12 22:50:52 2008 From: apevec at redhat.com (Alan Pevec) Date: Wed, 12 Nov 2008 23:50:52 +0100 Subject: [Ovirt-devel] Re: [PATCH node] Networking configuration support. In-Reply-To: <1226528817-7073-1-git-send-email-dpierce@redhat.com> References: <1226528817-7073-1-git-send-email-dpierce@redhat.com> Message-ID: <491B5DCC.4040005@redhat.com> Darryl L. Pierce wrote: > + IF_CONFIG="$IF_CONFIG\nset $IF_ROOT/ONBOOT yes" > + IF_CONFIG="$IF_CONFIG\nsave" > + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/ONBOOT yes" > + BR_CONFIG="$BR_CONFIG\nsave" no need to save after each i/f, just... > +# Merge together all generated files and run augtool > + > +cat /var/tmp/augtool-* > /var/tmp/config-augtool ...here: + printf "\nsave" >> /var/tmp/config-augtool > +augtool < /var/tmp/config-augtool and: + service network restart From dpierce at redhat.com Thu Nov 13 14:12:36 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 13 Nov 2008 09:12:36 -0500 Subject: [Ovirt-devel] [PATCH node] Networking configuration support. Message-ID: <1226585556-5646-1-git-send-email-dpierce@redhat.com> This script allows the user to iterate through and edit the network interfaces on the node. Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 94 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 94 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index c856ef1..b6d9c07 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -1,2 +1,96 @@ #!/bin/bash # +# Iterates over the list of network devices on the node and prompts the user +# to configure each. + +CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" +CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" + +function configure_interface +{ + NIC=$1 + BRIDGE=ovirtbr`echo $NIC | cut -b4-` + IF_FILENAME="/var/tmp/augtool-$NIC" + BR_FILENAME="/var/tmp/augtool-$BRIDGE" + + printf "\nConfigure $BRIDGE for use by $NIC..\n\n" + + IF_ROOT="$CONFIG_FILE_ROOT-$NIC" + IF_CONFIG="rm $IF_ROOT\nset $IF_ROOT/DEVICE $NIC" + + BR_ROOT="$CONFIG_FILE_ROOT-$BRIDGE" + BR_CONFIG="rm $BR_ROOT\nset $BR_ROOT/DEVICE $BRIDGE" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/TYPE bridge" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/PEERNTP yes" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/DELAY 0" + IF_CONFIG="$IF_CONFIG\nset $IF_ROOT/BRIDGE $BRIDGE" + + # how do you want to configure this device? (dhcp, static IP) + while true; do + printf "Will $BRIDGE use dynamic addressing? (Y/N) " + read + case $REPLY in + Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp"; break ;; + N|n) + printf "\nPlease enter the network details for $BRIDGE:\n" + printf "\tIP Address: "; read; IPADDR=$REPLY + printf "\t Netmask: "; read; NETMASK=$REPLY + printf "\t Broadcast: "; read; BROADCAST=$REPLY + printf "\t Gateway: "; read; GATEWAY=$REPLY + + printf "\nPlease review the details for $BRIDGE:\n" + printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Broadcast: $BROADCAST\n\t Gateway: $GATEWAY\n" + printf "Is this correct? (Y/N) " + read + case $REPLY in + Y|y) + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPADDR $IPADDR" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BROADCAST $BROADCAST" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/NETMASK $NETMASK" + break + ;; + esac + ;; + esac + done + + IF_CONFIG="$IF_CONFIG\nset $IF_ROOT/ONBOOT yes" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/ONBOOT yes" + + printf "$IF_CONFIG\n" > $IF_FILENAME + printf "$BR_CONFIG\n" > $BR_FILENAME + + echo +} + +function setup_menu +{ + NICS=$(hal-device | awk '/net.interface/ {match($0, "= '"'"'(.*)'"'"' ", nic); printf("%s ", nic[1]); }') + NICS="$NICS Quit" + PS3="Please select a network interface to configure:" +} + +# clean up any left over configurations +rm -f /var/tmp/config-augtool +rm -f /var/tmp/augtool-* + +setup_menu + +select NIC in $NICS +do + printf "\n" + case "$NIC" in + "Quit") break ;; + *) configure_interface $NIC $IFACE_NUMBER ;; + esac + setup_menu +done + +# Merge together all generated files and run augtool + +cat /var/tmp/augtool-* > /var/tmp/config-augtool +printf "save\n" >> /var/tmp/config-augtool +{ +augtool < /var/tmp/config-augtool +service network restart +} > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE \ No newline at end of file -- 1.5.6.5 From jim at meyering.net Thu Nov 13 15:17:37 2008 From: jim at meyering.net (Jim Meyering) Date: Thu, 13 Nov 2008 16:17:37 +0100 Subject: [Ovirt-devel] [PATCH node] Password configuration script for the root password and sasl users In-Reply-To: <1226344933-11105-1-git-send-email-bkearney@redhat.com> (Bryan Kearney's message of "Mon, 10 Nov 2008 14:22:13 -0500") References: <1226344933-11105-1-git-send-email-bkearney@redhat.com> Message-ID: <87wsf78xke.fsf@rho.meyering.net> Bryan Kearney wrote: > diff --git a/scripts/ovirt-config-password b/scripts/ovirt-config-password > index 8b13789..af99915 100755 > --- a/scripts/ovirt-config-password > +++ b/scripts/ovirt-config-password > @@ -1 +1,93 @@ > +#!/bin/bash > +# > +# Set the root password and others > + > +ROOT_PASSWORD="" > + > +function sasl_password { > + printf "adding user $1 to the sasl list for libvirt\n" > + echo $2 | saslpasswd2 -a libvirt -p $1 You need quotes here. Otherwise, a password with e.g., "foo bar" would be shortened (tokenized) to "foo bar". Also, you can't use echo, because that would honor (i.e., ignore) a leading -n, -e, or -E option in the password string. printf '%s\n' "$2" | saslpasswd2 -a libvirt -p "$1" Even with a tiny function like this, it's more readable and slightly more maintainable (less risk of confusing $1 and $2) to give names to the parameters, e.g., function sasl_password { user=$1 passwd=$2 printf "adding user $user to the sasl list for libvirt\n" printf '%s\n' "$passwd" | saslpasswd2 -a libvirt -p "$user" } > +} > + > +function set_root_password { > + while true; do > + printf "\nPlease enter the new root password (hit return to skip) " > + read -s > + if [[ $REPLY == "" ]]; then > + return 1 > + fi > + ROOT_PASSWORD=$REPLY > + printf "\nPlease enter again to confirm " > + read -s > + ROOT_PASSWORD_CONFIRM=$REPLY > + if [[ $ROOT_PASSWORD == $ROOT_PASSWORD_CONFIRM ]]; then > + echo $ROOT_PASSWORD | passwd --stdin root > + sasl_password root $ROOT_PASSWORD Both of the above require quotes, too: printf '%s\n' "$ROOT_PASSWORD" | passwd --stdin root sasl_password root "$ROOT_PASSWORD" > + break > + else > + printf "\nPaswords did not match. Please try again" Don't you want a "\n" at the end, here? Probably instead of the one at the beginning. > + fi > + done > + return 0 > +} These two functions are similar enough that they should use the same code. > +# Prompts the user for a single username, password combo > +function prompt_sasl_user { > + while true; do > + printf "\nPlease enter a new user (hit return to skip) " > + read > + if [[ $REPLY == "" ]]; then > + break > + fi > + SASL_USER=$REPLY > + printf "\nPlease enter the password for $SASL_USER (hit return to skip) " > + read -s > + if [[ $REPLY == "" ]]; then > + return 1 > + fi > + SASL_PASSWORD=$REPLY > + printf "\nPlease enter again to confirm " > + read -s > + SASL_PASSWORD_CONFIRM=$REPLY > + if [[ $SASL_PASSWORD == $SASL_PASSWORD_CONFIRM ]]; then > + sasl_password $SASL_USER $SASL_PASSWORD > + break > + else > + printf "\nPaswords did not match. Please try again" > + fi > + done > + > +} How about this (untested): # Usage: set_SASL_password USER # Prompt(twice) for a password for the specified USER. # If they match, set that user's system password, # and add USER to the SASL list for libvirt. set_SASL_password() { user=$1 while : ; do printf "\nPlease enter the new $user password (hit return to skip) " read -s test -z "$REPLY" && return 1 local passwd=$REPLY printf "\nPlease enter again to confirm " read -s local confirm=$REPLY if test "$passwd" = "$confirm"; then printf '%s\n' "$passwd" | passwd --stdin "$user" sasl_password "$user" "$passwd" return 0 fi printf "Paswords did not match. Please try again\n" done } Then you'd use set_SASL_passwd root Prompt for SASL_USER separately, then set_SASL_passwd $SASL_USER > +#Check for the root user first > +while true ; do > + printf "\nWould you like to set the root password (Y|N) " > + read > + case $REPLY in > + Y|y) > + set_root_password > + if [[ $? == 0 ]] ; then > + break ; > + fi The more maintainable/readable idiom for the above 4 lines is like this: set_root_password && break > + ;; > + N|n) > + break ; > + ;; This makes the code treat any non-Y/y response like "N". If you want to treat a response like "yes" differently, you can add a catch-all case: *) printf "invalid response: %s\n" "$REPLY" ;; > + esac > +done > + > +#Check for any sasl users > +while true ; do > + printf "\nWould you like to add a new sasl user for libvirt (Y|N) " > + read > + case $REPLY in > + Y|y) > + prompt_sasl_user > + ;; > + N|n) > + break ; > + ;; > + esac > +done > + From mmorsi at redhat.com Thu Nov 13 18:49:35 2008 From: mmorsi at redhat.com (Mohammed Morsi) Date: Thu, 13 Nov 2008 13:49:35 -0500 Subject: [Ovirt-devel] [PATCH server] renamed 'redux' layout to standard rails 'default' Message-ID: <1226602175-4887-1-git-send-email-mmorsi@redhat.com> --- src/app/controllers/application.rb | 6 +- src/app/views/layouts/_header.rhtml | 11 +++ src/app/views/layouts/_header_redux.rhtml | 11 --- src/app/views/layouts/default.rhtml | 102 +++++++++++++++++++++++++++++ src/app/views/layouts/redux.rhtml | 102 ----------------------------- 5 files changed, 116 insertions(+), 116 deletions(-) create mode 100644 src/app/views/layouts/_header.rhtml delete mode 100644 src/app/views/layouts/_header_redux.rhtml create mode 100644 src/app/views/layouts/default.rhtml delete mode 100644 src/app/views/layouts/redux.rhtml diff --git a/src/app/controllers/application.rb b/src/app/controllers/application.rb index 3f75979..9affb20 100644 --- a/src/app/controllers/application.rb +++ b/src/app/controllers/application.rb @@ -34,10 +34,10 @@ class ApplicationController < ActionController::Base before_filter :is_logged_in, :get_help_section def choose_layout - if(params[:component_layout]) - return (ENV["RAILS_ENV"] != "production")?'components/' << params[:component_layout]:'redux' + if(params[:component_layout] and ENV["RAILS_ENV"] != "production") + return 'components/' << params[:component_layout] end - return 'redux' + return 'default' end def is_logged_in diff --git a/src/app/views/layouts/_header.rhtml b/src/app/views/layouts/_header.rhtml new file mode 100644 index 0000000..a12d567 --- /dev/null +++ b/src/app/views/layouts/_header.rhtml @@ -0,0 +1,11 @@ + + +
+
Hi, <%= @user %>
+
'results' %>"> + + " title="Search" type="image">  | +
+
+ +
Resource Pools
diff --git a/src/app/views/layouts/_header_redux.rhtml b/src/app/views/layouts/_header_redux.rhtml deleted file mode 100644 index a12d567..0000000 --- a/src/app/views/layouts/_header_redux.rhtml +++ /dev/null @@ -1,11 +0,0 @@ - - -
-
Hi, <%= @user %>
-
'results' %>"> - - " title="Search" type="image">  | -
-
- -
Resource Pools
diff --git a/src/app/views/layouts/default.rhtml b/src/app/views/layouts/default.rhtml new file mode 100644 index 0000000..092e1fe --- /dev/null +++ b/src/app/views/layouts/default.rhtml @@ -0,0 +1,102 @@ + + + + + + + <%= yield :title -%> + <%# remove me %> + <%= stylesheet_link_tag 'layout' %> + <%= stylesheet_link_tag 'components' %> + + <%= stylesheet_link_tag '/javascripts/jquery-treeview/ovirt.treeview.css' %> + <%= stylesheet_link_tag 'flexigrid/flexigrid.css' %> + <%= stylesheet_link_tag 'facebox' %> + <%= stylesheet_link_tag 'jquery.jgrowl.css' %> + <%= stylesheet_link_tag 'ovirt-tree/tree' %> + + <%= javascript_include_tag "jquery-1.2.6.min.js" -%> + <%= javascript_include_tag "jquery-treeview/jquery.treeview.js" -%> + <%= javascript_include_tag "jquery-treeview/jquery.treeview.async.js" -%> + <%= javascript_include_tag "flexigrid.js" -%> + <%= javascript_include_tag "facebox.js" -%> + <%#= javascript_include_tag "jquery.timers.js" -%> + <%= javascript_include_tag "jquery-svg/jquery.svg.pack.js" -%> + + <%= javascript_include_tag "jquery-svg/jquery.svggraph.js" -%> + <%= javascript_include_tag "jquery.cookie.js" -%> + <%= javascript_include_tag "jquery.livequery.min.js" -%> + <%= javascript_include_tag "jquery.form.js" -%> + <%= javascript_include_tag "jquery.jgrowl.js" -%> + + <%= javascript_include_tag "jquery.ui-1.5.2/ui/packed/ui.core.packed.js" -%> + <%= javascript_include_tag "jquery.ui-1.5.2/ui/packed/ui.tabs.packed.js" -%> + <%= javascript_include_tag "trimpath-template-1.0.38.js" %> + <%= javascript_include_tag "ovirt.tree.js" %> + + + <%= javascript_include_tag "ovirt.js" -%> + + <%= yield :scripts -%> + + + + + + +
+ <%= render :partial => '/layouts/tree' %> +
+ +
+ <%= render :partial => '/layouts/side_toolbar' %> +
+ +
+ + +
+
+
+ <%= link_to image_tag("icon_help.png"), + {:controller => 'help', :action => @help_section, :anchor => @anchor}, + :id=>"help-link", :popup => true, :title => "Help" %> +
+ <%= yield %> <%# the rest of the center and right hand side %> +
+
+
+ + + diff --git a/src/app/views/layouts/redux.rhtml b/src/app/views/layouts/redux.rhtml deleted file mode 100644 index a41864d..0000000 --- a/src/app/views/layouts/redux.rhtml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - <%= yield :title -%> - <%# remove me %> - <%= stylesheet_link_tag 'layout' %> - <%= stylesheet_link_tag 'components' %> - - <%= stylesheet_link_tag '/javascripts/jquery-treeview/ovirt.treeview.css' %> - <%= stylesheet_link_tag 'flexigrid/flexigrid.css' %> - <%= stylesheet_link_tag 'facebox' %> - <%= stylesheet_link_tag 'jquery.jgrowl.css' %> - <%= stylesheet_link_tag 'ovirt-tree/tree' %> - - <%= javascript_include_tag "jquery-1.2.6.min.js" -%> - <%= javascript_include_tag "jquery-treeview/jquery.treeview.js" -%> - <%= javascript_include_tag "jquery-treeview/jquery.treeview.async.js" -%> - <%= javascript_include_tag "flexigrid.js" -%> - <%= javascript_include_tag "facebox.js" -%> - <%#= javascript_include_tag "jquery.timers.js" -%> - <%= javascript_include_tag "jquery-svg/jquery.svg.pack.js" -%> - - <%= javascript_include_tag "jquery-svg/jquery.svggraph.js" -%> - <%= javascript_include_tag "jquery.cookie.js" -%> - <%= javascript_include_tag "jquery.livequery.min.js" -%> - <%= javascript_include_tag "jquery.form.js" -%> - <%= javascript_include_tag "jquery.jgrowl.js" -%> - - <%= javascript_include_tag "jquery.ui-1.5.2/ui/packed/ui.core.packed.js" -%> - <%= javascript_include_tag "jquery.ui-1.5.2/ui/packed/ui.tabs.packed.js" -%> - <%= javascript_include_tag "trimpath-template-1.0.38.js" %> - <%= javascript_include_tag "ovirt.tree.js" %> - - - <%= javascript_include_tag "ovirt.js" -%> - - <%= yield :scripts -%> - - - - - - -
- <%= render :partial => '/layouts/tree' %> -
- -
- <%= render :partial => '/layouts/side_toolbar' %> -
- -
- - -
-
-
- <%= link_to image_tag("icon_help.png"), - {:controller => 'help', :action => @help_section, :anchor => @anchor}, - :id=>"help-link", :popup => true, :title => "Help" %> -
- <%= yield %> <%# the rest of the center and right hand side %> -
-
-
- - - -- 1.5.6.5 From apevec at redhat.com Thu Nov 13 19:02:05 2008 From: apevec at redhat.com (Alan Pevec) Date: Thu, 13 Nov 2008 20:02:05 +0100 Subject: [Ovirt-devel] [PATCH ovirt-node] disable ovirt services not used by stateful Node setup Message-ID: <1226602925-20389-1-git-send-email-apevec@redhat.com> --- ovirt-listen-awake/ovirt-install-node | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/ovirt-listen-awake/ovirt-install-node b/ovirt-listen-awake/ovirt-install-node index fcdf115..d65816f 100755 --- a/ovirt-listen-awake/ovirt-install-node +++ b/ovirt-listen-awake/ovirt-install-node @@ -126,6 +126,10 @@ elif [ "$1" = "stateful" ]; then add_if_not_exist "192.168.50.2 $MGMT_HOST" /etc/hosts chkconfig ovirt-listen-awake on + chkconfig ovirt-early off + chkconfig ovirt off + chkconfig ovirt-post off + chkconfig ovirt-firstboot off chkconfig collectd on chkconfig libvirt-qpid on chkconfig iptables on -- 1.5.6.5 From apevec at redhat.com Thu Nov 13 19:16:09 2008 From: apevec at redhat.com (Alan Pevec) Date: Thu, 13 Nov 2008 20:16:09 +0100 Subject: [Ovirt-devel] Re: [PATCH node-image] Delists necessary but blacklisted exes and includes bc. In-Reply-To: <1226524621-2059-1-git-send-email-dpierce@redhat.com> References: <1226524621-2059-1-git-send-email-dpierce@redhat.com> Message-ID: <491C7CF9.90702@redhat.com> ACK and pushed with more precise commit msg: more requirements for standalone mode to run hal-find-by-capability for device discovery bc is needed for non-integer arithmetics From apevec at redhat.com Thu Nov 13 20:57:02 2008 From: apevec at redhat.com (Alan Pevec) Date: Thu, 13 Nov 2008 21:57:02 +0100 Subject: [Ovirt-devel] Re: [PATCH node] Networking configuration support. In-Reply-To: <1226585556-5646-1-git-send-email-dpierce@redhat.com> References: <1226585556-5646-1-git-send-email-dpierce@redhat.com> Message-ID: <491C949E.5010708@redhat.com> ACK and pushed From apevec at redhat.com Thu Nov 13 20:57:53 2008 From: apevec at redhat.com (Alan Pevec) Date: Thu, 13 Nov 2008 21:57:53 +0100 Subject: [Ovirt-devel] Re: [PATCH node] Password configuration script for the root password and sasl users In-Reply-To: <87wsf78xke.fsf@rho.meyering.net> References: <1226344933-11105-1-git-send-email-bkearney@redhat.com> <87wsf78xke.fsf@rho.meyering.net> Message-ID: <491C94D1.3050104@redhat.com> applied suggested changes and pushed From apevec at redhat.com Thu Nov 13 20:59:37 2008 From: apevec at redhat.com (Alan Pevec) Date: Thu, 13 Nov 2008 21:59:37 +0100 Subject: [Ovirt-devel] Re: [PATCH node] RSyslog configuration for standalone mode. In-Reply-To: <1226328385-20013-1-git-send-email-bkearney@redhat.com> References: <1226328385-20013-1-git-send-email-bkearney@redhat.com> Message-ID: <491C9539.7030703@redhat.com> ACK and pushed with some minor tweaks, removed default action, will be done as part of auto-install From jim at meyering.net Thu Nov 13 22:00:33 2008 From: jim at meyering.net (Jim Meyering) Date: Thu, 13 Nov 2008 23:00:33 +0100 Subject: [Ovirt-devel] [PATCH node] Networking configuration support. In-Reply-To: <1226585556-5646-1-git-send-email-dpierce@redhat.com> (Darryl L. Pierce's message of "Thu, 13 Nov 2008 09:12:36 -0500") References: <1226585556-5646-1-git-send-email-dpierce@redhat.com> Message-ID: <87tzab70ce.fsf@rho.meyering.net> "Darryl L. Pierce" wrote: > This script allows the user to iterate through and edit the > network interfaces on the node. ... > +# clean up any left over configurations > +rm -f /var/tmp/config-augtool > +rm -f /var/tmp/augtool-* This surprised me. A script like this should delete only whatever files it creates. ... > +# Merge together all generated files and run augtool > + > +cat /var/tmp/augtool-* > /var/tmp/config-augtool Oops. A malicious user can create arbitrary /var/tmp/augtool-nasty-* files, and this script will use them. Safer would be to use a directory created by mktemp -d, and put all files in there. > +printf "save\n" >> /var/tmp/config-augtool > +{ > +augtool < /var/tmp/config-augtool > +service network restart > +} > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE > \ No newline at end of file From dpierce at redhat.com Thu Nov 13 22:05:28 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Thu, 13 Nov 2008 17:05:28 -0500 Subject: [Ovirt-devel] [PATCH node] Added support for local storage configuration. Message-ID: <1226613928-20862-1-git-send-email-dpierce@redhat.com> This patch wipes out the entire disk on the node and replaces it with a set of partitions. The partitions are a raw partition to hold the bootable kernel, and the rest of the disk is taken up as an physical volume. On the physical volume is created the following logical volumes: * SWAP - swap partition * ROOT - to host the node image * CONFIG - to hold node configuration data * LOGGING - to hold local logs * DATA - to hold VM images Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-storage | 199 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 199 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index c856ef1..25962e1 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -1,2 +1,201 @@ #!/bin/bash # +# To automate the partitioning, pass in the specific fields in this order +# ovirt-config-storage [swap size] [boot size] [root size] [logging size] +# +# All sizes are in megabytes +# + +function do_resolve_sizes +{ + DATA_SIZE=$(echo "scale=0; ($SPACE - $BOOT_SIZE - $SWAP_SIZE - $ROOT_SIZE - $CONFIG_SIZE - $LOGGING_SIZE)" | bc -l) +} + +function do_configure +{ + read -p "Swap partition size (Currently ${SWAP_SIZE} MB)? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + SWAP_SIZE=$REPLY + else + printf "Swap value is invalid: retaining ${SWAP_SIZE} MB.\n" + fi + + read -p "Boot partition size (Currently ${BOOT_SIZE} MB)? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + BOOT_SIZE=$REPLY + else + printf "Boot value is invalid: retaining ${BOOT_SIZE}.\n" + fi + + read -p "Root partition size (Current ${ROOT_SIZE} MB)? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + ROOT_SIZE=$REPLY + else + printf "Install size is invalid: retaining ${ROOT_SIZE} MB.\n" + fi + + read -p "Logging partition size (Current ${LOGGING_SIZE} MB)? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + LOGGING_SIZE=$REPLY + else + printf "Install size is invalid: retaining ${LOGGING_SIZE} MB.\n" + fi + + do_resolve_sizes +} + +function do_review +{ + printf "\n" + printf "The local disk will be repartitioned as follows:\n" + printf "================================================\n" + printf " Physical Hard Disk: ${DRIVE}\n" + printf " Total storage available: ${SPACE} MB\n" + printf " Swap partition size: ${SWAP_SIZE} MB\n" + printf " Boot partition size: ${BOOT_SIZE} MB\n" + printf " Installation partition size: ${ROOT_SIZE} MB\n" + printf " Configuration partition size: ${CONFIG_SIZE} MB\n" + printf " Logging partition size: ${LOGGING_SIZE} MB\n" + printf " Data partition size: ${DATA_SIZE} MB\n" + printf "\n" +} + +function perform_partitioning +{ + printf "Preparing local storage. Please wait..." + + { + vgroups=$(vgdisplay -C | awk '{ print $1" "; }') + vgremove -f $vgroups + + dd if=/dev/zero of=$DRIVE bs=1K count=1 + blockdev --rereadpt $DRIVE + partprobe -s $DRIVE + + parted $DRIVE -s "mklabel gpt" + parted $DRIVE -s "mkpart primary ext2 0M ${BOOT_SIZE}M" + parted $DRIVE -s "mkpart primary ext2 ${BOOT_SIZE}M ${SPACE}M" + parted $DRIVE -s "set 2 lvm on" + + pvcreate "${DRIVE}2" + pvck + vgcreate /dev/HostVG "${DRIVE}2" + + lvcreate --name Swap --size ${SWAP_SIZE}M /dev/HostVG + lvcreate --name Root --size ${ROOT_SIZE}M /dev/HostVG + lvcreate --name Config --size ${CONFIG_SIZE}M /dev/HostVG + lvcreate --name Logging --size ${LOGGING_SIZE}M /dev/HostVG + lvcreate --name Data -l 100%FREE /dev/HostVG + + mke2fs -j -T ext2 "${DRIVE}1" -L "BOOT" + tune2fs -c 0 -i 0 "${DRIVE}1" + mkswap /dev/HostVG/Swap + mke2fs -j -T ext2 /dev/HostVG/Root -L "ROOT" + tune2fs -c 0 -i 0 /dev/HostVG/Root + mke2fs -j -T ext3 /dev/HostVG/Config -L "CONFIG" + tune2fs -c 0 -i 0 /dev/HostVG/Config + mke2fs -j -T ext3 /dev/HostVG/Logging -L "LOGGING" + tune2fs -c 0 -i 0 /dev/HostVG/Logging + mke2fs -j -T ext3 /dev/HostVG/Data -L "DATA" + tune2fs -c 0 -i 0 /dev/HostVG/Data + } > /var/log/ovirt-partition.log 2>&1 + + printf "Completed!\n\n" +} + +function do_confirm +{ + while true; do + printf "\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! If you proceed this will destroy all data on your local system, and !!WARNING!!\n" + printf "!!WARNING!! your hard disk will be irreversably reconfiguration. !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "\n" + printf "\tContinue? (Y/n) " + read + case $REPLY in + Y|y) + perform_partitioning; break ;; + N|n) return ;; + esac + done +} + +DRIVE=$(for drive in `hal-find-by-capability --capability storage`; do + info=$(lshal -u $drive -s) + if [[ $info =~ "storage.drive_type = 'disk'" ]]; then + lshal -u $drive -s | awk ' /block.device/ { + match($0, "block.device = *'"'"'(.*)'"'"'", device) + printf "%s", device[1] + }' + fi +done) + +SPACE=$(for drive in `hal-find-by-capability --capability storage`; do + info=$(lshal -u $drive -s) + if [[ $info =~ "storage.drive_type = 'disk'" ]]; then + lshal -u $drive -s | awk ' /storage.size/ { + match($0, "storage.size *= *([0-9]+)", device) + printf "%s", device[1] + }' + fi +done) + +SPACE=$(echo "scale=0; $SPACE / (1024 * 1024)" | bc -l) +BOOT_SIZE="256" +ROOT_SIZE="256" +CONFIG_SIZE="5" +LOGGING_SIZE="256" + +MEM_SIZE=$(virsh -c qemu:///system nodeinfo | awk '/Memory size/ { print $3 }') +MEM_SIZE=$(echo "scale=0; $MEM_SIZE / 1024" | bc -l) +SWAP_SIZE=$MEM_SIZE + +# If the any partition size was provided as a kernel argument, +# then set the values and run without prompting + +counter=0 +while [ "$1" != "" ]; do + AUTO="Y" + case $counter in + 0) SWAP_SIZE=$1; break ;; + 1) BOOT_SIZE=$1; break ;; + 2) ROOT_SIZE=$1; break ;; + 3) LOGGING_SIZE=$1; break ;; + esac + counter=`expr $counter + 1 ` + shift +done + +if [ "$AUTO" == "Y" ]; then + printf "Partitioning hard disk..." + perform_partitioning + printf "[DONE]\n" + exit 0 +else + while true; do + do_resolve_sizes + + OPTIONS="Configure Review Partition Quit" + PS3="Choose an option: " + + printf "\n" + + select OPTION in $OPTIONS + do + case "$OPTION" in + "Configure") do_configure ; break ;; + "Review") do_review ; break ;; + "Partition") do_confirm ; break ;; + "Quit") exit ;; + esac + done + done +fi -- 1.5.6.5 From pmyers at redhat.com Fri Nov 14 09:07:27 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 04:07:27 -0500 Subject: [Ovirt-devel] [PATCH recipe] Split ovirt-appliance init script into storage and dnsmasq Message-ID: <1226653647-19080-1-git-send-email-pmyers@redhat.com> This makes the appliance a little more deterministic in setup. DNS services must be working correctly prior to calling the ovirt-server-appliance-setup script, but storage can't be activated until after. Splitting up these two services allows us to set up the dependencies properly in the puppet file. This fixes a transient bug where the appliance would start but the services would fail to configure properly. I was seeing this around 25% of the time with appliance firstboot. Signed-off-by: Perry Myers --- Makefile.am | 3 +- appliances/ovirt/files/ovirt-dnsmasq.conf | 25 ++++++ appliances/ovirt/files/ovirt-server-appliance | 87 -------------------- appliances/ovirt/files/ovirt-storage | 72 ++++++++++++++++ appliances/ovirt/ovirt.pp.in | 31 +++++-- .../templates/ovirt-server-appliance-setup.erb | 16 ++++ 6 files changed, 137 insertions(+), 97 deletions(-) create mode 100644 appliances/ovirt/files/ovirt-dnsmasq.conf delete mode 100644 appliances/ovirt/files/ovirt-server-appliance create mode 100644 appliances/ovirt/files/ovirt-storage diff --git a/Makefile.am b/Makefile.am index 4f7f939..2505208 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,7 +30,8 @@ EXTRA_DIST = \ appliances/ovirt/files/qpidd.conf \ appliances/ovirt/files/ovirt-cfgdb \ appliances/ovirt/files/ovirt.repo \ - appliances/ovirt/files/ovirt-server-appliance \ + appliances/ovirt/files/ovirt-dnsmasq.conf \ + appliances/ovirt/files/ovirt-storage \ appliances/ovirt/files/ovirt-splash.xpm.gz \ appliances/ovirt/templates/ovirt-server-appliance-setup.erb \ appliances/ovirt/templates/terminal.erb diff --git a/appliances/ovirt/files/ovirt-dnsmasq.conf b/appliances/ovirt/files/ovirt-dnsmasq.conf new file mode 100644 index 0000000..716ccd4 --- /dev/null +++ b/appliances/ovirt/files/ovirt-dnsmasq.conf @@ -0,0 +1,25 @@ +interface=eth1 +dhcp-range=192.168.50.6,192.168.50.252 +dhcp-host=00:16:3e:12:34:57,192.168.50.3 +dhcp-host=00:16:3e:12:34:58,192.168.50.4 +dhcp-host=00:16:3e:12:34:59,192.168.50.5 +domain=priv.ovirt.org +srv-host=_ovirt._tcp,management.priv.ovirt.org,80 +srv-host=_ipa._tcp,management.priv.ovirt.org,80 +srv-host=_ldap._tcp,management.priv.ovirt.org,389 +srv-host=_collectd._tcp,management.priv.ovirt.org,25826 +srv-host=_qpidd._tcp,management.priv.ovirt.org,5672 +srv-host=_identify._tcp,management.priv.ovirt.org,12120 +enable-tftp +tftp-root=/var/lib/tftpboot +dhcp-boot=pxelinux.0 +dhcp-option=option:router,192.168.50.2 +dhcp-option=option:ntp-server,192.168.50.2 +dhcp-option=12 +no-resolv +local=/priv.ovirt.org/ +server=192.168.122.1 + + + + diff --git a/appliances/ovirt/files/ovirt-server-appliance b/appliances/ovirt/files/ovirt-server-appliance deleted file mode 100644 index 5cf530d..0000000 --- a/appliances/ovirt/files/ovirt-server-appliance +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash -# -# ovirt-server-appliance oVirt Server Appliance service -# -# chkconfig: 3 96 4 -# description: ovirt server appliance service -# - -# Source functions library -. /etc/init.d/functions -TARGET_ID=32101 - -start() { - echo -n "Starting ovirt-server-appliance: " - dnsmasq -i eth1 -F 192.168.50.6,192.168.50.252 \ - -G 00:16:3e:12:34:57,192.168.50.3 -G 00:16:3e:12:34:58,192.168.50.4 \ - -G 00:16:3e:12:34:59,192.168.50.5 \ - -s priv.ovirt.org \ - -W _ovirt._tcp,management.priv.ovirt.org,80 \ - -W _ipa._tcp,management.priv.ovirt.org,80 \ - -W _ldap._tcp,management.priv.ovirt.org,389 \ - -W _collectd._tcp,management.priv.ovirt.org,25826 \ - -W _qpidd._tcp,management.priv.ovirt.org,5672 \ - -W _identify._tcp,management.priv.ovirt.org,12120 \ - --enable-tftp --tftp-root=/var/lib/tftpboot -M pxelinux.0 \ - -O option:router,192.168.50.2 -O option:ntp-server,192.168.50.2 \ - --dhcp-option=12 \ - -R --local /priv.ovirt.org/ --server 192.168.122.1 - - # Set up the fake iscsi target - tgtadm --lld iscsi --op new --mode target --tid $TARGET_ID \ - -T ovirtpriv:storage - - # - # Now associate them to the LVs - # - tgtadm --lld iscsi --op new --mode logicalunit --tid $TARGET_ID \ - --lun 1 -b /ovirtiscsi/iSCSI3 - tgtadm --lld iscsi --op new --mode logicalunit --tid $TARGET_ID \ - --lun 2 -b /ovirtiscsi/iSCSI4 - tgtadm --lld iscsi --op new --mode logicalunit --tid $TARGET_ID \ - --lun 3 -b /ovirtiscsi/iSCSI5 - - # - # Now make them available - # - tgtadm --lld iscsi --op bind --mode target --tid $TARGET_ID -I ALL - - echo_success - echo -} - -stop() { - echo -n "Stopping ovirt-server-appliance: " - - # stop access to the iscsi target - tgtadm --lld iscsi --op unbind --mode target --tid $TARGET_ID -I ALL - - # unbind the LUNs - tgtadm --lld iscsi --op delete --mode logicalunit --tid $TARGET_ID --lun 3 - tgtadm --lld iscsi --op delete --mode logicalunit --tid $TARGET_ID --lun 2 - tgtadm --lld iscsi --op delete --mode logicalunit --tid $TARGET_ID --lun 1 - - # shutdown the target - tgtadm --lld iscsi --op delete --mode target --tid $TARGET_ID - - kill $(cat /var/run/dnsmasq.pid) - - echo_success - echo -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - *) - echo "Usage: ovirt-server-appliance {start|stop|restart}" - exit 2 -esac diff --git a/appliances/ovirt/files/ovirt-storage b/appliances/ovirt/files/ovirt-storage new file mode 100644 index 0000000..2679995 --- /dev/null +++ b/appliances/ovirt/files/ovirt-storage @@ -0,0 +1,72 @@ +#!/bin/bash +# +# ovirt-storage Set up storage for oVirt Server Appliance +# +# chkconfig: 3 96 4 +# description: oVirt Appliance Storage Services +# + +# Source functions library +. /etc/init.d/functions +TARGET_ID=32101 + +prog="ovirt-storage" +num_iscsi_luns=5 + +start() { + echo -n "Starting $prog: " + + # Set up the fake iscsi target + tgtadm --lld iscsi --op new --mode target --tid $TARGET_ID \ + -T ovirtpriv:storage + + # + # Now associate them to the LVs + # + for i in `seq 1 $num_iscsi_luns` ; do + tgtadm --lld iscsi --op new --mode logicalunit --tid $TARGET_ID \ + --lun $i -b /ovirtiscsi/iSCSI$i + done + + # + # Now make them available + # + tgtadm --lld iscsi --op bind --mode target --tid $TARGET_ID -I ALL + + echo_success + echo +} + +stop() { + echo -n "Stopping $prog: " + + # stop access to the iscsi target + tgtadm --lld iscsi --op unbind --mode target --tid $TARGET_ID -I ALL + + # unbind the LUNs + for i in `seq 1 $num_iscsi_luns` ; do + tgtadm --lld iscsi --op delete --mode logicalunit --tid $TARGET_ID --lun $i + done + + # shutdown the target + tgtadm --lld iscsi --op delete --mode target --tid $TARGET_ID + + echo_success + echo +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 2 +esac diff --git a/appliances/ovirt/ovirt.pp.in b/appliances/ovirt/ovirt.pp.in index 9ac4c12..70ca04b 100644 --- a/appliances/ovirt/ovirt.pp.in +++ b/appliances/ovirt/ovirt.pp.in @@ -153,6 +153,18 @@ service {"qpidd": enable => true } +file {"/etc/dnsmasq.d/ovirt-dnsmasq.conf": + source => "puppet:///ovirt/ovirt-dnsmasq.conf", + mode => 644 +} + +service {"dnsmasq": + ensure => "running", + enable => true , + require => [File["/etc/dnsmasq.d/ovirt-dnsmasq.conf"], + Service["network"]] +} + file {"/usr/sbin/ovirt-server-appliance-setup": content => template("ovirt-server-appliance-setup.erb"), mode => 755 @@ -161,7 +173,8 @@ file {"/usr/sbin/ovirt-server-appliance-setup": single_exec {"ovirt_appliance_installation": command => "/usr/sbin/ovirt-server-appliance-setup >> /var/log/ovirt-server-appliance-setup.log 2>&1", require => [File["/usr/sbin/ovirt-server-appliance-setup"], - Exec["reload-firewall"],Augeas["network_scripts"]] + Exec["reload-firewall"],Augeas["network_scripts"], + Service["dnsmasq"]] } file {"/usr/sbin/cobbler-import": @@ -188,23 +201,23 @@ single_exec {"cobbler-import": Single_exec["ovirt_appliance_installation"]] } -file {"/etc/init.d/ovirt-server-appliance": - source => "puppet:///ovirt/ovirt-server-appliance", +file {"/etc/init.d/ovirt-storage": + source => "puppet:///ovirt/ovirt-storage", mode => 755 } -service {"ovirt-server-appliance": +service {"ovirt-storage": ensure => "running", enable => true , - require => [File["/etc/init.d/ovirt-server-appliance"], - Service["network"], Service["httpd"], - Single_exec["ovirt_appliance_installation"], - Single_exec["cobbler-import"]] + require => [File["/etc/init.d/ovirt-storage"], + Service["network"], + Single_exec["ovirt_appliance_installation"]] } single_exec {"ovirt_installation": command => "/usr/sbin/ovirt-server-install >> /var/log/ovirt-server-install.log 2>&1", - require => [Service["postgresql"],Service["ovirt-server-appliance"]] + require => [Service["postgresql"],Service["ovirt-storage"],Service["dnsmasq"], + Single_exec["ovirt_appliance_installation"],Single_exec["cobbler-import"]] } diff --git a/appliances/ovirt/templates/ovirt-server-appliance-setup.erb b/appliances/ovirt/templates/ovirt-server-appliance-setup.erb index 93cb2e5..bc542d6 100644 --- a/appliances/ovirt/templates/ovirt-server-appliance-setup.erb +++ b/appliances/ovirt/templates/ovirt-server-appliance-setup.erb @@ -1,15 +1,28 @@ #!/bin/bash export PATH=/usr/kerberos/bin:$PATH +set -x +set -e + # make sure to update the /etc/hosts with the list of all possible DHCP # addresses we can hand out; dnsmasq uses this sed -i -e 's/management\.priv\.ovirt\.org//' /etc/hosts +sed -i -e 's/management//' /etc/hosts echo "192.168.50.1 physical.priv.ovirt.org" >> /etc/hosts echo "192.168.50.2 management.priv.ovirt.org" >> /etc/hosts for i in `seq 3 252` ; do echo "192.168.50.$i node$i.priv.ovirt.org" >> /etc/hosts done +service dnsmasq reload + +# FIXME: This is a temporary fix to correct a problem in the puppet config +# dependencies. Sometimes the network will not get restarted with the right +# DNS server until after this script runs, which causes the IPA setup to fail. +# Once we remove the need for dhcp from the client (by only having a single +# interface with 50.2 as the address) this hack will go away +echo "nameserver 192.168.50.2" > /etc/resolv.conf + # workaround for https://bugzilla.redhat.com/show_bug.cgi?id=451936 sed -i '/\[kdcdefaults\]/a \ kdc_ports = 88' /usr/share/ipa/kdc.conf.template # set up freeipa @@ -81,3 +94,6 @@ echo "/cobblernfs 192.168.50.0/24(rw,no_root_squash)" >> /etc/exports # Turn off ace on appliance restarts until we make the installation scripts # reentrant chkconfig ace off + +set +x +set +e -- 1.6.0.3 From pmyers at redhat.com Fri Nov 14 09:10:34 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 04:10:34 -0500 Subject: [Ovirt-devel] [PATCH] Remove ovirt-node-image-pxe RPM Message-ID: <1226653836-19152-1-git-send-email-pmyers@redhat.com> This patch series removes ovirt-node-image-pxe and instead relies on the user running ovirt-pxe after install of ovirt-node-image RPM. Appliance recipe is tweaked to do this as well. From pmyers at redhat.com Fri Nov 14 09:10:35 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 04:10:35 -0500 Subject: [Ovirt-devel] [PATCH node-image] Remove pxe subpackage from ovirt-node-image In-Reply-To: <1226653836-19152-1-git-send-email-pmyers@redhat.com> References: <1226653836-19152-1-git-send-email-pmyers@redhat.com> Message-ID: <1226653836-19152-2-git-send-email-pmyers@redhat.com> pxe just duplicated for the most part what was in base package Instead users should just run ovirt-pxe script after installing ovirt-node-image package Signed-off-by: Perry Myers --- ovirt-node-image.spec.in | 29 ++--------------------------- 1 files changed, 2 insertions(+), 27 deletions(-) diff --git a/ovirt-node-image.spec.in b/ovirt-node-image.spec.in index 440ba2f..a30ea94 100644 --- a/ovirt-node-image.spec.in +++ b/ovirt-node-image.spec.in @@ -18,10 +18,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot URL: http://ovirt.org/ BuildRequires: livecd-tools >= 017.1-2ovirt BuildRequires: syslinux -BuildRequires: appliance-tools >= 002-3 %define app_root %{_datadir}/%{name} -%define tftpboot %{_var}/lib/tftpboot # disable debuginfo, makes no sense for boot image and it is created empty anyway %define debug_package %{nil} @@ -30,16 +28,11 @@ BuildRequires: appliance-tools >= 002-3 The ISO boot image for oVirt Node booting from CDROM device. At the moment, this RPM just packages prebuilt ISO. -%package pxe -Summary: oVirt Node PXE image -Group: Applications/System - -%description pxe -The PXE boot image for oVirt Node network boot from oVirt Server. - %prep %setup -q +%if ! %{source_iso} ./configure +%endif %build %if ! %{source_iso} @@ -48,19 +41,11 @@ make %{?ovirt_cache_dir: OVIRT_CACHE_DIR=%{ovirt_cache_dir}} \ %{?ovirt_url: OVIRT_URL=%{ovirt_url}} \ %{name}.iso %endif -sudo su - -c "cd $(pwd) && ./ovirt-pxe %{image_iso}" -sudo su - -c "cd $(pwd) && chown -R $USER ." %install %{__rm} -rf %{buildroot} mkdir %{buildroot} -%{__install} -d -m0755 %{buildroot}%{tftpboot} -%{__install} -d -m0755 %{buildroot}%{tftpboot}/pxelinux.cfg -%{__install} -p -m0644 tftpboot/pxelinux.cfg/default %{buildroot}%{tftpboot}/pxelinux.cfg/default -%{__install} -p -m0644 tftpboot/pxelinux.0 %{buildroot}%{tftpboot} -%{__install} -p -m0644 tftpboot/initrd0.img %{buildroot}%{tftpboot} -%{__install} -p -m0644 tftpboot/vmlinuz0 %{buildroot}%{tftpboot} %{__install} -d -m0755 %{buildroot}%{app_root} %{__install} -p -m0644 %{image_iso} %{buildroot}%{app_root} %{__install} -d -m0755 %{buildroot}%{_sbindir} @@ -74,9 +59,6 @@ mkdir %{buildroot} %clean %{__rm} -rf %{buildroot} -%post pxe -cobbler sync > /dev/null 2>&1 || : - %files %defattr(-,root,root,0644) %{app_root}/%{name}.iso @@ -88,13 +70,6 @@ cobbler sync > /dev/null 2>&1 || : %{_sbindir}/edit-livecd %{_sbindir}/livecd-setauth -%files pxe -%defattr(-,root,root,0644) -%config(noreplace) %{tftpboot}/pxelinux.cfg/default -%{tftpboot}/pxelinux.0 -%{tftpboot}/initrd0.img -%{tftpboot}/vmlinuz0 - %changelog * Thu Jul 03 2008 Perry Myers 0.92-0 - Only store ISO in SRPM, and generate PXE from that during build -- 1.6.0.3 From pmyers at redhat.com Fri Nov 14 09:10:36 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 04:10:36 -0500 Subject: [Ovirt-devel] [PATCH recipe] Use ovirt-node-image RPM instead of ovirt-node-image-pxe since it has been removed In-Reply-To: <1226653836-19152-2-git-send-email-pmyers@redhat.com> References: <1226653836-19152-1-git-send-email-pmyers@redhat.com> <1226653836-19152-2-git-send-email-pmyers@redhat.com> Message-ID: <1226653836-19152-3-git-send-email-pmyers@redhat.com> Signed-off-by: Perry Myers --- appliances/ovirt/files/cobbler-import | 17 +++++++++++++---- ovirt-recipe.spec.in | 3 ++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/appliances/ovirt/files/cobbler-import b/appliances/ovirt/files/cobbler-import index 9a65351..23d2dca 100644 --- a/appliances/ovirt/files/cobbler-import +++ b/appliances/ovirt/files/cobbler-import @@ -6,6 +6,7 @@ url=http://download.fedora.redhat.com/pub/fedora/linux ksdir=/var/www/cobbler/ks_mirror set -x +set -e for dir in $ksdir/* ; do base=$(basename $dir) nf=$(echo $base | awk -F - '{print NF}') @@ -30,13 +31,18 @@ for dir in $ksdir/* ; do --kickstart=/etc/cobbler/sample-$os-$ver-$arch.ks done -node_arch=$(rpm -q --qf "%{arch}" ovirt-node-image-pxe) +node_arch=$(rpm -q --qf "%{arch}" ovirt-node-image) + +# Create PXE images from oVirt ISO +tmp=$(mktemp -d) +pushd $tmp +ovirt-pxe /usr/share/ovirt-node-image/ovirt-node-image.iso +popd -# TODO extract Node boot params from /var/lib/tftboot/pxelinux.cfg/default -# before Cobbler overwrites it cobbler distro add --name="oVirt-Node-$node_arch" --arch=$node_arch \ - --initrd=/var/lib/tftpboot/initrd0.img --kernel=/var/lib/tftpboot/vmlinuz0 \ + --initrd=$tmp/tftpboot/initrd0.img --kernel=$tmp/tftpboot/vmlinuz0 \ --kopts="rootflags=loop root=/ovirt-node-image.iso rootfstype=iso9660 ro console=ttyS0,115200n8 console=tty0" + cobbler profile add --name=oVirt-Node-$node_arch --distro=oVirt-Node-$node_arch cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$node_arch \ --name=node3 --mac=00:16:3e:12:34:57 @@ -59,6 +65,9 @@ service cobblerd restart cobbler sync cobbler list +rm -Rf $tmp + set +x +set +e echo "Add new oVirt Nodes as Cobbler systems to make them PXE boot oVirt Node image directly." echo "oVirt-Node-$node_arch is also default boot option in Cobbler menu" diff --git a/ovirt-recipe.spec.in b/ovirt-recipe.spec.in index 2993770..638e2e0 100644 --- a/ovirt-recipe.spec.in +++ b/ovirt-recipe.spec.in @@ -27,7 +27,7 @@ Requires: ipa-admintools Requires: scsi-target-utils Requires: iscsi-initiator-utils Requires: ovirt-server -Requires: ovirt-node-image-pxe +Requires: ovirt-node-image Requires: ovirt-release Requires: rhpl Requires: cobbler @@ -41,6 +41,7 @@ Requires: qpidd Requires: rubygem-qpid Requires: qpidc Requires: qmf +Requires: livecd-tools >= 019 %description Thincrust oVirt Server Appliance Recipe -- 1.6.0.3 From jim at meyering.net Fri Nov 14 11:23:13 2008 From: jim at meyering.net (Jim Meyering) Date: Fri, 14 Nov 2008 12:23:13 +0100 Subject: [Ovirt-devel] [PATCH node] Added support for local storage configuration. In-Reply-To: <1226613928-20862-1-git-send-email-dpierce@redhat.com> (Darryl L. Pierce's message of "Thu, 13 Nov 2008 17:05:28 -0500") References: <1226613928-20862-1-git-send-email-dpierce@redhat.com> Message-ID: <8763mq7dr2.fsf@rho.meyering.net> "Darryl L. Pierce" wrote: > This patch wipes out the entire disk on the node and replaces it with > a set of partitions. The partitions are a raw partition to hold the bootable > kernel, and the rest of the disk is taken up as an physical volume. > > On the physical volume is created the following logical volumes: > > * SWAP - swap partition > * ROOT - to host the node image > * CONFIG - to hold node configuration data > * LOGGING - to hold local logs > * DATA - to hold VM images > > Signed-off-by: Darryl L. Pierce > --- > scripts/ovirt-config-storage | 199 ++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 199 insertions(+), 0 deletions(-) > > diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage > index c856ef1..25962e1 100755 > --- a/scripts/ovirt-config-storage > +++ b/scripts/ovirt-config-storage > @@ -1,2 +1,201 @@ > #!/bin/bash > # > +# To automate the partitioning, pass in the specific fields in this order > +# ovirt-config-storage [swap size] [boot size] [root size] [logging size] > +# > +# All sizes are in megabytes > +# > + > +function do_resolve_sizes > +{ > + DATA_SIZE=$(echo "scale=0; ($SPACE - $BOOT_SIZE - $SWAP_SIZE - $ROOT_SIZE - $CONFIG_SIZE - $LOGGING_SIZE)" | bc -l) > +} > + > +function do_configure > +{ > + read -p "Swap partition size (Currently ${SWAP_SIZE} MB)? " > + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then > + SWAP_SIZE=$REPLY > + else > + printf "Swap value is invalid: retaining ${SWAP_SIZE} MB.\n" > + fi > + > + read -p "Boot partition size (Currently ${BOOT_SIZE} MB)? " > + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then > + BOOT_SIZE=$REPLY > + else > + printf "Boot value is invalid: retaining ${BOOT_SIZE}.\n" > + fi > + > + read -p "Root partition size (Current ${ROOT_SIZE} MB)? " > + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then > + ROOT_SIZE=$REPLY > + else > + printf "Install size is invalid: retaining ${ROOT_SIZE} MB.\n" > + fi > + > + read -p "Logging partition size (Current ${LOGGING_SIZE} MB)? " > + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then > + LOGGING_SIZE=$REPLY > + else > + printf "Install size is invalid: retaining ${LOGGING_SIZE} MB.\n" > + fi > + > + do_resolve_sizes > +} Please replace the above function with the following equivalent one: (except that it doesn't say "Install size" for invalid _Logging_ size) function do_configure { for i in swap boot root logging; do uc=$(echo $i|tr '[[:lower:]]' '[[:upper:]]') var=${uc}_SIZE eval "size=\$$var" read -p "$i partition size (Currently $size MB)? " if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then eval "$var=$REPLY" else printf "invalid value: '$i'. retaining $size MB.\n" fi done do_resolve_sizes } > +function do_review > +{ > + printf "\n" > + printf "The local disk will be repartitioned as follows:\n" > + printf "================================================\n" > + printf " Physical Hard Disk: ${DRIVE}\n" > + printf " Total storage available: ${SPACE} MB\n" > + printf " Swap partition size: ${SWAP_SIZE} MB\n" > + printf " Boot partition size: ${BOOT_SIZE} MB\n" > + printf " Installation partition size: ${ROOT_SIZE} MB\n" > + printf " Configuration partition size: ${CONFIG_SIZE} MB\n" > + printf " Logging partition size: ${LOGGING_SIZE} MB\n" > + printf " Data partition size: ${DATA_SIZE} MB\n" > + printf "\n" > +} You can get away with a lot less "syntax" (ease readability/maint) like this: function do_review { cat < + > +function perform_partitioning > +{ > + printf "Preparing local storage. Please wait..." > + > + { How about putting "set -e" here. Then if there's any failure, the whole script fails. > + vgroups=$(vgdisplay -C | awk '{ print $1" "; }') > + vgremove -f $vgroups > + > + dd if=/dev/zero of=$DRIVE bs=1K count=1 > + blockdev --rereadpt $DRIVE > + partprobe -s $DRIVE > + > + parted $DRIVE -s "mklabel gpt" > + parted $DRIVE -s "mkpart primary ext2 0M ${BOOT_SIZE}M" > + parted $DRIVE -s "mkpart primary ext2 ${BOOT_SIZE}M ${SPACE}M" > + parted $DRIVE -s "set 2 lvm on" > + > + pvcreate "${DRIVE}2" > + pvck > + vgcreate /dev/HostVG "${DRIVE}2" > + > + lvcreate --name Swap --size ${SWAP_SIZE}M /dev/HostVG > + lvcreate --name Root --size ${ROOT_SIZE}M /dev/HostVG > + lvcreate --name Config --size ${CONFIG_SIZE}M /dev/HostVG > + lvcreate --name Logging --size ${LOGGING_SIZE}M /dev/HostVG > + lvcreate --name Data -l 100%FREE /dev/HostVG > + > + mke2fs -j -T ext2 "${DRIVE}1" -L "BOOT" > + tune2fs -c 0 -i 0 "${DRIVE}1" > + mkswap /dev/HostVG/Swap > + mke2fs -j -T ext2 /dev/HostVG/Root -L "ROOT" Per discussion with Alan Pevec on IRC, it looks like those two above should both be "-T ext3" rather than "-j T ext2". Slightly clearer. And the following don't need -j. You get the journal with "ext3" by default. > + tune2fs -c 0 -i 0 /dev/HostVG/Root > + mke2fs -j -T ext3 /dev/HostVG/Config -L "CONFIG" > + tune2fs -c 0 -i 0 /dev/HostVG/Config > + mke2fs -j -T ext3 /dev/HostVG/Logging -L "LOGGING" > + tune2fs -c 0 -i 0 /dev/HostVG/Logging > + mke2fs -j -T ext3 /dev/HostVG/Data -L "DATA" > + tune2fs -c 0 -i 0 /dev/HostVG/Data > + } > /var/log/ovirt-partition.log 2>&1 > + > + printf "Completed!\n\n" > +} > + > +function do_confirm > +{ > + while true; do > + printf "\n" > + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" > + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" > + printf "!!WARNING!! !!WARNING!!\n" > + printf "!!WARNING!! !!WARNING!!\n" > + printf "!!WARNING!! If you proceed this will destroy all data on your local system, and !!WARNING!!\n" > + printf "!!WARNING!! your hard disk will be irreversably reconfiguration. !!WARNING!!\n" > + printf "!!WARNING!! !!WARNING!!\n" > + printf "!!WARNING!! !!WARNING!!\n" > + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" > + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" > + printf "\n" > + printf "\tContinue? (Y/n) " > + read > + case $REPLY in > + Y|y) > + perform_partitioning; break ;; > + N|n) return ;; > + esac > + done > +} How about this replacement I proposed a few days ago? All the warning code below is hard to read in source form, and the output wraps on my 80-column console, so how about something like this instead? sp=' ' w='!!WARNING' wb="$w"'!!' w8="$w$w$w$w$w$w$w$w" printf '%s!!\n' \ "$w8" \ "$w8" \ "$wb$sp$w" \ "$wb$sp$w" \ "$wb If you proceed, this will destroy all data on your local" \ "$wb system, and your hard disk will be irreversably reconfigured" \ "$wb$sp$w" \ "$wb$sp$w" \ "$w8" \ "$w8" > +DRIVE=$(for drive in `hal-find-by-capability --capability storage`; do > + info=$(lshal -u $drive -s) > + if [[ $info =~ "storage.drive_type = 'disk'" ]]; then > + lshal -u $drive -s | awk ' /block.device/ { > + match($0, "block.device = *'"'"'(.*)'"'"'", device) > + printf "%s", device[1] > + }' > + fi > +done) > + > +SPACE=$(for drive in `hal-find-by-capability --capability storage`; do > + info=$(lshal -u $drive -s) > + if [[ $info =~ "storage.drive_type = 'disk'" ]]; then > + lshal -u $drive -s | awk ' /storage.size/ { > + match($0, "storage.size *= *([0-9]+)", device) > + printf "%s", device[1] > + }' > + fi > +done) > + > +SPACE=$(echo "scale=0; $SPACE / (1024 * 1024)" | bc -l) > +BOOT_SIZE="256" > +ROOT_SIZE="256" > +CONFIG_SIZE="5" > +LOGGING_SIZE="256" > + > +MEM_SIZE=$(virsh -c qemu:///system nodeinfo | awk '/Memory size/ { print $3 }') > +MEM_SIZE=$(echo "scale=0; $MEM_SIZE / 1024" | bc -l) > +SWAP_SIZE=$MEM_SIZE It's probably worthwhile to sanity-check this: case $MEM_SIZE in ''|*[^0-9]*) die failed to get system memory size;; esac And while testing the above, I noticed that you must be root, which this script is, of course. But there's no need for auth in this case, so might as well use --readonly: MEM_SIZE=$(virsh --readonly -c qemu:///system nodeinfo \ | awk '/Memory size/ { print $3 }') > +# If the any partition size was provided as a kernel argument, > +# then set the values and run without prompting > + > +counter=0 > +while [ "$1" != "" ]; do > + AUTO="Y" > + case $counter in > + 0) SWAP_SIZE=$1; break ;; > + 1) BOOT_SIZE=$1; break ;; > + 2) ROOT_SIZE=$1; break ;; > + 3) LOGGING_SIZE=$1; break ;; > + esac > + counter=`expr $counter + 1 ` stray space. > + shift > +done > + > +if [ "$AUTO" == "Y" ]; then > + printf "Partitioning hard disk..." > + perform_partitioning > + printf "[DONE]\n" > + exit 0 > +else > + while true; do > + do_resolve_sizes > + > + OPTIONS="Configure Review Partition Quit" > + PS3="Choose an option: " > + > + printf "\n" > + > + select OPTION in $OPTIONS > + do > + case "$OPTION" in > + "Configure") do_configure ; break ;; > + "Review") do_review ; break ;; > + "Partition") do_confirm ; break ;; > + "Quit") exit ;; > + esac > + done > + done > +fi I've added this function, current not used anywhere: check_partition_sizes() { # FIXME: use this function before performing any partitioning, auto or not : # Perform some sanity checks. E.g., # What if DATA_SIZE ends up zero or negative? # What if any of those partition sizes is smaller than # the minimum size for an ext3 partition? Diagnose it here # or just let the mke2fs failure suffice. } Also, I switched the function-definition syntax, "function NAME { ... }" to the POSIX syntax: "NAME() { ... }". Using "function" as a keyword is a bashism. Also, I moved the "do_resolve_sizes" call out of the while loop, to be called once just before it, instead. It's not needed in the loop, since the only thing that changes its inputs in the loop (do_configure) also calls do_resolve_sizes. In testing this simply by running the script as non-root on my desktop, I get a mess, due to the fact that there is more than one matching "storage" device: $ /t/ovirt-config-storage 1) Configure 2) Review 3) Partition 4) Quit Choose an option: 2 The local disk will be repartitioned as follows: ================================================ Physical Hard Disk: /dev/dm-1/dev/dm-0/dev/ram9/dev/ram8/dev/ram7/dev/ram6/dev/ram5/dev/ram4/dev/ram3/dev/ram2/dev/ram15/dev/ram14/dev/ram13/dev/ram12/dev/ram11/dev/ram10/dev/ram1/dev/ram0/dev/loop7/dev/loop6/dev/loop5/dev/loop4/dev/loop3/dev/loop2/dev/loop1/dev/loop0/dev/sdb/dev/sda Total storage available: 81920000009523200000016000000160000001600000016000000160000001600000\ 01600000016000000160000001600000016000000160000001600000016000000160\ 000001600000000000000476940023437976940 MB Swap partition size: 8005 MB Boot partition size: 256 MB Installation partition size: 256 MB Configuration partition size: 5 MB Logging partition size: 256 MB Data partition size: 81920000009523200000016000000160000001600000016000000160000001600000\ 01600000016000000160000001600000016000000160000001600000016000000160\ 000001600000000000000476940023437968679 -517 MB 1) Configure 2) Review 3) Partition 4) Quit Choose an option: This just shows that the node is assumed to have only one disk device. Do we _need_ to account for any other scenario? For now I'm not even trying to deal with alternatives. ------------------ Here's an amended patch with all of the above changes: >From 6ceaf55b8cd9a719340d83c8fb87d2f1c98c4743 Mon Sep 17 00:00:00 2001 From: Darryl L. Pierce Date: Thu, 13 Nov 2008 17:05:28 -0500 Subject: [PATCH node] Added support for local storage configuration. This patch wipes out the entire disk on the node and replaces it with a set of partitions. The partitions are a raw partition to hold the bootable kernel, and the rest of the disk is taken up as an physical volume. On the physical volume is created the following logical volumes: * SWAP - swap partition * ROOT - to host the node image * CONFIG - to hold node configuration data * LOGGING - to hold local logs * DATA - to hold VM images Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-storage | 213 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 213 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index c856ef1..797aee4 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -1,2 +1,215 @@ #!/bin/bash # +# To automate the partitioning, pass in the specific fields in this order +# ovirt-config-storage [swap size] [boot size] [root size] [logging size] +# +# All sizes are in megabytes +# + +ME=$(basename "$0") +warn() { printf '%s: %s\n' "$ME" "$*" >&2; } +die() { warn "$*"; exit 1; } + +do_resolve_sizes() +{ + DATA_SIZE=$(printf '%s\n' 'scale=0' \ + "$SPACE - $BOOT_SIZE - $SWAP_SIZE + - $ROOT_SIZE - $CONFIG_SIZE - $LOGGING_SIZE" | bc -l) +} + +check_partition_sizes() +{ + # FIXME: use this function before performing any partitioning, auto or not + : + # Perform some sanity checks. E.g., + # What if DATA_SIZE ends up zero or negative? + # What if any of those partition sizes is smaller than + # the minimum size for an ext3 partition? Diagnose it here + # or just let the mke2fs failure suffice. +} + +do_configure() +{ + for i in swap boot root logging; do + uc=$(echo $i|tr '[[:lower:]]' '[[:upper:]]') + var=${uc}_SIZE + eval "size=\$$var" + read -p "$i partition size (Currently $size MB)? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + eval "$var=$REPLY" + else + printf "invalid value: '$i'. retaining $size MB.\n" + fi + done + + do_resolve_sizes +} + +do_review() +{ + cat < /var/log/ovirt-partition.log 2>&1 + + printf "Completed!\n\n" +} + +do_confirm() +{ + while true; do + sp=' ' + w='!!WARNING' + wb="$w"'!!' + w8="$w$w$w$w$w$w$w$w" + printf '%s!!\n' \ + "$w8" \ + "$w8" \ + "$wb$sp$w" \ + "$wb$sp$w" \ + "$wb If you proceed, this will destroy all data on your local" \ + "$wb system, and your hard disk will be irreversably reconfigured" \ + "$wb$sp$w" \ + "$wb$sp$w" \ + "$w8" \ + "$w8" + printf "\n\tContinue? (Y/n) " + read + case $REPLY in + Y|y) + perform_partitioning; break ;; + N|n) return ;; + esac + done +} + +DRIVE=$(for drive in `hal-find-by-capability --capability storage`; do + info=$(lshal -u $drive -s) + if [[ $info =~ "storage.drive_type = 'disk'" ]]; then + lshal -u $drive -s | awk ' /block.device/ { + match($0, "block.device = *'"'"'(.*)'"'"'", device) + printf "%s", device[1] + }' + fi +done) + +SPACE=$(for drive in `hal-find-by-capability --capability storage`; do + info=$(lshal -u $drive -s) + if [[ $info =~ "storage.drive_type = 'disk'" ]]; then + lshal -u $drive -s | awk ' /storage.size/ { + match($0, "storage.size *= *([0-9]+)", device) + printf "%s", device[1] + }' + fi +done) + +SPACE=$(echo "scale=0; $SPACE / (1024 * 1024)" | bc -l) +BOOT_SIZE="256" +ROOT_SIZE="256" +CONFIG_SIZE="5" +LOGGING_SIZE="256" + +MEM_SIZE=$(virsh --readonly -c qemu:///system nodeinfo \ + | awk '/Memory size/ { print $3 }') +case $MEM_SIZE in + ''|*[^0-9]*) die failed to get system memory size;; +esac + +MEM_SIZE=$(echo "scale=0; $MEM_SIZE / 1024" | bc -l) +SWAP_SIZE=$MEM_SIZE + +# If the any partition size was provided as a kernel argument, +# then set the values and run without prompting + +counter=0 +while [ "$1" != "" ]; do + AUTO="Y" + case $counter in + 0) SWAP_SIZE=$1; break ;; + 1) BOOT_SIZE=$1; break ;; + 2) ROOT_SIZE=$1; break ;; + 3) LOGGING_SIZE=$1; break ;; + esac + counter=`expr $counter + 1` + shift +done + +if [ "$AUTO" == "Y" ]; then + printf "Partitioning hard disk..." + perform_partitioning + printf "[DONE]\n" + exit 0 +else + do_resolve_sizes + while true; do + + OPTIONS="Configure Review Partition Quit" + PS3="Choose an option: " + + printf "\n" + + select OPTION in $OPTIONS + do + case "$OPTION" in + "Configure") do_configure ; break ;; + "Review") do_review ; break ;; + "Partition") do_confirm ; break ;; + "Quit") exit ;; + esac + done + done +fi -- 1.6.0.4.911.gc990 From dpierce at redhat.com Fri Nov 14 13:59:50 2008 From: dpierce at redhat.com (Darryl Pierce) Date: Fri, 14 Nov 2008 08:59:50 -0500 Subject: [Ovirt-devel] [PATCH node] Networking configuration support. In-Reply-To: <87tzab70ce.fsf@rho.meyering.net> References: <1226585556-5646-1-git-send-email-dpierce@redhat.com> <87tzab70ce.fsf@rho.meyering.net> Message-ID: <200811140859.53924.dpierce@redhat.com> On Thursday 13 November 2008 05:00:33 pm Jim Meyering wrote: > "Darryl L. Pierce" wrote: > > This script allows the user to iterate through and edit the > > network interfaces on the node. > > ... > > > +# clean up any left over configurations > > +rm -f /var/tmp/config-augtool > > +rm -f /var/tmp/augtool-* > > This surprised me. A script like this > should delete only whatever files it creates. > > ... > > > +# Merge together all generated files and run augtool > > + > > +cat /var/tmp/augtool-* > /var/tmp/config-augtool > > Oops. > A malicious user can create arbitrary /var/tmp/augtool-nasty-* > files, and this script will use them. > > Safer would be to use a directory created by mktemp -d, > and put all files in there. > > > +printf "save\n" >> /var/tmp/config-augtool > > +{ > > +augtool < /var/tmp/config-augtool > > +service network restart > > +} > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE > > \ No newline at end of file Good suggestion. Since this is already pushed, I'll patch it and submit for review. -- Darryl L. Pierce, Sr. Software Engineer Red Hat, Inc. - http://www.redhat.com/ oVirt - Virtual Machine Management - http://www.ovirt.org/ "What do you care what other people think, Mr. Feynman?" -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part. URL: From dpierce at redhat.com Fri Nov 14 14:02:20 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 14 Nov 2008 09:02:20 -0500 Subject: [Ovirt-devel] [PATCH node] Moved network configuration work files to a temporary directory. Message-ID: <1226671340-5376-1-git-send-email-dpierce@redhat.com> Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 18 ++++++++---------- 1 files changed, 8 insertions(+), 10 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 2f8363c..5c8cfa9 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -3,15 +3,18 @@ # Iterates over the list of network devices on the node and prompts the user # to configure each. +WORKDIR=$(mktemp -d) + CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" -CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" +#CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" +CONFIG_LOG_FILE="ovirt-network-setup.log" function configure_interface { NIC=$1 BRIDGE=ovirtbr`echo $NIC | cut -b4-` - IF_FILENAME="/var/tmp/augtool-$NIC" - BR_FILENAME="/var/tmp/augtool-$BRIDGE" + IF_FILENAME="${WORKDIR}/augtool-$NIC" + BR_FILENAME="${WORKDIR}/augtool-$BRIDGE" printf "\nConfigure $BRIDGE for use by $NIC..\n\n" @@ -70,10 +73,6 @@ function setup_menu PS3="Please select a network interface to configure:" } -# clean up any left over configurations -rm -f /var/tmp/config-augtool -rm -f /var/tmp/augtool-* - setup_menu select NIC in $NICS @@ -88,10 +87,9 @@ done # Merge together all generated files and run augtool -cat /var/tmp/augtool-* > /var/tmp/config-augtool -printf "save\n" >> /var/tmp/config-augtool { +cat ${WORKDIR}/augtool-* > ${WORKDIR}/config-augtool +printf "save\n" >> /var/tmp/config-augtool augtool < /var/tmp/config-augtool service network restart } > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE - -- 1.5.6.5 From dpierce at redhat.com Fri Nov 14 14:22:54 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 14 Nov 2008 09:22:54 -0500 Subject: [Ovirt-devel] [PATCH node] Added support for local storage configuration. Message-ID: <1226672574-6706-1-git-send-email-dpierce@redhat.com> This patch wipes out the entire disk on the node and replaces it with a set of partitions. The partitions are a raw partition to hold the bootable kernel, and the rest of the disk is taken up as an physical volume. On the physical volume is created the following logical volumes: * SWAP - swap partition * ROOT - to host the node image * CONFIG - to hold node configuration data * LOGGING - to hold local logs * DATA - to hold VM images Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-storage | 183 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 183 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index c856ef1..eaaf220 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -1,2 +1,185 @@ #!/bin/bash # +# To automate the partitioning, pass in the specific fields in this order +# ovirt-config-storage [swap size] [boot size] [root size] [logging size] +# +# All sizes are in megabytes +# + +function do_resolve_sizes +{ + DATA_SIZE=$(echo "scale=0; ($SPACE - $BOOT_SIZE - $SWAP_SIZE - $ROOT_SIZE - $CONFIG_SIZE - $LOGGING_SIZE)" | bc -l) +} + +function do_configure +{ + for i in swap boot root logging; do + uc=$(echo $i|tr '[[:lower:]]' '[[:upper:]]') + var=${uc}_SIZE + eval "size=\$$var" + read -p "$i partition size (Currently $size MB)? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + eval "$var=$REPLY" + else + printf "Invalid value for $i. Retaining $size MB.\n" + fi + done + + do_resolve_sizes +} + +function do_review +{ + printf "\n" + printf "The local disk will be repartitioned as follows:\n" + printf "================================================\n" + printf " Physical Hard Disk: ${DRIVE}\n" + printf " Total storage available: ${SPACE} MB\n" + printf " Swap partition size: ${SWAP_SIZE} MB\n" + printf " Boot partition size: ${BOOT_SIZE} MB\n" + printf " Installation partition size: ${ROOT_SIZE} MB\n" + printf " Configuration partition size: ${CONFIG_SIZE} MB\n" + printf " Logging partition size: ${LOGGING_SIZE} MB\n" + printf " Data partition size: ${DATA_SIZE} MB\n" + printf "\n" +} + +function perform_partitioning +{ + printf "Preparing local storage. Please wait..." + + { + vgroups=$(vgdisplay -C | awk '{ print $1" "; }') + vgremove -f $vgroups + + dd if=/dev/zero of=$DRIVE bs=1K count=1 + blockdev --rereadpt $DRIVE + partprobe -s $DRIVE + + parted $DRIVE -s "mklabel gpt" + parted $DRIVE -s "mkpart primary ext2 0M ${BOOT_SIZE}M" + parted $DRIVE -s "mkpart primary ext2 ${BOOT_SIZE}M ${SPACE}M" + parted $DRIVE -s "set 2 lvm on" + + pvcreate "${DRIVE}2" + pvck + vgcreate /dev/HostVG "${DRIVE}2" + + lvcreate --name Swap --size ${SWAP_SIZE}M /dev/HostVG + lvcreate --name Root --size ${ROOT_SIZE}M /dev/HostVG + lvcreate --name Config --size ${CONFIG_SIZE}M /dev/HostVG + lvcreate --name Logging --size ${LOGGING_SIZE}M /dev/HostVG + lvcreate --name Data -l 100%FREE /dev/HostVG + + mke2fs -j -T ext2 "${DRIVE}1" -L "BOOT" + tune2fs -c 0 -i 0 "${DRIVE}1" + mkswap /dev/HostVG/Swap + mke2fs -j -T ext2 /dev/HostVG/Root -L "ROOT" + tune2fs -c 0 -i 0 /dev/HostVG/Root + mke2fs -j -T ext3 /dev/HostVG/Config -L "CONFIG" + tune2fs -c 0 -i 0 /dev/HostVG/Config + mke2fs -j -T ext3 /dev/HostVG/Logging -L "LOGGING" + tune2fs -c 0 -i 0 /dev/HostVG/Logging + mke2fs -j -T ext3 /dev/HostVG/Data -L "DATA" + tune2fs -c 0 -i 0 /dev/HostVG/Data + } > /var/log/ovirt-partition.log 2>&1 + + printf "Completed!\n\n" +} + +function do_confirm +{ + while true; do + printf "\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! If you proceed this will destroy all data on your local system, and !!WARNING!!\n" + printf "!!WARNING!! your hard disk will be irreversably reconfiguration. !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "\n" + printf "\tContinue? (Y/n) " + read + case $REPLY in + Y|y) + perform_partitioning; break ;; + N|n) return ;; + esac + done +} + +DRIVE=$(for drive in `hal-find-by-capability --capability storage`; do + info=$(lshal -u $drive -s) + if [[ $info =~ "storage.drive_type = 'disk'" ]]; then + lshal -u $drive -s | awk ' /block.device/ { + match($0, "block.device = *'"'"'(.*)'"'"'", device) + printf "%s", device[1] + }' + fi +done) + +SPACE=$(for drive in `hal-find-by-capability --capability storage`; do + info=$(lshal -u $drive -s) + if [[ $info =~ "storage.drive_type = 'disk'" ]]; then + lshal -u $drive -s | awk ' /storage.size/ { + match($0, "storage.size *= *([0-9]+)", device) + printf "%s", device[1] + }' + fi +done) + +SPACE=$(echo "scale=0; $SPACE / (1024 * 1024)" | bc -l) +BOOT_SIZE="256" +ROOT_SIZE="256" +CONFIG_SIZE="5" +LOGGING_SIZE="256" + +MEM_SIZE=$(virsh -c qemu:///system nodeinfo | awk '/Memory size/ { print $3 }') +MEM_SIZE=$(echo "scale=0; $MEM_SIZE / 1024" | bc -l) +SWAP_SIZE=$MEM_SIZE + +# If the any partition size was provided as a kernel argument, +# then set the values and run without prompting + +counter=0 +while [ "$1" != "" ]; do + AUTO="Y" + case $counter in + 0) SWAP_SIZE=$1; break ;; + 1) BOOT_SIZE=$1; break ;; + 2) ROOT_SIZE=$1; break ;; + 3) LOGGING_SIZE=$1; break ;; + esac + counter=`expr $counter + 1 ` + shift +done + +if [ "$AUTO" == "Y" ]; then + printf "Partitioning hard disk..." + perform_partitioning + printf "[DONE]\n" + exit 0 +else + while true; do + do_resolve_sizes + + OPTIONS="Configure Review Partition Quit" + PS3="Choose an option: " + + printf "\n" + + select OPTION in $OPTIONS + do + case "$OPTION" in + "Configure") do_configure ; break ;; + "Review") do_review ; break ;; + "Partition") do_confirm ; break ;; + "Quit") exit ;; + esac + done + done +fi -- 1.5.6.5 From bkearney at redhat.com Fri Nov 14 14:18:38 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Fri, 14 Nov 2008 09:18:38 -0500 Subject: [Ovirt-devel] Testing the standalone stuff Message-ID: <491D88BE.7090409@redhat.com> I went through the currently checked in standalone code. Couple of comments below. I wanted to test the passthrough of the data. I see it getting written to the /etc/sysconfig/ovirt location. Who is supposed to access that? Is each ovirt-config-* supposed to have a "default" which is called by the main script? - The code lookging for _ovirt._tcp DNS SRV does not default it to standalone. Either Need to fix ovirt-early or change the docs at http://www.ovirt.org/page/Node_Standalone_Operation - First menu has Starting ovirt-post... on the same line as 1) Networking. Can this be put onto two lines. - Networking -- After configuing one, I am given "Please select a network interface to configre" with no options. -- Networking "Quit" seems to be "quit and save" Make this clear, and give a "Quit not save" feature - Main Menu "quit" perhaps should be continue? -- bk From hbrock at redhat.com Fri Nov 14 14:30:32 2008 From: hbrock at redhat.com (Hugh O. Brock) Date: Fri, 14 Nov 2008 09:30:32 -0500 Subject: [Ovirt-devel] [PATCH recipe] Split ovirt-appliance init script into storage and dnsmasq In-Reply-To: <1226653647-19080-1-git-send-email-pmyers@redhat.com> References: <1226653647-19080-1-git-send-email-pmyers@redhat.com> Message-ID: <20081114143032.GS22797@redhat.com> On Fri, Nov 14, 2008 at 04:07:27AM -0500, Perry Myers wrote: > This makes the appliance a little more deterministic in setup. > DNS services must be working correctly prior to calling the > ovirt-server-appliance-setup script, but storage can't be activated > until after. Splitting up these two services allows us to set up > the dependencies properly in the puppet file. > > This fixes a transient bug where the appliance would start but > the services would fail to configure properly. I was seeing > this around 25% of the time with appliance firstboot. > > Signed-off-by: Perry Myers Ahhhh is this why people's appliances were randomly failing to set up? --Hugh From pmyers at redhat.com Fri Nov 14 14:40:05 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 09:40:05 -0500 Subject: [Ovirt-devel] [PATCH recipe] Split ovirt-appliance init script into storage and dnsmasq In-Reply-To: <20081114143032.GS22797@redhat.com> References: <1226653647-19080-1-git-send-email-pmyers@redhat.com> <20081114143032.GS22797@redhat.com> Message-ID: <491D8DC5.9090302@redhat.com> Hugh O. Brock wrote: > On Fri, Nov 14, 2008 at 04:07:27AM -0500, Perry Myers wrote: >> This makes the appliance a little more deterministic in setup. >> DNS services must be working correctly prior to calling the >> ovirt-server-appliance-setup script, but storage can't be activated >> until after. Splitting up these two services allows us to set up >> the dependencies properly in the puppet file. >> >> This fixes a transient bug where the appliance would start but >> the services would fail to configure properly. I was seeing >> this around 25% of the time with appliance firstboot. >> >> Signed-off-by: Perry Myers > > Ahhhh is this why people's appliances were randomly failing to set up? Most likely, yes. If I can get someone to review and ack this patch I'd be happy to push it to the repo :) Perry -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=| From dpierce at redhat.com Fri Nov 14 16:20:19 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 14 Nov 2008 11:20:19 -0500 Subject: [Ovirt-devel] [PATCH node] Adds automatic non-interactive configuration for the standalone node. Message-ID: <1226679619-18655-1-git-send-email-dpierce@redhat.com> If ovirt-config-network is called as follows: ovirt-config-network AUTO [NIC] [IP NETMASK GATEWAY BROADCAST] where NIC is the management interface to be configured. If the IP details are provided then they are used to configure the device. Otherwise DHCP will be used. Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 82 +++++++++++++++++++++++++++------------ scripts/ovirt-firstboot | 6 ++- 2 files changed, 62 insertions(+), 26 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 2f8363c..583ee5e 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -4,11 +4,17 @@ # to configure each. CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" -CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" +# CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" +CONFIG_LOG_FILE="ovirt-network-setup.log" function configure_interface { NIC=$1 + AUTO=$2 + IPADDR=$3 + NETMASK=$4 + GATEWAY=$5 + BROADCAST=$6 BRIDGE=ovirtbr`echo $NIC | cut -b4-` IF_FILENAME="/var/tmp/augtool-$NIC" BR_FILENAME="/var/tmp/augtool-$BRIDGE" @@ -27,21 +33,33 @@ function configure_interface # how do you want to configure this device? (dhcp, static IP) while true; do - printf "Will $BRIDGE use dynamic addressing? (Y/N) " - read + if [ -z "$AUTO" ]; then + read -p "Will $BRIDGE use dynamic addressing? (Y/N) " + else + if [ -z "$IPADDR" ]; then + REPLY="Y" + else + REPLY="N" + fi + fi + case $REPLY in Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp"; break ;; N|n) - printf "\nPlease enter the network details for $BRIDGE:\n" - printf "\tIP Address: "; read; IPADDR=$REPLY - printf "\t Netmask: "; read; NETMASK=$REPLY - printf "\t Broadcast: "; read; BROADCAST=$REPLY - printf "\t Gateway: "; read; GATEWAY=$REPLY - - printf "\nPlease review the details for $BRIDGE:\n" - printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Broadcast: $BROADCAST\n\t Gateway: $GATEWAY\n" - printf "Is this correct? (Y/N) " - read + if [ -z "$IPADDR" ]; then + printf "\nPlease enter the network details for $BRIDGE:\n" + printf "\tIP Address: "; read; IPADDR=$REPLY + printf "\t Netmask: "; read; NETMASK=$REPLY + printf "\t Broadcast: "; read; BROADCAST=$REPLY + printf "\t Gateway: "; read; GATEWAY=$REPLY + + printf "\nPlease review the details for $BRIDGE:\n" + printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Broadcast: $BROADCAST\n\t Gateway: $GATEWAY\n" + read -p "Is this correct? (Y/N) " + else + REPLY="Y" + fi + case $REPLY in Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPADDR $IPADDR" @@ -70,21 +88,35 @@ function setup_menu PS3="Please select a network interface to configure:" } -# clean up any left over configurations -rm -f /var/tmp/config-augtool -rm -f /var/tmp/augtool-* +# if we're in autoconfig mode, then iterate over all network interfaces and +# set them use DHCP -setup_menu +if [ "$1" == "AUTO" ]; then + if [ -n "$2" ]; then + configure_interface $2 AUTO $3 $4 $5 $6 + else + printf "No network interface specified to auto-configure. Exiting...\n" + exit 1 + fi +else + + # clean up any left over configurations + rm -f /var/tmp/config-augtool + rm -f /var/tmp/augtool-* -select NIC in $NICS -do - printf "\n" - case "$NIC" in - "Quit") break ;; - *) configure_interface $NIC $IFACE_NUMBER ;; - esac setup_menu -done + + select NIC in $NICS + do + printf "\n" + case "$NIC" in + "Quit") break ;; + *) configure_interface $NIC $IFACE_NUMBER ;; + esac + setup_menu + done + +fi # Merge together all generated files and run augtool diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot index 82d9e48..f93ba1b 100755 --- a/scripts/ovirt-firstboot +++ b/scripts/ovirt-firstboot @@ -29,7 +29,11 @@ start () { - ovirt-config-setup + if is_interactive_firstboot; then + ovirt-config-setup + else + ovirt-config-network AUTO + fi } case "$1" in -- 1.5.6.5 From dpierce at redhat.com Fri Nov 14 16:22:15 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 14 Nov 2008 11:22:15 -0500 Subject: [Ovirt-devel] [PATCH node] Adds automatic non-interactive configuration for the standalone node. Message-ID: <1226679735-18869-1-git-send-email-dpierce@redhat.com> If ovirt-config-network is called as follows: ovirt-config-network AUTO [NIC] [IP NETMASK GATEWAY BROADCAST] where NIC is the management interface to be configured. If the IP details are provided then they are used to configure the device. Otherwise DHCP will be used. Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 79 +++++++++++++++++++++++++++------------ scripts/ovirt-firstboot | 6 ++- 2 files changed, 60 insertions(+), 25 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 2f8363c..5f4fc84 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -9,6 +9,11 @@ CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" function configure_interface { NIC=$1 + AUTO=$2 + IPADDR=$3 + NETMASK=$4 + GATEWAY=$5 + BROADCAST=$6 BRIDGE=ovirtbr`echo $NIC | cut -b4-` IF_FILENAME="/var/tmp/augtool-$NIC" BR_FILENAME="/var/tmp/augtool-$BRIDGE" @@ -27,21 +32,33 @@ function configure_interface # how do you want to configure this device? (dhcp, static IP) while true; do - printf "Will $BRIDGE use dynamic addressing? (Y/N) " - read + if [ -z "$AUTO" ]; then + read -p "Will $BRIDGE use dynamic addressing? (Y/N) " + else + if [ -z "$IPADDR" ]; then + REPLY="Y" + else + REPLY="N" + fi + fi + case $REPLY in Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp"; break ;; N|n) - printf "\nPlease enter the network details for $BRIDGE:\n" - printf "\tIP Address: "; read; IPADDR=$REPLY - printf "\t Netmask: "; read; NETMASK=$REPLY - printf "\t Broadcast: "; read; BROADCAST=$REPLY - printf "\t Gateway: "; read; GATEWAY=$REPLY - - printf "\nPlease review the details for $BRIDGE:\n" - printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Broadcast: $BROADCAST\n\t Gateway: $GATEWAY\n" - printf "Is this correct? (Y/N) " - read + if [ -z "$IPADDR" ]; then + printf "\nPlease enter the network details for $BRIDGE:\n" + printf "\tIP Address: "; read; IPADDR=$REPLY + printf "\t Netmask: "; read; NETMASK=$REPLY + printf "\t Broadcast: "; read; BROADCAST=$REPLY + printf "\t Gateway: "; read; GATEWAY=$REPLY + + printf "\nPlease review the details for $BRIDGE:\n" + printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Broadcast: $BROADCAST\n\t Gateway: $GATEWAY\n" + read -p "Is this correct? (Y/N) " + else + REPLY="Y" + fi + case $REPLY in Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPADDR $IPADDR" @@ -70,21 +87,35 @@ function setup_menu PS3="Please select a network interface to configure:" } -# clean up any left over configurations -rm -f /var/tmp/config-augtool -rm -f /var/tmp/augtool-* +# if we're in autoconfig mode, then iterate over all network interfaces and +# set them use DHCP -setup_menu +if [ "$1" == "AUTO" ]; then + if [ -n "$2" ]; then + configure_interface $2 AUTO $3 $4 $5 $6 + else + printf "No network interface specified to auto-configure. Exiting...\n" + exit 1 + fi +else + + # clean up any left over configurations + rm -f /var/tmp/config-augtool + rm -f /var/tmp/augtool-* -select NIC in $NICS -do - printf "\n" - case "$NIC" in - "Quit") break ;; - *) configure_interface $NIC $IFACE_NUMBER ;; - esac setup_menu -done + + select NIC in $NICS + do + printf "\n" + case "$NIC" in + "Quit") break ;; + *) configure_interface $NIC $IFACE_NUMBER ;; + esac + setup_menu + done + +fi # Merge together all generated files and run augtool diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot index 82d9e48..f93ba1b 100755 --- a/scripts/ovirt-firstboot +++ b/scripts/ovirt-firstboot @@ -29,7 +29,11 @@ start () { - ovirt-config-setup + if is_interactive_firstboot; then + ovirt-config-setup + else + ovirt-config-network AUTO + fi } case "$1" in -- 1.5.6.5 From dpierce at redhat.com Fri Nov 14 16:22:45 2008 From: dpierce at redhat.com (Darryl Pierce) Date: Fri, 14 Nov 2008 11:22:45 -0500 Subject: [Ovirt-devel] Re: [PATCH node] Adds automatic non-interactive configuration for the standalone node. In-Reply-To: <1226679619-18655-1-git-send-email-dpierce@redhat.com> References: <1226679619-18655-1-git-send-email-dpierce@redhat.com> Message-ID: <200811141122.45974.dpierce@redhat.com> On Friday 14 November 2008 11:20:19 am Darryl L. Pierce wrote: > If ovirt-config-network is called as follows: > > ovirt-config-network AUTO [NIC] [IP NETMASK GATEWAY BROADCAST] > > where NIC is the management interface to be configured. > > If the IP details are provided then they are used to configure the device. > Otherwise DHCP will be used. > > Signed-off-by: Darryl L. Pierce > --- > scripts/ovirt-config-networking | 82 > +++++++++++++++++++++++++++------------ scripts/ovirt-firstboot | > 6 ++- > 2 files changed, 62 insertions(+), 26 deletions(-) > > diff --git a/scripts/ovirt-config-networking > b/scripts/ovirt-config-networking index 2f8363c..583ee5e 100755 > --- a/scripts/ovirt-config-networking > +++ b/scripts/ovirt-config-networking > @@ -4,11 +4,17 @@ > # to configure each. > > CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" > -CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" > +# CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" > +CONFIG_LOG_FILE="ovirt-network-setup.log" Missed this when I sent this patch. A followup patch removes this debugging bit. -- Darryl L. Pierce, Sr. Software Engineer Red Hat, Inc. - http://www.redhat.com/ oVirt - Virtual Machine Management - http://www.ovirt.org/ "What do you care what other people think, Mr. Feynman?" -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part. URL: From sseago at redhat.com Fri Nov 14 17:03:39 2008 From: sseago at redhat.com (Scott Seago) Date: Fri, 14 Nov 2008 12:03:39 -0500 Subject: [Ovirt-devel] [PATCH recipe] Split ovirt-appliance init script into storage and dnsmasq In-Reply-To: <1226653647-19080-1-git-send-email-pmyers@redhat.com> References: <1226653647-19080-1-git-send-email-pmyers@redhat.com> Message-ID: <491DAF6B.4030403@redhat.com> Perry Myers wrote: > This makes the appliance a little more deterministic in setup. > DNS services must be working correctly prior to calling the > ovirt-server-appliance-setup script, but storage can't be activated > until after. Splitting up these two services allows us to set up > the dependencies properly in the puppet file. > > This fixes a transient bug where the appliance would start but > the services would fail to configure properly. I was seeing > this around 25% of the time with appliance firstboot. > > Signed-off-by: Perry Myers > --- > Makefile.am | 3 +- > appliances/ovirt/files/ovirt-dnsmasq.conf | 25 ++++++ > appliances/ovirt/files/ovirt-server-appliance | 87 -------------------- > appliances/ovirt/files/ovirt-storage | 72 ++++++++++++++++ > appliances/ovirt/ovirt.pp.in | 31 +++++-- > .../templates/ovirt-server-appliance-setup.erb | 16 ++++ > 6 files changed, 137 insertions(+), 97 deletions(-) > create mode 100644 appliances/ovirt/files/ovirt-dnsmasq.conf > delete mode 100644 appliances/ovirt/files/ovirt-server-appliance > create mode 100644 appliances/ovirt/files/ovirt-storage > > OK this works for me... Scott From apevec at redhat.com Fri Nov 14 17:47:09 2008 From: apevec at redhat.com (Alan Pevec) Date: Fri, 14 Nov 2008 18:47:09 +0100 Subject: [Ovirt-devel] Re: [PATCH recipe] Use ovirt-node-image RPM instead of ovirt-node-image-pxe since it has been removed In-Reply-To: <1226653836-19152-3-git-send-email-pmyers@redhat.com> References: <1226653836-19152-1-git-send-email-pmyers@redhat.com> <1226653836-19152-2-git-send-email-pmyers@redhat.com> <1226653836-19152-3-git-send-email-pmyers@redhat.com> Message-ID: <491DB99D.9000709@redhat.com> Perry Myers wrote: > +# Create PXE images from oVirt ISO > +tmp=$(mktemp -d) ... > cobbler distro add --name="oVirt-Node-$node_arch" --arch=$node_arch \ > - --initrd=/var/lib/tftpboot/initrd0.img --kernel=/var/lib/tftpboot/vmlinuz0 \ > + --initrd=$tmp/tftpboot/initrd0.img --kernel=$tmp/tftpboot/vmlinuz0 \ hm, I think cobbler sync will fail later when when tmpdir is gone... From jim at meyering.net Fri Nov 14 18:31:36 2008 From: jim at meyering.net (Jim Meyering) Date: Fri, 14 Nov 2008 19:31:36 +0100 Subject: [Ovirt-devel] [PATCH node] Moved network configuration work files to a temporary directory. In-Reply-To: <1226671340-5376-1-git-send-email-dpierce@redhat.com> (Darryl L. Pierce's message of "Fri, 14 Nov 2008 09:02:20 -0500") References: <1226671340-5376-1-git-send-email-dpierce@redhat.com> Message-ID: <87skpu40s7.fsf@rho.meyering.net> "Darryl L. Pierce" wrote: > Signed-off-by: Darryl L. Pierce > --- > scripts/ovirt-config-networking | 18 ++++++++---------- > 1 files changed, 8 insertions(+), 10 deletions(-) > > diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking > index 2f8363c..5c8cfa9 100755 > --- a/scripts/ovirt-config-networking > +++ b/scripts/ovirt-config-networking > @@ -3,15 +3,18 @@ > # Iterates over the list of network devices on the node and prompts the user > # to configure each. > > +WORKDIR=$(mktemp -d) How about this, so if mktemp fails, the script exits right away: WORKDIR=$(mktemp -d) || exit 1 > CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" > -CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" > +#CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" > +CONFIG_LOG_FILE="ovirt-network-setup.log" > > function configure_interface > { > NIC=$1 > BRIDGE=ovirtbr`echo $NIC | cut -b4-` > - IF_FILENAME="/var/tmp/augtool-$NIC" > - BR_FILENAME="/var/tmp/augtool-$BRIDGE" > + IF_FILENAME="${WORKDIR}/augtool-$NIC" > + BR_FILENAME="${WORKDIR}/augtool-$BRIDGE" No need for curly braces in general: IF_FILENAME="$WORKDIR/augtool-$NIC" BR_FILENAME="$WORKDIR/augtool-$BRIDGE" > printf "\nConfigure $BRIDGE for use by $NIC..\n\n" > > @@ -70,10 +73,6 @@ function setup_menu > PS3="Please select a network interface to configure:" > } > > -# clean up any left over configurations > -rm -f /var/tmp/config-augtool > -rm -f /var/tmp/augtool-* > - > setup_menu > > select NIC in $NICS > @@ -88,10 +87,9 @@ done > > # Merge together all generated files and run augtool > > -cat /var/tmp/augtool-* > /var/tmp/config-augtool > -printf "save\n" >> /var/tmp/config-augtool > { > +cat ${WORKDIR}/augtool-* > ${WORKDIR}/config-augtool > +printf "save\n" >> /var/tmp/config-augtool You can drop the curly braces here, too. Try not to use hard-coded names in /tmp or /var/tmp. Use a file in $WORKDIR instead. Otherwise, someone can pre-seed config-augtool with bad things, or create a symlink by that name to make you clobber whatever file they choose. > augtool < /var/tmp/config-augtool > service network restart > } > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE > - From dpierce at redhat.com Fri Nov 14 18:47:12 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 14 Nov 2008 13:47:12 -0500 Subject: [Ovirt-devel] [PATCH node] Adds automatic non-interactive configuration for the standalone node. Message-ID: <1226688432-26928-1-git-send-email-dpierce@redhat.com> If ovirt-config-network is called as follows: ovirt-config-network AUTO [NIC] [IP NETMASK GATEWAY BROADCAST] where NIC is the management interface to be configured. If the IP details are provided then they are used to configure the device. Otherwise DHCP will be used. The kernel arguments are: * OVIRT_MGMT_IFACE: the management network interface name * OVIRT_IP_ADDRESS: the IP address * OVIRT_IP_NETMASK: the netmask * OVIRT_IP_GATEWAY: the network gateway * OVIRT_IP_BROADCAST: the network broadcast address Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 91 +++++++++++++++++++++++++-------------- scripts/ovirt-firstboot | 12 +++++- 2 files changed, 69 insertions(+), 34 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 2f8363c..f8ff1a6 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -4,11 +4,17 @@ # to configure each. CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" -CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" +# CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" +CONFIG_LOG_FILE="ovirt-network-setup.log" function configure_interface { NIC=$1 + AUTO=$2 + IPADDR=$3 + NETMASK=$4 + GATEWAY=$5 + BROADCAST=$6 BRIDGE=ovirtbr`echo $NIC | cut -b4-` IF_FILENAME="/var/tmp/augtool-$NIC" BR_FILENAME="/var/tmp/augtool-$BRIDGE" @@ -27,21 +33,33 @@ function configure_interface # how do you want to configure this device? (dhcp, static IP) while true; do - printf "Will $BRIDGE use dynamic addressing? (Y/N) " - read + if [ -z "$AUTO" ]; then + read -p "Will $BRIDGE use dynamic addressing? (Y/N) " + else + if [ -z "$IPADDR" ]; then + REPLY="Y" + else + REPLY="N" + fi + fi + case $REPLY in Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp"; break ;; N|n) - printf "\nPlease enter the network details for $BRIDGE:\n" - printf "\tIP Address: "; read; IPADDR=$REPLY - printf "\t Netmask: "; read; NETMASK=$REPLY - printf "\t Broadcast: "; read; BROADCAST=$REPLY - printf "\t Gateway: "; read; GATEWAY=$REPLY - - printf "\nPlease review the details for $BRIDGE:\n" - printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Broadcast: $BROADCAST\n\t Gateway: $GATEWAY\n" - printf "Is this correct? (Y/N) " - read + if [ -z "$IPADDR" ]; then + printf "\nPlease enter the network details for $BRIDGE:\n" + printf "\tIP Address: "; read; IPADDR=$REPLY + printf "\t Netmask: "; read; NETMASK=$REPLY + printf "\t Broadcast: "; read; BROADCAST=$REPLY + printf "\t Gateway: "; read; GATEWAY=$REPLY + + printf "\nPlease review the details for $BRIDGE:\n" + printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Broadcast: $BROADCAST\n\t Gateway: $GATEWAY\n" + read -p "Is this correct? (Y/N) " + else + REPLY="Y" + fi + case $REPLY in Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPADDR $IPADDR" @@ -70,28 +88,35 @@ function setup_menu PS3="Please select a network interface to configure:" } -# clean up any left over configurations -rm -f /var/tmp/config-augtool -rm -f /var/tmp/augtool-* +if [ "$1" == "AUTO" ]; then + configure_interface $2 AUTO $3 $4 $5 $6 + RESTART="Y" +else -setup_menu + # clean up any left over configurations + rm -f /var/tmp/config-augtool + rm -f /var/tmp/augtool-* -select NIC in $NICS -do - printf "\n" - case "$NIC" in - "Quit") break ;; - *) configure_interface $NIC $IFACE_NUMBER ;; - esac setup_menu -done - -# Merge together all generated files and run augtool -cat /var/tmp/augtool-* > /var/tmp/config-augtool -printf "save\n" >> /var/tmp/config-augtool -{ -augtool < /var/tmp/config-augtool -service network restart -} > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE + select NIC in $NICS + do + printf "\n" + case "$NIC" in + "Quit") RESTART="Y"; break ;; + *) configure_interface $NIC $IFACE_NUMBER ;; + esac + setup_menu + done +fi + +if [ "$RESTART" == "Y" ]; then + # Merge together all generated files and run augtool + cat /var/tmp/augtool-* > /var/tmp/config-augtool + printf "save\n" >> /var/tmp/config-augtool + { + augtool < /var/tmp/config-augtool + service network restart + } > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE +fi diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot index 82d9e48..6eaf8b6 100755 --- a/scripts/ovirt-firstboot +++ b/scripts/ovirt-firstboot @@ -29,7 +29,17 @@ start () { - ovirt-config-setup + INTERACTIVE="Y" + + if [ -n "$OVIRT_MGMT_IFACE" ]; then + INTERACTIVE="N" + ./ovirt-config-networking AUTO $OVIRT_MGMT_IFACE\ + $OVIRT_IP_ADDRESS $OVIRT_IP_NETMASK $OVIRT_IP_GATEWAY $OVIRT_IP_BROADCAST + fi + + if [ "$INTERACTIVE" == "Y" ]; then + ovirt-config-setup + fi } case "$1" in -- 1.5.6.5 From dpierce at redhat.com Fri Nov 14 18:48:24 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 14 Nov 2008 13:48:24 -0500 Subject: [Ovirt-devel] [PATCH node] Adds automatic non-interactive configuration for the standalone node. Message-ID: <1226688504-27016-1-git-send-email-dpierce@redhat.com> NOTE: Sorry, again sent out a patch that had debugging code in it. :-/ If ovirt-config-network is called as follows: ovirt-config-network AUTO [NIC] [IP NETMASK GATEWAY BROADCAST] where NIC is the management interface to be configured. If the IP details are provided then they are used to configure the device. Otherwise DHCP will be used. The kernel arguments are: * OVIRT_MGMT_IFACE: the management network interface name * OVIRT_IP_ADDRESS: the IP address * OVIRT_IP_NETMASK: the netmask * OVIRT_IP_GATEWAY: the network gateway * OVIRT_IP_BROADCAST: the network broadcast address Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 88 +++++++++++++++++++++++++-------------- scripts/ovirt-firstboot | 12 +++++- 2 files changed, 67 insertions(+), 33 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 2f8363c..45d7cf8 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -9,6 +9,11 @@ CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" function configure_interface { NIC=$1 + AUTO=$2 + IPADDR=$3 + NETMASK=$4 + GATEWAY=$5 + BROADCAST=$6 BRIDGE=ovirtbr`echo $NIC | cut -b4-` IF_FILENAME="/var/tmp/augtool-$NIC" BR_FILENAME="/var/tmp/augtool-$BRIDGE" @@ -27,21 +32,33 @@ function configure_interface # how do you want to configure this device? (dhcp, static IP) while true; do - printf "Will $BRIDGE use dynamic addressing? (Y/N) " - read + if [ -z "$AUTO" ]; then + read -p "Will $BRIDGE use dynamic addressing? (Y/N) " + else + if [ -z "$IPADDR" ]; then + REPLY="Y" + else + REPLY="N" + fi + fi + case $REPLY in Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp"; break ;; N|n) - printf "\nPlease enter the network details for $BRIDGE:\n" - printf "\tIP Address: "; read; IPADDR=$REPLY - printf "\t Netmask: "; read; NETMASK=$REPLY - printf "\t Broadcast: "; read; BROADCAST=$REPLY - printf "\t Gateway: "; read; GATEWAY=$REPLY - - printf "\nPlease review the details for $BRIDGE:\n" - printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Broadcast: $BROADCAST\n\t Gateway: $GATEWAY\n" - printf "Is this correct? (Y/N) " - read + if [ -z "$IPADDR" ]; then + printf "\nPlease enter the network details for $BRIDGE:\n" + printf "\tIP Address: "; read; IPADDR=$REPLY + printf "\t Netmask: "; read; NETMASK=$REPLY + printf "\t Broadcast: "; read; BROADCAST=$REPLY + printf "\t Gateway: "; read; GATEWAY=$REPLY + + printf "\nPlease review the details for $BRIDGE:\n" + printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Broadcast: $BROADCAST\n\t Gateway: $GATEWAY\n" + read -p "Is this correct? (Y/N) " + else + REPLY="Y" + fi + case $REPLY in Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPADDR $IPADDR" @@ -70,28 +87,35 @@ function setup_menu PS3="Please select a network interface to configure:" } -# clean up any left over configurations -rm -f /var/tmp/config-augtool -rm -f /var/tmp/augtool-* +if [ "$1" == "AUTO" ]; then + configure_interface $2 AUTO $3 $4 $5 $6 + RESTART="Y" +else -setup_menu + # clean up any left over configurations + rm -f /var/tmp/config-augtool + rm -f /var/tmp/augtool-* -select NIC in $NICS -do - printf "\n" - case "$NIC" in - "Quit") break ;; - *) configure_interface $NIC $IFACE_NUMBER ;; - esac setup_menu -done - -# Merge together all generated files and run augtool -cat /var/tmp/augtool-* > /var/tmp/config-augtool -printf "save\n" >> /var/tmp/config-augtool -{ -augtool < /var/tmp/config-augtool -service network restart -} > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE + select NIC in $NICS + do + printf "\n" + case "$NIC" in + "Quit") RESTART="Y"; break ;; + *) configure_interface $NIC $IFACE_NUMBER ;; + esac + setup_menu + done +fi + +if [ "$RESTART" == "Y" ]; then + # Merge together all generated files and run augtool + cat /var/tmp/augtool-* > /var/tmp/config-augtool + printf "save\n" >> /var/tmp/config-augtool + { + augtool < /var/tmp/config-augtool + service network restart + } > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE +fi diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot index 82d9e48..6eaf8b6 100755 --- a/scripts/ovirt-firstboot +++ b/scripts/ovirt-firstboot @@ -29,7 +29,17 @@ start () { - ovirt-config-setup + INTERACTIVE="Y" + + if [ -n "$OVIRT_MGMT_IFACE" ]; then + INTERACTIVE="N" + ./ovirt-config-networking AUTO $OVIRT_MGMT_IFACE\ + $OVIRT_IP_ADDRESS $OVIRT_IP_NETMASK $OVIRT_IP_GATEWAY $OVIRT_IP_BROADCAST + fi + + if [ "$INTERACTIVE" == "Y" ]; then + ovirt-config-setup + fi } case "$1" in -- 1.5.6.5 From dpierce at redhat.com Fri Nov 14 18:52:06 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 14 Nov 2008 13:52:06 -0500 Subject: [Ovirt-devel] [PATCH node] Moved network configuration work files to a temporary directory. Message-ID: <1226688726-27233-1-git-send-email-dpierce@redhat.com> Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 22 ++++++++++------------ 1 files changed, 10 insertions(+), 12 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 2f8363c..592bef4 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -1,17 +1,20 @@ -#!/bin/bash +$#!/bin/bash # # Iterates over the list of network devices on the node and prompts the user # to configure each. +WORKDIR=$(mktemp -d) || exit 1 + CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" -CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" +#CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" +CONFIG_LOG_FILE="ovirt-network-setup.log" function configure_interface { NIC=$1 BRIDGE=ovirtbr`echo $NIC | cut -b4-` - IF_FILENAME="/var/tmp/augtool-$NIC" - BR_FILENAME="/var/tmp/augtool-$BRIDGE" + IF_FILENAME="$WORKDIR/augtool-$NIC" + BR_FILENAME="$WORKDIR/augtool-$BRIDGE" printf "\nConfigure $BRIDGE for use by $NIC..\n\n" @@ -70,10 +73,6 @@ function setup_menu PS3="Please select a network interface to configure:" } -# clean up any left over configurations -rm -f /var/tmp/config-augtool -rm -f /var/tmp/augtool-* - setup_menu select NIC in $NICS @@ -88,10 +87,9 @@ done # Merge together all generated files and run augtool -cat /var/tmp/augtool-* > /var/tmp/config-augtool -printf "save\n" >> /var/tmp/config-augtool { -augtool < /var/tmp/config-augtool +cat $WORKDIR/augtool-* > $WORKDIR/config-augtool +printf "save\n" >> /var/tmp/config-augtool +augtool < $WORKDIR/config-augtool service network restart } > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE - -- 1.5.6.5 From dpierce at redhat.com Fri Nov 14 18:52:27 2008 From: dpierce at redhat.com (Darryl Pierce) Date: Fri, 14 Nov 2008 13:52:27 -0500 Subject: [Ovirt-devel] [PATCH node] Moved network configuration work files to a temporary directory. In-Reply-To: <87skpu40s7.fsf@rho.meyering.net> References: <1226671340-5376-1-git-send-email-dpierce@redhat.com> <87skpu40s7.fsf@rho.meyering.net> Message-ID: <200811141352.30243.dpierce@redhat.com> On Friday 14 November 2008 01:31:36 pm Jim Meyering wrote: Applied each of your suggestions. New patch sent. -- Darryl L. Pierce, Sr. Software Engineer Red Hat, Inc. - http://www.redhat.com/ oVirt - Virtual Machine Management - http://www.ovirt.org/ "What do you care what other people think, Mr. Feynman?" -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part. URL: From pmyers at redhat.com Fri Nov 14 20:10:59 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 15:10:59 -0500 Subject: [Ovirt-devel] Re: [PATCH recipe] Use ovirt-node-image RPM instead of ovirt-node-image-pxe since it has been removed In-Reply-To: <491DB99D.9000709@redhat.com> References: <1226653836-19152-1-git-send-email-pmyers@redhat.com> <1226653836-19152-2-git-send-email-pmyers@redhat.com> <1226653836-19152-3-git-send-email-pmyers@redhat.com> <491DB99D.9000709@redhat.com> Message-ID: <491DDB53.9090503@redhat.com> Alan Pevec wrote: > Perry Myers wrote: >> +# Create PXE images from oVirt ISO >> +tmp=$(mktemp -d) > ... >> cobbler distro add --name="oVirt-Node-$node_arch" --arch=$node_arch \ >> - --initrd=/var/lib/tftpboot/initrd0.img >> --kernel=/var/lib/tftpboot/vmlinuz0 \ >> + --initrd=$tmp/tftpboot/initrd0.img --kernel=$tmp/tftpboot/vmlinuz0 \ > > hm, I think cobbler sync will fail later when when tmpdir is gone... > You are correct. Sucks that we have to keep these images around in two places: cobbler staging area and inside cobbler directories. But I'll change the patch to put these images somewhere else other than /tmp -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=| From jim at meyering.net Fri Nov 14 20:44:32 2008 From: jim at meyering.net (Jim Meyering) Date: Fri, 14 Nov 2008 21:44:32 +0100 Subject: [Ovirt-devel] [PATCH node] Moved network configuration work files to a temporary directory. In-Reply-To: <1226688726-27233-1-git-send-email-dpierce@redhat.com> (Darryl L. Pierce's message of "Fri, 14 Nov 2008 13:52:06 -0500") References: <1226688726-27233-1-git-send-email-dpierce@redhat.com> Message-ID: <8763mq3umn.fsf@rho.meyering.net> "Darryl L. Pierce" wrote: > Signed-off-by: Darryl L. Pierce > --- > scripts/ovirt-config-networking | 22 ++++++++++------------ > 1 files changed, 10 insertions(+), 12 deletions(-) > > diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking > index 2f8363c..592bef4 100755 > --- a/scripts/ovirt-config-networking > +++ b/scripts/ovirt-config-networking > @@ -1,17 +1,20 @@ > -#!/bin/bash > +$#!/bin/bash Hi Darryl, Typo? > # > # Iterates over the list of network devices on the node and prompts the user > # to configure each. > > +WORKDIR=$(mktemp -d) || exit 1 Nothing removes $WORKDIR. You could just remove it at the end. Doing it right isn't trivial, but once you've seen the idiom, it's easy to reuse (this is from coreutils/tests/test-lib.sh). Just insert this: # Remove $WORKDIR upon interrupt (and HUP, PIPE, TERM) and upon normal # termination, being careful not to change the exit status. trap '__st=$?; rm -rf "$WORKDIR"; exit $__st' 0 trap 'exit $?' 1 2 13 15 > CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" > -CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" > +#CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" > +CONFIG_LOG_FILE="ovirt-network-setup.log" > > function configure_interface > { > NIC=$1 > BRIDGE=ovirtbr`echo $NIC | cut -b4-` > - IF_FILENAME="/var/tmp/augtool-$NIC" > - BR_FILENAME="/var/tmp/augtool-$BRIDGE" > + IF_FILENAME="$WORKDIR/augtool-$NIC" > + BR_FILENAME="$WORKDIR/augtool-$BRIDGE" > > printf "\nConfigure $BRIDGE for use by $NIC..\n\n" > > @@ -70,10 +73,6 @@ function setup_menu > PS3="Please select a network interface to configure:" > } > > -# clean up any left over configurations > -rm -f /var/tmp/config-augtool > -rm -f /var/tmp/augtool-* > - > setup_menu > > select NIC in $NICS > @@ -88,10 +87,9 @@ done > > # Merge together all generated files and run augtool > > -cat /var/tmp/augtool-* > /var/tmp/config-augtool > -printf "save\n" >> /var/tmp/config-augtool > { > -augtool < /var/tmp/config-augtool > +cat $WORKDIR/augtool-* > $WORKDIR/config-augtool > +printf "save\n" >> /var/tmp/config-augtool Oops. one remaining /var/tmp/... > +augtool < $WORKDIR/config-augtool I've just noticed that these uses of $WORKDIR need to be double-quoted-for-the-paranoid. (in case $TMPDIR contains bogus characters). Also, ideally, you'd run augtool only if all preceding writes completed without error, so, cf="$WORKDIR/config-augtool" { cat "$WORKDIR"/augtool-* && printf "save\n"; } > "$cf" \ && augtool < "$cf" > service network restart > } > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE I really, really prefer not to program in shell. From dpierce at redhat.com Fri Nov 14 21:24:27 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 14 Nov 2008 16:24:27 -0500 Subject: [Ovirt-devel] [PATCH node] Moved network configuration work files to a temporary directory. Message-ID: <1226697867-3768-1-git-send-email-dpierce@redhat.com> Added a trap call to ensure that the work directory is removed after the script exits. Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 25 +++++++++++++++---------- 1 files changed, 15 insertions(+), 10 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 2f8363c..0be24a0 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -3,6 +3,13 @@ # Iterates over the list of network devices on the node and prompts the user # to configure each. +WORKDIR=$(mktemp -d) || exit 1 + +# Remove $WORKDIR upon interrupt (and HUP, PIPE, TERM) and upon normal +# termination, being careful not to change the exit status. +trap '__st=$?; rm -rf "$WORKDIR"; exit $__st' 0 +trap 'exit $?' 1 2 13 15 + CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" @@ -10,8 +17,8 @@ function configure_interface { NIC=$1 BRIDGE=ovirtbr`echo $NIC | cut -b4-` - IF_FILENAME="/var/tmp/augtool-$NIC" - BR_FILENAME="/var/tmp/augtool-$BRIDGE" + IF_FILENAME="$WORKDIR/augtool-$NIC" + BR_FILENAME="$WORKDIR/augtool-$BRIDGE" printf "\nConfigure $BRIDGE for use by $NIC..\n\n" @@ -70,10 +77,6 @@ function setup_menu PS3="Please select a network interface to configure:" } -# clean up any left over configurations -rm -f /var/tmp/config-augtool -rm -f /var/tmp/augtool-* - setup_menu select NIC in $NICS @@ -88,10 +91,12 @@ done # Merge together all generated files and run augtool -cat /var/tmp/augtool-* > /var/tmp/config-augtool -printf "save\n" >> /var/tmp/config-augtool { -augtool < /var/tmp/config-augtool +config="$WORKDIR"/config-augtool +cat "$WORKDIR"/augtool-* > $config +printf "save\n" >> $config + +augtool < "$WORKDIR"/config-augtool + service network restart } > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE - -- 1.5.6.5 From dpierce at redhat.com Fri Nov 14 21:25:41 2008 From: dpierce at redhat.com (Darryl Pierce) Date: Fri, 14 Nov 2008 16:25:41 -0500 Subject: [Ovirt-devel] [PATCH node] Moved network configuration work files to a temporary directory. In-Reply-To: <8763mq3umn.fsf@rho.meyering.net> References: <1226688726-27233-1-git-send-email-dpierce@redhat.com> <8763mq3umn.fsf@rho.meyering.net> Message-ID: <200811141625.44192.dpierce@redhat.com> On Friday 14 November 2008 3:44:32 pm Jim Meyering wrote: > Also, ideally, you'd run augtool only if all preceding writes > completed without error, so, > > cf="$WORKDIR/config-augtool" > { cat "$WORKDIR"/augtool-* && printf "save\n"; } > "$cf" \ > && augtool < "$cf" I tried to apply the above and got a constant "unexpected end of file error" with it within the other braces to capture output to a log. -- Darryl L. Pierce, Sr. Software Engineer Red Hat, Inc. - http://www.redhat.com/ oVirt - Virtual Machine Management - http://www.ovirt.org/ "What do you care what other people think, Mr. Feynman?" -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part. URL: From dpierce at redhat.com Fri Nov 14 21:33:50 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 14 Nov 2008 16:33:50 -0500 Subject: [Ovirt-devel] [PATCH node] Adds a "Save" option to save the configuration. Message-ID: <1226698430-4433-1-git-send-email-dpierce@redhat.com> Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 2f8363c..0c34561 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -66,7 +66,7 @@ function configure_interface function setup_menu { NICS=$(hal-device | awk '/net.interface/ {match($0, "= '"'"'(.*)'"'"' ", nic); printf("%s ", nic[1]); }') - NICS="$NICS Quit" + NICS="$NICS Save Quit" PS3="Please select a network interface to configure:" } @@ -80,7 +80,8 @@ select NIC in $NICS do printf "\n" case "$NIC" in - "Quit") break ;; + "Save") break ;; + "Quit") exit 0 ;; *) configure_interface $NIC $IFACE_NUMBER ;; esac setup_menu @@ -94,4 +95,3 @@ printf "save\n" >> /var/tmp/config-augtool augtool < /var/tmp/config-augtool service network restart } > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE - -- 1.5.6.5 From dpierce at redhat.com Fri Nov 14 21:41:35 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 14 Nov 2008 16:41:35 -0500 Subject: [Ovirt-devel] [PATCH node] Moved network configuration work files to a temporary directory. Message-ID: <1226698895-5060-1-git-send-email-dpierce@redhat.com> Added a trap call to ensure that the work directory is removed after the script exits. Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 2f8363c..d2bfc45 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -3,6 +3,13 @@ # Iterates over the list of network devices on the node and prompts the user # to configure each. +WORKDIR=$(mktemp -d) || exit 1 + +# Remove $WORKDIR upon interrupt (and HUP, PIPE, TERM) and upon normal +# termination, being careful not to change the exit status. +trap '__st=$?; rm -rf "$WORKDIR"; exit $__st' 0 +trap 'exit $?' 1 2 13 15 + CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" @@ -10,8 +17,8 @@ function configure_interface { NIC=$1 BRIDGE=ovirtbr`echo $NIC | cut -b4-` - IF_FILENAME="/var/tmp/augtool-$NIC" - BR_FILENAME="/var/tmp/augtool-$BRIDGE" + IF_FILENAME="$WORKDIR/augtool-$NIC" + BR_FILENAME="$WORKDIR/augtool-$BRIDGE" printf "\nConfigure $BRIDGE for use by $NIC..\n\n" @@ -70,10 +77,6 @@ function setup_menu PS3="Please select a network interface to configure:" } -# clean up any left over configurations -rm -f /var/tmp/config-augtool -rm -f /var/tmp/augtool-* - setup_menu select NIC in $NICS @@ -88,10 +91,10 @@ done # Merge together all generated files and run augtool -cat /var/tmp/augtool-* > /var/tmp/config-augtool -printf "save\n" >> /var/tmp/config-augtool { -augtool < /var/tmp/config-augtool +config="$WORKDIR"/config-augtool +{ cat "$WORKDIR"/augtool-* && printf "save\n"; } > $config \ +&& augtool < "$WORKDIR"/config-augtool + service network restart } > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE - -- 1.5.6.5 From pmyers at redhat.com Fri Nov 14 21:49:34 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 16:49:34 -0500 Subject: [Ovirt-devel] [PATCH node-image] Add logic for allowing SSH keys to be included during livecd iso creation time Message-ID: <1226699374-11208-1-git-send-email-pmyers@redhat.com> This is to be used for development purposes only so that we can disable setting a default root password. If ovirt_dev is set to 1 (which happens if the Release in the spec file is 0) then this functionality is turned on by default. Signed-off-by: Perry Myers --- Makefile.am | 11 ++++++++--- ovirt-node-image.ks | 9 +++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index d594c90..25b939c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -50,7 +50,7 @@ DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz \ $(PACKAGE).$(PKG_FMT) \ $(NVR).$(PKG_FMT) \ $(NVR).$(PKG_FMT).$(SUM) \ - repos.ks + repos.ks ovirt-authorized_keys # For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT- # annotated rpm version strings. @@ -83,8 +83,13 @@ repos.ks: echo "repo --name=ovirt-local --baseurl=$(OVIRT_LOCAL_REPO)" >> $@ \ ) +keys: + if [ "$(_ovirt_dev)" = 1 ]; then \ + cp -va ~/.ssh/authorized_keys ovirt-authorized_keys ;\ + fi + SELINUX_ENFORCING=$(shell /usr/sbin/getenforce) -$(NVR).$(PKG_FMT): repos.ks +$(NVR).$(PKG_FMT): repos.ks keys mkdir -p $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp mkdir -p $(OVIRT_CACHE_DIR)/yum ( \ @@ -129,4 +134,4 @@ publish: rpms createrepo $(OVIRT_CACHE_DIR)/ovirt .PHONY: rpms publish $(NVR).$(PKG_FMT).$(SUM) $(NVR).$(PKG_FMT) \ - $(PACKAGE).$(PKG_FMT) + $(PACKAGE).$(PKG_FMT) keys diff --git a/ovirt-node-image.ks b/ovirt-node-image.ks index 20ec36c..3a6f399 100644 --- a/ovirt-node-image.ks +++ b/ovirt-node-image.ks @@ -19,6 +19,15 @@ touch /.autorelabel %include common-blacklist.ks %post --nochroot +if [ -f "ovirt-authorized_keys" ]; then + echo "Adding authorized_keys to Image" + mkdir -p $INSTALL_ROOT/root/.ssh + cp -v ovirt-authorized_keys $INSTALL_ROOT/root/.ssh/authorized_keys + chown -R root:root $INSTALL_ROOT/root/.ssh + chmod 755 $INSTALL_ROOT/root/.ssh + chmod 644 $INSTALL_ROOT/root/.ssh/authorized_keys +fi + echo "Fixing boot menu" # remove quiet from Node bootparams, added by livecd-creator sed -i -e 's/ quiet//' $LIVE_ROOT/isolinux/isolinux.cfg -- 1.6.0.3 From pmyers at redhat.com Fri Nov 14 21:53:51 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 16:53:51 -0500 Subject: [Ovirt-devel] [PATCH Repost] Remove ovirt-node-image-pxe package Message-ID: <1226699633-11327-1-git-send-email-pmyers@redhat.com> This patch series removes ovirt-node-image-pxe and instead relies on the user running ovirt-pxe after install of ovirt-node-image RPM. Appliance recipe is tweaked to do this as well. This is a repost of the original patch series and corrects a problem identified by Alan where after the tmp dir is deleted on the appliance cobbler sync would fail. From pmyers at redhat.com Fri Nov 14 21:53:52 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 16:53:52 -0500 Subject: [Ovirt-devel] [PATCH node-image] Remove pxe subpackage from ovirt-node-image In-Reply-To: <1226699633-11327-1-git-send-email-pmyers@redhat.com> References: <1226699633-11327-1-git-send-email-pmyers@redhat.com> Message-ID: <1226699633-11327-2-git-send-email-pmyers@redhat.com> pxe just duplicated for the most part what was in base package Instead users should just run ovirt-pxe script after installing ovirt-node-image package Signed-off-by: Perry Myers --- ovirt-node-image.spec.in | 29 ++--------------------------- 1 files changed, 2 insertions(+), 27 deletions(-) diff --git a/ovirt-node-image.spec.in b/ovirt-node-image.spec.in index 440ba2f..a30ea94 100644 --- a/ovirt-node-image.spec.in +++ b/ovirt-node-image.spec.in @@ -18,10 +18,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot URL: http://ovirt.org/ BuildRequires: livecd-tools >= 017.1-2ovirt BuildRequires: syslinux -BuildRequires: appliance-tools >= 002-3 %define app_root %{_datadir}/%{name} -%define tftpboot %{_var}/lib/tftpboot # disable debuginfo, makes no sense for boot image and it is created empty anyway %define debug_package %{nil} @@ -30,16 +28,11 @@ BuildRequires: appliance-tools >= 002-3 The ISO boot image for oVirt Node booting from CDROM device. At the moment, this RPM just packages prebuilt ISO. -%package pxe -Summary: oVirt Node PXE image -Group: Applications/System - -%description pxe -The PXE boot image for oVirt Node network boot from oVirt Server. - %prep %setup -q +%if ! %{source_iso} ./configure +%endif %build %if ! %{source_iso} @@ -48,19 +41,11 @@ make %{?ovirt_cache_dir: OVIRT_CACHE_DIR=%{ovirt_cache_dir}} \ %{?ovirt_url: OVIRT_URL=%{ovirt_url}} \ %{name}.iso %endif -sudo su - -c "cd $(pwd) && ./ovirt-pxe %{image_iso}" -sudo su - -c "cd $(pwd) && chown -R $USER ." %install %{__rm} -rf %{buildroot} mkdir %{buildroot} -%{__install} -d -m0755 %{buildroot}%{tftpboot} -%{__install} -d -m0755 %{buildroot}%{tftpboot}/pxelinux.cfg -%{__install} -p -m0644 tftpboot/pxelinux.cfg/default %{buildroot}%{tftpboot}/pxelinux.cfg/default -%{__install} -p -m0644 tftpboot/pxelinux.0 %{buildroot}%{tftpboot} -%{__install} -p -m0644 tftpboot/initrd0.img %{buildroot}%{tftpboot} -%{__install} -p -m0644 tftpboot/vmlinuz0 %{buildroot}%{tftpboot} %{__install} -d -m0755 %{buildroot}%{app_root} %{__install} -p -m0644 %{image_iso} %{buildroot}%{app_root} %{__install} -d -m0755 %{buildroot}%{_sbindir} @@ -74,9 +59,6 @@ mkdir %{buildroot} %clean %{__rm} -rf %{buildroot} -%post pxe -cobbler sync > /dev/null 2>&1 || : - %files %defattr(-,root,root,0644) %{app_root}/%{name}.iso @@ -88,13 +70,6 @@ cobbler sync > /dev/null 2>&1 || : %{_sbindir}/edit-livecd %{_sbindir}/livecd-setauth -%files pxe -%defattr(-,root,root,0644) -%config(noreplace) %{tftpboot}/pxelinux.cfg/default -%{tftpboot}/pxelinux.0 -%{tftpboot}/initrd0.img -%{tftpboot}/vmlinuz0 - %changelog * Thu Jul 03 2008 Perry Myers 0.92-0 - Only store ISO in SRPM, and generate PXE from that during build -- 1.6.0.3 From pmyers at redhat.com Fri Nov 14 21:53:53 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 16:53:53 -0500 Subject: [Ovirt-devel] [PATCH recipe] Use ovirt-node-image RPM instead of ovirt-node-image-pxe since it has been removed In-Reply-To: <1226699633-11327-2-git-send-email-pmyers@redhat.com> References: <1226699633-11327-1-git-send-email-pmyers@redhat.com> <1226699633-11327-2-git-send-email-pmyers@redhat.com> Message-ID: <1226699633-11327-3-git-send-email-pmyers@redhat.com> Signed-off-by: Perry Myers --- appliances/ovirt/files/cobbler-import | 15 +++++++++++---- ovirt-recipe.spec.in | 3 ++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/appliances/ovirt/files/cobbler-import b/appliances/ovirt/files/cobbler-import index 9a65351..0837919 100644 --- a/appliances/ovirt/files/cobbler-import +++ b/appliances/ovirt/files/cobbler-import @@ -6,6 +6,7 @@ url=http://download.fedora.redhat.com/pub/fedora/linux ksdir=/var/www/cobbler/ks_mirror set -x +set -e for dir in $ksdir/* ; do base=$(basename $dir) nf=$(echo $base | awk -F - '{print NF}') @@ -30,13 +31,18 @@ for dir in $ksdir/* ; do --kickstart=/etc/cobbler/sample-$os-$ver-$arch.ks done -node_arch=$(rpm -q --qf "%{arch}" ovirt-node-image-pxe) +node_arch=$(rpm -q --qf "%{arch}" ovirt-node-image) +node_dir=/usr/share/ovirt-node-image + +# Create PXE images from oVirt ISO +pushd $node_dir +ovirt-pxe ovirt-node-image.iso +popd -# TODO extract Node boot params from /var/lib/tftboot/pxelinux.cfg/default -# before Cobbler overwrites it cobbler distro add --name="oVirt-Node-$node_arch" --arch=$node_arch \ - --initrd=/var/lib/tftpboot/initrd0.img --kernel=/var/lib/tftpboot/vmlinuz0 \ + --initrd=$node_dir/tftpboot/initrd0.img --kernel=$node_dir/tftpboot/vmlinuz0 \ --kopts="rootflags=loop root=/ovirt-node-image.iso rootfstype=iso9660 ro console=ttyS0,115200n8 console=tty0" + cobbler profile add --name=oVirt-Node-$node_arch --distro=oVirt-Node-$node_arch cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$node_arch \ --name=node3 --mac=00:16:3e:12:34:57 @@ -60,5 +66,6 @@ cobbler sync cobbler list set +x +set +e echo "Add new oVirt Nodes as Cobbler systems to make them PXE boot oVirt Node image directly." echo "oVirt-Node-$node_arch is also default boot option in Cobbler menu" diff --git a/ovirt-recipe.spec.in b/ovirt-recipe.spec.in index 2993770..638e2e0 100644 --- a/ovirt-recipe.spec.in +++ b/ovirt-recipe.spec.in @@ -27,7 +27,7 @@ Requires: ipa-admintools Requires: scsi-target-utils Requires: iscsi-initiator-utils Requires: ovirt-server -Requires: ovirt-node-image-pxe +Requires: ovirt-node-image Requires: ovirt-release Requires: rhpl Requires: cobbler @@ -41,6 +41,7 @@ Requires: qpidd Requires: rubygem-qpid Requires: qpidc Requires: qmf +Requires: livecd-tools >= 019 %description Thincrust oVirt Server Appliance Recipe -- 1.6.0.3 From pmyers at redhat.com Fri Nov 14 21:55:09 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 16:55:09 -0500 Subject: [Ovirt-devel] Re: [PATCH recipe] Split ovirt-appliance init script into storage and dnsmasq In-Reply-To: <1226653647-19080-1-git-send-email-pmyers@redhat.com> References: <1226653647-19080-1-git-send-email-pmyers@redhat.com> Message-ID: <491DF3BD.20509@redhat.com> Perry Myers wrote: > This makes the appliance a little more deterministic in setup. > DNS services must be working correctly prior to calling the > ovirt-server-appliance-setup script, but storage can't be activated > until after. Splitting up these two services allows us to set up > the dependencies properly in the puppet file. > > This fixes a transient bug where the appliance would start but > the services would fail to configure properly. I was seeing > this around 25% of the time with appliance firstboot. This has been pushed. Perry From dpierce at redhat.com Fri Nov 14 22:02:43 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Fri, 14 Nov 2008 17:02:43 -0500 Subject: [Ovirt-devel] [PATCH node] Added support for local storage configuration. Message-ID: <1226700163-6287-1-git-send-email-dpierce@redhat.com> This patch wipes out the entire disk on the node and replaces it with a set of partitions. The partitions are a raw partition to hold the bootable kernel, and the rest of the disk is taken up as an physical volume. On the physical volume is created the following logical volumes: * SWAP - swap partition * ROOT - to host the node image * CONFIG - to hold node configuration data * LOGGING - to hold local logs * DATA - to hold VM images Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-storage | 183 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 183 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index c856ef1..eaaf220 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -1,2 +1,185 @@ #!/bin/bash # +# To automate the partitioning, pass in the specific fields in this order +# ovirt-config-storage [swap size] [boot size] [root size] [logging size] +# +# All sizes are in megabytes +# + +function do_resolve_sizes +{ + DATA_SIZE=$(echo "scale=0; ($SPACE - $BOOT_SIZE - $SWAP_SIZE - $ROOT_SIZE - $CONFIG_SIZE - $LOGGING_SIZE)" | bc -l) +} + +function do_configure +{ + for i in swap boot root logging; do + uc=$(echo $i|tr '[[:lower:]]' '[[:upper:]]') + var=${uc}_SIZE + eval "size=\$$var" + read -p "$i partition size (Currently $size MB)? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + eval "$var=$REPLY" + else + printf "Invalid value for $i. Retaining $size MB.\n" + fi + done + + do_resolve_sizes +} + +function do_review +{ + printf "\n" + printf "The local disk will be repartitioned as follows:\n" + printf "================================================\n" + printf " Physical Hard Disk: ${DRIVE}\n" + printf " Total storage available: ${SPACE} MB\n" + printf " Swap partition size: ${SWAP_SIZE} MB\n" + printf " Boot partition size: ${BOOT_SIZE} MB\n" + printf " Installation partition size: ${ROOT_SIZE} MB\n" + printf " Configuration partition size: ${CONFIG_SIZE} MB\n" + printf " Logging partition size: ${LOGGING_SIZE} MB\n" + printf " Data partition size: ${DATA_SIZE} MB\n" + printf "\n" +} + +function perform_partitioning +{ + printf "Preparing local storage. Please wait..." + + { + vgroups=$(vgdisplay -C | awk '{ print $1" "; }') + vgremove -f $vgroups + + dd if=/dev/zero of=$DRIVE bs=1K count=1 + blockdev --rereadpt $DRIVE + partprobe -s $DRIVE + + parted $DRIVE -s "mklabel gpt" + parted $DRIVE -s "mkpart primary ext2 0M ${BOOT_SIZE}M" + parted $DRIVE -s "mkpart primary ext2 ${BOOT_SIZE}M ${SPACE}M" + parted $DRIVE -s "set 2 lvm on" + + pvcreate "${DRIVE}2" + pvck + vgcreate /dev/HostVG "${DRIVE}2" + + lvcreate --name Swap --size ${SWAP_SIZE}M /dev/HostVG + lvcreate --name Root --size ${ROOT_SIZE}M /dev/HostVG + lvcreate --name Config --size ${CONFIG_SIZE}M /dev/HostVG + lvcreate --name Logging --size ${LOGGING_SIZE}M /dev/HostVG + lvcreate --name Data -l 100%FREE /dev/HostVG + + mke2fs -j -T ext2 "${DRIVE}1" -L "BOOT" + tune2fs -c 0 -i 0 "${DRIVE}1" + mkswap /dev/HostVG/Swap + mke2fs -j -T ext2 /dev/HostVG/Root -L "ROOT" + tune2fs -c 0 -i 0 /dev/HostVG/Root + mke2fs -j -T ext3 /dev/HostVG/Config -L "CONFIG" + tune2fs -c 0 -i 0 /dev/HostVG/Config + mke2fs -j -T ext3 /dev/HostVG/Logging -L "LOGGING" + tune2fs -c 0 -i 0 /dev/HostVG/Logging + mke2fs -j -T ext3 /dev/HostVG/Data -L "DATA" + tune2fs -c 0 -i 0 /dev/HostVG/Data + } > /var/log/ovirt-partition.log 2>&1 + + printf "Completed!\n\n" +} + +function do_confirm +{ + while true; do + printf "\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! If you proceed this will destroy all data on your local system, and !!WARNING!!\n" + printf "!!WARNING!! your hard disk will be irreversably reconfiguration. !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "\n" + printf "\tContinue? (Y/n) " + read + case $REPLY in + Y|y) + perform_partitioning; break ;; + N|n) return ;; + esac + done +} + +DRIVE=$(for drive in `hal-find-by-capability --capability storage`; do + info=$(lshal -u $drive -s) + if [[ $info =~ "storage.drive_type = 'disk'" ]]; then + lshal -u $drive -s | awk ' /block.device/ { + match($0, "block.device = *'"'"'(.*)'"'"'", device) + printf "%s", device[1] + }' + fi +done) + +SPACE=$(for drive in `hal-find-by-capability --capability storage`; do + info=$(lshal -u $drive -s) + if [[ $info =~ "storage.drive_type = 'disk'" ]]; then + lshal -u $drive -s | awk ' /storage.size/ { + match($0, "storage.size *= *([0-9]+)", device) + printf "%s", device[1] + }' + fi +done) + +SPACE=$(echo "scale=0; $SPACE / (1024 * 1024)" | bc -l) +BOOT_SIZE="256" +ROOT_SIZE="256" +CONFIG_SIZE="5" +LOGGING_SIZE="256" + +MEM_SIZE=$(virsh -c qemu:///system nodeinfo | awk '/Memory size/ { print $3 }') +MEM_SIZE=$(echo "scale=0; $MEM_SIZE / 1024" | bc -l) +SWAP_SIZE=$MEM_SIZE + +# If the any partition size was provided as a kernel argument, +# then set the values and run without prompting + +counter=0 +while [ "$1" != "" ]; do + AUTO="Y" + case $counter in + 0) SWAP_SIZE=$1; break ;; + 1) BOOT_SIZE=$1; break ;; + 2) ROOT_SIZE=$1; break ;; + 3) LOGGING_SIZE=$1; break ;; + esac + counter=`expr $counter + 1 ` + shift +done + +if [ "$AUTO" == "Y" ]; then + printf "Partitioning hard disk..." + perform_partitioning + printf "[DONE]\n" + exit 0 +else + while true; do + do_resolve_sizes + + OPTIONS="Configure Review Partition Quit" + PS3="Choose an option: " + + printf "\n" + + select OPTION in $OPTIONS + do + case "$OPTION" in + "Configure") do_configure ; break ;; + "Review") do_review ; break ;; + "Partition") do_confirm ; break ;; + "Quit") exit ;; + esac + done + done +fi -- 1.5.6.5 From pmyers at redhat.com Fri Nov 14 22:06:52 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 17:06:52 -0500 Subject: [Ovirt-devel] [PATCH] Series to simplify the appliance and appliance creation scripts Message-ID: <1226700416-11413-1-git-send-email-pmyers@redhat.com> These 4 patches need to be applied together. [PATCH recipe] Changes to support removal of second network interface on the appliance [PATCH appliance] Create separate data disk for storing iSCSI and NFS for appliance [PATCH appliance] Move appliance creation out of spec file to Makefile [PATCH appliance] Refactor the create-ovirt-appliance script into several scripts The end results are: 1. an appliance that only has a single network interface 2. appliance has a separate data disk for storing NFS and iSCSI sparse images 3. appliance is no longer packaged inside of an RPM, instead it is packaged as qcow2 disk images w/ helper scripts and virt-image XML in a tarball 4. ovirt-appliance RPM still exists but is just used to hold the helper scripts so that the process for downloading the appliance on a Fedora system would be # yum install ovirt-appliance # get-ovirt-appliance # create-ovirt-network # create-ovirt-nodes # create-ovirt-appliance get-ovirt-appliance retrieves the appliance image from the ovirt.org server or from a local directory (see -l parameter). create-ovirt-network sets up either a self contained network for fake nodes or bridges to specified interface with -e parameter. create-ovirt-appliance just creates the appliance from the virt-image XML definition and optionally starts and connects to its serial console. create-ovirt-nodes creates the fake nodes; this step is optional. Splitting out the functionality into several files will make debugging issues easier (in the past our one script to do it all caused problems when someone -just- wanted to redefine the appliance but not the network, or just create fake nodes separately). And the change in packaging helps non-RPM based systems download and use the appliance easier and decreases build time by several minutes... From pmyers at redhat.com Fri Nov 14 22:06:53 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 17:06:53 -0500 Subject: [Ovirt-devel] [PATCH appliance] Create separate data disk for storing iSCSI and NFS for appliance In-Reply-To: <1226700416-11413-1-git-send-email-pmyers@redhat.com> References: <1226700416-11413-1-git-send-email-pmyers@redhat.com> Message-ID: <1226700416-11413-2-git-send-email-pmyers@redhat.com> Signed-off-by: Perry Myers --- ovirt-appliance.ks | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks index 3613a53..69286fb 100644 --- a/ovirt-appliance.ks +++ b/ovirt-appliance.ks @@ -15,16 +15,13 @@ services --disabled=libvirtd,postgresql --enabled=network,tgtd,nfs,iptables,ntpd timezone --utc UTC text -bootloader --location=mbr --driveorder=sda --append="console=tty0 console=ttyS0,115200" -# The following is the partition information you requested -# Note that any partitions you deleted are not expressed -# here so unless you clear all partitions first, this is -# not guaranteed to work +bootloader --location=mbr --driveorder=sda,sdb --append="console=tty0 console=ttyS0,115200" zerombr -clearpart --all --drives=sda +clearpart --all --drives=sda,sdb part /boot --ondisk=sda --fstype=ext3 --size=100 -part / --ondisk=sda --fstype=ext3 --size=20000 +part / --ondisk=sda --fstype=ext3 --size=2000 part swap --ondisk=sda --fstype=swap --size=512 +part /mnt/data --ondisk=sdb --fstype=ext3 --size=20000 reboot network --device=eth1 --bootproto=static --ip=192.168.50.2 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.50.2 --hostname=management.priv.ovirt.org -- 1.6.0.3 From pmyers at redhat.com Fri Nov 14 22:06:54 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 17:06:54 -0500 Subject: [Ovirt-devel] [PATCH appliance] Move appliance creation out of spec file to Makefile In-Reply-To: <1226700416-11413-2-git-send-email-pmyers@redhat.com> References: <1226700416-11413-1-git-send-email-pmyers@redhat.com> <1226700416-11413-2-git-send-email-pmyers@redhat.com> Message-ID: <1226700416-11413-3-git-send-email-pmyers@redhat.com> The appliance-creator RPM is now just used to store the create-ovirt-appliance script and contains dependencies for installing and running the appliance. The appliance is also modified to be packaged in tar.bz2 format with raw disks. Signed-off-by: Perry Myers --- Makefile.am | 111 ++++++++++++++++++++++++++++++++++++++++------ ovirt-appliance.spec.in | 71 ++---------------------------- 2 files changed, 101 insertions(+), 81 deletions(-) diff --git a/Makefile.am b/Makefile.am index b464da0..4b96624 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,16 +16,30 @@ # also available at http://www.gnu.org/copyleft/gpl.html. OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache +OVIRT_LOCAL_REPO ?= file://$(OVIRT_CACHE_DIR)/ovirt +OVIRT_URL ?= http://ovirt.org/repos/ovirt +THINCRUST_URL ?= http://thincrust.org/repo +PKG_FMT = tar +DISK_FMT ?= qcow2 +SUM ?= sha1sum +APP_RAM ?= 768 + +FEDORA = $(shell rpm --eval '%{fedora}') +ARCH = $(shell rpm --eval '%{_arch}') + +NVR = $(PACKAGE)-$(VERSION)-$(ARCH) EXTRA_DIST = \ .gitignore \ - create-ovirt-appliance \ + create-$(PACKAGE) \ gettree.sh \ - ovirt-appliance.ks \ - ovirt-appliance.spec \ - ovirt-appliance.spec.in + $(PACKAGE).ks \ + $(PACKAGE).spec \ + $(PACKAGE).spec.in -DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz +DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz \ + $(NVR).$(PKG_FMT) \ + $(NVR).$(PKG_FMT).$(SUM) # For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT- # annotated rpm version strings. @@ -38,15 +52,82 @@ GIT_RELEASE = $$(date --utc +%Y%m%d%H%M%S)git$(git_head) RPMDIR = $$(rpm --eval '%{_rpmdir}') RPM_FLAGS = --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)" RPM_FLAGS += $(if $(_ovirt_dev),--define "extra_release .$(GIT_RELEASE)") -# FEDORA_URL env var can be set to the root of a fedora mirror -RPM_FLAGS += $(if $(FEDORA_URL),--define "fedora_url $(FEDORA_URL)") -# OVIRT_URL env var can be set to the root of an ovirt.org mirror -RPM_FLAGS += $(if $(OVIRT_URL),--define "ovirt_url $(OVIRT_URL)") -# THINCRUST_URL env var can be set to the root of an thincrust.net mirror -# FIXME: This is temporary until thincrust RPMS are in Fedora 9 Updates -RPM_FLAGS += $(if $(THINCRUST_URL),--define "thincrust_url $(THINCRUST_URL)") - -rpms: dist + +FEDORA_MIRROR = http://mirrors.fedoraproject.org/mirrorlist +FEDORA_URL_DEF = http://download.fedoraproject.org/pub/fedora/linux +CUR_RAWHIDE = 10 + +repos.ks: + ( \ + if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \ + FEDORA_REPO=rawhide ;\ + FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/development/$(ARCH)/os,--mirrorlist=$(FEDORA_MIRROR)?repo=rawhide&arch=$(ARCH))" ;\ + OVIRT_DISTRO=development ;\ + else \ + FEDORA_REPO=f$(FEDORA) ;\ + FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/$(ARCH)/os,--mirrorlist=$(FEDORA_MIRROR)?repo=fedora-$(FEDORA)&arch=$(ARCH))" ;\ + OVIRT_DISTRO=$(FEDORA) ;\ + UPDATE_REPO_LINE="repo --name=$${FEDORA_REPO}-updates-newkey $(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/updates/$(FEDORA)/$(ARCH).newkey,--mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-f$(FEDORA).newkey&arch=$(ARCH))" ;\ + fi ;\ + echo "repo --name=$${FEDORA_REPO} $${FEDORA_REPO_LOC}" > $@ ;\ + echo "repo --name=ovirt-org --baseurl=$(OVIRT_URL)/$${OVIRT_DISTRO}/$(ARCH)" >> $@ ;\ + echo "repo --name=thincrust-org --baseurl=$(THINCRUST_URL)/noarch" >> $@ ;\ + echo "$${UPDATE_REPO_LINE}" >> $@ ;\ + echo "repo --name=ovirt-local --baseurl=$(OVIRT_LOCAL_REPO)" >> $@ \ + ) + +SELINUX_ENFORCING=$(shell /usr/sbin/getenforce) +$(NVR).$(PKG_FMT): repos.ks + mkdir -p $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree + mkdir -p $(OVIRT_CACHE_DIR)/yum + ( \ + case $(SELINUX_ENFORCING) in \ + Enforcing) sudo /usr/sbin/setenforce Permissive ;; \ + Permissive) ;; \ + *) if ksflatten $(PACKAGE).ks 2>/dev/null \ + | grep -q '^selinux --disabled'; then \ + echo WARNING: SELinux disabled in kickstart ;\ + else \ + echo ERROR: SELinux enabled in kickstart, \ + but disabled on the build machine ;\ + exit 1 ;\ + fi ;; \ + esac ;\ + if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \ + FEDORA_TREE_URL="$(if $(FEDORA_URL),$(FEDORA_URL)/development/$(ARCH)/os,$(FEDORA_URL_DEF)/development/$(ARCH)/os)" ;\ + else \ + FEDORA_TREE_URL="$(if $(FEDORA_URL),$(FEDORA_URL)/releases/$(FEDORA)/Fedora/$(ARCH)/os,$(FEDORA_URL_DEF)/releases/$(FEDORA)/Fedora/$(ARCH)/os)" ;\ + fi ;\ + ./gettree.sh $${FEDORA_TREE_URL} $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree ;\ + ) + + mkdir -p scripts + cp -a create-$(PACKAGE) scripts + + ln -snf $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp tmp + sudo su -c "export PATH=$(PATH):/sbin:/usr/sbin && \ + appliance-creator --config $(PACKAGE).ks \ + --name $(PACKAGE) -f $(DISK_FMT) -p $(PKG_FMT) -d -v \ + --tmpdir='$(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp' \ + --cache='$(OVIRT_CACHE_DIR)/yum' \ + --vmem=$(APP_RAM) \ + -i scripts" + sudo chown $${USER} $(PACKAGE).$(PKG_FMT) + ( \ + if [ $(SELINUX_ENFORCING) = Enforcing ]; then \ + sudo /usr/sbin/setenforce Enforcing || exit 1 ;\ + fi \ + ) + + mv $(PACKAGE).$(PKG_FMT) $(NVR).$(PKG_FMT) + rm -Rf scripts + +$(NVR).$(PKG_FMT).$(SUM): $(NVR).$(PKG_FMT) + $(SUM) $(NVR).$(PKG_FMT) > $(NVR).$(PKG_FMT).$(SUM) + +appliance: $(NVR).$(PKG_FMT).$(SUM) + +rpms: dist appliance rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz publish: rpms @@ -55,4 +136,4 @@ publish: rpms rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src/ createrepo $(OVIRT_CACHE_DIR)/ovirt -.PHONY: rpms publish +.PHONY: rpms publish $(NVR).$(PKG_FMT).$(SUM) $(NVR).$(PKG_FMT) diff --git a/ovirt-appliance.spec.in b/ovirt-appliance.spec.in index f73c764..c35530b 100644 --- a/ovirt-appliance.spec.in +++ b/ovirt-appliance.spec.in @@ -1,12 +1,3 @@ -%{!?ovirt_cache_dir: %define ovirt_cache_dir /var/tmp/ovirt-cache} -%{!?ovirt_local_repo: %define ovirt_local_repo file://%{ovirt_cache_dir}/ovirt} -%{!?ovirt_url: %define ovirt_url http://ovirt.org/repos/ovirt} -%{!?thincrust_url: %define thincrust_url http://www.thincrust.net/repo} -%{?fedora_url: %define fedora_tree_url %{fedora_url}/releases/%{fedora}/Fedora/%{_arch}/os} -%{!?fedora_tree_url: %define fedora_tree_url http://download.fedoraproject.org/pub/fedora/linux/releases/%{fedora}/Fedora/%{_arch}/os} -%{!?bad_pkgs: %define bad_pkgs ""} -%define fedora_mirror http://mirrors.fedoraproject.org/mirrorlist - Summary: oVirt Appliance Name: ovirt-appliance Version: @VERSION@ @@ -15,13 +6,8 @@ Source0: %{name}-%{version}.tar.gz License: GPLv2+ Group: Applications/System BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot +BuildArch: noarch URL: http://ovirt.org/ -BuildRequires: appliance-tools >= 003-6 -BuildRequires: appliance-os -BuildRequires: livecd-tools >= 019 -BuildRequires: syslinux -BuildRequires: qemu-img -BuildRequires: wget # FIXME: libvirt and kvm require ovirt specific patches presently due to # the fact that migration has not been fixed upstream. Once upstream migration # is fixed, these Requires should be fixed. @@ -36,59 +22,12 @@ Requires: augeas %define debug_package %{nil} %description -The oVirt Appliance image and scripts to install on a Fedora Host +The oVirt Appliance scripts to install on a Fedora Host %prep %setup -q %build -%if 0%{?fedora} == 010 - # XXX current rawhide - %if "%{?fedora_url}" == "" -cat > repos.ks << EOF -repo --name=rawhide --mirrorlist=%{fedora_mirror}?repo=rawhide&arch=%{_arch} -EOF - %else -cat > repos.ks << EOF -repo --name=rawhide --baseurl=%{fedora_url}/development/%{_arch}/os -EOF - %endif -cat >> repos.ks << EOF -repo --name=ovirt-org --baseurl=%{ovirt_url}/development/%{_arch} -EOF -%else - %if "%{?fedora_url}" == "" -cat > repos.ks << EOF -repo --name=f%{fedora} --mirrorlist=%{fedora_mirror}?repo=fedora-%{fedora}&arch=%{_arch} -repo --name=f%{fedora}-updates-newkey --mirrorlist=%{fedora_mirror}?repo=updates-released-f%{fedora}.newkey&arch=%{_arch} --excludepkgs=%{bad_pkgs} -EOF - %else -cat > repos.ks << EOF -repo --name=f%{fedora} --baseurl=%{fedora_url}/releases/%{fedora}/Everything/%{_arch}/os -repo --name=f%{fedora}-updates-newkey --baseurl=%{fedora_url}/updates/%{fedora}/%{_arch}.newkey --excludepkgs=%{bad_pkgs} -EOF - %endif -cat >> repos.ks << EOF -repo --name=ovirt-org --baseurl=%{ovirt_url}/%{fedora}/%{_arch} -EOF -%endif - -cat >> repos.ks << EOF -repo --name=ovirt-local --baseurl=%{ovirt_local_repo} -repo --name=thincrust-org --baseurl=%{thincrust_url}/noarch - -EOF - -mkdir -p %{ovirt_cache_dir}/appliance-tmp/tree -mkdir -p %{ovirt_cache_dir}/yum -./gettree.sh %{fedora_tree_url} %{ovirt_cache_dir}/appliance-tmp/tree -ln -s %{ovirt_cache_dir}/appliance-tmp tmp -sudo su - -c "cd $(pwd) && appliance-creator --config ovirt-appliance.ks \ - --name %{name} -f qcow2 -d -v \ - --tmpdir='%{ovirt_cache_dir}/appliance-tmp' \ - --cache='%{ovirt_cache_dir}/yum'" -sudo su - -c "cd $(pwd) && chown -R $USER ." -mv %{name}/%{name}-sda.qcow2 %{name}.img %install %{__rm} -rf %{buildroot} @@ -96,8 +35,6 @@ mkdir %{buildroot} %{__install} -d -m0755 %{buildroot}%{app_root} %{__install} -p -m0644 COPYING %{buildroot}%{app_root} -%{__install} -d -m0755 %{buildroot}%{_localstatedir}/lib/libvirt/images -%{__install} -p -m0644 %{name}.img %{buildroot}%{_localstatedir}/lib/libvirt/images %{__install} -d -m0755 %{buildroot}%{_sbindir} %{__install} -p -m0755 create-%{name} %{buildroot}%{_sbindir} @@ -107,11 +44,13 @@ mkdir %{buildroot} %files %defattr(-,root,root,0644) %{app_root}/COPYING -%{_localstatedir}/lib/libvirt/images/%{name}.img %defattr(-,root,root,0755) %{_sbindir}/create-%{name} %changelog +* Wed Nov 05 2008 Perry Myers 0.96 +- Removed appliance building from rpm. RPM now just contains tools to + download image and install it * Sun Sep 14 2008 Perry Myers 0.92-1 - Added Requires on libvirt/kvm * Fri Sep 05 2008 Perry Myers 0.92-1 -- 1.6.0.3 From pmyers at redhat.com Fri Nov 14 22:06:56 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 17:06:56 -0500 Subject: [Ovirt-devel] [PATCH recipe] Changes to support removal of second network interface on the appliance In-Reply-To: <1226700416-11413-4-git-send-email-pmyers@redhat.com> References: <1226700416-11413-1-git-send-email-pmyers@redhat.com> <1226700416-11413-2-git-send-email-pmyers@redhat.com> <1226700416-11413-3-git-send-email-pmyers@redhat.com> <1226700416-11413-4-git-send-email-pmyers@redhat.com> Message-ID: <1226700416-11413-5-git-send-email-pmyers@redhat.com> Old appliance had: eth0 - libvirt default network (used for forwarding and upstream access) eth1 - ovirtbr0 for fake node access and bridging to oVirt network The forwarding/NAT and upstream access has been merged into ovirtbr0 eliminating the need for eth0/default. So eth0 becomes bridged to ovirtbr0 and eth1 is removed. To support this, the create-ovirt-appliance script needs to be modified to set up the host network appropriately. This is done in a related patch in the ovirt-appliance repo. The appliance is no longer used as a gateway, the host is the default gateway. So the sections for NAT are removed from the puppet config. Signed-off-by: Perry Myers --- appliances/ovirt/files/ovirt-dnsmasq.conf | 6 +++--- appliances/ovirt/ovirt.pp.in | 19 ++----------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/appliances/ovirt/files/ovirt-dnsmasq.conf b/appliances/ovirt/files/ovirt-dnsmasq.conf index 716ccd4..569672a 100644 --- a/appliances/ovirt/files/ovirt-dnsmasq.conf +++ b/appliances/ovirt/files/ovirt-dnsmasq.conf @@ -1,4 +1,4 @@ -interface=eth1 +interface=eth0 dhcp-range=192.168.50.6,192.168.50.252 dhcp-host=00:16:3e:12:34:57,192.168.50.3 dhcp-host=00:16:3e:12:34:58,192.168.50.4 @@ -13,12 +13,12 @@ srv-host=_identify._tcp,management.priv.ovirt.org,12120 enable-tftp tftp-root=/var/lib/tftpboot dhcp-boot=pxelinux.0 -dhcp-option=option:router,192.168.50.2 +dhcp-option=option:router,192.168.50.1 dhcp-option=option:ntp-server,192.168.50.2 dhcp-option=12 no-resolv local=/priv.ovirt.org/ -server=192.168.122.1 +server=192.168.50.1 diff --git a/appliances/ovirt/ovirt.pp.in b/appliances/ovirt/ovirt.pp.in index 70ca04b..9279af0 100644 --- a/appliances/ovirt/ovirt.pp.in +++ b/appliances/ovirt/ovirt.pp.in @@ -46,8 +46,8 @@ postgres::setup{$appliance_name:} firewall::setup{$appliance_name: status => "enabled"} $net_changes = [ - "set /files/etc/sysconfig/network-scripts/ifcfg-eth0/PEERDNS no", - "set /files/etc/sysconfig/network-scripts/ifcfg-eth1/DNS1 192.168.50.2" + "set /files/etc/sysconfig/network-scripts/ifcfg-eth0/DNS1 192.168.50.2", + "set /files/etc/sysconfig/network-scripts/ifcfg-eth0/GATEWAY 192.168.50.1" ] augeas {"network_scripts": @@ -96,14 +96,6 @@ file {"/boot/grub/splash.xpm.gz": source => "puppet:///ovirt/ovirt-splash.xpm.gz" } -firewall_rule {"ovirt_nat": - table => "nat", - chain => "POSTROUTING", - out_interface => "eth0", - action => "MASQUERADE", - protocol => '' -} - firewall_rule {"ssh": destination_port => '22'} firewall_rule {"http": destination_port => '80'} firewall_rule {"https": destination_port => '443'} @@ -129,13 +121,6 @@ firewall_rule {"krb5kdc": destination_port => '88', protocol => 'udp'} firewall_rule {"cobblerd": destination_port => "25150"} firewall_rule {"cobblerd-mgmt": destination_port => "25151"} -file_replacement{"nat_forwarding" : - file => "/etc/sysctl.conf", - pattern => "^net.ipv4.ip_forward = .*", - replacement => "net.ipv4.ip_forward = 1", - notify => Service[network] -} - service {"nfs": ensure => "running", enable => true, -- 1.6.0.3 From pmyers at redhat.com Fri Nov 14 22:06:55 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 17:06:55 -0500 Subject: [Ovirt-devel] [PATCH appliance] Refactor the create-ovirt-appliance script into several scripts In-Reply-To: <1226700416-11413-3-git-send-email-pmyers@redhat.com> References: <1226700416-11413-1-git-send-email-pmyers@redhat.com> <1226700416-11413-2-git-send-email-pmyers@redhat.com> <1226700416-11413-3-git-send-email-pmyers@redhat.com> Message-ID: <1226700416-11413-4-git-send-email-pmyers@redhat.com> Separated out several independent functions from ovirt-create-appliance: - installing the appliance image from the appliance packaging - creating the appliance in libvirt - creating the fake nodes - setting up the host networking to support running the appliance Along with these changes also made it so that the appliance and fake nodes are created using virt-image from the appliance-creator or from virt-install and changed so that only a single network (ovirtbr0) is required for the appliance and fake nodes. Signed-off-by: Perry Myers --- Makefile.am | 7 +- create-ovirt-appliance | 344 +++++++-------------------------------------- create-ovirt-network | 141 ++++++++++++++++++ create-ovirt-nodes | 51 +++++++ get-ovirt-appliance | 100 +++++++++++++ ovirt-appliance-functions | 180 +++++++++++++++++++++++ ovirt-appliance.ks | 4 +- ovirt-appliance.spec.in | 9 ++ 8 files changed, 537 insertions(+), 299 deletions(-) create mode 100755 create-ovirt-network create mode 100755 create-ovirt-nodes create mode 100755 get-ovirt-appliance create mode 100644 ovirt-appliance-functions diff --git a/Makefile.am b/Makefile.am index 4b96624..af84422 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,6 +32,10 @@ NVR = $(PACKAGE)-$(VERSION)-$(ARCH) EXTRA_DIST = \ .gitignore \ create-$(PACKAGE) \ + create-ovirt-network \ + create-ovirt-nodes \ + get-$(PACKAGE) \ + $(PACKAGE)-functions \ gettree.sh \ $(PACKAGE).ks \ $(PACKAGE).spec \ @@ -102,7 +106,8 @@ $(NVR).$(PKG_FMT): repos.ks ) mkdir -p scripts - cp -a create-$(PACKAGE) scripts + cp -a create-$(PACKAGE) create-ovirt-network create-ovirt-nodes \ + get-$(PACKAGE) $(PACKAGE)-functions scripts ln -snf $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp tmp sudo su -c "export PATH=$(PATH):/sbin:/usr/sbin && \ diff --git a/create-ovirt-appliance b/create-ovirt-appliance index 9454377..1669368 100755 --- a/create-ovirt-appliance +++ b/create-ovirt-appliance @@ -1,44 +1,42 @@ #!/bin/bash - -PATH=$PATH:/sbin:/usr/sbin - -ME=$(basename "$0") -warn() { printf '%s: %s\n' "$ME" "$*" >&2; } -try_h() { printf "Try \`$ME -h' for more information.\n" >&2; } -die() { warn "$@"; try_h; exit 1; } - -RAM=768 - -IMGDIR_DEFAULT=/var/lib/libvirt/images -NAME_DEFAULT=ovirt-appliance -NET_SCRIPTS=/etc/sysconfig/network-scripts -BRIDGENAME=ovirtbr0 -NET_TYPE=network - -NODE_DISK_SIZE=128M -NODE_DISK_FMT=raw - -imgdir=$IMGDIR_DEFAULT -name=$NAME_DEFAULT +# +# Create oVirt Appliance +# Copyright 2008 Red Hat, Inc. +# Written by Perry Myers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +. $(dirname $0)/ovirt-appliance-functions usage() { case $# in 1) warn "$1"; try_h; exit 1;; esac cat < - $name - - - -EOF -} - -gen_fake_managed_node() { - local num=$1 - local disk=$2 - local last_mac=$(( 54 + $num )) - - cat < - node$num - 25ab2490-7c4c-099f-b647-${num}5ff8efa73f6 - 524288 - 524288 - 1 - - hvm - - - - destroy - restart - destroy - - $KVM_BINARY - - - - - - - - - - - - - - - - - - -EOF -} - -gen_app() { - local name=$1 - local disk=$2 - local ram=$3 - - cat< - $name - $(( $ram * 1024 )) - $(( $ram * 1024 )) - 1 - - hvm - - - - destroy - restart - destroy - - $KVM_BINARY - - - - - - - - - - - - - - - - - - - - - - -EOF -} - -net_debug() { - # Some output for debugging problems - echo "Currently active bridges:" - echo "-------------------------" - brctl show - echo - echo "Currently defined libvirt networks:" - echo "-----------------------------------" - virsh net-list --all - echo -} - -# first, check to see we are root -if [ $( id -u ) -ne 0 ]; then - die "Must run as root" -fi +do_checks -# now make sure the packages we need are installed -if [ -e /etc/redhat-release ]; then - # We rely on RPM deps for this in Red Hat/Fedora systems - CHECK=0 - KVM_BINARY=/usr/bin/qemu-kvm -elif [ -e /etc/debian_version ]; then - # Works in Ubuntu 8.04. Still needs testing in Debian - PACKAGES="libvirt0 libvirt-bin kvm qemu" - CHECK=$(dpkg -l $PACKAGES &> /dev/null; echo $?) - KVM_BINARY=/usr/bin/kvm -else - die "Not a supported system" -fi - -if [ $CHECK -ne 0 ]; then - # one of the previous packages wasn't installed; bail out - die "Must have the $PACKAGES packages installed" -fi - -service libvirtd status > /dev/null 2>&1 \ - || service libvirtd start > /dev/null 2>&1 -chkconfig libvirtd on - -# Cleanup to handle older version of script that used these bridge names -{ - virsh net-destroy dummybridge - virsh net-undefine dummybridge - brctl delif eth1bridge eth1 - virsh net-destroy eth1bridge - virsh net-undefine eth1bridge - old_bridge=$(brctl show \ - | awk -v BRIDGENAME=ovirtbr '$1==BRIDGENAME {print $4}') - if [ -n "$old_bridge" ]; then - ifconfig $old_bridge down - fi - brctl delif ovirtbr $old_bridge - virsh net-destroy ovirtbr - virsh net-undefine ovirtbr - sed -i "/# ovirtbr$/d" /etc/rc.d/rc.local -} > /dev/null 2>&1 - -net_debug - -# If we're bridging to a physical network, run some checks to make sure the -# choice of physical eth device is sane -if [ -n "$bridge" ]; then - NET_TYPE=bridge - # Check to see if the physical device is present - ifconfig $bridge > /dev/null 2>&1 ; bridge_dev_present=$? - test $bridge_dev_present != 0 \ - && die "$bridge device not present, aborting!" - - # Check to see if the eth device is already tied to a non oVirt bridge - attached_bridge=$(brctl show \ - | awk -v BRIDGE=$bridge '$4~BRIDGE {print $1}') - test -n "$attached_bridge" -a "$attached_bridge" != "$BRIDGENAME" \ - && die "$bridge already attached to other bridge $attached_bridge" - - # Check to make sure that the system is not already using the interface - if test -f $NET_SCRIPTS/ifcfg-$bridge ; then - echo "$NET_SCRIPTS/ifcfg-$bridge is present, are you sure you wish to" - echo "overwrite this file? [y/N]? " - read yesno - - if [ "$yesno" != "y" -a "$yesno" != "Y" ]; then - exit 2 - fi - fi +if virsh dumpxml $name > /dev/null 2>&1 ; then + # If the appliance is already defined, abort since rewriting the appliance + # will change network settings that break the appliance. + echo "$name is already a defined virtual machine." + die fi mkdir -p $imgdir -# define the fake managed nodes we will use. -for i in `seq 3 5` ; do - imgname="node${i}.img" - if [ ! -f $imgdir/$imgname ]; then - qemu-img create -f $NODE_DISK_FMT $imgdir/$imgname $NODE_DISK_SIZE - fi - virsh destroy node$i >& /dev/null - virsh undefine node$i >& /dev/null - TMPXML=$(mktemp) - gen_fake_managed_node $i $imgdir/$imgname > $TMPXML - virsh define $TMPXML - rm $TMPXML -done - -# Remove old bridge device if it exists -sed -i "/# $BRIDGENAME/d" /etc/rc.d/rc.local -old_bridge=$(brctl show \ - | awk -v BRIDGENAME=$BRIDGENAME '$1==BRIDGENAME {print $4}') -if [ -n "$old_bridge" ]; then - echo "Removing old bridge $old_bridge" - ifconfig $old_bridge down - brctl delif $BRIDGENAME $old_bridge - rm -f $NET_SCRIPTS/ifcfg-$old_bridge -fi - -{ -echo "Removing $BRIDGENAME" -virsh net-destroy $BRIDGENAME -virsh net-undefine $BRIDGENAME -ifconfig $BRIDGENAME down -brctl delbr $BRIDGENAME -rm -fv $NET_SCRIPTS/ifcfg-$BRIDGENAME -echo "Done Removing $BRIDGENAME" -} 2> /dev/null - -if [ -n "$bridge" ]; then - # real external bridge, use distro networking scripts - ifconfig $bridge down 2> /dev/null - TMPAUG=$(mktemp) || exit 1 - cat > $TMPAUG < $TMPXML - virsh net-define $TMPXML - rm $TMPXML - virsh net-start $BRIDGENAME - virsh net-autostart $BRIDGENAME -fi - -net_debug +appdisk=$name/$name-sda.$DISK_FMT +datadisk=$name/$name-sdb.$DISK_FMT -# Cleanup to handle older version of script that used these domain names -{ - virsh destroy developer - virsh undefine developer - virsh destroy bundled - virsh undefine bundled -} > /dev/null 2>&1 - -imgname=$name.img -test ! -r $imgdir/$imgname && die "Disk image not found at $imgdir/$imgname" +test ! -r $imgdir/$appdisk && die "Disk image not found at $imgdir/$appdisk" +test ! -r $imgdir/$datadisk && die "Disk image not found at $imgdir/$datadisk" virsh destroy $name > /dev/null 2>&1 virsh undefine $name > /dev/null 2>&1 +virt-image -b $BRIDGENAME $imgdir/$name/$name.xml +# FIXME: virt-image doesn't do virtio so we have to kill the appliance, edit +# the libvirt xml and restart +virsh destroy $name > /dev/null 2>&1 TMPXML=$(mktemp) || exit 1 -# FIXME virt-image to define the appliance instance -gen_app $name $imgdir/$imgname $RAM > $TMPXML -virsh define $TMPXML -rm $TMPXML -echo "Application defined using disk located at $imgdir/$imgname." -echo "Run virsh start $name to start the appliance" +BR_XML="" +VNIC_XML="" +# FIXME: virtio disks won't boot presently, need to look into this +# -e "s/bus='ide'/bus='virtio'/" \ +# -e "s/dev='hd\(.\)'/dev='vd\1'/" \ +virsh dumpxml $name | sed -e "s^\($BR_XML\)^\1\n$VNIC_XML^" \ + > $TMPXML && \ + virsh define $TMPXML && \ + rm -f $TMPXML + +test $console = 1 && virsh start $name && virsh console $name diff --git a/create-ovirt-network b/create-ovirt-network new file mode 100755 index 0000000..00b56ba --- /dev/null +++ b/create-ovirt-network @@ -0,0 +1,141 @@ +#!/bin/bash + +. $(dirname $0)/ovirt-appliance-functions + +usage() { + case $# in 1) warn "$1"; try_h; exit 1;; esac + cat < /dev/null 2>&1 ; bridge_dev_present=$? + test $bridge_dev_present != 0 \ + && die "$bridge device not present, aborting!" + + # Check to see if the eth device is already tied to a non oVirt bridge + attached_bridge=$(brctl show \ + | awk -v BRIDGE=$bridge '$4~BRIDGE {print $1}') + test -n "$attached_bridge" -a "$attached_bridge" != "$BRIDGENAME" \ + && die "$bridge already attached to other bridge $attached_bridge" + + # Check to make sure that the system is not already using the interface + if test -f $NET_SCRIPTS/ifcfg-$bridge ; then + echo "$NET_SCRIPTS/ifcfg-$bridge is present, are you sure you wish to" + echo "overwrite this file? [y/N]? " + read yesno + + if [ "$yesno" != "y" -a "$yesno" != "Y" ]; then + exit 2 + fi + fi +fi + +# Remove old bridge device if it exists +sed -i "/# $BRIDGENAME/d" /etc/rc.d/rc.local +old_bridge=$(brctl show \ + | awk -v BRIDGENAME=$BRIDGENAME '$1==BRIDGENAME {print $4}') +if [ -n "$old_bridge" ]; then + echo "Removing old bridge $old_bridge" + ifconfig $old_bridge down + brctl delif $BRIDGENAME $old_bridge + rm -f $NET_SCRIPTS/ifcfg-$old_bridge +fi + +{ +echo "Removing $BRIDGENAME" +virsh net-destroy $BRIDGENAME +virsh net-undefine $BRIDGENAME +ifconfig $BRIDGENAME down +brctl delbr $BRIDGENAME +rm -fv $NET_SCRIPTS/ifcfg-$BRIDGENAME +rm -fv /etc/sysconfig/iptables-$BRIDGENAME-filter +rm -fv /etc/sysconfig/iptables-$BRIDGENAME-nat +sed -i "/iptables-$BRIDGENAME/d" /etc/sysconfig/system-config-firewall +lokkit --update +echo "Done Removing $BRIDGENAME" +} 2> /dev/null + +if [ -n "$bridge" ]; then + # real external bridge, use distro networking scripts + ifconfig $bridge down 2> /dev/null + TMPAUG=$(mktemp) || exit 1 + cat > $TMPAUG < /etc/sysconfig/iptables-$BRIDGENAME-filter < /etc/sysconfig/iptables-$BRIDGENAME-nat < $TMPXML + virsh net-define $TMPXML + rm $TMPXML + virsh net-start $BRIDGENAME + virsh net-autostart $BRIDGENAME +fi + +# Set up dnsmasq on $BRIDGENAME just for DNS forwarding +cat < /etc/dnsmasq.d/$BRIDGENAME.conf +bind-interfaces +interface=$BRIDGENAME +except-interface=lo +EOF +chkconfig dnsmasq on +service dnsmasq restart + +net_debug diff --git a/create-ovirt-nodes b/create-ovirt-nodes new file mode 100755 index 0000000..0ac5fd0 --- /dev/null +++ b/create-ovirt-nodes @@ -0,0 +1,51 @@ +#!/bin/bash +# +# Create fake oVirt Nodes that PXE boot to the Appliance Server +# Copyright 2008 Red Hat, Inc. +# Written by Perry Myers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +. $(dirname $0)/ovirt-appliance-functions + +usage() { + case $# in 1) warn "$1"; try_h; exit 1;; esac + cat < +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +. $(dirname $0)/ovirt-appliance-functions + +usage() { + case $# in 1) warn "$1"; try_h; exit 1;; esac + cat < /dev/null 2>&1 ; then + echo "Using http at $app_loc to retrieve appliance" + + if verify_sum $pkgfile $sumfile ; then + app_loc=$(pwd) + else + wget -c $app_loc/$sumfile || die "error downloading $app_loc/$sumfile" + wget -c $app_loc/$pkgfile || die "error downloading $app_loc/$pkgfile" + if verify_sum $pkgfile $sumfile ; then + app_loc=$(pwd) + else + die "appliance files not available, aborting" + fi + fi +else + echo "Using local files in $app_loc for appliance" + + if [ -d $app_loc ]; then + if ! verify_sum $app_loc/$pkgfile $app_loc/$sumfile ; then + die "appliance files not available, aborting" + fi + elif [ -f $app_loc -a -f $app_loc.$SUM ]; then + if ! verify_sum $app_loc $app_loc.$SUM ; then + die "appliance files not available, aborting" + fi + fi +fi + +mkdir -p $imgdir + +appdisk=$name/$name-sda.$DISK_FMT +datadisk=$name/$name-sdb.$DISK_FMT + +# This is the only bit of PKG_FMT that is hardcoded. If we really want to support +# multiple formats for distribution we should have a case statement here +tar -xvf $app_loc/$pkgfile -C $imgdir + +test ! -r $imgdir/$appdisk && die "Disk image not found at $imgdir/$appdisk" +test ! -r $imgdir/$datadisk && die "Disk image not found at $imgdir/$datadisk" + +virsh destroy $name > /dev/null 2>&1 +virsh undefine $name > /dev/null 2>&1 + +echo "Appliance Disks installed to $imgdir" +echo "Run create-ovirt-appliance to define and start the appliance" diff --git a/ovirt-appliance-functions b/ovirt-appliance-functions new file mode 100644 index 0000000..a81660e --- /dev/null +++ b/ovirt-appliance-functions @@ -0,0 +1,180 @@ +# -*-Shell-script-*- +# +# Common functions for the oVirt Appliance scripts +# Copyright 2008 Red Hat, Inc. +# Written by Perry Myers +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +PATH=$PATH:/sbin:/usr/sbin + +ME=$(basename "$0") +warn() { printf '%s: %s\n' "$ME" "$*" >&2; } +try_h() { printf "Try \`$ME -h' for more information.\n" >&2; } +die() { warn "$@"; try_h; exit 1; } + +IMGDIR_DEFAULT=/var/lib/libvirt/images +NAME_DEFAULT=ovirt-appliance +NET_SCRIPTS=/etc/sysconfig/network-scripts + +BRIDGENAME=ovirtbr0 +NETWORK=192.168.50.0 +NETMASK=255.255.255.0 + +PKG_FMT=tar +SUM=sha1sum + +DISK_FMT=qcow2 +OVIRT_URL=http://ovirt.org/download + +NODE_DISK_FMT=qcow2 +NODE_DISK_SIZE=128M + +imgdir=$IMGDIR_DEFAULT +name=$NAME_DEFAULT + +do_checks() { + # first, check to see we are root + if [ $( id -u ) -ne 0 ]; then + die "Must run as root" + fi + + # now make sure the packages we need are installed + if [ -e /etc/redhat-release ]; then + # We rely on RPM deps for this in Red Hat/Fedora systems + CHECK=0 + KVM_BINARY=/usr/bin/qemu-kvm + version=$(rpm -q --qf '%{version}' ovirt-appliance) + elif [ -e /etc/debian_version ]; then + # Works in Ubuntu 8.04. Still needs testing in Debian + PACKAGES="libvirt0 libvirt-bin kvm qemu" + CHECK=$(dpkg -l $PACKAGES &> /dev/null; echo $?) + KVM_BINARY=/usr/bin/kvm + version=LATEST + else + die "Not a supported system" + fi + + if [ $CHECK -ne 0 ]; then + # one of the previous packages wasn't installed; bail out + die "Must have the $PACKAGES packages installed" + fi + + service NetworkManager status > /dev/null 2>&1 \ + && die "NetworkManager is running, disable and use standard network scripts before proceeding" + + service iptables status > /dev/null 2>&1 \ + || service iptables start > /dev/null 2>&1 + chkconfig iptables on + + service libvirtd status > /dev/null 2>&1 \ + || service libvirtd start > /dev/null 2>&1 + chkconfig libvirtd on +} + +gen_bridge() { + cat << EOF + + $BRIDGENAME + + + + +EOF +} + +gen_fake_managed_node() { + local num=$1 + local last_mac=$(( 54 + $num )) + + echo "Creating fake node$num..." + virsh destroy node$num > /dev/null 2>&1 + virsh undefine node$num > /dev/null 2>&1 + rm -f $imgdir/node${i}-sda.$NODE_DISK_FMT + qemu-img create -f $NODE_DISK_FMT $imgdir/node${i}-sda.$NODE_DISK_FMT \ + $NODE_DISK_SIZE + # FIXME: virt-install should be changed to have a --nostart parameter + # that just defines the VM w/o starting it. + virt-install --name=node$num --ram=512 --vcpus=1 \ + --disk path=$imgdir/node${i}-sda.$NODE_DISK_FMT \ + --network=bridge:$BRIDGENAME --mac=00:16:3e:12:34:$last_mac \ + --vnc --accelerate --hvm --noautoconsole \ + --os-type=linux --os-variant=fedora9 \ + --force --noreboot --pxe + virsh destroy node$num > /dev/null 2>&1 + # FIXME: virt-install should be changed to allow network boot + # to be a permanent selection + TMPXML=$(mktemp) || exit 1 + virsh dumpxml node$num | sed "s/boot dev='.*'/boot dev='network'/" > $TMPXML + virsh define $TMPXML + rm -f $TMPXML + echo "node$num created" +} + +net_debug() { + # Some output for debugging problems + echo "Currently active bridges:" + echo "-------------------------" + brctl show + echo + echo "Currently defined libvirt networks:" + echo "-----------------------------------" + virsh net-list --all + echo +} + +cleanup_old_apps() { + # Cleanup to handle older version of script that used these domain names + virsh destroy developer + virsh undefine developer + virsh destroy bundled + virsh undefine bundled +} > /dev/null 2>&1 + +cleanup_old_nets() { + # Cleanup to handle older version of script that used these bridge names + virsh net-destroy dummybridge + virsh net-undefine dummybridge + brctl delif eth1bridge eth1 + virsh net-destroy eth1bridge + virsh net-undefine eth1bridge + old_bridge=$(brctl show \ + | awk -v BRIDGENAME=ovirtbr '$1==BRIDGENAME {print $4}') + if [ -n "$old_bridge" ]; then + ifconfig $old_bridge down + fi + brctl delif ovirtbr $old_bridge + virsh net-destroy ovirtbr + virsh net-undefine ovirtbr + sed -i "/# ovirtbr$/d" /etc/rc.d/rc.local +} > /dev/null 2>&1 + +verify_sum() { + local pkgfile=$1 + local sumfile=$2 + + test ! -f $sumfile && { echo "$sumfile not found" ; return 1 ; } + test ! -f $pkgfile && { echo "$pkgfile not found" ; return 1 ; } + + local actual_sum=$($SUM $pkgfile | awk '{print $1}') + local expect_sum=$(awk '{print $1}' $sumfile) + + if [ "$actual_sum" = "$expect_sum" ]; then + echo "checksum verified" + return 0 + else + echo "checksum failed" + return 1 + fi +} diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks index 69286fb..8fabdb7 100644 --- a/ovirt-appliance.ks +++ b/ovirt-appliance.ks @@ -2,7 +2,7 @@ install lang en_US.UTF-8 keyboard us -network --device eth0 --bootproto dhcp +network --device=eth0 --bootproto=static --ip=192.168.50.2 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.50.2 --hostname=management.priv.ovirt.org # Root password is 'ovirt' rootpw --iscrypted Xa8QeYfWrtscM firewall --disabled @@ -24,8 +24,6 @@ part swap --ondisk=sda --fstype=swap --size=512 part /mnt/data --ondisk=sdb --fstype=ext3 --size=20000 reboot -network --device=eth1 --bootproto=static --ip=192.168.50.2 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.50.2 --hostname=management.priv.ovirt.org - %include repos.ks %packages --nobase diff --git a/ovirt-appliance.spec.in b/ovirt-appliance.spec.in index c35530b..191fc2d 100644 --- a/ovirt-appliance.spec.in +++ b/ovirt-appliance.spec.in @@ -37,6 +37,10 @@ mkdir %{buildroot} %{__install} -p -m0644 COPYING %{buildroot}%{app_root} %{__install} -d -m0755 %{buildroot}%{_sbindir} %{__install} -p -m0755 create-%{name} %{buildroot}%{_sbindir} +%{__install} -p -m0755 create-ovirt-network %{buildroot}%{_sbindir} +%{__install} -p -m0755 create-ovirt-nodes %{buildroot}%{_sbindir} +%{__install} -p -m0755 get-%{name} %{buildroot}%{_sbindir} +%{__install} -p -m0644 %{name}-functions %{buildroot}%{_sbindir} %clean %{__rm} -rf %{buildroot} @@ -46,6 +50,11 @@ mkdir %{buildroot} %{app_root}/COPYING %defattr(-,root,root,0755) %{_sbindir}/create-%{name} +%{_sbindir}/create-ovirt-network +%{_sbindir}/create-ovirt-nodes +%{_sbindir}/get-%{name} +%defattr(-,root,root,0644) +%{_sbindir}/%{name}-functions %changelog * Wed Nov 05 2008 Perry Myers 0.96 -- 1.6.0.3 From dpierce at redhat.com Fri Nov 14 22:49:09 2008 From: dpierce at redhat.com (Darryl Pierce) Date: Fri, 14 Nov 2008 17:49:09 -0500 Subject: [Ovirt-devel] Fwd: Re: [PATCH node-image] Add logic for allowing SSH keys to be included during livecd iso creation time Message-ID: <200811141749.09334.dpierce@redhat.com> On Friday 14 November 2008 5:31:02 pm Perry Myers wrote: During the build I got the following error and the build quit: /usr/local/dev/ovirt/test/appliance mkdir -p scripts cp -a create-ovirt-appliance create-ovirt-network create-ovirt-nodes \ get-ovirt-appliance ovirt-appliance-functions scripts ln -snf /usr/local/dev/ovirt/.ovirt-cache/ovirt-appliance-tmp tmp sudo su -c "export PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/mcpierce/bin:/home/mcpierce/bin:/home/mcpierce/bin:/sbin:/usr/sbin && \ appliance-creator --config ovirt-appliance.ks \ --name ovirt-appliance -f qcow2 -p tar -d -v \ --tmpdir='/usr/local/dev/ovirt/.ovirt-cache/ovirt-appliance-tmp' \ --cache='/usr/local/dev/ovirt/.ovirt-cache/yum' \ --vmem=768 \ -i scripts" included file 'scripts' does not exist make[1]: *** [ovirt-appliance-0.96-x86_64.tar] Error 2 make[1]: Leaving directory `/usr/local/dev/ovirt/test/appliance' make: *** [publish] Error 1 -- Darryl L. Pierce, Sr. Software Engineer Red Hat, Inc. - http://www.redhat.com/ oVirt - Virtual Machine Management - http://www.ovirt.org/ "What do you care what other people think, Mr. Feynman?" -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part. URL: From pmyers at redhat.com Sat Nov 15 03:03:51 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 22:03:51 -0500 Subject: [Ovirt-devel] [PATCH release] Add build dependencies for the oVirt repositories Message-ID: <1226718231-13742-1-git-send-email-pmyers@redhat.com> This way developers don't need to manually install the correct versions of the requires tools. This ovirt-build package will bring in all of the correct dependencies automatically. Signed-off-by: Perry Myers --- ovirt-release.spec.in | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/ovirt-release.spec.in b/ovirt-release.spec.in index 301727d..01432fa 100644 --- a/ovirt-release.spec.in +++ b/ovirt-release.spec.in @@ -21,6 +21,17 @@ Summary: oVirt Build Scripts for developers Group: Applications/System Requires: %{name} = %{version} Requires: gcc autogen libtool rpm-build createrepo git pungi +Requires: ruby ruby-devel rubygem-rake rubygem-gettext +Requires: pkgconfig +Requires: libvirt-devel >= 0.4.6-2 +Requires: livecd-tools >= 020 +Requires: appliance-tools >= 003.7 +Requires: syslinux +Requires: appliance-os +Requires: qemu-img +Requires: wget +Requires: publican-ovirt + %description -n ovirt-build Developer makefile and scripts to help automate the building of oVirt from source repositories. -- 1.6.0.3 From pmyers at redhat.com Sat Nov 15 04:30:10 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 14 Nov 2008 23:30:10 -0500 Subject: [Ovirt-devel] [PATCH appliance] Add logic for allowing SSH keys to be included during appliance creation time Message-ID: <1226723410-14425-1-git-send-email-pmyers@redhat.com> This is to be used for development purposes only for convenience. If ovirt_dev is set to 1 (which happens if the Release in the spec file is 0) then this functionality is turned on by default. AUTH_KEYS makefile var can be overridden by environment to specify alternate location for auth keys file. Default is ~/.ssh/authorized_keys. Signed-off-by: Perry Myers --- Makefile.am | 13 ++++++++++--- ovirt-appliance.ks | 9 +++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index af84422..adace7c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,6 +23,7 @@ PKG_FMT = tar DISK_FMT ?= qcow2 SUM ?= sha1sum APP_RAM ?= 768 +AUTH_KEYS ?= ~/.ssh/authorized_keys FEDORA = $(shell rpm --eval '%{fedora}') ARCH = $(shell rpm --eval '%{_arch}') @@ -43,7 +44,8 @@ EXTRA_DIST = \ DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz \ $(NVR).$(PKG_FMT) \ - $(NVR).$(PKG_FMT).$(SUM) + $(NVR).$(PKG_FMT).$(SUM) \ + repos.ks ovirt-authorized_keys # For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT- # annotated rpm version strings. @@ -80,8 +82,13 @@ repos.ks: echo "repo --name=ovirt-local --baseurl=$(OVIRT_LOCAL_REPO)" >> $@ \ ) +keys: + if [ "$(_ovirt_dev)" = 1 -a -f $(AUTH_KEYS) ]; then \ + cp -va $(AUTH_KEYS) ovirt-authorized_keys ;\ + fi + SELINUX_ENFORCING=$(shell /usr/sbin/getenforce) -$(NVR).$(PKG_FMT): repos.ks +$(NVR).$(PKG_FMT): repos.ks keys mkdir -p $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree mkdir -p $(OVIRT_CACHE_DIR)/yum ( \ @@ -141,4 +148,4 @@ publish: rpms rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src/ createrepo $(OVIRT_CACHE_DIR)/ovirt -.PHONY: rpms publish $(NVR).$(PKG_FMT).$(SUM) $(NVR).$(PKG_FMT) +.PHONY: rpms publish $(NVR).$(PKG_FMT).$(SUM) $(NVR).$(PKG_FMT) keys diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks index 8fabdb7..f9bfcd5 100644 --- a/ovirt-appliance.ks +++ b/ovirt-appliance.ks @@ -44,6 +44,15 @@ lokkit %end %post --nochroot + if [ -f "ovirt-authorized_keys" ]; then + echo "Adding authorized_keys to Image" + mkdir -p $INSTALL_ROOT/root/.ssh + cp -v ovirt-authorized_keys $INSTALL_ROOT/root/.ssh/authorized_keys + chown -R root:root $INSTALL_ROOT/root/.ssh + chmod 755 $INSTALL_ROOT/root/.ssh + chmod 644 $INSTALL_ROOT/root/.ssh/authorized_keys + fi + set -e python -c ' from iniparse.ini import INIConfig -- 1.6.0.3 From apevec at redhat.com Sat Nov 15 09:31:51 2008 From: apevec at redhat.com (Alan Pevec) Date: Sat, 15 Nov 2008 10:31:51 +0100 Subject: [Ovirt-devel] Re: [PATCH node-image] Remove pxe subpackage from ovirt-node-image In-Reply-To: <1226699633-11327-2-git-send-email-pmyers@redhat.com> References: <1226699633-11327-1-git-send-email-pmyers@redhat.com> <1226699633-11327-2-git-send-email-pmyers@redhat.com> Message-ID: <491E9707.2040202@redhat.com> Perry Myers wrote: > -BuildRequires: appliance-tools >= 002-3 we need to keep that, since we started using image-minimizer in common-blacklist.ks and the goal is to switch all rm -rf to use it: >>> %post --nochroot --interpreter image-minimizer From pmyers at redhat.com Sat Nov 15 15:30:52 2008 From: pmyers at redhat.com (Perry Myers) Date: Sat, 15 Nov 2008 10:30:52 -0500 Subject: [Ovirt-devel] Re: [PATCH node-image] Remove pxe subpackage from ovirt-node-image In-Reply-To: <491E9707.2040202@redhat.com> References: <1226699633-11327-1-git-send-email-pmyers@redhat.com> <1226699633-11327-2-git-send-email-pmyers@redhat.com> <491E9707.2040202@redhat.com> Message-ID: <491EEB2C.4080709@redhat.com> Alan Pevec wrote: > Perry Myers wrote: >> -BuildRequires: appliance-tools >= 002-3 > > we need to keep that, since we started using image-minimizer in > common-blacklist.ks and the goal is to switch all rm -rf to use it: >>>> %post --nochroot --interpreter image-minimizer > Ah, I thought someone had put in the appliance-tools package by mistake since we're using livecd-creator. I'll leave that in then. Perry -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=| From clalance at redhat.com Sat Nov 15 15:42:09 2008 From: clalance at redhat.com (Chris Lalancette) Date: Sat, 15 Nov 2008 16:42:09 +0100 Subject: [Ovirt-devel] [PATCH node] Added support for local storage configuration. In-Reply-To: <1226700163-6287-1-git-send-email-dpierce@redhat.com> References: <1226700163-6287-1-git-send-email-dpierce@redhat.com> Message-ID: <491EEDD1.6080905@redhat.com> Darryl L. Pierce wrote: > This patch wipes out the entire disk on the node and replaces it with > a set of partitions. The partitions are a raw partition to hold the bootable > kernel, and the rest of the disk is taken up as an physical volume. > > On the physical volume is created the following logical volumes: Just to confirm; this will only do this partitioning if you both boot into local mode (using the kernel command-line arguments) and say yes to the prompts, correct? It looks that way from the code, I just want to make sure that my development node that PXE boots doesn't automatically wipe the hard disk the next time I boot it. Chris Lalancette From apevec at gmail.com Sat Nov 15 16:21:20 2008 From: apevec at gmail.com (Alan Pevec) Date: Sat, 15 Nov 2008 17:21:20 +0100 Subject: [Ovirt-devel] [PATCH node] Added support for local storage configuration. In-Reply-To: <491EEDD1.6080905@redhat.com> References: <1226700163-6287-1-git-send-email-dpierce@redhat.com> <491EEDD1.6080905@redhat.com> Message-ID: <2be7262f0811150821j23273cb2tb020843409ff5f99@mail.gmail.com> On Sat, Nov 15, 2008 at 4:42 PM, Chris Lalancette wrote: > Just to confirm; this will only do this partitioning if you both boot into > local > mode (using the kernel command-line arguments) and say yes to the prompts, > correct? It looks that way from the code, I just want to make sure that my > development node that PXE boots doesn't automatically wipe the hard disk > the > next time I boot it. Yes, bootparams we set by default in Cobbler, boot oVirt Node in managed mode and this feature is for standalone mode only. But if admin wants, s/he is free to PXE boot to standalone mode by setting appropriate kernel options. As always, you're free to shoot yourself in the foot, but that's the price of freedom :) -------------- next part -------------- An HTML attachment was scrubbed... URL: From acathrow at redhat.com Sat Nov 15 21:47:35 2008 From: acathrow at redhat.com (Andrew Cathrow) Date: Sat, 15 Nov 2008 16:47:35 -0500 Subject: [Ovirt-devel] [PATCH node] Added support for local storage configuration. In-Reply-To: <8763mq7dr2.fsf@rho.meyering.net> References: <1226613928-20862-1-git-send-email-dpierce@redhat.com> <8763mq7dr2.fsf@rho.meyering.net> Message-ID: <1226785655.7344.13.camel@localhost.localdomain> On Fri, 2008-11-14 at 12:23 +0100, Jim Meyering wrote: > > This just shows that the node is assumed to have only one disk device. > Do we _need_ to account for any other scenario? > For now I'm not even trying to deal with alternatives. > If the node is connected to fiber channel storage then it's likely to see more than one device - for example a diskless blade server are a common choice for virtualization hosts. Can we have a simple UI to select from a list of drives? -------------- next part -------------- An HTML attachment was scrubbed... URL: From apevec at redhat.com Mon Nov 17 00:19:45 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 17 Nov 2008 01:19:45 +0100 Subject: [Ovirt-devel] Re: [PATCH node] Adds automatic non-interactive configuration for the standalone node. In-Reply-To: <1226688504-27016-1-git-send-email-dpierce@redhat.com> References: <1226688504-27016-1-git-send-email-dpierce@redhat.com> Message-ID: <4920B8A1.7050101@redhat.com> Darryl L. Pierce wrote: > NOTE: Sorry, again sent out a patch that had debugging code in it. :-/ > > If ovirt-config-network is called as follows: > > ovirt-config-network AUTO [NIC] [IP NETMASK GATEWAY BROADCAST] Default values don't need to be parameters, they're already stored in OVIRT_* variables. BTW, this patch didn't apply for me, but maybe I mis-ordered your outstanding patches - please list them how your have it in your > where NIC is the management interface to be configured. > The kernel arguments are: > * OVIRT_MGMT_IFACE: the management network interface name hmm, we don't have this boot parameter yet, it should be added to the parsing case in ovirt-early. But it could also be figured out automatically: for PXE boot we already have BOOTIF boot param. Assumption is that automated installs are mostly going to be done using PXE boot. > * OVIRT_IP_BROADCAST: the network broadcast address this one is not a parameter in pxelinux or anaconda format and ifcfg scripts derives it using ipcalc command From sburgess at redhat.com Mon Nov 17 08:08:43 2008 From: sburgess at redhat.com (Susan Burgess) Date: Mon, 17 Nov 2008 18:08:43 +1000 Subject: [Ovirt-devel] Doc Patch - Please ACK Message-ID: <4921268B.3040801@redhat.com> -- Susan Burgess Content Author Red Hat APAC Level 1, 193 North Quay Brisbane, QLD 4000 Australia Phone +61 7 3514 8179 Fax +61 7 3514 8199 Mail sburgess at redhat.com -------------- next part -------------- A non-text attachment was scrubbed... Name: DIFF.tgz Type: application/x-compressed-tar Size: 468754 bytes Desc: not available URL: From clalance at redhat.com Mon Nov 17 08:09:17 2008 From: clalance at redhat.com (Chris Lalancette) Date: Mon, 17 Nov 2008 09:09:17 +0100 Subject: [Ovirt-devel] [PATCH node] Added support for local storage configuration. In-Reply-To: <2be7262f0811150821j23273cb2tb020843409ff5f99@mail.gmail.com> References: <1226700163-6287-1-git-send-email-dpierce@redhat.com> <491EEDD1.6080905@redhat.com> <2be7262f0811150821j23273cb2tb020843409ff5f99@mail.gmail.com> Message-ID: <492126AD.7050203@redhat.com> Alan Pevec wrote: > Yes, bootparams we set by default in Cobbler, boot oVirt Node in managed > mode and this feature is for standalone mode only. > But if admin wants, s/he is free to PXE boot to standalone mode by > setting appropriate kernel options. > As always, you're free to shoot yourself in the foot, but that's the > price of freedom :) OK, cool, just wanted to confirm. Thanks! -- Chris Lalancette From jim at meyering.net Mon Nov 17 08:17:41 2008 From: jim at meyering.net (Jim Meyering) Date: Mon, 17 Nov 2008 09:17:41 +0100 Subject: [Ovirt-devel] Doc Patch - Please ACK In-Reply-To: <4921268B.3040801@redhat.com> (Susan Burgess's message of "Mon, 17 Nov 2008 18:08:43 +1000") References: <4921268B.3040801@redhat.com> Message-ID: <87vdumydei.fsf@rho.meyering.net> ACK From apevec at redhat.com Mon Nov 17 11:54:49 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 17 Nov 2008 12:54:49 +0100 Subject: [Ovirt-devel] Re: [PATCH node] Adds automatic non-interactive configuration for the standalone node. In-Reply-To: <4920B8A1.7050101@redhat.com> References: <1226688504-27016-1-git-send-email-dpierce@redhat.com> <4920B8A1.7050101@redhat.com> Message-ID: <49215B89.8060409@redhat.com> Alan Pevec wrote: > BTW, this patch didn't apply for me, but maybe I mis-ordered your > outstanding patches - please list them how your have it in your ok, I see now that each patch is relative to 'next', I'll rebase them to be a patch series From apevec at redhat.com Mon Nov 17 12:08:50 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 17 Nov 2008 13:08:50 +0100 Subject: [Ovirt-devel] [PATCH ovirt-node] Adds automatic non-interactive configuration for the standalone node. In-Reply-To: <1226688504-27016-1-git-send-email-dpierce@redhat.com> References: <1226688504-27016-1-git-send-email-dpierce@redhat.com> Message-ID: <1226923730-16509-1-git-send-email-apevec@redhat.com> From: Darryl L. Pierce NOTE: rebased to apply after: Moved network configuration work files to a temporary directory. Adds a "Save" option to save the configuration. If ovirt-config-network is called as follows: ovirt-config-network AUTO [NIC] [IP NETMASK GATEWAY BROADCAST] where NIC is the management interface to be configured. If the IP details are provided then they are used to configure the device. Otherwise DHCP will be used. The kernel arguments are: * OVIRT_MGMT_IFACE: the management network interface name * OVIRT_IP_ADDRESS: the IP address * OVIRT_IP_NETMASK: the netmask * OVIRT_IP_GATEWAY: the network gateway * OVIRT_IP_BROADCAST: the network broadcast address Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 84 +++++++++++++++++++++++++-------------- scripts/ovirt-firstboot | 12 +++++- 2 files changed, 65 insertions(+), 31 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 2ac3970..0d359a6 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -16,6 +16,11 @@ CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" function configure_interface { NIC=$1 + AUTO=$2 + IPADDR=$3 + NETMASK=$4 + GATEWAY=$5 + BROADCAST=$6 BRIDGE=ovirtbr`echo $NIC | cut -b4-` IF_FILENAME="$WORKDIR/augtool-$NIC" BR_FILENAME="$WORKDIR/augtool-$BRIDGE" @@ -34,21 +39,33 @@ function configure_interface # how do you want to configure this device? (dhcp, static IP) while true; do - printf "Will $BRIDGE use dynamic addressing? (Y/N) " - read + if [ -z "$AUTO" ]; then + read -p "Will $BRIDGE use dynamic addressing? (Y/N) " + else + if [ -z "$IPADDR" ]; then + REPLY="Y" + else + REPLY="N" + fi + fi + case $REPLY in Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp"; break ;; N|n) - printf "\nPlease enter the network details for $BRIDGE:\n" - printf "\tIP Address: "; read; IPADDR=$REPLY - printf "\t Netmask: "; read; NETMASK=$REPLY - printf "\t Broadcast: "; read; BROADCAST=$REPLY - printf "\t Gateway: "; read; GATEWAY=$REPLY - - printf "\nPlease review the details for $BRIDGE:\n" - printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Broadcast: $BROADCAST\n\t Gateway: $GATEWAY\n" - printf "Is this correct? (Y/N) " - read + if [ -z "$IPADDR" ]; then + printf "\nPlease enter the network details for $BRIDGE:\n" + printf "\tIP Address: "; read; IPADDR=$REPLY + printf "\t Netmask: "; read; NETMASK=$REPLY + printf "\t Broadcast: "; read; BROADCAST=$REPLY + printf "\t Gateway: "; read; GATEWAY=$REPLY + + printf "\nPlease review the details for $BRIDGE:\n" + printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Broadcast: $BROADCAST\n\t Gateway: $GATEWAY\n" + read -p "Is this correct? (Y/N) " + else + REPLY="Y" + fi + case $REPLY in Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPADDR $IPADDR" @@ -77,25 +94,32 @@ function setup_menu PS3="Please select a network interface to configure:" } -setup_menu +if [ "$1" == "AUTO" ]; then + configure_interface $2 AUTO $3 $4 $5 $6 + RESTART="Y" +else -select NIC in $NICS -do - printf "\n" - case "$NIC" in - "Save") break ;; - "Quit") exit 0 ;; - *) configure_interface $NIC $IFACE_NUMBER ;; - esac setup_menu -done - -# Merge together all generated files and run augtool -{ -config="$WORKDIR"/config-augtool -{ cat "$WORKDIR"/augtool-* && printf "save\n"; } > $config \ -&& augtool < "$WORKDIR"/config-augtool + select NIC in $NICS + do + printf "\n" + case "$NIC" in + "Save") RESTART="Y"; break ;; + "Quit") break ;; + *) configure_interface $NIC $IFACE_NUMBER ;; + esac + setup_menu + done -service network restart -} > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE +fi + +if [ "$RESTART" == "Y" ]; then + # Merge together all generated files and run augtool + { + config="$WORKDIR"/config-augtool + { cat "$WORKDIR"/augtool-* && printf "save\n"; } > $config \ + && augtool < "$WORKDIR"/config-augtool + service network restart + } > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE +fi diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot index 82d9e48..6eaf8b6 100755 --- a/scripts/ovirt-firstboot +++ b/scripts/ovirt-firstboot @@ -29,7 +29,17 @@ start () { - ovirt-config-setup + INTERACTIVE="Y" + + if [ -n "$OVIRT_MGMT_IFACE" ]; then + INTERACTIVE="N" + ./ovirt-config-networking AUTO $OVIRT_MGMT_IFACE\ + $OVIRT_IP_ADDRESS $OVIRT_IP_NETMASK $OVIRT_IP_GATEWAY $OVIRT_IP_BROADCAST + fi + + if [ "$INTERACTIVE" == "Y" ]; then + ovirt-config-setup + fi } case "$1" in -- 1.5.6.5 From berrange at redhat.com Mon Nov 17 12:14:21 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Mon, 17 Nov 2008 12:14:21 +0000 Subject: [Ovirt-devel] [PATCH ovirt-node] Adds automatic non-interactive configuration for the standalone node. In-Reply-To: <1226923730-16509-1-git-send-email-apevec@redhat.com> References: <1226688504-27016-1-git-send-email-dpierce@redhat.com> <1226923730-16509-1-git-send-email-apevec@redhat.com> Message-ID: <20081117121421.GB21429@redhat.com> On Mon, Nov 17, 2008 at 01:08:50PM +0100, Alan Pevec wrote: > From: Darryl L. Pierce > > NOTE: rebased to apply after: > Moved network configuration work files to a temporary directory. > Adds a "Save" option to save the configuration. > > If ovirt-config-network is called as follows: > > ovirt-config-network AUTO [NIC] [IP NETMASK GATEWAY BROADCAST] > > where NIC is the management interface to be configured. > > If the IP details are provided then they are used to configure the device. > Otherwise DHCP will be used. > > The kernel arguments are: > * OVIRT_MGMT_IFACE: the management network interface name This should really expect the MAC address rather than the interface name. An admin deploying a piece of hardware has no clue what name each NIC will be given by Linux. They do, however, know exactly what MAC address is associated with each NIC and which they have plugged into which LAN. So we should either use MAC exclusively or allow either a MAC or name here. > * OVIRT_IP_ADDRESS: the IP address > * OVIRT_IP_NETMASK: the netmask > * OVIRT_IP_GATEWAY: the network gateway > * OVIRT_IP_BROADCAST: the network broadcast address This latter BROADCAST address can be calculated from the ADDRESS+NETMASK. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From apevec at redhat.com Mon Nov 17 12:23:43 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 17 Nov 2008 13:23:43 +0100 Subject: [Ovirt-devel] [PATCH ovirt-node] Adds automatic non-interactive configuration for the standalone node. In-Reply-To: <20081117121421.GB21429@redhat.com> References: <1226688504-27016-1-git-send-email-dpierce@redhat.com> <1226923730-16509-1-git-send-email-apevec@redhat.com> <20081117121421.GB21429@redhat.com> Message-ID: <4921624F.9030009@redhat.com> Daniel P. Berrange wrote: >> The kernel arguments are: >> * OVIRT_MGMT_IFACE: the management network interface name > > This should really expect the MAC address rather than the interface > name. An admin deploying a piece of hardware has no clue what name > each NIC will be given by Linux. They do, however, know exactly what > MAC address is associated with each NIC and which they have plugged > into which LAN. So we should either use MAC exclusively or allow > either a MAC or name here. yes, to avoid boot parameter inflation, BOOTIF parameter set by pxelinux will be used >> * OVIRT_IP_BROADCAST: the network broadcast address > > This latter BROADCAST address can be calculated from the ADDRESS+NETMASK. yes, we can drop this altogether, it's obsolete to put that in ifcfg-* anyway This was just a repost of the original patch, rebased so that all outstanding patches can apply as a series. I'm now working on above modifications. From jim at meyering.net Mon Nov 17 12:28:08 2008 From: jim at meyering.net (Jim Meyering) Date: Mon, 17 Nov 2008 13:28:08 +0100 Subject: [Ovirt-devel] [PATCH ovirt-node] Adds automatic non-interactive configuration for the standalone node. In-Reply-To: <1226923730-16509-1-git-send-email-apevec@redhat.com> (Alan Pevec's message of "Mon, 17 Nov 2008 13:08:50 +0100") References: <1226688504-27016-1-git-send-email-dpierce@redhat.com> <1226923730-16509-1-git-send-email-apevec@redhat.com> Message-ID: <873ahqwn8n.fsf@rho.meyering.net> Alan Pevec wrote: > From: Darryl L. Pierce > NOTE: rebased to apply after: > Moved network configuration work files to a temporary directory. > Adds a "Save" option to save the configuration. > > If ovirt-config-network is called as follows: > > ovirt-config-network AUTO [NIC] [IP NETMASK GATEWAY BROADCAST] > > where NIC is the management interface to be configured. > > If the IP details are provided then they are used to configure the device. > Otherwise DHCP will be used. > > The kernel arguments are: > * OVIRT_MGMT_IFACE: the management network interface name > * OVIRT_IP_ADDRESS: the IP address > * OVIRT_IP_NETMASK: the netmask > * OVIRT_IP_GATEWAY: the network gateway > * OVIRT_IP_BROADCAST: the network broadcast address > > Signed-off-by: Darryl L. Pierce > --- > scripts/ovirt-config-networking | 84 +++++++++++++++++++++++++-------------- > scripts/ovirt-firstboot | 12 +++++- > 2 files changed, 65 insertions(+), 31 deletions(-) > > diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking ... > -{ > -config="$WORKDIR"/config-augtool > -{ cat "$WORKDIR"/augtool-* && printf "save\n"; } > $config \ > -&& augtool < "$WORKDIR"/config-augtool > + select NIC in $NICS > + do > + printf "\n" > + case "$NIC" in > + "Save") RESTART="Y"; break ;; > + "Quit") break ;; > + *) configure_interface $NIC $IFACE_NUMBER ;; > + esac > + setup_menu > + done > > -service network restart > -} > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE > +fi > + > +if [ "$RESTART" == "Y" ]; then > + # Merge together all generated files and run augtool > + { > + config="$WORKDIR"/config-augtool > + { cat "$WORKDIR"/augtool-* && printf "save\n"; } > $config \ > + && augtool < "$WORKDIR"/config-augtool > + service network restart > + } > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE The above looks fishy, with ">"; I suspect it truncates rather than appending. So maybe you want this instead: } >> $CONFIG_LOG_FILE 2>&1 Also, how about performing the network restart only if augtool etc. succeeded? [this also factors out another $config] { config="$WORKDIR"/config-augtool { cat "$WORKDIR"/augtool-* && printf "save\n"; } > $config \ && augtool < $config \ && service network restart } >> $CONFIG_LOG_FILE 2>&1 With iteration upon iteration like this, you can see how using a shared development/unstable/pu branch (with very permissive "push" policy) might help. From apevec at redhat.com Mon Nov 17 12:33:07 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 17 Nov 2008 13:33:07 +0100 Subject: [Ovirt-devel] [PATCH ovirt-node] Adds automatic non-interactive configuration for the standalone node. In-Reply-To: <873ahqwn8n.fsf@rho.meyering.net> References: <1226688504-27016-1-git-send-email-dpierce@redhat.com> <1226923730-16509-1-git-send-email-apevec@redhat.com> <873ahqwn8n.fsf@rho.meyering.net> Message-ID: <49216483.7070804@redhat.com> Jim Meyering wrote: ... Thanks for the fixes, I'll apply them. > With iteration upon iteration like this, you can see > how using a shared development/unstable/pu branch (with very > permissive "push" policy) might help. Yes, indeed! I'm just not sure if we should put that in the main git repo - I guess github would be good enough for such temporary dev. branches? From pmyers at redhat.com Mon Nov 17 13:06:41 2008 From: pmyers at redhat.com (Perry Myers) Date: Mon, 17 Nov 2008 08:06:41 -0500 Subject: [Ovirt-devel] [PATCH node-image] Add logic for allowing SSH keys to be included during livecd iso creation time Message-ID: <1226927201-3765-1-git-send-email-pmyers@redhat.com> This is to be used for development purposes only so that we can disable setting a default root password. If ovirt_dev is set to 1 (which happens if the Release in the spec file is 0) then this functionality is turned on by default. Signed-off-by: Perry Myers --- Makefile.am | 12 +++++++++--- ovirt-node-image.ks | 9 +++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index d594c90..d46ed58 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,6 +20,7 @@ OVIRT_LOCAL_REPO ?= file://$(OVIRT_CACHE_DIR)/ovirt OVIRT_URL ?= http://ovirt.org/repos/ovirt SUM ?= sha1sum PKG_FMT = iso +AUTH_KEYS ?= ~/.ssh/authorized_keys FEDORA_MIRROR = http://mirrors.fedoraproject.org/mirrorlist CUR_RAWHIDE = 10 @@ -50,7 +51,7 @@ DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz \ $(PACKAGE).$(PKG_FMT) \ $(NVR).$(PKG_FMT) \ $(NVR).$(PKG_FMT).$(SUM) \ - repos.ks + repos.ks ovirt-authorized_keys # For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT- # annotated rpm version strings. @@ -83,8 +84,13 @@ repos.ks: echo "repo --name=ovirt-local --baseurl=$(OVIRT_LOCAL_REPO)" >> $@ \ ) +keys: + if [ "$(_ovirt_dev)" = 1 -a -f $(AUTH_KEYS) ]; then \ + cp -va $(AUTH_KEYS) ovirt-authorized_keys ;\ + fi + SELINUX_ENFORCING=$(shell /usr/sbin/getenforce) -$(NVR).$(PKG_FMT): repos.ks +$(NVR).$(PKG_FMT): repos.ks keys mkdir -p $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp mkdir -p $(OVIRT_CACHE_DIR)/yum ( \ @@ -129,4 +135,4 @@ publish: rpms createrepo $(OVIRT_CACHE_DIR)/ovirt .PHONY: rpms publish $(NVR).$(PKG_FMT).$(SUM) $(NVR).$(PKG_FMT) \ - $(PACKAGE).$(PKG_FMT) + $(PACKAGE).$(PKG_FMT) keys diff --git a/ovirt-node-image.ks b/ovirt-node-image.ks index 20ec36c..3a6f399 100644 --- a/ovirt-node-image.ks +++ b/ovirt-node-image.ks @@ -19,6 +19,15 @@ touch /.autorelabel %include common-blacklist.ks %post --nochroot +if [ -f "ovirt-authorized_keys" ]; then + echo "Adding authorized_keys to Image" + mkdir -p $INSTALL_ROOT/root/.ssh + cp -v ovirt-authorized_keys $INSTALL_ROOT/root/.ssh/authorized_keys + chown -R root:root $INSTALL_ROOT/root/.ssh + chmod 755 $INSTALL_ROOT/root/.ssh + chmod 644 $INSTALL_ROOT/root/.ssh/authorized_keys +fi + echo "Fixing boot menu" # remove quiet from Node bootparams, added by livecd-creator sed -i -e 's/ quiet//' $LIVE_ROOT/isolinux/isolinux.cfg -- 1.6.0.3 From dpierce at redhat.com Mon Nov 17 14:05:20 2008 From: dpierce at redhat.com (Darryl Pierce) Date: Mon, 17 Nov 2008 09:05:20 -0500 Subject: [Ovirt-devel] [PATCH node] Added support for local storage configuration. In-Reply-To: <1226785655.7344.13.camel@localhost.localdomain> References: <1226613928-20862-1-git-send-email-dpierce@redhat.com> <8763mq7dr2.fsf@rho.meyering.net> <1226785655.7344.13.camel@localhost.localdomain> Message-ID: <200811170905.24312.dpierce@redhat.com> On Saturday 15 November 2008 4:47:35 pm Andrew Cathrow wrote: > On Fri, 2008-11-14 at 12:23 +0100, Jim Meyering wrote: > > This just shows that the node is assumed to have only one disk device. > > Do we _need_ to account for any other scenario? > > For now I'm not even trying to deal with alternatives. > > If the node is connected to fiber channel storage then it's likely to > see more than one device - for example a diskless blade server are a > common choice for virtualization hosts. > Can we have a simple UI to select from a list of drives? It wouldn't be difficult to do. I can submit a patch to do this. -- Darryl L. Pierce, Sr. Software Engineer Red Hat, Inc. - http://www.redhat.com/ oVirt - Virtual Machine Management - http://www.ovirt.org/ "What do you care what other people think, Mr. Feynman?" -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part. URL: From bkearney at redhat.com Mon Nov 17 14:38:45 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Mon, 17 Nov 2008 09:38:45 -0500 Subject: [Ovirt-devel] Questions on the Server Suite UI Message-ID: <492181F5.2030607@redhat.com> Below are a couple of functional question on the UI having installed it, and reviewed version .6 of the docs. I realize the answer may be "in an upcoming release", but I wanted to at least throw it out: 1) Can I set quotas at the VM pool level, or are they only inherited from the hardware pool? 2) Are there plans to support moving vm pools between hardware pools? 3) Can I move a storage server from one pool to another if it is being used? If not, where do I see the information about where it is being used? 4) In the appliance setup, is there a ui path to add users to LDAP? 5) In the docs it says that a user is defined at the Hardware / VM pool level and can not be moved. But, I assume that a person can have access to many hardware or VM pools. Is that accurate? 6) What is a SmartPool? Couple of UI RFEs: - Given the richness of the UI, I keep expecting a right click context menu. Especially in the tree nav. - When creating a VM, a refresh button would be nice. Unless you have push to the client. -- bk From dpierce at redhat.com Mon Nov 17 15:24:32 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Mon, 17 Nov 2008 10:24:32 -0500 Subject: [Ovirt-devel] [PATCH node] Adds automatic non-interactive configuration for the standalone node. Message-ID: <1226935472-11193-1-git-send-email-dpierce@redhat.com> If ovirt-config-network is called as follows: ovirt-config-network AUTO where NIC is the management interface to be configured. The kernel arguments are: * OVIRT_MGMT_IFACE: the management network interface name * OVIRT_IP_ADDRESS: the IP address * OVIRT_IP_NETMASK: the netmask * OVIRT_IP_GATEWAY: the network gateway This patch also incorporates changes to move configuration files into a temporary folder and to ensure that directory is deleted. Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 103 ++++++++++++++++++++++++--------------- scripts/ovirt-firstboot | 11 ++++- 2 files changed, 74 insertions(+), 40 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 2f8363c..4ad8af0 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -3,15 +3,27 @@ # Iterates over the list of network devices on the node and prompts the user # to configure each. +WORKDIR=$(mktemp -d) || exit 1 + +# Remove $WORKDIR upon interrupt (and HUP, PIPE, TERM) and upon normal +# termination, being careful not to change the exit status. +trap '__st=$?; rm -rf "$WORKDIR"; exit $__st' 0 +trap 'exit $?' 1 2 13 15 + CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" function configure_interface { NIC=$1 + AUTO=$2 + IPADDR=$OVIRT_IP_ADDRESS + NETMASK=$OVIRT_IP_NETMASK + GATEWAY=$OVIRT_IP_GATEWAY + BRIDGE=ovirtbr`echo $NIC | cut -b4-` - IF_FILENAME="/var/tmp/augtool-$NIC" - BR_FILENAME="/var/tmp/augtool-$BRIDGE" + IF_FILENAME="$WORKDIR/augtool-$NIC" + BR_FILENAME="$WORKDIR/augtool-$BRIDGE" printf "\nConfigure $BRIDGE for use by $NIC..\n\n" @@ -27,25 +39,35 @@ function configure_interface # how do you want to configure this device? (dhcp, static IP) while true; do - printf "Will $BRIDGE use dynamic addressing? (Y/N) " - read + if [ -z "$AUTO" ]; then + read -p "Will $BRIDGE use dynamic addressing? (Y/N) " + else + if [ -z "$IPADDR" ]; then + REPLY="Y" + else + REPLY="N" + fi + fi + case $REPLY in Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp"; break ;; N|n) - printf "\nPlease enter the network details for $BRIDGE:\n" - printf "\tIP Address: "; read; IPADDR=$REPLY - printf "\t Netmask: "; read; NETMASK=$REPLY - printf "\t Broadcast: "; read; BROADCAST=$REPLY - printf "\t Gateway: "; read; GATEWAY=$REPLY - - printf "\nPlease review the details for $BRIDGE:\n" - printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Broadcast: $BROADCAST\n\t Gateway: $GATEWAY\n" - printf "Is this correct? (Y/N) " - read + if [ -z "$IPADDR" ]; then + printf "\nPlease enter the network details for $BRIDGE:\n" + printf "\tIP Address: "; read; IPADDR=$REPLY + printf "\t Netmask: "; read; NETMASK=$REPLY + printf "\t Gateway: "; read; GATEWAY=$REPLY + + printf "\nPlease review the details for $BRIDGE:\n" + printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Gateway: $GATEWAY\n" + read -p "Is this correct? (Y/N) " + else + REPLY="Y" + fi + case $REPLY in Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPADDR $IPADDR" - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BROADCAST $BROADCAST" BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/NETMASK $NETMASK" break ;; @@ -66,32 +88,35 @@ function configure_interface function setup_menu { NICS=$(hal-device | awk '/net.interface/ {match($0, "= '"'"'(.*)'"'"' ", nic); printf("%s ", nic[1]); }') - NICS="$NICS Quit" + NICS="$NICS Save Quit" PS3="Please select a network interface to configure:" } -# clean up any left over configurations -rm -f /var/tmp/config-augtool -rm -f /var/tmp/augtool-* - -setup_menu - -select NIC in $NICS -do - printf "\n" - case "$NIC" in - "Quit") break ;; - *) configure_interface $NIC $IFACE_NUMBER ;; - esac +if [ "$1" == "AUTO" ]; then + configure_interface $OVIRT_MGMT_IFACE AUTO + RESTART="Y" +else setup_menu -done - -# Merge together all generated files and run augtool - -cat /var/tmp/augtool-* > /var/tmp/config-augtool -printf "save\n" >> /var/tmp/config-augtool -{ -augtool < /var/tmp/config-augtool -service network restart -} > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE + select NIC in $NICS + do + printf "\n" + case "$NIC" in + "Save") RESTART="Y"; break ;; + "Quit") exit 0; break ;; + *) configure_interface $NIC $IFACE_NUMBER ;; + esac + setup_menu + done +fi + +if [ "$RESTART" == "Y" ]; then + { + printf "Configuring network.\n" + config="$WORKDIR"/config-augtool + printf "config=$config\n" + { cat "$WORKDIR"/augtool-* && printf "save\n"; } > $config \ + && augtool < $config \ + && service network restart + } >> $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE +fi diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot index 82d9e48..2a47f7a 100755 --- a/scripts/ovirt-firstboot +++ b/scripts/ovirt-firstboot @@ -29,7 +29,16 @@ start () { - ovirt-config-setup + INTERACTIVE="Y" + + if [ -n "$OVIRT_MGMT_IFACE" ]; then + INTERACTIVE="N" + ./ovirt-config-networking AUTO + fi + + if [ "$INTERACTIVE" == "Y" ]; then + ovirt-config-setup + fi } case "$1" in -- 1.5.6.5 From dpierce at redhat.com Mon Nov 17 15:28:39 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Mon, 17 Nov 2008 10:28:39 -0500 Subject: [Ovirt-devel] [PATCH node] Adds automatic non-interactive configuration for the standalone node. Message-ID: <1226935719-11480-1-git-send-email-dpierce@redhat.com> If ovirt-config-network is called as follows: ovirt-config-network AUTO where NIC is the management interface to be configured. The kernel arguments are: * OVIRT_MGMT_IFACE: the management network interface name * OVIRT_IP_ADDRESS: the IP address * OVIRT_IP_NETMASK: the netmask * OVIRT_IP_GATEWAY: the network gateway This patch also incorporates changes to move configuration files into a temporary folder and to ensure that directory is deleted. Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 103 ++++++++++++++++++++++++--------------- scripts/ovirt-firstboot | 11 ++++- 2 files changed, 74 insertions(+), 40 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 2f8363c..4ad8af0 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -3,15 +3,27 @@ # Iterates over the list of network devices on the node and prompts the user # to configure each. +WORKDIR=$(mktemp -d) || exit 1 + +# Remove $WORKDIR upon interrupt (and HUP, PIPE, TERM) and upon normal +# termination, being careful not to change the exit status. +trap '__st=$?; rm -rf "$WORKDIR"; exit $__st' 0 +trap 'exit $?' 1 2 13 15 + CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" function configure_interface { NIC=$1 + AUTO=$2 + IPADDR=$OVIRT_IP_ADDRESS + NETMASK=$OVIRT_IP_NETMASK + GATEWAY=$OVIRT_IP_GATEWAY + BRIDGE=ovirtbr`echo $NIC | cut -b4-` - IF_FILENAME="/var/tmp/augtool-$NIC" - BR_FILENAME="/var/tmp/augtool-$BRIDGE" + IF_FILENAME="$WORKDIR/augtool-$NIC" + BR_FILENAME="$WORKDIR/augtool-$BRIDGE" printf "\nConfigure $BRIDGE for use by $NIC..\n\n" @@ -27,25 +39,35 @@ function configure_interface # how do you want to configure this device? (dhcp, static IP) while true; do - printf "Will $BRIDGE use dynamic addressing? (Y/N) " - read + if [ -z "$AUTO" ]; then + read -p "Will $BRIDGE use dynamic addressing? (Y/N) " + else + if [ -z "$IPADDR" ]; then + REPLY="Y" + else + REPLY="N" + fi + fi + case $REPLY in Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp"; break ;; N|n) - printf "\nPlease enter the network details for $BRIDGE:\n" - printf "\tIP Address: "; read; IPADDR=$REPLY - printf "\t Netmask: "; read; NETMASK=$REPLY - printf "\t Broadcast: "; read; BROADCAST=$REPLY - printf "\t Gateway: "; read; GATEWAY=$REPLY - - printf "\nPlease review the details for $BRIDGE:\n" - printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Broadcast: $BROADCAST\n\t Gateway: $GATEWAY\n" - printf "Is this correct? (Y/N) " - read + if [ -z "$IPADDR" ]; then + printf "\nPlease enter the network details for $BRIDGE:\n" + printf "\tIP Address: "; read; IPADDR=$REPLY + printf "\t Netmask: "; read; NETMASK=$REPLY + printf "\t Gateway: "; read; GATEWAY=$REPLY + + printf "\nPlease review the details for $BRIDGE:\n" + printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Gateway: $GATEWAY\n" + read -p "Is this correct? (Y/N) " + else + REPLY="Y" + fi + case $REPLY in Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPADDR $IPADDR" - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BROADCAST $BROADCAST" BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/NETMASK $NETMASK" break ;; @@ -66,32 +88,35 @@ function configure_interface function setup_menu { NICS=$(hal-device | awk '/net.interface/ {match($0, "= '"'"'(.*)'"'"' ", nic); printf("%s ", nic[1]); }') - NICS="$NICS Quit" + NICS="$NICS Save Quit" PS3="Please select a network interface to configure:" } -# clean up any left over configurations -rm -f /var/tmp/config-augtool -rm -f /var/tmp/augtool-* - -setup_menu - -select NIC in $NICS -do - printf "\n" - case "$NIC" in - "Quit") break ;; - *) configure_interface $NIC $IFACE_NUMBER ;; - esac +if [ "$1" == "AUTO" ]; then + configure_interface $OVIRT_MGMT_IFACE AUTO + RESTART="Y" +else setup_menu -done - -# Merge together all generated files and run augtool - -cat /var/tmp/augtool-* > /var/tmp/config-augtool -printf "save\n" >> /var/tmp/config-augtool -{ -augtool < /var/tmp/config-augtool -service network restart -} > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE + select NIC in $NICS + do + printf "\n" + case "$NIC" in + "Save") RESTART="Y"; break ;; + "Quit") exit 0; break ;; + *) configure_interface $NIC $IFACE_NUMBER ;; + esac + setup_menu + done +fi + +if [ "$RESTART" == "Y" ]; then + { + printf "Configuring network.\n" + config="$WORKDIR"/config-augtool + printf "config=$config\n" + { cat "$WORKDIR"/augtool-* && printf "save\n"; } > $config \ + && augtool < $config \ + && service network restart + } >> $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE +fi diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot index 82d9e48..ed4ad2d 100755 --- a/scripts/ovirt-firstboot +++ b/scripts/ovirt-firstboot @@ -29,7 +29,16 @@ start () { - ovirt-config-setup + INTERACTIVE="Y" + + if [ -n "$OVIRT_MGMT_IFACE" ]; then + INTERACTIVE="N" + ovirt-config-networking AUTO + fi + + if [ "$INTERACTIVE" == "Y" ]; then + ovirt-config-setup + fi } case "$1" in -- 1.5.6.5 From bkearney at redhat.com Mon Nov 17 15:27:23 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Mon, 17 Nov 2008 10:27:23 -0500 Subject: [Ovirt-devel] Questions on the Server Suite UI In-Reply-To: <492181F5.2030607@redhat.com> References: <492181F5.2030607@redhat.com> Message-ID: <49218D5B.7040007@redhat.com> Bryan Kearney wrote: > Below are a couple of functional question on the UI having installed it, > and reviewed version .6 of the docs. I realize the answer may be "in an > upcoming release", but I wanted to at least throw it out: > > > 1) Can I set quotas at the VM pool level, or are they only inherited > from the hardware pool? > 2) Are there plans to support moving vm pools between hardware pools? > 3) Can I move a storage server from one pool to another if it is being > used? If not, where do I see the information about where it is being used? > 4) In the appliance setup, is there a ui path to add users to LDAP? > 5) In the docs it says that a user is defined at the Hardware / VM pool > level and can not be moved. But, I assume that a person can have access > to many hardware or VM pools. Is that accurate? > 6) What is a SmartPool? > > > Couple of UI RFEs: > - Given the richness of the UI, I keep expecting a right click context > menu. Especially in the tree nav. > - When creating a VM, a refresh button would be nice. Unless you have > push to the client. > Follow up question: Assume I have a hardware pool with 40 cpus, 40 Gigs RAM, and 400 Gigs Storage. If I wanted to dole it out to several development teams, would the assumption be that I create a hardware pool with default quotas of (4, 4, 10) and then create 10 team Virtual Machine pools? If I assume that each team will use 1/2 of the capacity I give them, I could assume creating 15 to 20 Virtual Machine pools. Is there an expected best practice for this? -- bk From sseago at redhat.com Mon Nov 17 16:10:58 2008 From: sseago at redhat.com (Scott Seago) Date: Mon, 17 Nov 2008 11:10:58 -0500 Subject: [Ovirt-devel] Questions on the Server Suite UI In-Reply-To: <492181F5.2030607@redhat.com> References: <492181F5.2030607@redhat.com> Message-ID: <49219792.8010503@redhat.com> Bryan Kearney wrote: > Below are a couple of functional question on the UI having installed > it, and reviewed version .6 of the docs. I realize the answer may be > "in an upcoming release", but I wanted to at least throw it out: > > > 1) Can I set quotas at the VM pool level, or are they only inherited > from the hardware pool? Yes -- in fact the VM pool is the primary usage of quotas. At the hardware pool level, quotas are only meaningful as 'default' values inherited by VM pools that don't specify quotas. > 2) Are there plans to support moving vm pools between hardware pools? Not at the moment. > 3) Can I move a storage server from one pool to another if it is being > used? If not, where do I see the information about where it is being used? Right now we don't have validation in the UI to prevent this, but this validation must be put in -- otherwise you'll end up with VMs that are attached to storage that they shouldn't have access to. In addition we don't show this anywhere in the UI now, but we do need to show what storage a VM currently uses, and what VM a storage volume is currently attached to in their respective details panes. > 4) In the appliance setup, is there a ui path to add users to LDAP? As far as I know the only way to do this is via the IPA web UI or other IPA APIs. Although we are creating the ovirtadmin user, so it probably wouldn't be hard to use whatever API this uses to include other users as well. > 5) In the docs it says that a user is defined at the Hardware / VM > pool level and can not be moved. But, I assume that a person can have > access to many hardware or VM pools. Is that accurate? Sounds like the wording is a bit off there. Here's what's going on: 1) users aren't created in the ovirt WUI but in IPA 2) for any hardware or VM pool, users can be granted access (user/admin/etc) 3) when a user has access to a pool, he can access that pool and any pool below it (i.e. if a user can access a HW pool, that user can access all sub-HW pools and VM pools within it -- the admin user who can access the 'default' pool at top can access all pools 4) there are no limits on how many pools a user can be granted access to 5) but no, there isn't a way to transfer a user permission to another pool, since all that would mean would be that you're granting access in one place and revoking it elsewhere. > 6) What is a SmartPool? > It's just a fancy way of referring to tagging. I didn't come up with the name :-) But anyway basically a user can create a smart pool and "add" (i.e. tag) any number of hosts, vms, HW/VM pools, storage pools to it -- and these items will all show up together on that smart pool's page -- eventually with nice summary graphs too. But adding something to a smart pool doesn't change the underlying pool/permissions/access/etc -- it really is just tagging. > > Couple of UI RFEs: > - Given the richness of the UI, I keep expecting a right click context > menu. Especially in the tree nav. > - When creating a VM, a refresh button would be nice. Unless you have > push to the client. > Yes, certainly on the latter point we've discussed it -- we do want some form of client push eventually, but in the interim some sort of 'refresh this view/tab/details pane/etc' action would be useful. > > -- bk > > Scott > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel From lutter at redhat.com Mon Nov 17 16:16:07 2008 From: lutter at redhat.com (David Lutterkort) Date: Mon, 17 Nov 2008 17:16:07 +0100 Subject: [Ovirt-devel] [PATCH ovirt-node] Adds automatic non-interactive configuration for the standalone node. In-Reply-To: <873ahqwn8n.fsf@rho.meyering.net> References: <1226688504-27016-1-git-send-email-dpierce@redhat.com> <1226923730-16509-1-git-send-email-apevec@redhat.com> <873ahqwn8n.fsf@rho.meyering.net> Message-ID: <1226938567.4888.12.camel@localhost.localdomain> Morea question for Alan: On Mon, 2008-11-17 at 13:28 +0100, Jim Meyering wrote: > Also, how about performing the network restart only if augtool etc. > succeeded? [this also factors out another $config] > > { > config="$WORKDIR"/config-augtool > { cat "$WORKDIR"/augtool-* && printf "save\n"; } > $config \ > && augtool < $config \ > && service network restart > } >> $CONFIG_LOG_FILE 2>&1 Why not pipe straight into augtool ? { cat "$WORKDIR"/augtool-* && printf "save\n"; } | augtool Also, would it help if augtool had an option that appends a 'save' to any commands read from stdin, so that you could say for f in "$WORKDIR"/augtool-*; do; augtool --save $f; done Or not worth the trouble, especially when it comes to checking errors ? David From sseago at redhat.com Mon Nov 17 16:20:28 2008 From: sseago at redhat.com (Scott Seago) Date: Mon, 17 Nov 2008 11:20:28 -0500 Subject: [Ovirt-devel] Questions on the Server Suite UI In-Reply-To: <49218D5B.7040007@redhat.com> References: <492181F5.2030607@redhat.com> <49218D5B.7040007@redhat.com> Message-ID: <492199CC.2040104@redhat.com> Bryan Kearney wrote: > Bryan Kearney wrote: >> Below are a couple of functional question on the UI having installed >> it, and reviewed version .6 of the docs. I realize the answer may be >> "in an upcoming release", but I wanted to at least throw it out: >> >> >> 1) Can I set quotas at the VM pool level, or are they only inherited >> from the hardware pool? >> 2) Are there plans to support moving vm pools between hardware pools? >> 3) Can I move a storage server from one pool to another if it is >> being used? If not, where do I see the information about where it is >> being used? >> 4) In the appliance setup, is there a ui path to add users to LDAP? >> 5) In the docs it says that a user is defined at the Hardware / VM >> pool level and can not be moved. But, I assume that a person can have >> access to many hardware or VM pools. Is that accurate? >> 6) What is a SmartPool? >> >> >> Couple of UI RFEs: >> - Given the richness of the UI, I keep expecting a right click >> context menu. Especially in the tree nav. >> - When creating a VM, a refresh button would be nice. Unless you have >> push to the client. >> > Follow up question: > > Assume I have a hardware pool with 40 cpus, 40 Gigs RAM, and 400 Gigs > Storage. If I wanted to dole it out to several development teams, > would the assumption be that I create a hardware pool with default > quotas of (4, 4, 10) and then create 10 team Virtual Machine pools? If > I assume that each team will use 1/2 of the capacity I give them, I > could assume creating 15 to 20 Virtual Machine pools. Is there an > expected best practice for this? > One point here - -we're currently limited to a single layer of VM pools -- i.e. you can't split one VM pool into smaller sub-VM pools, although this functionality is eventually planned. So the next question to ask is whether the VMs for each team are truly shared (no individual permissions, anyone can start/stop any VM) or if each user should have exclusive create/destroy/etc rights for his own VMs. In the former case, then one VM pool per team would work -- in the latter case, then you'd want each developer on the team to have a separate VM pool, and you'd want to have a hardware pool for each team. So the suggestion you list above will work fine if each user in a team has total control over all of that team's resources. If you want per-user VM pools, your only choice right now would be to make sub-HW pools with 1/10 of the hosts and 1/10 of the storage in each, and break the VM pools out at that point. Once we implement nested VM pools then your specified use case above would still work fine in the per-user VMs case -- we'd just break each of those 10 VM pools down into sub-VM pools, with or without additional quota restrictions per user. Scott > -- bk > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel From bkearney at redhat.com Mon Nov 17 16:16:41 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Mon, 17 Nov 2008 11:16:41 -0500 Subject: [Ovirt-devel] Questions on the Server Suite UI In-Reply-To: <49219792.8010503@redhat.com> References: <492181F5.2030607@redhat.com> <49219792.8010503@redhat.com> Message-ID: <492198E9.5060406@redhat.com> Scott Seago wrote: > Bryan Kearney wrote: >> Below are a couple of functional question on the UI having installed >> it, and reviewed version .6 of the docs. I realize the answer may be >> "in an upcoming release", but I wanted to at least throw it out: >> >> >> 1) Can I set quotas at the VM pool level, or are they only inherited >> from the hardware pool? > Yes -- in fact the VM pool is the primary usage of quotas. At the > hardware pool level, quotas are only meaningful as 'default' values > inherited by VM pools that don't specify quotas. Ok.. my version does not have the ability to edit. Is that a bug or a "to be added" feature? >> 2) Are there plans to support moving vm pools between hardware pools? > Not at the moment. >> 3) Can I move a storage server from one pool to another if it is being >> used? If not, where do I see the information about where it is being >> used? > Right now we don't have validation in the UI to prevent this, but this > validation must be put in -- otherwise you'll end up with VMs that are > attached to storage that they shouldn't have access to. > In addition we don't show this anywhere in the UI now, but we do need to > show what storage a VM currently uses, and what VM a storage volume is > currently attached to in their respective details panes. Make sense. >> 4) In the appliance setup, is there a ui path to add users to LDAP? > As far as I know the only way to do this is via the IPA web UI or other > IPA APIs. Although we are creating the ovirtadmin user, so it probably > wouldn't be hard to use whatever API this uses to include other users as > well. On the appliance, is the LDAP UI exposed some place? >> 5) In the docs it says that a user is defined at the Hardware / VM >> pool level and can not be moved. But, I assume that a person can have >> access to many hardware or VM pools. Is that accurate? > Sounds like the wording is a bit off there. Here's what's going on: > 1) users aren't created in the ovirt WUI but in IPA > 2) for any hardware or VM pool, users can be granted access > (user/admin/etc) > 3) when a user has access to a pool, he can access that pool and any > pool below it (i.e. if a user can access a HW pool, that user can access > all sub-HW pools and VM pools within it -- the admin user who can access > the 'default' pool at top can access all pools > 4) there are no limits on how many pools a user can be granted access to > 5) but no, there isn't a way to transfer a user permission to another > pool, since all that would mean would be that you're granting access in > one place and revoking it elsewhere. Ok.. that make sense. I did not read the doco that way. >> 6) What is a SmartPool? >> > It's just a fancy way of referring to tagging. I didn't come up with the > name :-) > > But anyway basically a user can create a smart pool and "add" (i.e. tag) > any number of hosts, vms, HW/VM pools, storage pools to it -- and these > items will all show up together on that smart pool's page -- eventually > with nice summary graphs too. > > But adding something to a smart pool doesn't change the underlying > pool/permissions/access/etc -- it really is just tagging. I will keep playing with it. >> >> Couple of UI RFEs: >> - Given the richness of the UI, I keep expecting a right click context >> menu. Especially in the tree nav. >> - When creating a VM, a refresh button would be nice. Unless you have >> push to the client. >> > Yes, certainly on the latter point we've discussed it -- we do want some > form of client push eventually, but in the interim some sort of 'refresh > this view/tab/details pane/etc' action would be useful. >> >> -- bk >> >> > Scott > >> _______________________________________________ >> Ovirt-devel mailing list >> Ovirt-devel at redhat.com >> https://www.redhat.com/mailman/listinfo/ovirt-devel > From hbrock at redhat.com Mon Nov 17 16:23:33 2008 From: hbrock at redhat.com (Hugh O. Brock) Date: Mon, 17 Nov 2008 11:23:33 -0500 Subject: [Ovirt-devel] Questions on the Server Suite UI In-Reply-To: <492181F5.2030607@redhat.com> References: <492181F5.2030607@redhat.com> Message-ID: <20081117162333.GZ22797@redhat.com> On Mon, Nov 17, 2008 at 09:38:45AM -0500, Bryan Kearney wrote: > Below are a couple of functional question on the UI having installed it, > and reviewed version .6 of the docs. I realize the answer may be "in an > upcoming release", but I wanted to at least throw it out: Hi Bryan, thanks for checking out oVirt! > 1) Can I set quotas at the VM pool level, or are they only inherited > from the hardware pool? Yes -- in fact the VM pool is the main carrier for quotas. The hardware pool quota settings merely define a default for VM pools created within a hardware pool. I recall a bug one or two releases ago however where the "edit quota" link in the details pane for a VM pool was either obscured or missing -- I think I even filed the BZ for it. I thought it was fixed in the current release but maybe not. I'll check on it. > 2) Are there plans to support moving vm pools between hardware pools? I believe we had decided we didn't want to do this, simply because the act of moving a VM pool to another hardware pool would imply mass-migrating all the VMs there to a hardware pool where they would not necessarily be able to run (the hardware pool defines hardware compatibility -- e.g. Intel vs. AMD -- and migration boundaries). Can you think of a use case we should to support here? > 3) Can I move a storage server from one pool to another if it is being > used? If not, where do I see the information about where it is being > used? You can definitely move a storage server from one pool to another; however, we need to add validation to make sure you can't do that while the server is in use. There is a lot more UI around the whole storage server/storage volume area coming in the next release. > 4) In the appliance setup, is there a ui path to add users to LDAP? The path for the moment is to browse to http://management.priv.ovirt.org/ipa. However IPA's web UI requires that you have a kerberos principal, which you may not if you are browsing to the appliance from outside its management network. We have been leaning on the IPA guys to add fallback http authentication for this case, but they haven't done it yet. In a future release I would like to have a simple "add user" dialog within oVirt itself. > 5) In the docs it says that a user is defined at the Hardware / VM pool > level and can not be moved. But, I assume that a person can have access > to many hardware or VM pools. Is that accurate? Yes, I'm not sure what the docs are implying there. I assume they mean that user privileges are set for hardware pools or VM pools (correct). They inherit down the tree from there. > 6) What is a SmartPool? A SmartPool is a way to group arbitrary objects you might be interested in without navigating down the hierarchy to each one. So if I have servers in three different VM pools, for example, I might pull them all into a single smart pool to work on them or view their stats. > > Couple of UI RFEs: > - Given the richness of the UI, I keep expecting a right click context > menu. Especially in the tree nav. That would be a good idea, yes... paging Mr. Guiditta... > - When creating a VM, a refresh button would be nice. Unless you have > push to the client. Also true. push-to-the-client will be coming but not right away, and I'm not quire sure what form it will take yet. Thanks for this, let me know if you have any other questions! Take care, --Hugh From jim at meyering.net Mon Nov 17 16:24:21 2008 From: jim at meyering.net (Jim Meyering) Date: Mon, 17 Nov 2008 17:24:21 +0100 Subject: [Ovirt-devel] [PATCH ovirt-node] Adds automatic non-interactive configuration for the standalone node. In-Reply-To: <1226938567.4888.12.camel@localhost.localdomain> (David Lutterkort's message of "Mon, 17 Nov 2008 17:16:07 +0100") References: <1226688504-27016-1-git-send-email-dpierce@redhat.com> <1226923730-16509-1-git-send-email-apevec@redhat.com> <873ahqwn8n.fsf@rho.meyering.net> <1226938567.4888.12.camel@localhost.localdomain> Message-ID: <87bpweuxqi.fsf@rho.meyering.net> David Lutterkort wrote: > Morea question for Alan: > > On Mon, 2008-11-17 at 13:28 +0100, Jim Meyering wrote: >> Also, how about performing the network restart only if augtool etc. >> succeeded? [this also factors out another $config] >> >> { >> config="$WORKDIR"/config-augtool >> { cat "$WORKDIR"/augtool-* && printf "save\n"; } > $config \ >> && augtool < $config \ >> && service network restart >> } >> $CONFIG_LOG_FILE 2>&1 > > Why not pipe straight into augtool ? > > { cat "$WORKDIR"/augtool-* && printf "save\n"; } | augtool The reason is actually sort of subtle. If somehow cat or printf malfunctions (I/O error, ENOMEM) or is killed, the nonzero exit status won't propagate out, and augtool may be happy to parse the incomplete input. Then we'd restart the network, yet with incomplete config changes. That might be a hard one to diagnose. > Also, would it help if augtool had an option that appends a 'save' to > any commands read from stdin, so that you could say > > for f in "$WORKDIR"/augtool-*; do; augtool --save $f; done > > Or not worth the trouble, especially when it comes to checking errors ? Not worth it, IMHO. From sseago at redhat.com Mon Nov 17 16:25:52 2008 From: sseago at redhat.com (Scott Seago) Date: Mon, 17 Nov 2008 11:25:52 -0500 Subject: [Ovirt-devel] Questions on the Server Suite UI In-Reply-To: <492198E9.5060406@redhat.com> References: <492181F5.2030607@redhat.com> <49219792.8010503@redhat.com> <492198E9.5060406@redhat.com> Message-ID: <49219B10.5080209@redhat.com> Bryan Kearney wrote: > Scott Seago wrote: >> Bryan Kearney wrote: >>> Below are a couple of functional question on the UI having installed >>> it, and reviewed version .6 of the docs. I realize the answer may be >>> "in an upcoming release", but I wanted to at least throw it out: >>> >>> >>> 1) Can I set quotas at the VM pool level, or are they only inherited >>> from the hardware pool? >> Yes -- in fact the VM pool is the primary usage of quotas. At the >> hardware pool level, quotas are only meaningful as 'default' values >> inherited by VM pools that don't specify quotas. > > Ok.. my version does not have the ability to edit. Is that a bug or a > "to be added" feature? If your wui doesn't allow it now, sounds like a bug., We actually implemented VM pool quota editing _before_ HW pool quota editing. But I haven't looked at this functionality in a while. Feel free to add a bug. > >>> 4) In the appliance setup, is there a ui path to add users to LDAP? >> As far as I know the only way to do this is via the IPA web UI or >> other IPA APIs. Although we are creating the ovirtadmin user, so it >> probably wouldn't be hard to use whatever API this uses to include >> other users as well. > > On the appliance, is the LDAP UI exposed some place? > It's exposed via hte freeIPA UI at /ipa >>> 5) In the docs it says that a user is defined at the Hardware / VM >>> pool level and can not be moved. But, I assume that a person can >>> have access to many hardware or VM pools. Is that accurate? >> Sounds like the wording is a bit off there. Here's what's going on: >> 1) users aren't created in the ovirt WUI but in IPA >> 2) for any hardware or VM pool, users can be granted access >> (user/admin/etc) >> 3) when a user has access to a pool, he can access that pool and any >> pool below it (i.e. if a user can access a HW pool, that user can >> access all sub-HW pools and VM pools within it -- the admin user who >> can access the 'default' pool at top can access all pools >> 4) there are no limits on how many pools a user can be granted access to >> 5) but no, there isn't a way to transfer a user permission to another >> pool, since all that would mean would be that you're granting access >> in one place and revoking it elsewhere. > > Ok.. that make sense. I did not read the doco that way. > Maybe that bit of the doc should be revisited. Scott From pmyers at redhat.com Mon Nov 17 17:03:44 2008 From: pmyers at redhat.com (Perry Myers) Date: Mon, 17 Nov 2008 12:03:44 -0500 Subject: [Ovirt-devel] problem installing the appliance In-Reply-To: <5A0FF108221C7C4E85738678804B567C06C0935A@ftrdmel3> References: <5A0FF108221C7C4E85738678804B567C06C0935A@ftrdmel3> Message-ID: <4921A3F0.6010309@redhat.com> sylvain.desbureaux at orange-ftgroup.com wrote: > Hi all, First of all, I apologize if it's not the right place to send > questions about overt but this is the only mailing list I see. This is the right list. Sorry for the delay, didn't see this mail until recently :) > I've just installed ovirt-appliance 0.95.1 on fedora core 9 (not that > easy because I have my own dhcp server). After the installation, I can > connect to the web server but the authentication fail (http error_log > says it doesn't find any KDC). Except some trick on the hypervisor to > make the appliance running (stopping iptables and ip6tables, creating a > new script for putting the appliance tap on the good bridge), the > install is a stock one. I've took a look ? ipa.conf, krdc5.conf... but > I don't see where is the problem. Any ideas ? It could be an appliance initialization problem that we've recently seen here. The domain we're using on the appliance is priv.ovirt.org which actually does resolve externally since *.ovirt.org resolves as a wildcard. To confirm that this is the problem, if you can send me a few logs that would help me figure out what went wrong. Actually, if you can tar up your entire /var/log dir on the appliance and send it that would be best. Thanks, Perry From pmyers at redhat.com Mon Nov 17 18:07:00 2008 From: pmyers at redhat.com (Perry Myers) Date: Mon, 17 Nov 2008 13:07:00 -0500 Subject: [Ovirt-devel] Fwd: Re: [PATCH node-image] Add logic for allowing SSH keys to be included during livecd iso creation time In-Reply-To: <200811141749.09334.dpierce@redhat.com> References: <200811141749.09334.dpierce@redhat.com> Message-ID: <4921B2C4.4030102@redhat.com> Darryl Pierce wrote: > On Friday 14 November 2008 5:31:02 pm Perry Myers wrote: > > > During the build I got the following error and the build quit: > > /usr/local/dev/ovirt/test/appliance > mkdir -p scripts > cp -a create-ovirt-appliance create-ovirt-network create-ovirt-nodes \ > get-ovirt-appliance ovirt-appliance-functions scripts > ln -snf /usr/local/dev/ovirt/.ovirt-cache/ovirt-appliance-tmp tmp > sudo su -c "export > PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/mcpierce/bin:/home/mcpierce/bin:/home/mcpierce/bin:/sbin:/usr/sbin > && \ > appliance-creator --config ovirt-appliance.ks \ > --name ovirt-appliance -f qcow2 -p tar -d -v \ > --tmpdir='/usr/local/dev/ovirt/.ovirt-cache/ovirt-appliance-tmp' \ > --cache='/usr/local/dev/ovirt/.ovirt-cache/yum' \ > --vmem=768 \ > -i scripts" > included file 'scripts' does not exist > make[1]: *** [ovirt-appliance-0.96-x86_64.tar] Error 2 > make[1]: Leaving directory `/usr/local/dev/ovirt/test/appliance' > make: *** [publish] Error 1 You need an updated version of appliance-tools that is in the ovirt.org repository. Since the RPM no longer builds the appliance, putting this Requires dependency in the spec no longer makes sense, but it's difficult to ensure that the right version of the tools are installed otherwise. What I suggest is that ovirt-build RPM has Requires for all components that are necessary to build the oVirt code. I've sent a patch for the ovirt-release repository to do this. Please review and ack :) Perry From bkearney at redhat.com Mon Nov 17 18:08:19 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Mon, 17 Nov 2008 13:08:19 -0500 Subject: [Ovirt-devel] Questions on the Server Suite UI In-Reply-To: <20081117162333.GZ22797@redhat.com> References: <492181F5.2030607@redhat.com> <20081117162333.GZ22797@redhat.com> Message-ID: <4921B313.5050102@redhat.com> Hugh O. Brock wrote: > On Mon, Nov 17, 2008 at 09:38:45AM -0500, Bryan Kearney wrote: >> Below are a couple of functional question on the UI having installed it, >> and reviewed version .6 of the docs. I realize the answer may be "in an >> upcoming release", but I wanted to at least throw it out: > > Hi Bryan, thanks for checking out oVirt! > >> 1) Can I set quotas at the VM pool level, or are they only inherited >> from the hardware pool? > > Yes -- in fact the VM pool is the main carrier for quotas. The > hardware pool quota settings merely define a default for VM pools > created within a hardware pool. I recall a bug one or two releases ago > however where the "edit quota" link in the details pane for a VM pool > was either obscured or missing -- I think I even filed the BZ for > it. I thought it was fixed in the current release but maybe not. I'll > check on it. > >> 2) Are there plans to support moving vm pools between hardware pools? > > I believe we had decided we didn't want to do this, simply because the > act of moving a VM pool to another hardware pool would imply > mass-migrating all the VMs there to a hardware pool where they would > not necessarily be able to run (the hardware pool defines hardware > compatibility -- e.g. Intel vs. AMD -- and migration boundaries). Can > you think of a use case we should to support here? The use case I was thinking was one of quota policy. I could see using high level hardware pools as a means to group VM pools with the same quota and SLA. If a groups is granted a higher or lower Quota/SLA then I would want to move the vm pool to a new hardware pool. -- bk From hbrock at redhat.com Mon Nov 17 18:27:40 2008 From: hbrock at redhat.com (Hugh O. Brock) Date: Mon, 17 Nov 2008 13:27:40 -0500 Subject: [Ovirt-devel] Questions on the Server Suite UI In-Reply-To: <4921B313.5050102@redhat.com> References: <492181F5.2030607@redhat.com> <20081117162333.GZ22797@redhat.com> <4921B313.5050102@redhat.com> Message-ID: <20081117182740.GC22797@redhat.com> On Mon, Nov 17, 2008 at 01:08:19PM -0500, Bryan Kearney wrote: > Hugh O. Brock wrote: >> On Mon, Nov 17, 2008 at 09:38:45AM -0500, Bryan Kearney wrote: >>> Below are a couple of functional question on the UI having installed >>> it, and reviewed version .6 of the docs. I realize the answer may be >>> "in an upcoming release", but I wanted to at least throw it out: >> >> Hi Bryan, thanks for checking out oVirt! >> >>> 1) Can I set quotas at the VM pool level, or are they only inherited >>> from the hardware pool? >> >> Yes -- in fact the VM pool is the main carrier for quotas. The >> hardware pool quota settings merely define a default for VM pools >> created within a hardware pool. I recall a bug one or two releases ago >> however where the "edit quota" link in the details pane for a VM pool >> was either obscured or missing -- I think I even filed the BZ for >> it. I thought it was fixed in the current release but maybe not. I'll >> check on it. >> >>> 2) Are there plans to support moving vm pools between hardware pools? >> >> I believe we had decided we didn't want to do this, simply because the >> act of moving a VM pool to another hardware pool would imply >> mass-migrating all the VMs there to a hardware pool where they would >> not necessarily be able to run (the hardware pool defines hardware >> compatibility -- e.g. Intel vs. AMD -- and migration boundaries). Can >> you think of a use case we should to support here? > > The use case I was thinking was one of quota policy. I could see using > high level hardware pools as a means to group VM pools with the same > quota and SLA. If a groups is granted a higher or lower Quota/SLA then I > would want to move the vm pool to a new hardware pool. > Interesting. The more I think about it the more I think we really need to nest VM pools to handle it. Since the VM pool carries things like quota and (eventually) SLA, what you really probably want is to allow VM pools to have VM pool children that are subject to the SLA of the parent... and you want to be able to move a child VM pool from one parent to another. This keeps the hardware pool firmly in the physical-topology-related domain of network and migration boundaries, while tying VM pools more firmly to SLA and chargeback and so on. Scott, what do you think of this? Take care, --Hugh From bkearney at redhat.com Mon Nov 17 18:27:58 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Mon, 17 Nov 2008 13:27:58 -0500 Subject: [Ovirt-devel] Questions on the Server Suite UI In-Reply-To: <20081117182740.GC22797@redhat.com> References: <492181F5.2030607@redhat.com> <20081117162333.GZ22797@redhat.com> <4921B313.5050102@redhat.com> <20081117182740.GC22797@redhat.com> Message-ID: <4921B7AE.2090605@redhat.com> Hugh O. Brock wrote: > On Mon, Nov 17, 2008 at 01:08:19PM -0500, Bryan Kearney wrote: >> Hugh O. Brock wrote: >>> On Mon, Nov 17, 2008 at 09:38:45AM -0500, Bryan Kearney wrote: >>>> Below are a couple of functional question on the UI having installed >>>> it, and reviewed version .6 of the docs. I realize the answer may be >>>> "in an upcoming release", but I wanted to at least throw it out: >>> Hi Bryan, thanks for checking out oVirt! >>> >>>> 1) Can I set quotas at the VM pool level, or are they only inherited >>>> from the hardware pool? >>> Yes -- in fact the VM pool is the main carrier for quotas. The >>> hardware pool quota settings merely define a default for VM pools >>> created within a hardware pool. I recall a bug one or two releases ago >>> however where the "edit quota" link in the details pane for a VM pool >>> was either obscured or missing -- I think I even filed the BZ for >>> it. I thought it was fixed in the current release but maybe not. I'll >>> check on it. >>> >>>> 2) Are there plans to support moving vm pools between hardware pools? >>> I believe we had decided we didn't want to do this, simply because the >>> act of moving a VM pool to another hardware pool would imply >>> mass-migrating all the VMs there to a hardware pool where they would >>> not necessarily be able to run (the hardware pool defines hardware >>> compatibility -- e.g. Intel vs. AMD -- and migration boundaries). Can >>> you think of a use case we should to support here? >> The use case I was thinking was one of quota policy. I could see using >> high level hardware pools as a means to group VM pools with the same >> quota and SLA. If a groups is granted a higher or lower Quota/SLA then I >> would want to move the vm pool to a new hardware pool. >> > > Interesting. The more I think about it the more I think we really need > to nest VM pools to handle it. Since the VM pool carries things like > quota and (eventually) SLA, what you really probably want is to allow > VM pools to have VM pool children that are subject to the SLA of the > parent... and you want to be able to move a child VM pool from one > parent to another. This keeps the hardware pool firmly in the > physical-topology-related domain of network and migration boundaries, > while tying VM pools more firmly to SLA and chargeback and so on. > > Scott, what do you think of this? Either that, or you take in a mix-in approach where quota and SLA is provides as an attribute.. not as inheritance from its location in the tree. -- bk From sseago at redhat.com Mon Nov 17 18:38:29 2008 From: sseago at redhat.com (Scott Seago) Date: Mon, 17 Nov 2008 13:38:29 -0500 Subject: [Ovirt-devel] Questions on the Server Suite UI In-Reply-To: <4921B7AE.2090605@redhat.com> References: <492181F5.2030607@redhat.com> <20081117162333.GZ22797@redhat.com> <4921B313.5050102@redhat.com> <20081117182740.GC22797@redhat.com> <4921B7AE.2090605@redhat.com> Message-ID: <4921BA25.9000306@redhat.com> Bryan Kearney wrote: > Hugh O. Brock wrote: >> On Mon, Nov 17, 2008 at 01:08:19PM -0500, Bryan Kearney wrote: >>> Hugh O. Brock wrote: >>>> On Mon, Nov 17, 2008 at 09:38:45AM -0500, Bryan Kearney wrote: >>>>> Below are a couple of functional question on the UI having >>>>> installed it, and reviewed version .6 of the docs. I realize the >>>>> answer may be "in an upcoming release", but I wanted to at least >>>>> throw it out: >>>> Hi Bryan, thanks for checking out oVirt! >>>> >>>>> 1) Can I set quotas at the VM pool level, or are they only >>>>> inherited from the hardware pool? >>>> Yes -- in fact the VM pool is the main carrier for quotas. The >>>> hardware pool quota settings merely define a default for VM pools >>>> created within a hardware pool. I recall a bug one or two releases ago >>>> however where the "edit quota" link in the details pane for a VM pool >>>> was either obscured or missing -- I think I even filed the BZ for >>>> it. I thought it was fixed in the current release but maybe not. I'll >>>> check on it. >>>> >>>>> 2) Are there plans to support moving vm pools between hardware pools? >>>> I believe we had decided we didn't want to do this, simply because the >>>> act of moving a VM pool to another hardware pool would imply >>>> mass-migrating all the VMs there to a hardware pool where they would >>>> not necessarily be able to run (the hardware pool defines hardware >>>> compatibility -- e.g. Intel vs. AMD -- and migration boundaries). Can >>>> you think of a use case we should to support here? >>> The use case I was thinking was one of quota policy. I could see >>> using high level hardware pools as a means to group VM pools with >>> the same quota and SLA. If a groups is granted a higher or lower >>> Quota/SLA then I would want to move the vm pool to a new hardware >>> pool. >>> >> >> Interesting. The more I think about it the more I think we really need >> to nest VM pools to handle it. Since the VM pool carries things like >> quota and (eventually) SLA, what you really probably want is to allow >> VM pools to have VM pool children that are subject to the SLA of the >> parent... and you want to be able to move a child VM pool from one >> parent to another. This keeps the hardware pool firmly in the >> physical-topology-related domain of network and migration boundaries, >> while tying VM pools more firmly to SLA and chargeback and so on. >> >> Scott, what do you think of this? > > > Either that, or you take in a mix-in approach where quota and SLA is > provides as an attribute.. not as inheritance from its location in the > tree. > > -- bk Well that's sort of what we have. Quota only inherits from the parent if you don't provide one for the VM pool. Assuming we attach SLA to the quotas, this would probably be set up in a similar manner. Although you'd have additional flexibility with nested VM pools. Scott From jguiditt at redhat.com Mon Nov 17 20:16:31 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Mon, 17 Nov 2008 15:16:31 -0500 Subject: [Ovirt-devel] [PATCH server] DB change to support larger numbers. Message-ID: <1226952991-25573-1-git-send-email-jguiditt@redhat.com> Since we store mem, storage, etc in KB, we need an 8 byte int. This patch change all tables with this type of data to support larger size. Signed-off-by: Jason Guiditta --- src/db/migrate/029_update_integer_size.rb | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) create mode 100644 src/db/migrate/029_update_integer_size.rb diff --git a/src/db/migrate/029_update_integer_size.rb b/src/db/migrate/029_update_integer_size.rb new file mode 100644 index 0000000..5c67d48 --- /dev/null +++ b/src/db/migrate/029_update_integer_size.rb @@ -0,0 +1,22 @@ +class UpdateIntegerSize < ActiveRecord::Migration + def self.up + #Since we store mem, storage, etc in KB, we need an 8 byte int. + #Change all tables with this type of data to support larger size + + change_column :hosts, :memory, :integer, :limit => 8 + change_column :storage_volumes, :size, :integer, :limit => 8 + change_column :quotas, :total_vmemory, :integer, :limit => 8 + change_column :quotas, :total_storage, :integer, :limit => 8 + change_column :vms, :memory_allocated, :integer, :limit => 8 + change_column :vms, :memory_used, :integer, :limit => 8 + end + + def self.down + change_column :hosts, :memory, :integer, :limit => 4 + change_column :storage_volumes, :size, :integer, :limit => 4 + change_column :quotas, :total_vmemory, :integer, :limit => 4 + change_column :quotas, :total_storage, :integer, :limit => 4 + change_column :vms, :memory_allocated, :integer, :limit => 4 + change_column :vms, :memory_used, :integer, :limit => 4 + end +end -- 1.5.6.5 From jguiditt at redhat.com Mon Nov 17 20:21:04 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Mon, 17 Nov 2008 15:21:04 -0500 Subject: [Ovirt-devel] [PATCH server] Test/fixture revamp. In-Reply-To: <1226952991-25573-1-git-send-email-jguiditt@redhat.com> References: <1226952991-25573-1-git-send-email-jguiditt@redhat.com> Message-ID: <1226953264-25753-1-git-send-email-jguiditt@redhat.com> NOTE: This patch relies on previous one that changes int size of db tables. Redoing the test fixtures to take advantage of rails 2.1 'foxy fixtures'. This means very few ids, except for a couple special cases. This not only gets us closer to current rails standards, but makes the fixtures more readable and maintainable, which hopefully translates into making it less painful to write comprehensive tests for new code (and build out better tests for existing code). A side effect of this is that I have been trimming unneeded fixture entries and renaming many of the ones we are keeping so it is more clear what they are, as well as general cleanup of incorrect things like quotes where they shouldn't be. Signed-off-by: Jason Guiditta --- src/test/fixtures/bondings.yml | 26 ++-- src/test/fixtures/bondings_nics.yml | 15 -- src/test/fixtures/cpus.yml | 44 ++--- src/test/fixtures/hosts.yml | 221 ++++++++++----------- src/test/fixtures/ip_addresses.yml | 40 +---- src/test/fixtures/networks.yml | 36 ++-- src/test/fixtures/nics.yml | 94 +++------ src/test/fixtures/permissions.yml | 200 ++++--------------- src/test/fixtures/pools.yml | 163 +++++++--------- src/test/fixtures/quotas.yml | 88 +++------ src/test/fixtures/storage_pools.yml | 81 ++------ src/test/fixtures/storage_volumes.yml | 82 ++++---- src/test/fixtures/tasks.yml | 115 +---------- src/test/fixtures/vms.yml | 174 +++++----------- src/test/functional/host_controller_test.rb | 36 ++-- src/test/functional/nic_controller_test.rb | 8 +- src/test/functional/permission_controller_test.rb | 42 +++-- src/test/functional/quota_controller_test.rb | 45 +++-- src/test/functional/resources_controller_test.rb | 42 +++-- src/test/functional/storage_controller_test.rb | 40 +++-- src/test/functional/task_controller_test.rb | 4 +- src/test/functional/vm_controller_test.rb | 41 +++-- src/test/unit/active_record_env_test.rb | 10 +- src/test/unit/host_browser_awaken_test.rb | 3 +- src/test/unit/ip_address_test.rb | 13 +- src/test/unit/permission_test.rb | 12 +- src/test/unit/pool_test.rb | 8 +- src/test/unit/storage_pool_test.rb | 5 +- src/test/unit/storage_volume_test.rb | 4 +- src/test/unit/task_test.rb | 11 +- src/test/unit/vm_test.rb | 4 + 31 files changed, 641 insertions(+), 1066 deletions(-) delete mode 100644 src/test/fixtures/bondings_nics.yml diff --git a/src/test/fixtures/bondings.yml b/src/test/fixtures/bondings.yml index ee1939d..40d856c 100644 --- a/src/test/fixtures/bondings.yml +++ b/src/test/fixtures/bondings.yml @@ -1,15 +1,17 @@ mailservers_managed_node_bonding: - name: Production Network - interface_name: mailbonding0 - bonding_type_id: <%= Fixtures.identify(:link_aggregation_bonding_type) %> - host_id: <%= Fixtures.identify(:mailservers_managed_node) %> - arp_ping_address: 172.31.0.100 - arp_interval: 0 - vlan_id: <%= Fixtures.identify(:dhcp_vlan_one) %> + name: Production Network + interface_name: mailbonding0 + bonding_type: link_aggregation_bonding_type + host: mailservers_managed_node + arp_ping_address: 172.31.0.100 + arp_interval: 0 + vlan: dhcp_vlan_one + nics: mailserver_nic_one, mailserver_nic_two mediaserver_managed_node_bonding: - name: Fileserver Network - interface_name: mediabonding0 - bonding_type_id: <%= Fixtures.identify(:link_aggregation_bonding_type) %> - host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> - vlan_id: <%= Fixtures.identify(:dhcp_vlan_one) %> + name: Fileserver Network + interface_name: mediabonding0 + bonding_type: link_aggregation_bonding_type + host: mediaserver_managed_node + vlan: dhcp_vlan_one + nics: mediaserver_nic_one, mediaserver_nic_two diff --git a/src/test/fixtures/bondings_nics.yml b/src/test/fixtures/bondings_nics.yml deleted file mode 100644 index 607ff8b..0000000 --- a/src/test/fixtures/bondings_nics.yml +++ /dev/null @@ -1,15 +0,0 @@ -mailservers_managed_node_bonding_nic_1: - bonding_id: <%= Fixtures.identify(:mailservers_managed_node_bonding) %> - nic_id: <%= Fixtures.identify(:mailserver_nic_one) %> - -mailservers_managed_node_bonding_nic_2: - bonding_id: <%= Fixtures.identify(:mailservers_managed_node_bonding) %> - nic_id: <%= Fixtures.identify(:mailserver_nic_two) %> - -mediaservers_managed_node_bonding_nic_1: - bonding_id: <%= Fixtures.identify(:mediaserver_managed_node_bonding) %> - nic_id: <%= Fixtures.identify(:mediaserver_nic_one) %> - -mediaservers_managed_node_bonding_nic_2: - bonding_id: <%= Fixtures.identify(:mediaserver_managed_node_bonding) %> - nic_id: <%= Fixtures.identify(:mediaserver_nic_two) %> diff --git a/src/test/fixtures/cpus.yml b/src/test/fixtures/cpus.yml index 995b433..c49e574 100644 --- a/src/test/fixtures/cpus.yml +++ b/src/test/fixtures/cpus.yml @@ -1,65 +1,55 @@ -# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html - -one: - id: 1 - host_id: 10 +prod_corp_com_1: + host: prod_corp_com cpu_number: 1 core_number: 1 number_of_cores: 2 vendor: 'intel' -two: - id: 2 - host_id: 10 +prod_corp_com_2: + host: prod_corp_com cpu_number: 1 core_number: 2 number_of_cores: 2 vendor: 'intel' -three: - id: 3 - host_id: 10 +prod_corp_com_3: + host: prod_corp_com cpu_number: 2 core_number: 1 number_of_cores: 4 vendor: 'intel' -four: - id: 4 - host_id: 10 +prod_corp_com_4: + host: prod_corp_com cpu_number: 2 core_number: 2 number_of_cores: 4 vendor: 'intel' -five: - id: 5 - host_id: 10 +prod_corp_com_5: + host: prod_corp_com cpu_number: 2 core_number: 3 number_of_cores: 4 vendor: 'intel' -six: - id: 6 - host_id: 10 +buildserver_managed_node_1: + host: buildserver_managed_node cpu_number: 2 core_number: 4 number_of_cores: 4 vendor: 'intel' -seven: - id: 7 - host_id: 10 +buildserver_managed_node_2: + host: buildserver_managed_node cpu_number: 3 core_number: 1 number_of_cores: 1 vendor: 'intel' -seven: - id: 8 - host_id: 10 +buildserver_managed_node_3: + host: buildserver_managed_node cpu_number: 4 core_number: 1 number_of_cores: 1 - vendor: 'intel' + vendor: 'amd' diff --git a/src/test/fixtures/hosts.yml b/src/test/fixtures/hosts.yml index 28282c2..31e7580 100644 --- a/src/test/fixtures/hosts.yml +++ b/src/test/fixtures/hosts.yml @@ -1,137 +1,122 @@ -one: - id: 1 - uuid: '1148fdf8-961d-11dc-9387-001558c41534' - hostname: 'prod.corp.com' - arch: 'i686' +prod_corp_com: + uuid: 1148fdf8-961d-11dc-9387-001558c41534 + hostname: prod.corp.com + arch: i686 memory: 18384 is_disabled: 0 - hypervisor_type: 'xen' - hardware_pool_id: 3 -two: - id: 2 - uuid: '1f2a8694-961d-11dc-9387-001558c41534' - hostname: 'myworkstation.dev.corp.com' - arch: 'i386' + state: available + hypervisor_type: xen + hardware_pool: corp_com +workstation_corp_com: + uuid: 1f2a8694-961d-11dc-9387-001558c41534 + hostname: workstation.corp.com + arch: i386 memory: 2048 is_disabled: 0 - hypervisor_type: 'qemu' - hardware_pool_id: 4 -three: - id: 3 - uuid: '58a85f44-75fd-4934-805f-88e45b40d4b4' - hostname: 'macworkstation.foobar.com' - arch: 'mips' + hypervisor_type: qemu + hardware_pool: corp_com +macworkstation_qa_corp_com: + uuid: 58a85f44-75fd-4934-805f-88e45b40d4b4 + hostname: macworkstation.qa.corp.com + arch: mips memory: 2048 is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: 3 -four: - id: 4 - uuid: '520bbb34-6515-490e-9d07-0c8b14f76805' - hostname: 'fedoraworkstation.foobar.com' - arch: 'i386' + hypervisor_type: kvm + hardware_pool: corp_com_qa +fedoraworkstation_qa_corp_com: + uuid: 520bbb34-6515-490e-9d07-0c8b14f76805 + hostname: fedoraworkstation.qa.corp.com + arch: i386 memory: 2048 is_disabled: 1 - hypervisor_type: 'kvm' - hardware_pool_id: 3 -five: - id: 5 - uuid: '2e422f66-324e-48d4-973f-0b91b33070f9' - hostname: 'pipeline.foobar.com' - arch: 'xeon' + hypervisor_type: kvm + hardware_pool: corp_com_qa +pipeline_qa_corp_com: + uuid: 2e422f66-324e-48d4-973f-0b91b33070f9 + hostname: pipeline.qa.corp.com + arch: xeon memory: 1048576 is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: 3 -six: - id: 6 - uuid: 'bb0ce7c7-f234-49ae-84b5-6f4fd8bddcaa' - hostname: 'prod.foobar.com' - arch: 'xeon' + hypervisor_type: kvm + hardware_pool: corp_com_qa +app_qa_corp_com: + uuid: bb0ce7c7-f234-49ae-84b5-6f4fd8bddcaa + hostname: app.qa.corp.com + arch: xeon memory: 16384 is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: 3 -seven: - id: 7 - uuid: '6ae3d22e-97e0-4d86-9712-5395b20a0f45' - hostname: 'mystation.dev.corp.com' - arch: 'i686' + hypervisor_type: kvm + hardware_pool: corp_com_qa +issue_qa_corp_com: + uuid: ec0d86de-657b-48f6-b7cc-e733a3f9a834 + hostname: issue.qa.corp.com + arch: x86 + memory: 4096 + is_disabled: 0 + hypervisor_type: kvm + hardware_pool: corp_com_qa +db_dev_corp_com: + uuid: 81c15560-dbf4-45f5-9b75-106cdbd63aeb + hostname: db.dev.corp.com + arch: x86 + memory: 4096 + is_disabled: 0 + hypervisor_type: kvm + hardware_pool: corp_com_dev +mystation_dev_corp_com: + uuid: 6ae3d22e-97e0-4d86-9712-5395b20a0f45 + hostname: mystation.dev.corp.com + arch: i686 memory: 2048 is_disabled: 0 - hypervisor_type: 'xen' - hardware_pool_id: 4 -eight: - id: 8 - uuid: 'ec0d86de-657b-48f6-b7cc-e733a3f9a834' - hostname: 'issue.qa.corp.com' - arch: 'x86' - memory: 4096 - is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: 5 -nine: - id: 9 - uuid: '81c15560-dbf4-45f5-9b75-106cdbd63aeb' - hostname: 'somehost' - arch: 'x86' - memory: 4096 - is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: 3 -ten: - id: 10 - uuid: '75f8d5f3-faf0-4308-9f20-e4b03d013a27' - hostname: 'node3.priv.ovirt.org' - arch: 'x86_64' - memory: 4194304 - is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: 1 - state: "available" - + hypervisor_type: xen + hardware_pool: corp_com_dev +node3_priv_ovirt_org: + uuid: 75f8d5f3-faf0-4308-9f20-e4b03d013a27 + hostname: node3.priv.ovirt.org + arch: x86_64 + memory: 4194304 + is_disabled: 0 + hypervisor_type: kvm + hardware_pool: default + state: available mailservers_managed_node: - uuid: '182a8596-961d-11dc-9387-001558c41534' - hostname: 'mail.mynetwork.com' - arch: 'i386' - memory: 16384 - is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: <%= Fixtures.identify(:prodops_pool) %> - + uuid: 182a8596-961d-11dc-9387-001558c41534 + hostname: mail.mynetwork.com + arch: i386 + memory: 16384 + is_disabled: 0 + hypervisor_type: kvm + hardware_pool: corp_com_prod fileserver_managed_node: - uuid: '928ad8172-9723-11dc-9387-001558c41534' - hostname: 'files.mynetwork.com' - arch: 'x86_64' - memory: 32768 - is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: <%= Fixtures.identify(:prodops_pool) %> - + uuid: 928ad8172-9723-11dc-9387-001558c41534 + hostname: files.mynetwork.com + arch: x86_64 + memory: 32768 + is_disabled: 0 + hypervisor_type: kvm + hardware_pool: corp_com_prod ldapserver_managed_node: - uuid: '919ae372-9156-11dc-9387-001558c41534' - hostname: 'ldap.mynetwork.com' - arch: 'i386' - memory: 16384 - is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: <%= Fixtures.identify(:prodops_pool) %> - + uuid: 919ae372-9156-11dc-9387-001558c41534 + hostname: ldap.mynetwork.com + arch: i386 + memory: 16384 + is_disabled: 0 + hypervisor_type: kvm + hardware_pool: corp_com_prod buildserver_managed_node: - uuid: '6293acd9-2784-11dc-9387-001558c41534' - hostname: 'build.mynetwork.com' - arch: 'x86_64' - memory: 65536 - is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: <%= Fixtures.identify(:prodops_pool) %> - + uuid: 6293acd9-2784-11dc-9387-001558c41534 + hostname: build.mynetwork.com + arch: x86_64 + memory: 65536 + is_disabled: 0 + hypervisor_type: kvm + hardware_pool: corp_com_prod mediaserver_managed_node: - uuid: '6293acd9-2784-11dc-9387-001558c41534' - hostname: 'build.mynetwork.com' - arch: 'x86_64' - memory: 65536 - is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: <%= Fixtures.identify(:prodops_pool) %> - + uuid: 6293acd9-2784-11dc-9387-001558c41534 + hostname: build.mynetwork.com + arch: x86_64 + memory: 65536 + is_disabled: 0 + hypervisor_type: kvm + hardware_pool: corp_com_prod diff --git a/src/test/fixtures/ip_addresses.yml b/src/test/fixtures/ip_addresses.yml index aed3811..b19e9e1 100644 --- a/src/test/fixtures/ip_addresses.yml +++ b/src/test/fixtures/ip_addresses.yml @@ -1,37 +1,5 @@ -ip_v4_one: - nic_id: <%= Fixtures.identify(:nic_one) %> - type: IpV4Address - address: 1.2.3.4 - netmask: 255.255.255.0 - gateway: 1.2.3.1 - broadcast: 1.2.3.255 - -ip_v4_two: - nic_id: <%= Fixtures.identify(:nic_two) %> - type: IpV4Address - address: 2.3.4.5 - netmask: 255.255.255.0 - gateway: 1.2.3.1 - broadcast: 2.3.4.255 - -ip_v4_three: - nic_id: <%= Fixtures.identify(:nic_three) %> - type: IpV4Address - address: 3.4.5.6 - netmask: 255.255.255.0 - gateway: 3.4.5.1 - broadcast: 3.4.5.255 - -ip_v4_four: - nic_id: <%= Fixtures.identify(:nic_four) %> - type: IpV4Address - address: 3.4.5.6 - netmask: 255.255.255.0 - gateway: 3.4.5.1 - broadcast: 3.4.5.255 - ip_v4_mailserver_nic_one: - nic_id: <%= Fixtures.identify(:mailserver_nic_one) %> + nic: mailserver_nic_one type: IpV4Address address: 172.31.0.15 netmask: 255.255.255.0 @@ -39,13 +7,13 @@ ip_v4_mailserver_nic_one: broadcast: 172.31.0.255 ip_v4_ldapserver_nic_one: - nic_id: <%= Fixtures.identify(:ldapserver_nic_one) %> + nic: ldapserver_nic_one type: IpV4Address address: 172.31.0.25 gateway: 172.31.0.1 ip_v4_buildserver_nic_one: - nic_id: <%= Fixtures.identify(:buildserver_nic_two) %> + nic: buildserver_nic_two type: IpV4Address address: 172.31.0.31 netmask: 255.255.255.0 @@ -53,7 +21,7 @@ ip_v4_buildserver_nic_one: broadcast: 172.31.0.255 ip_v4_mailservers_managed_node_bonding: - bonding_id: <%= Fixtures.identify(:mailservers_managed_node_bonding) %> + bonding: mailservers_managed_node_bonding type: IpV4Address address: 192.168.50.100 netmask: 255.255.255.0 diff --git a/src/test/fixtures/networks.yml b/src/test/fixtures/networks.yml index cb50c0c..1ea2c7c 100644 --- a/src/test/fixtures/networks.yml +++ b/src/test/fixtures/networks.yml @@ -1,33 +1,33 @@ static_vlan_one: - type: 'Vlan' - name: 'Static Vlan 1' - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + type: Vlan + name: Static Vlan 1 + boot_type: boot_type_static_ip number: 1 dhcp_vlan_one: - type: 'Vlan' - name: 'DHCP Vlan 1' - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + type: Vlan + name: DHCP Vlan 1 + boot_type: boot_type_dhcp number: 2 bootp_vlan_one: - type: 'Vlan' - name: 'BOOTP Vlan 1' - boot_type_id: <%= Fixtures.identify(:boot_type_bootp) %> + type: Vlan + name: BOOTP Vlan 1 + boot_type: boot_type_bootp number: 3 static_physical_network_one: - type: 'PhysicalNetwork' - name: 'Static Physical Network 1' - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + type: PhysicalNetwork + name: Static Physical Network 1 + boot_type: boot_type_static_ip dhcp_physical_network_one: - type: 'PhysicalNetwork' - name: 'DHCP Physical Network 1' - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + type: PhysicalNetwork + name: DHCP Physical Network 1 + boot_type: boot_type_dhcp bootp_physical_network_one: - type: 'PhysicalNetwork' - name: 'BOOTP Physical Network 1' - boot_type_id: <%= Fixtures.identify(:boot_type_bootp) %> + type: PhysicalNetwork + name: BOOTP Physical Network 1 + boot_type: boot_type_bootp diff --git a/src/test/fixtures/nics.yml b/src/test/fixtures/nics.yml index 7f65ef6..a7851ff 100644 --- a/src/test/fixtures/nics.yml +++ b/src/test/fixtures/nics.yml @@ -1,84 +1,56 @@ -nic_one: - id: 1 - mac: '00:11:22:33:44:55' - bandwidth: 100 - host_id: 10 - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> -nic_two: - id: 2 - mac: 'AA:BB:CC:DD:EE:FF' - usage_type: '2' - bandwidth: 1000 - host_id: 10 - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> -nic_three: - id: 3 - mac: '00:FF:11:EE:22:DD' - usage_type: '1' - bandwidth: 10 - host_id: 10 - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> -nic_four: - id: 4 - mac: '00:FF:11:EE:22:DD' - usage_type: '1' - bandwidth: 10 - host_id: 10 - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> - mailserver_nic_one: - mac: '00:11:22:33:44:55' - usage_type: '1' + mac: 00:11:22:33:44:55 + usage_type: 1 bandwidth: 100 - host_id: <%= Fixtures.identify(:mailservers_managed_node) %> - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> + host: mailservers_managed_node + physical_network: dhcp_physical_network_one mailserver_nic_two: - mac: '22:11:33:66:44:55' - usage_type: '1' + mac: 22:11:33:66:44:55 + usage_type: 1 bandwidth: 100 - host_id: <%= Fixtures.identify(:mailservers_managed_node) %> - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> + host: mailservers_managed_node + physical_network: dhcp_physical_network_one fileserver_nic_one: - mac: '00:99:00:99:13:07' - usage_type: '1' + mac: 00:99:00:99:13:07 + usage_type: 1 bandwidth: 100 - host_id: <%= Fixtures.identify(:fileserver_managed_node) %> - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> + host: fileserver_managed_node + physical_network: dhcp_physical_network_one ldapserver_nic_one: - mac: '00:03:02:00:09:06' - usage_type: '1' + mac: 00:03:02:00:09:06 + usage_type: 1 bandwidth: 100 - bridge: 'ovirtbr0' - host_id: <%= Fixtures.identify(:ldapserver_managed_node) %> - physical_network_id: <%= Fixtures.identify(:static_physical_network_one) %> + bridge: ovirtbr0 + host: ldapserver_managed_node + physical_network: static_physical_network_one buildserver_nic_one: - mac: '07:17:19:65:03:38' - usage_type: '1' + mac: 07:17:19:65:03:38 + usage_type: 1 bandwidth: 100 - host_id: <%= Fixtures.identify(:buildserver_managed_node) %> - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> + host: buildserver_managed_node + physical_network: dhcp_physical_network_one buildserver_nic_two: - mac: '07:17:19:65:03:39' - usage_type: '1' + mac: 07:17:19:65:03:39 + usage_type: 1 bandwidth: 100 - host_id: <%= Fixtures.identify(:buildserver_managed_node) %> - physical_network_id: <%= Fixtures.identify(:static_physical_network_one) %> + host: buildserver_managed_node + physical_network: static_physical_network_one mediaserver_nic_one: - mac: '07:17:19:65:03:32' - usage_type: '1' + mac: 07:17:19:65:03:32 + usage_type: 1 bandwidth: 100 - host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> + host: mediaserver_managed_node + physical_network: dhcp_physical_network_one mediaserver_nic_two: - mac: '07:17:19:65:03:31' - usage_type: '1' + mac: 07:17:19:65:03:31 + usage_type: 1 bandwidth: 100 - host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> + host: mediaserver_managed_node + physical_network: dhcp_physical_network_one diff --git a/src/test/fixtures/permissions.yml b/src/test/fixtures/permissions.yml index e86a42e..4fff79e 100644 --- a/src/test/fixtures/permissions.yml +++ b/src/test/fixtures/permissions.yml @@ -1,161 +1,39 @@ -one: - id: 1 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 1 -two: - id: 2 - user_role: 'Administrator' - uid: 'jadmin' - pool_id: 3 -three: - id: 3 - user_role: 'User' - uid: 'buser' - pool_id: 10 -four: - id: 4 - user_role: 'Monitor' - uid: 'auser' - pool_id: 10 -five: - id: 5 - user_role: 'Administrator' - uid: 'kadmin' - pool_id: 6 -six: - id: 6 - user_role: 'Monitor' - uid: 'auser' - pool_id: 6 -seven: - id: 7 - user_role: 'User' - uid: 'luser' - pool_id: 7 -eight: - id: 8 - user_role: 'User' - uid: 'muser' - pool_id: 7 -nine: - id: 9 - user_role: 'Monitor' - uid: 'iuser' - pool_id: 7 -ten: - id: 10 - user_role: 'Administrator' - uid: 'qadmin' - pool_id: 6 -eleven: - id: 11 - user_role: 'Monitor' - uid: 'iuser' - pool_id: 6 -twelve: - id: 12 - user_role: 'User' - uid: 'buser' - pool_id: 2 -thirteen: - id: 13 - user_role: 'User' - uid: 'yuser' - pool_id: 9 -fourteen: - id: 14 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 2 - inherited_from_id: 1 -fifteen: - id: 15 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 3 - inherited_from_id: 1 -sixteen: - id: 16 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 4 - inherited_from_id: 1 -seventeen: - id: 17 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 5 - inherited_from_id: 1 -eighteen: - id: 18 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 6 - inherited_from_id: 1 -nineteen: - id: 19 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 7 - inherited_from_id: 1 -twenty: - id: 20 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 8 - inherited_from_id: 1 -twentyone: - id: 21 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 9 - inherited_from_id: 1 -twentytwo: - id: 22 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 10 - inherited_from_id: 1 -twentythree: - id: 23 - user_role: 'Administrator' - uid: 'jadmin' - pool_id: 4 - inherited_from_id: 2 -twentyfour: - id: 24 - user_role: 'Administrator' - uid: 'jadmin' - pool_id: 5 - inherited_from_id: 2 -twentyfive: - id: 25 - user_role: 'Administrator' - uid: 'jadmin' - pool_id: 6 - inherited_from_id: 2 -twentysix: - id: 26 - user_role: 'Administrator' - uid: 'jadmin' - pool_id: 7 - inherited_from_id: 2 -twentyseven: - id: 27 - user_role: 'Administrator' - uid: 'jadmin' - pool_id: 8 - inherited_from_id: 2 -twentyeight: - id: 28 - user_role: 'Administrator' - uid: 'jadmin' - pool_id: 9 - inherited_from_id: 2 -twentynine: - id: 29 - user_role: 'Administrator' - uid: 'jadmin' - pool_id: 10 - inherited_from_id: 2 +ovirtadmin_root: + user_role: Super Admin + uid: ovirtadmin + pool: root_dir_pool +ovirtadmin_default: + user_role: Super Admin + uid: ovirtadmin + pool: default + inherited_from_id: <%= Fixtures.identify(:ovirtadmin_root) %> +ovirtadmin_hardware_pool: + user_role: Super Admin + uid: ovirtadmin + pool: hw_dir_pool + inherited_from_id: <%= Fixtures.identify(:ovirtadmin_root) %> +ovirtadmin_users_pool: + user_role: Super Admin + uid: ovirtadmin + pool: smart_dir_pool + inherited_from_id: <%= Fixtures.identify(:ovirtadmin_root) %> +ovirtadmin_corp_com_pool: + user_role: Super Admin + uid: ovirtadmin + pool: corp_com + inherited_from_id: <%= Fixtures.identify(:ovirtadmin_root) %> +ovirtadmin_corp_com_production_vmpool: + user_role: Super Admin + uid: ovirtadmin + pool: corp_com_production_vmpool + inherited_from_id: <%= Fixtures.identify(:ovirtadmin_root) %> +ovirtadmin_prodops_pool: + user_role: Super Admin #Monitor + uid: ovirtadmin + pool: corp_com_prod + inherited_from_id: <%= Fixtures.identify(:ovirtadmin_root) %> +ovirtadmin_corp_com_qa_pool: + user_role: Monitor + uid: ovirtadmin + pool: corp_com_qa + inherited_from_id: <%= Fixtures.identify(:ovirtadmin_root) %> \ No newline at end of file diff --git a/src/test/fixtures/pools.yml b/src/test/fixtures/pools.yml index 181a75b..1c810b3 100644 --- a/src/test/fixtures/pools.yml +++ b/src/test/fixtures/pools.yml @@ -1,100 +1,77 @@ -one: - id: 1 - name: 'default' - type: 'HardwarePool' - parent_id: 12 - created_at: '2008-02-13 15:42:43.417883' - updated_at: '2008-02-14 16:41:42.417883' - lft: 3 +root_dir_pool: + name: root + type: DirectoryPool + lft: 1 + rgt: 26 +hw_dir_pool: + name: hardware + type: DirectoryPool + parent_id: <%= Fixtures.identify(:root_dir_pool) %> + lft: 2 + rgt: 19 +smart_dir_pool: + name: users + type: DirectoryPool + parent_id: <%= Fixtures.identify(:root_dir_pool) %> + lft: 20 + rgt: 25 +ovirtadmin_dir_pool: + name: ovirtadmin + type: DirectoryPool + parent_id: <%= Fixtures.identify(:smart_dir_pool) %> + lft: 21 rgt: 24 -two: - id: 2 - name: 'foobar hosts' - type: 'VmResourcePool' - parent_id: 1 +default: + name: default + type: HardwarePool + parent_id: <%= Fixtures.identify(:hw_dir_pool) %> + lft: 3 + rgt: 18 +corp_com: + name: corp.com + type: HardwarePool + parent_id: <%= Fixtures.identify(:default) %> lft: 4 - rgt: 5 -three: - id: 3 - name: 'corp.com' - type: 'HardwarePool' - parent_id: 1 - lft: 6 - rgt: 23 -four: - id: 4 - name: 'corp.com dev' - type: 'HardwarePool' - parent_id: 3 - lft: 7 + rgt: 17 +corp_com_prod: + name: Production Operations + type: HardwarePool + parent_id: <%= Fixtures.identify(:corp_com) %> + lft: 5 rgt: 8 -five: - id: 5 - name: 'corp.com qa' - type: 'HardwarePool' - parent_id: 3 +corp_com_qa: + name: corp.com qa + type: HardwarePool + parent_id: <%= Fixtures.identify(:corp_com) %> lft: 9 - rgt: 20 -six: - id: 6 - name: 'corp.com production vms' - type: 'VmResourcePool' - parent_id: 3 - lft: 21 - rgt: 22 -seven: - id: 7 - name: 'foobar' - type: 'VmResourcePool' - parent_id: 5 + rgt: 12 +corp_com_dev: + name: corp.com dev + type: HardwarePool + parent_id: <%= Fixtures.identify(:corp_com) %> + lft: 13 + rgt: 16 +corp_com_production_vmpool: + name: corp.com production vmpool + type: VmResourcePool + parent_id: <%= Fixtures.identify(:corp_com_prod) %> + lft: 6 + rgt: 7 +corp_qa_vmpool: + name: corp.com qa vms + type: VmResourcePool + parent_id: <%= Fixtures.identify(:corp_com_qa) %> lft: 10 rgt: 11 -eight: - id: 8 - name: 'some foobar hardware' - type: 'HardwarePool' - parent_id: 5 - lft: 12 +corp_com_dev_vmpool: + name: corp.com dev vmpool + type: VmResourcePool + parent_id: <%= Fixtures.identify(:corp_com_dev) %> + lft: 14 rgt: 15 -nine: - id: 9 - name: 'some more foobar hardware' - type: 'HardwarePool' - parent_id: 8 - lft: 13 - rgt: 14 -ten: - id: 10 - name: 'yet another pool' - type: 'VmResourcePool' - parent_id: 5 - lft: 16 - rgt: 17 -prodops_pool: - id: 11 - name: 'Production Operations' - type: 'HardwarePool' - parent_id: 5 - lft: 18 - rgt: 19 -hw_dir_pool: - id: 12 - name: 'hardware' - type: 'DirectoryPool' - parent_id: 13 - lft: 2 - rgt: 25 -root_dir_pool: - id: 13 - name: 'root' - type: 'DirectoryPool' - lft: 1 - rgt: 28 -smart_dir_pool: - id: 14 - name: 'hardware' - type: 'DirectoryPool' - parent_id: 13 - lft: 26 - rgt: 27 - +qa_testing_smartpool: + name: qa testing + type: SmartPool + parent_id: <%= Fixtures.identify(:ovirtadmin_dir_pool) %> + lft: 22 + rgt: 23 diff --git a/src/test/fixtures/quotas.yml b/src/test/fixtures/quotas.yml index 037fd67..f953d3a 100644 --- a/src/test/fixtures/quotas.yml +++ b/src/test/fixtures/quotas.yml @@ -1,65 +1,35 @@ -# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html -one: - id: 1 +default_quota: total_vcpus: 30 - total_vmemory: 2097152 + total_vmemory: 204800000 total_vnics: 20 - total_storage: 104857600 + total_storage: 41943040000 total_vms: 20 - pool_id: 1 -two: - id: 2 + pool: default +corp_com_quota: total_vcpus: 32 - total_vmemory: 16765 + total_vmemory: 51200000 + total_vnics: 20 + total_storage: 10485760000 + total_vms: 32 + pool: corp_com +corp_com_dev_quota: + total_vcpus: 4 + total_vmemory: 12288000 total_vnics: 5 - total_storage: 1000000 - total_vms: 13 - pool_id: 3 -three: - id: 3 - total_vcpus: 2 - total_vmemory: - total_vnics: - total_storage: - total_vms: - pool_id: 4 -four: - id: 4 - total_vcpus: - total_vmemory: - total_vnics: - total_storage: - total_vms: 2 - pool_id: 6 -five: - id: 5 - total_vcpus: 3 - total_vmemory: 1024 - total_vnics: - total_storage: 150 - total_vms: - pool_id: 5 -six: - id: 6 + total_storage: 2621440000 + total_vms: 8 + pool: corp_com_dev +corp_com_qa_quota: total_vcpus: 4 - total_vmemory: 5096 - total_vnics: 3 - total_storage: 1024 - total_vms: 2 - pool_id: 5 -seven: - id: 7 - total_vcpus: - total_vmemory: - total_vnics: 1 - total_storage: 112233 - total_vms: - pool_id: 11 -eight: - id: 8 - total_vcpus: 20 - total_vmemory: 2097152 - total_vnics: 30 - total_storage: 1111111111 - total_vms: 20 - pool_id: 7 + total_vmemory: 12288000 + total_vnics: 5 + total_storage: 2621440000 + total_vms: 8 + pool: corp_com_qa +corp_com_prod_quota: + total_vcpus: 4 + total_vmemory: 12288000 + total_vnics: 5 + total_storage: 2621440000 + total_vms: 8 + pool: corp_com_prod diff --git a/src/test/fixtures/storage_pools.yml b/src/test/fixtures/storage_pools.yml index ac042a0..604b49c 100644 --- a/src/test/fixtures/storage_pools.yml +++ b/src/test/fixtures/storage_pools.yml @@ -1,65 +1,16 @@ -one: - id: 1 - hardware_pool_id: 3 - ip_addr: '127.0.0.1' - type: 'IscsiStoragePool' - port: 53 - target: 'footarget' -two: - id: 2 - hardware_pool_id: 4 - type: 'NfsStoragePool' - ip_addr: '127.0.0.1' - export_path: '/tmp/foopath' -three: - id: 3 - hardware_pool_id: 4 - type: 'NfsStoragePool' - ip_addr: '192.168.50.1' - export_path: '/tmp/barpath' -four: - id: 4 - hardware_pool_id: 9 - type: 'IscsiStoragePool' - port: 121 - ip_addr: '192.168.50.1' - target: 'rubarb' - hardware_pool_id: 1 -five: - id: 5 - hardware_pool_id: 9 - type: 'NfsStoragePool' - ip_addr: '192.168.50.2' - export_path: '/tmp/thepath' -six: - id: 6 - hardware_pool_id: 9 - type: 'NfsStoragePool' - ip_addr: '192.168.50.3' - export_path: '/tmp/anotherpath' -seven: - id: 7 - hardware_pool_id: 9 - type: 'NfsStoragePool' - ip_addr: '192.168.50.4' - export_path: '/tmp/apath' -eight: - id: 8 - hardware_pool_id: 9 - ip_addr: '192.168.50.2' - type: 'IscsiStoragePool' - port: 531 - target: 'bartarget' -nine: - id: 9 - hardware_pool_id: 9 - type: 'NfsStoragePool' - ip_addr: '1.2.3.4' - export_path: '/tmp/somepath' -ten: - id: 10 - hardware_pool_id: 9 - type: 'IscsiStoragePool' - ip_addr: '192.168.50.3' - port: 539 - target: 'stayontarget' +corp_com_ovirtpriv_storage: + hardware_pool: corp_com + ip_addr: 192.168.50.2 + type: IscsiStoragePool + port: 3260 + target: ovirtpriv:storage +corp_com_nfs_ovirtnfs: + hardware_pool: corp_com + type: NfsStoragePool + ip_addr: 192.168.50.2 + export_path: /ovirtnfs +corp_com_dev_nfs_ovirtnfs: + hardware_pool: corp_com_dev + type: NfsStoragePool + ip_addr: 192.168.50.3 + export_path: /devnfs diff --git a/src/test/fixtures/storage_volumes.yml b/src/test/fixtures/storage_volumes.yml index 1c49ace..82a1860 100644 --- a/src/test/fixtures/storage_volumes.yml +++ b/src/test/fixtures/storage_volumes.yml @@ -1,40 +1,42 @@ -# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html -one: - id: 1 - lun: 'abcd' - size: '10485760' - path: '/tmp/foobar' - storage_pool_id: 1 - type: 'IscsiStorageVolume' -two: - id: 2 - size: '20485760' - path: '/home/secretstuff' - storage_pool_id: 2 - type: 'NfsStorageVolume' - filename: 'secretstuff' -three: - id: 3 - lun: 'abcd' - size: '14221672' - path: - storage_pool_id: 1 - type: 'IscsiStorageVolume' -four: - id: 4 - lun: '49723e4d-32e6-469e-8019-913a3dc1bb5d' - size: '01223542' - storage_pool_id: 4 - type: 'IscsiStorageVolume' -five: - id: 5 - size: '42424242' - storage_pool_id: 2 - type: 'NfsStorageVolume' - filename: 'foobar' -six: - id: 6 - size: '007007' - storage_pool_id: 6 - type: 'NfsStorageVolume' - filename: 'barfoo' +ovirtpriv_storage_lun_1: + lun: lun-1 + size: 3145728 + path: /dev/disk/by-id/scsi-S_beaf321011 + storage_pool: corp_com_ovirtpriv_storage + type: IscsiStorageVolume + state: pending_setup +ovirtpriv_storage_lun_2: + lun: lun-2 + size: 3145728 + path: /dev/disk/by-id/scsi-S_beaf321012 + storage_pool: corp_com_ovirtpriv_storage + type: IscsiStorageVolume + state: pending_setup +ovirtpriv_storage_lun_3: + lun: lun-3 + size: 3145728 + path: /dev/disk/by-id/scsi-S_beaf321013 + storage_pool: corp_com_ovirtpriv_storage + type: IscsiStorageVolume + state: pending_setup +ovirt_nfs_disk_1: + size: 3145728 + path: /mnt/a3q49Sj4Sfmae1bV/disk1.dsk + storage_pool: corp_com_nfs_ovirtnfs + type: NfsStorageVolume + filename: disk1.dsk + state: pending_setup +ovirt_nfs_disk_2: + size: 3145728 + path: /mnt/a3q49Sj4Sfmae1bV/disk2.dsk + storage_pool: corp_com_nfs_ovirtnfs + type: NfsStorageVolume + filename: disk2.dsk + state: pending_setup +ovirt_nfs_disk_3: + size: 3145728 + path: /mnt/a3q49Sj4Sfmae1bV/disk3.dsk + storage_pool: corp_com_nfs_ovirtnfs + type: NfsStorageVolume + filename: disk3.dsk + state: pending_setup \ No newline at end of file diff --git a/src/test/fixtures/tasks.yml b/src/test/fixtures/tasks.yml index 404543c..7f1e0bf 100644 --- a/src/test/fixtures/tasks.yml +++ b/src/test/fixtures/tasks.yml @@ -1,110 +1,9 @@ -one: - id: 1 - user: 'admin' - action: 'create_vm' - state: 'queued' +shutdown_production_httpd_appliance_task: + user: ovirtadmin + action: shutdown_vm + state: running args: - created_at: '2008-02-13 15:42:43.417883' - time_started: - time_ended: + created_at: 2008-02-13 15:42:43.417883 message: - type: 'VmTask' - task_target_type: 'Vm' - task_target_id: 5 -two: - id: 2 - user: 'admin' - action: 'refresh_pool' - state: 'queued' - created_at: '2008-01-13 15:40:13.417883' - type: 'StorageTask' - task_target_type: 'StoragePool' - task_target_id: 1 -three: - id: 3 - user: 'luser' - action: 'start_vm' - state: 'finished' - created_at: '2002-12-14 05:12:23.417883' - time_started: '2002-12-14 05:12:23.417884' - time_ended: '2002-12-14 05:12:23.417885' - message: 'finished!' - type: 'VmTask' - task_target_type: 'Vm' - task_target_id: 7 -four: - id: 4 - user: 'buser' - action: 'pause_vm' - state: 'running' - created_at: '2015-11-23 15:12:43.417883' - time_started: '2015-11-23 15:12:43.417885' - type: 'VmTask' - task_target_type: 'Vm' - task_target_id: 2 -five: - id: 5 - user: 'admin' - action: 'pause_vm' - state: 'running' - created_at: '2015-11-23 15:12:43.417883' - time_started: '2015-11-23 15:12:43.417885' - type: 'VmTask' - task_target_type: 'Vm' - task_target_id: 3 -six: - id: 6 - user: 'buser' - action: 'clear_vms' - state: 'canceled' - created_at: '2001-01-03 01:01:01.417883' - time_started: '2001-01-03 01:05:01.417885' - time_ended: '2001-01-03 01:05:19.417885' - message: 'task cancelled' - type: 'HostTask' - task_target_type: 'Host' - task_target_id: 9 -seven: - id: 7 - user: 'yuser' - action: 'refresh_pool' - state: 'failed' - created_at: '2001-05-10 13:47:53.417883' - time_started: '2001-05-10 13:49:12.417885' - time_ended: '2001-01-10 13:49:15.417885' - message: 'task failed, insufficient permissions' - type: 'StorageTask' - task_target_type: 'StoragePool' - task_target_id: 4 -eight: - id: 8 - user: 'yuser' - action: 'refresh_pool' - state: 'finished' - created_at: '2001-05-10 13:51:53.417883' - time_started: '2001-05-10 13:53:12.417885' - time_ended: '2001-01-10 14:04:15.417885' - message: 'completed' - type: 'StorageTask' - task_target_type: 'StoragePool' - task_target_id: 4 -nine: - id: 9 - user: 'kadmin' - action: 'save_vm' - state: 'paused' - created_at: '2008-04-20 04:00:00.417883' - time_started: '2008-04-20 20:00:00.417885' - message: 'paused' - type: 'VmTask' - task_target_type: 'Vm' - task_target_id: 12 -ten: - id: 10 - user: 'kadmin' - action: 'shutdown_vm' - state: 'queued' - created_at: '2008-04-20 20:05:30.417883' - type: 'VmTask' - task_target_type: 'Vm' - task_target_id: 12 + type: VmTask + task_target: production_httpd_vm (Vm) diff --git a/src/test/fixtures/vms.yml b/src/test/fixtures/vms.yml index ca783e6..ca0d63f 100644 --- a/src/test/fixtures/vms.yml +++ b/src/test/fixtures/vms.yml @@ -1,168 +1,104 @@ -one: - id: 1 - uuid: 'dd2573c3-b97d-493d-bedf-6a8369c965e9' - description: 'production httpd appliance' +production_httpd_vm: + uuid: dd2573c3-b97d-493d-bedf-6a8369c965e9 + description: production httpd appliance num_vcpus_allocated: 2 num_vcpus_used: 2 memory_allocated: 262144 - memory_used: 1024 - vnic_mac_addr: '23:51:90:A1:13:37' - state: 'stopped' + memory_used: 131072 + vnic_mac_addr: 23:51:90:A1:13:37 + state: stopped needs_restart: 0 - boot_device: 'hd' - host_id: 1 - vm_resource_pool_id: 7 -two: - id: 2 - uuid: '89e62d32-04d9-4351-b573-b1a253397296' - description: 'production mysqld appliance' + boot_device: hd + host: prod_corp_com + vm_resource_pool: corp_com_production_vmpool +production_mysqld_vm: + uuid: 89e62d32-04d9-4351-b573-b1a253397296 + description: production mysqld appliance num_vcpus_allocated: 2 num_vcpus_used: 1 memory_allocated: 2048 memory_used: 512 - vnic_mac_addr: '15:99:FE:ED:11:EE' - state: 'running' + vnic_mac_addr: 15:99:FE:ED:11:EE + state: running needs_restart: 0 - boot_device: 'network' - host_id: 1 - vm_resource_pool_id: 7 -three: - id: 3 - uuid: 'e2714087-3a71-460c-8112-23e044f0aa1c' - description: 'production ftpd appliance' + boot_device: network + host: prod_corp_com + vm_resource_pool: corp_com_production_vmpool +production_ftpd_vm: + uuid: e2714087-3a71-460c-8112-23e044f0aa1c + description: production ftpd appliance num_vcpus_allocated: 2 num_vcpus_used: 1 memory_allocated: 1024 memory_used: 512 - vnic_mac_addr: 'FF:AA:BB:00:11:55' - state: 'stopped' + vnic_mac_addr: FF:AA:BB:00:11:55 + state: stopped needs_restart: 1 - boot_device: 'cdrom' - host_id: 1 - vm_resource_pool_id: 7 -four: - id: 4 - uuid: '95454587-24e0-4a52-bb0f-c16abf7433d0' - description: 'production postgresql appliance' + boot_device: cdrom + host: prod_corp_com + vm_resource_pool: corp_com_production_vmpool +production_postgresql_vm: + uuid: 95454587-24e0-4a52-bb0f-c16abf7433d0 + description: production postgresql appliance num_vcpus_allocated: 2 num_vcpus_used: 2 memory_allocated: 2048 memory_used: 1536 - vnic_mac_addr: '48:24:12:93:42:11' - state: 'running' + vnic_mac_addr: 48:24:12:93:42:11 + state: running needs_restart: 0 - boot_device: 'hd' - host_id: 1 - vm_resource_pool_id: 7 -five: - id: 5 - uuid: 'aae029b7-0e9a-4327-8f8a-8447f473a75b' - description: 'foobar pipeline stage1: dev' - num_vcpus_allocated: 2 - num_vcpus_used: 2 - memory_allocated: 2048 - memory_used: 2048 - vnic_mac_addr: '19:18:17:16:15:14' - state: 'running' - needs_restart: 0 - boot_device: 'hd' - host_id: 5 - vm_resource_pool_id: 2 -six: - id: 6 - uuid: 'd02d27b9-328b-4d70-8237-28557e053cb6' - description: 'foobar pipeline stage2: qa' - num_vcpus_allocated: 2 - num_vcpus_used: 2 - memory_allocated: 4096 - memory_used: 4098 - vnic_mac_addr: '25:62:A1:0F:EE:BB' - state: 'running' - needs_restart: 0 - boot_device: 'hd' - host_id: 5 - vm_resource_pool_id: 2 -seven: - id: 7 - uuid: '56f9d73d-d7bb-48d1-bc0e-0308fc22c504' - description: 'foobar pipeline stage3: stage1' + boot_device: hd + host: myworkstation_dev_corp_com + vm_resource_pool: corp_com_production_vmpool +foobar_prod1_vm: + uuid: 786c824a-392f-4bce-b5bb-6765f810acd1 + description: foobar prod1 num_vcpus_allocated: 2 num_vcpus_used: 2 memory_allocated: 4096 memory_used: 4096 - vnic_mac_addr: '42:42:42:42:42:42' - state: 'running' + vnic_mac_addr: FF:FF:FF:EE:EE:EE + state: running needs_restart: 0 - boot_device: 'cdrom' - host_id: 5 - vm_resource_pool_id: 2 -eight: - id: 8 - uuid: '1135ffad-78c7-437c-95c6-74302cf48198' - description: 'foobar pipeline stage3: stage2' - num_vcpus_allocated: 2 - num_vcpus_used: 2 - memory_allocated: 4096 - memory_used: 4096 - vnic_mac_addr: '24:24:24:24:24:24' - state: 'running' - needs_restart: 0 - boot_device: 'cdrom' - host_id: 5 - vm_resource_pool_id: 2 -nine: - id: 9 - uuid: '786c824a-392f-4bce-b5bb-6765f810acd1' - description: 'foobar prod1' - num_vcpus_allocated: 2 - num_vcpus_used: 2 - memory_allocated: 4096 - memory_used: 4096 - vnic_mac_addr: 'FF:FF:FF:EE:EE:EE' - state: 'running' - needs_restart: 0 - boot_device: 'cdrom' - host_id: 6 + boot_device: cdrom + host: fedoraworkstation_foobar_com vm_resource_pool_id: 2 ten: - id: 10 - uuid: '24b9a994-d415-481d-ace8-1d810b601eb6' - description: 'foobar prod2' + uuid: 24b9a994-d415-481d-ace8-1d810b601eb6 + description: foobar prod2 num_vcpus_allocated: 2 num_vcpus_used: 2 memory_allocated: 4096 memory_used: 4096 - vnic_mac_addr: 'EE:EE:EE:FF:FF:FF' - state: 'running' + vnic_mac_addr: EE:EE:EE:FF:FF:FF + state: running needs_restart: 0 - boot_device: 'cdrom' + boot_device: cdrom host_id: 6 vm_resource_pool_id: 2 eleven: - id: 11 - uuid: '9b2c3c73-1abe-460e-b671-b8b7b6719e4c' - description: 'corp.com errata appliance' + uuid: 9b2c3c73-1abe-460e-b671-b8b7b6719e4c + description: corp.com errata appliance num_vcpus_allocated: 2 num_vcpus_used: 2 memory_allocated: 2048 memory_used: 2048 - vnic_mac_addr: '77:77:77:77:77:77' - state: 'running' + vnic_mac_addr: 77:77:77:77:77:77 + state: running needs_restart: 0 - boot_device: 'network' + boot_device: network host_id: 8 vm_resource_pool_id: 6 twelve: - id: 12 - uuid: '552134c7-b0ad-4607-bbf5-d6b9a33c2476' - description: 'corp.com bugzilla appliance' + uuid: 552134c7-b0ad-4607-bbf5-d6b9a33c2476 + description: corp.com bugzilla appliance num_vcpus_allocated: 2 num_vcpus_used: 2 memory_allocated: 2048 memory_used: 2048 - vnic_mac_addr: '77:77:77:77:77:77' - state: 'running' + vnic_mac_addr: 77:77:77:77:77:77 + state: running needs_restart: 0 - boot_device: 'network' + boot_device: network host_id: 8 vm_resource_pool_id: 6 diff --git a/src/test/functional/host_controller_test.rb b/src/test/functional/host_controller_test.rb index 9dc73e9..9a97009 100644 --- a/src/test/functional/host_controller_test.rb +++ b/src/test/functional/host_controller_test.rb @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2008 Red Hat, Inc. # Written by Scott Seago # @@ -31,7 +31,7 @@ class HostControllerTest < Test::Unit::TestCase @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @first_id = hosts(:one).id + @host_id = hosts(:prod_corp_com).id end def test_index @@ -50,7 +50,7 @@ class HostControllerTest < Test::Unit::TestCase end def test_show - get :show, :id => @first_id + get :show, :id => @host_id assert_response :success assert_template 'show' @@ -60,10 +60,10 @@ class HostControllerTest < Test::Unit::TestCase end def test_new - get :new, :hardware_pool_id => 1 + get :new, :hardware_pool_id => pools(:default).id assert_response :redirect - assert_redirected_to :controller => 'hardware', :action => 'show', :id => 1 + assert_redirected_to :controller => 'hardware', :action => 'show', :id => pools(:default).id end def test_create @@ -78,32 +78,32 @@ class HostControllerTest < Test::Unit::TestCase end def test_edit - get :edit, :id => @first_id + get :edit, :id => @host_id assert_response :redirect - assert_redirected_to :action => 'show', :id => @first_id + assert_redirected_to :action => 'show', :id => @host_id assert_not_nil assigns(:host) assert assigns(:host).valid? end def test_update - post :update, :id => @first_id + post :update, :id => @host_id assert_response :redirect - assert_redirected_to :action => 'show', :id => @first_id + assert_redirected_to :action => 'show', :id => @host_id end def test_destroy - assert_nothing_raised { - Host.find(@first_id) - } - - post :destroy, :id => @first_id + #FIXME: this controller method does nothing, do we even need it or a test? + post :destroy, :id => @host_id assert_response :redirect - assert_redirected_to :action => 'show', :id => @first_id + assert_redirected_to :action => 'show', :id => @host_id + end - assert_nothing_raised { - Host.find(@first_id) - } + def test_disable_host + post :host_action, :action_type => 'disable', :id => @host_id + assert_response :success + json = ActiveSupport::JSON.decode(@response.body) + assert_equal 'Host was successfully disabled', json['alert'] end end diff --git a/src/test/functional/nic_controller_test.rb b/src/test/functional/nic_controller_test.rb index 673e399..8a8776a 100644 --- a/src/test/functional/nic_controller_test.rb +++ b/src/test/functional/nic_controller_test.rb @@ -24,14 +24,14 @@ require 'nic_controller' class NicController; def rescue_action(e) raise e end; end class NicControllerTest < Test::Unit::TestCase - fixtures :nics, :permissions + fixtures :permissions, :pools, :nics def setup @controller = NicController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @first_id = nics(:nic_one).id + @first_id = nics(:fileserver_nic_one).id end def test_show @@ -45,10 +45,10 @@ class NicControllerTest < Test::Unit::TestCase end def test_new - get :new, :host_id => 1 + get :new, :host_id => pools(:default).id assert_response :redirect - assert_redirected_to :controller => 'host', :action => 'show', :id => 1 + assert_redirected_to :controller => 'host', :action => 'show', :id => pools(:default).id end end diff --git a/src/test/functional/permission_controller_test.rb b/src/test/functional/permission_controller_test.rb index 45e7ec5..c32100a 100644 --- a/src/test/functional/permission_controller_test.rb +++ b/src/test/functional/permission_controller_test.rb @@ -1,4 +1,4 @@ - + # Copyright (C) 2008 Red Hat, Inc. # Written by Scott Seago # @@ -24,18 +24,18 @@ require 'permission_controller' class PermissionController; def rescue_action(e) raise e end; end class PermissionControllerTest < Test::Unit::TestCase - fixtures :permissions + fixtures :permissions, :pools def setup @controller = PermissionController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @first_id = permissions(:one).id + @permission_id = permissions(:ovirtadmin_default).id end def test_show - get :show, :id => @first_id + get :show, :id => @permission_id assert_response :success assert_template 'show' @@ -45,7 +45,7 @@ class PermissionControllerTest < Test::Unit::TestCase end def test_new - get :new, :pool_id => 1 + get :new, :pool_id => pools(:default).id assert_response :success assert_template 'new' @@ -55,26 +55,32 @@ class PermissionControllerTest < Test::Unit::TestCase def test_create num_permissions = Permission.count - - post :create, :permission => { :user_role => 'Administrator', :uid => 'admin', :pool_id => 2} - + post :create, :permission => { :user_role => 'Administrator', + :uid => 'admin', + :pool_id => pools(:corp_com_production_vmpool).id} assert_response :success - assert_equal num_permissions + 1, Permission.count end def test_destroy - assert_nothing_raised { - Permission.find(@first_id) - } - - post :destroy, :id => @first_id + post :destroy, :id => @permission_id assert_response :redirect - assert_redirected_to :controller => 'hardware', :action => 'show', :id => 1 + assert_redirected_to :controller => 'hardware', :action => 'show', :id => pools(:default).id + assert_equal "ovirtadmin permissions were revoked successfully" , flash[:notice] + end + def test_no_perms_to_destroy + post :destroy, :id => permissions(:ovirtadmin_corp_com_qa_pool).id + assert_response :redirect + assert_redirected_to :controller => 'hardware', :action => 'show', :id => pools(:corp_com_qa).id + assert_equal "You do not have permission to delete this permission record" , flash[:notice] + end - assert_raise(ActiveRecord::RecordNotFound) { - Permission.find(@first_id) - } + #FIXME: write the code to make this a real test! + def test_bad_id_on_destroy +# post :destroy, :id => bad_id +# assert_response :success +# The controller needs to gracefully handle ActiveRecord::RecordNotFound, +# which it does not right now. end end diff --git a/src/test/functional/quota_controller_test.rb b/src/test/functional/quota_controller_test.rb index c87faef..dd44dfc 100644 --- a/src/test/functional/quota_controller_test.rb +++ b/src/test/functional/quota_controller_test.rb @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2008 Red Hat, Inc. # Written by Scott Seago # @@ -24,18 +24,18 @@ require 'quota_controller' class QuotaController; def rescue_action(e) raise e end; end class QuotaControllerTest < Test::Unit::TestCase - fixtures :quotas + fixtures :quotas, :pools def setup @controller = QuotaController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @first_id = quotas(:one).id + @quota_id = quotas(:default_quota).id end def test_show - get :show, :id => @first_id + get :show, :id => @quota_id assert_response :success assert_template 'show' @@ -45,7 +45,7 @@ class QuotaControllerTest < Test::Unit::TestCase end def test_new - get :new, :pool_id => 1 + get :new, :pool_id => pools(:default).id assert_response :success assert_template 'new' @@ -56,7 +56,7 @@ class QuotaControllerTest < Test::Unit::TestCase def test_create num_quotas = Quota.count - post :create, :quota => { :pool_id => 8 } + post :create, :quota => { :pool_id => pools(:default).id } assert_response :success @@ -64,7 +64,7 @@ class QuotaControllerTest < Test::Unit::TestCase end def test_edit - get :edit, :id => @first_id + get :edit, :id => @quota_id assert_response :success assert_template 'edit' @@ -74,22 +74,31 @@ class QuotaControllerTest < Test::Unit::TestCase end def test_update - post :update, :id => @first_id + post :update, :id => @quota_id assert_response :success end def test_destroy - pool = nil - assert_nothing_raised { - quota = Quota.find(@first_id) - pool = quota.pool - } - - post :destroy, :id => @first_id + post :destroy, :id => @quota_id assert_response :success + json = ActiveSupport::JSON.decode(@response.body) + assert_equal 'Quota was successfully deleted.', json['alert'] + end + + def test_not_destroyed + assert true #How do we make it return failure message? + end + + def test_no_perms_to_destroy + post :destroy, :id => quotas(:corp_com_dev_quota).id + assert_response :redirect #Is this really what we want? Or should we just pop up the login page? + end - assert_raise(ActiveRecord::RecordNotFound) { - Quota.find(@first_id) - } + #FIXME: write the code to make this a real test! + def test_bad_id_on_destroy +# post :destroy, :id => bad_id +# assert_response :success +# The controller needs to gracefully handle ActiveRecord::RecordNotFound, +# which it does not right now. end end diff --git a/src/test/functional/resources_controller_test.rb b/src/test/functional/resources_controller_test.rb index 49e8d0e..8e3989b 100644 --- a/src/test/functional/resources_controller_test.rb +++ b/src/test/functional/resources_controller_test.rb @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2008 Red Hat, Inc. # Written by Scott Seago # @@ -18,8 +18,20 @@ # also available at http://www.gnu.org/copyleft/gpl.html. require File.dirname(__FILE__) + '/../test_helper' +require 'resources_controller' + +# Re-raise errors caught by the controller. +class ResourcesController; def rescue_action(e) raise e end; end class ResourcesControllerTest < ActionController::TestCase + fixtures :permissions, :pools + + def setup + @controller = ResourcesController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + def test_index get :index assert_response :success @@ -27,45 +39,39 @@ class ResourcesControllerTest < ActionController::TestCase end def test_new - get :new, :parent_id => 1 + get :new, :parent_id => pools(:default).id assert_response :success end def test_create assert_difference('VmResourcePool.count') do - post :create, :vm_resource_pool => { :name => 'foo_resource_pool' }, :parent_id => 1 + post :create, :vm_resource_pool => { :name => 'foo_resource_pool' }, :parent_id => pools(:default).id end assert_response :success end def test_show - get :show, :id => 2 + get :show, :id => pools(:corp_com_production_vmpool).id assert_response :success end - def test_get - get :edit, :id => 2 + def test_edit + get :edit, :id => pools(:corp_com_production_vmpool).id assert_response :success end def test_update - put :update, :id => 2, :vm_resource_pool => { } + put :update, :id => pools(:corp_com_production_vmpool).id, :vm_resource_pool => { } assert_response :redirect assert_redirected_to :action => 'list' end - def test_destroy - pool = nil - assert_nothing_raised { - pool = VmResourcePool.find(10).parent.id - } - - post :destroy, :id => 10 + def test_destroy_valid_pool + post :destroy, :id => pools(:corp_com_production_vmpool).id assert_response :success - - assert_raise(ActiveRecord::RecordNotFound) { - VmResourcePool.find(10) - } + json = ActiveSupport::JSON.decode(@response.body) + assert_equal 'Virtual Machine Pool was successfully deleted.', json['alert'] end + end diff --git a/src/test/functional/storage_controller_test.rb b/src/test/functional/storage_controller_test.rb index a9f7eb9..a448fdf 100644 --- a/src/test/functional/storage_controller_test.rb +++ b/src/test/functional/storage_controller_test.rb @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2008 Red Hat, Inc. # Written by Scott Seago # @@ -24,14 +24,15 @@ require 'storage_controller' class StorageController; def rescue_action(e) raise e end; end class StorageControllerTest < Test::Unit::TestCase - fixtures :storage_volumes, :storage_pools + fixtures :permissions, :pools, :storage_volumes, :storage_pools def setup @controller = StorageController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @first_id = storage_volumes(:one).id + @lun_1_id = storage_volumes(:ovirtpriv_storage_lun_1).id + @ovirtpriv_storage_id = storage_pools(:corp_com_ovirtpriv_storage).id end def test_index @@ -50,7 +51,7 @@ class StorageControllerTest < Test::Unit::TestCase end def test_show - get :show, :id => @first_id + get :show, :id => @ovirtpriv_storage_id assert_response :success assert_template 'show' @@ -60,7 +61,7 @@ class StorageControllerTest < Test::Unit::TestCase end def test_new - get :new, :hardware_pool_id => 4 + get :new, :hardware_pool_id => pools(:corp_com).id assert_response :success assert_template 'new' @@ -80,7 +81,7 @@ class StorageControllerTest < Test::Unit::TestCase end def test_edit - get :edit, :id => @first_id + get :edit, :id => @ovirtpriv_storage_id assert_response :success assert_template 'edit' @@ -90,22 +91,27 @@ class StorageControllerTest < Test::Unit::TestCase end def test_update - post :update, :id => @first_id + post :update, :id => @ovirtpriv_storage_id assert_response :success end def test_destroy - hw_pool_id = nil - assert_nothing_raised { - pool = StoragePool.find(@first_id) - hw_pool_id = pool.hardware_pool.id - } - - post :destroy, :id => @first_id + post :destroy, :id => @ovirtpriv_storage_id assert_response :success + json = ActiveSupport::JSON.decode(@response.body) + assert_equal 'Storage Pool was successfully deleted.', json['alert'] + end + + def test_no_perms_to_destroy + post :destroy, :id => storage_pools(:corp_com_dev_nfs_ovirtnfs).id + assert_response :redirect #Is this really what we want? Or should we just pop up the login page? + end - assert_raise(ActiveRecord::RecordNotFound) { - StoragePool.find(@first_id) - } + #FIXME: write the code to make this a real test! + def test_bad_id_on_destroy +# post :destroy, :id => bad_id +# assert_response :success +# The controller needs to gracefully handle ActiveRecord::RecordNotFound, +# which it does not right now. end end diff --git a/src/test/functional/task_controller_test.rb b/src/test/functional/task_controller_test.rb index a9578b6..3b90756 100644 --- a/src/test/functional/task_controller_test.rb +++ b/src/test/functional/task_controller_test.rb @@ -31,11 +31,11 @@ class TaskControllerTest < Test::Unit::TestCase @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @first_id = tasks(:one).id + @task_id = tasks(:shutdown_production_httpd_appliance_task).id end def test_show - get :show, :id => @first_id + get :show, :id => @task_id assert_response :success assert_template 'show' diff --git a/src/test/functional/vm_controller_test.rb b/src/test/functional/vm_controller_test.rb index 3744f4a..7936f01 100644 --- a/src/test/functional/vm_controller_test.rb +++ b/src/test/functional/vm_controller_test.rb @@ -24,18 +24,19 @@ require 'vm_controller' class VmController; def rescue_action(e) raise e end; end class VmControllerTest < Test::Unit::TestCase - fixtures :vms + fixtures :permissions, :pools, :vms def setup @controller = VmController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @first_id = vms(:one).id + @vm_id = vms(:production_httpd_vm).id + @default_pool = pools(:default) end def test_show - get :show, :id => @first_id + get :show, :id => @vm_id assert_response :success assert_template 'show' @@ -45,7 +46,7 @@ class VmControllerTest < Test::Unit::TestCase end def test_new - get :new, :hardware_pool_id => 1 + get :new, :hardware_pool_id => @default_pool.id assert_response :redirect assert_redirected_to :controller => 'resources', :action => 'show' @@ -56,7 +57,14 @@ class VmControllerTest < Test::Unit::TestCase def test_create num_vms = Vm.count - post :create, :vm_resource_pool_name => 'foobar', :hardware_pool_id => 1, :vm => { :uuid => 'f43b298c-1e65-46fa-965f-0f6fb9ffaa10', :description => 'descript', :num_vcpus_allocated => 4, :memory_allocated => 262144, :vnic_mac_addr => 'AA:BB:CC:DD:EE:FF', :boot_device => 'network' } + post :create, :vm_resource_pool_name => 'foobar', + :hardware_pool_id => @default_pool.id, + :vm => { :uuid => 'f43b298c-1e65-46fa-965f-0f6fb9ffaa10', + :description => 'descript', + :num_vcpus_allocated => 4, + :memory_allocated => 262144, + :vnic_mac_addr => 'AA:BB:CC:DD:EE:FF', + :boot_device => 'network' } assert_response :success @@ -64,31 +72,30 @@ class VmControllerTest < Test::Unit::TestCase end def test_edit - get :edit, :id => @first_id + get :edit, :id => @vm_id assert_response :success assert_template 'edit' assert_not_nil assigns(:vm) - assert assigns(:vm).valid? + assert assigns(:vm).valid?, assigns(:vm).errors.inspect end def test_update - post :update, :id => @first_id, :vm => {} + post :update, :id => @vm_id, :vm => {} assert_response :success end def test_destroy - pool = nil - assert_nothing_raised { - pool = Vm.find(@first_id).vm_resource_pool_id - } - - post :destroy, :id => @first_id + assert_difference 'Vm.count', -1 do + post :destroy, :id => @vm_id + end assert_response :success + json = ActiveSupport::JSON.decode(@response.body) + assert_equal 'Virtual Machine was successfully deleted.', json['alert'] + end - assert_raise(ActiveRecord::RecordNotFound) { - Vm.find(@first_id) - } + def test_not_destroyed + assert true end end diff --git a/src/test/unit/active_record_env_test.rb b/src/test/unit/active_record_env_test.rb index 1b42cf5..30db689 100644 --- a/src/test/unit/active_record_env_test.rb +++ b/src/test/unit/active_record_env_test.rb @@ -21,11 +21,19 @@ require File.dirname(__FILE__) + '/../test_helper' require File.dirname(__FILE__) + '/../../dutils/active_record_env' class ActiveRecordEnvTest < Test::Unit::TestCase - fixtures :pools, :storage_pools, :hosts, :cpus, :vms, :tasks + fixtures :pools, :hosts, :vms, :boot_types, + :networks, :nics, :ip_addresses, :permissions, :quotas, + :storage_pools, :storage_volumes, :tasks def test_can_find_hosts database_connect hosts = Host.find(:all, :limit => 2) assert_not_nil hosts, 'you have no hosts list!' end + +# def test_can_get_nested_set +# pools = HardwarePool.get_default_pool.full_set_nested(:method => :json_hash_element, +# :privilege => Permission::PRIV_VIEW, :user => get_login_user) +# flunk 'pools contains: ' << pools.inspect +# end end diff --git a/src/test/unit/host_browser_awaken_test.rb b/src/test/unit/host_browser_awaken_test.rb index 4e6f803..d251e90 100644 --- a/src/test/unit/host_browser_awaken_test.rb +++ b/src/test/unit/host_browser_awaken_test.rb @@ -22,8 +22,7 @@ $: << File.join(File.dirname(__FILE__), "../../dutils") $: << File.join(File.dirname(__FILE__), "../../host-browser") require File.dirname(__FILE__) + '/../test_helper' -require 'test/unit' -require 'flexmock/test_unit' +require 'flexmock/test_unit' #probably should move this into test_helper TESTING=true diff --git a/src/test/unit/ip_address_test.rb b/src/test/unit/ip_address_test.rb index 152578e..5ecff77 100644 --- a/src/test/unit/ip_address_test.rb +++ b/src/test/unit/ip_address_test.rb @@ -1,8 +1,13 @@ -require 'test_helper' +require File.dirname(__FILE__) + '/../test_helper' class IpAddressTest < ActiveSupport::TestCase - # Replace this with your real tests. - def test_truth - assert true + fixtures :boot_types, :bondings, :networks, :nics, :ip_addresses + + def test_can_retrieve_nic + assert_equal ip_addresses(:ip_v4_mailserver_nic_one).nic.bandwidth.to_s, '100' + end + + def test_can_get_ipaddress_object + assert_equal ip_addresses(:ip_v4_mailserver_nic_one).address, '172.31.0.15' end end diff --git a/src/test/unit/permission_test.rb b/src/test/unit/permission_test.rb index 3c27b9f..5e2c7ba 100644 --- a/src/test/unit/permission_test.rb +++ b/src/test/unit/permission_test.rb @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2008 Red Hat, Inc. # Written by Scott Seago # @@ -23,7 +23,13 @@ class PermissionTest < Test::Unit::TestCase fixtures :permissions # Replace this with your real tests. - def test_truth - assert true + def test_simple_permission + assert_equal permissions(:ovirtadmin_root).user_role, 'Super Admin' + assert_equal permissions(:ovirtadmin_root).pool.name, 'root' + end + + def test_permission_with_parent + assert_equal permissions(:ovirtadmin_default).inherited_from_id, permissions(:ovirtadmin_root).id + assert_equal permissions(:ovirtadmin_default).parent_permission, permissions(:ovirtadmin_root) end end diff --git a/src/test/unit/pool_test.rb b/src/test/unit/pool_test.rb index c591e58..6f20f9f 100644 --- a/src/test/unit/pool_test.rb +++ b/src/test/unit/pool_test.rb @@ -23,7 +23,11 @@ class PoolTest < Test::Unit::TestCase fixtures :pools # Replace this with your real tests. - def test_truth - assert true + def test_get_name + assert_equal(pools(:corp_com_prod).name, 'Production Operations') + end + + def test_get_parent + assert_equal(pools(:corp_com_prod).parent.name, 'corp.com') end end diff --git a/src/test/unit/storage_pool_test.rb b/src/test/unit/storage_pool_test.rb index a446904..8cc8d1b 100644 --- a/src/test/unit/storage_pool_test.rb +++ b/src/test/unit/storage_pool_test.rb @@ -22,8 +22,7 @@ require File.dirname(__FILE__) + '/../test_helper' class StoragePoolTest < Test::Unit::TestCase fixtures :storage_pools - # Replace this with your real tests. - def test_truth - assert true + def test_hardware_pool_relationship + assert_equal 'corp.com', storage_pools(:corp_com_ovirtpriv_storage).hardware_pool.name end end diff --git a/src/test/unit/storage_volume_test.rb b/src/test/unit/storage_volume_test.rb index 5422706..d0a89f4 100644 --- a/src/test/unit/storage_volume_test.rb +++ b/src/test/unit/storage_volume_test.rb @@ -23,7 +23,7 @@ class StorageVolumeTest < Test::Unit::TestCase fixtures :storage_volumes # Replace this with your real tests. - def test_truth - assert true + def test_relationship_to_storage_pool + assert_equal 'corp.com', storage_volumes(:ovirtpriv_storage_lun_1).storage_pool.hardware_pool.name end end diff --git a/src/test/unit/task_test.rb b/src/test/unit/task_test.rb index e9b64b4..33a3bd8 100644 --- a/src/test/unit/task_test.rb +++ b/src/test/unit/task_test.rb @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2008 Red Hat, Inc. # Written by Scott Seago # @@ -20,10 +20,11 @@ require File.dirname(__FILE__) + '/../test_helper' class TaskTest < Test::Unit::TestCase - fixtures :tasks + fixtures :pools, :hosts, :vms, :permissions, :tasks - # Replace this with your real tests. - def test_truth - assert true + def test_exercise_task_relationships + assert_equal tasks(:shutdown_production_httpd_appliance_task).task_target.vm_resource_pool.name, 'corp.com production vmpool' + assert_equal tasks(:shutdown_production_httpd_appliance_task).task_target.host.hostname, 'prod.corp.com' end + end diff --git a/src/test/unit/vm_test.rb b/src/test/unit/vm_test.rb index a9ed9dc..a196130 100644 --- a/src/test/unit/vm_test.rb +++ b/src/test/unit/vm_test.rb @@ -88,4 +88,8 @@ class VmTest < Test::Unit::TestCase assert_equal @vm.cobbler_system_name, @vm.uuid, "VMs should be using the UUID as their Cobbler system name." end + + def test_get_pending_state + assert_equal 'stopped', vms(:production_httpd_vm).get_pending_state + end end -- 1.5.6.5 From dpierce at redhat.com Mon Nov 17 20:49:47 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Mon, 17 Nov 2008 15:49:47 -0500 Subject: [Ovirt-devel] [PATCH node] Added support for local storage configuration. Message-ID: <1226954987-4987-1-git-send-email-dpierce@redhat.com> This patch wipes out the entire disk on the node and replaces it with a set of partitions. The partitions are a raw partition to hold the bootable kernel, and the rest of the disk is taken up as an physical volume. On the physical volume is created the following logical volumes: * SWAP - swap partition * ROOT - to host the node image * CONFIG - to hold node configuration data * LOGGING - to hold local logs * DATA - to hold VM images If a kernel argument named OVIRT_VOL is present, then the firstboot script will run ovirt-config-storage in non-interactive mode. Default values are used unless environment variables override them. Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-storage | 200 ++++++++++++++++++++++++++++++++++++++++++ scripts/ovirt-firstboot | 6 +- 2 files changed, 205 insertions(+), 1 deletions(-) diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index c856ef1..04db5ea 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -1,2 +1,202 @@ #!/bin/bash # +# To automate the partitioning, pass in the specific fields in this order +# ovirt-config-storage [swap size] [boot size] [root size] [logging size] +# +# All sizes are in megabytes +# + +function init +{ + if [ -n "$OVIRT_BOOT_SIZE" ]; then BOOT_SIZE=$OVIRT_BOOT_SIZE; else BOOT_SIZE="256"; fi + if [ -n "$OVIRT_ROOT_SIZE" ]; then ROOT_SIZE=$OVIRT_ROOT_SIZE; else ROOT_SIZE="256"; fi + if [ -n "$OVIRT_CONFIG_SIZE" ]; then CONFIG_SIZE=$OVIRT_CONFIG_SIZE; else CONFIG_SIZE="5"; fi + if [ -n "$OVIRT_LOGGING_SIZE" ]; then LOGGING_SIZE=$OVIRT_LOGGING_SIZE; else LOGGING_SIZE="256"; fi + if [ -n "$OVIRT_DATA_SIZE" ]; then DATA_SIZE=$OVIRT_DATA_SIZE; fi + + MEM_SIZE=$(virsh -c qemu:///system nodeinfo | awk '/Memory size/ { print $3 }') + MEM_SIZE=$(echo "scale=0; $MEM_SIZE / 1024" | bc -l) + SWAP_SIZE=$MEM_SIZE +} + +function resolve_sizes +{ + DATA_SIZE=$(echo "scale=0; ($SPACE - $BOOT_SIZE - $SWAP_SIZE - $ROOT_SIZE - $CONFIG_SIZE - $LOGGING_SIZE)" | bc -l) +} + +function configure +{ + DEVICES=$(for drive in `hal-find-by-capability --capability storage`; do + info=$(lshal -u $drive -s) + if [[ $info =~ "storage.drive_type = 'disk'" ]]; then + lshal -u $drive -s | awk ' /block.device/ { + match($0, "block.device = *'"'"'(.*)'"'"'", device) + printf "%s ", device[1] + }' + fi + done) + + DEVICES="$DEVICES Abort" + + select DEVICE in $DEVICES + do + case "$DEVICE" in + "Abort") return ;; + *) + DRIVE=$DEVICE + SPACE=$(for drive in `hal-find-by-capability --capability storage`; do + info=$(lshal -u $drive -s) + if [[ $info =~ $DRIVE ]]; then + lshal -u $drive -s | awk ' /storage.size/ { + match($0, "storage.size *= *([0-9]+)", device) + printf "%s", device[1] + }' + fi + done) + + SPACE=$(echo "scale=0; $SPACE / (1024 * 1024)" | bc -l) + + for i in swap boot root logging config; do + uc=$(echo $i|tr '[[:lower:]]' '[[:upper:]]') + var=${uc}_SIZE + eval "size=\$$var" + read -p "Change $i partition size (currently $size MB)? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + eval "$var=$REPLY" + else + printf "Invalid value for $i. Retaining $size MB.\n" + fi + done + + resolve_sizes + + return + ;; + esac + done +} + +function review +{ + printf "\n" + if [ -n "$DRIVE" ]; then + printf "The local disk will be repartitioned as follows:\n" + printf "================================================\n" + printf " Physical Hard Disk: ${DRIVE}\n" + printf " Total storage available: ${SPACE} MB\n" + printf " Swap partition size: ${SWAP_SIZE} MB\n" + printf " Boot partition size: ${BOOT_SIZE} MB\n" + printf " Installation partition size: ${ROOT_SIZE} MB\n" + printf " Configuration partition size: ${CONFIG_SIZE} MB\n" + printf " Logging partition size: ${LOGGING_SIZE} MB\n" + printf " Data partition size: ${DATA_SIZE} MB\n" + printf "\n" + else + printf "No storage device selected.\n" + fi +} + +function perform_partitioning +{ + printf "\n" + if [ -n "$DRIVE" ]; then + printf "Preparing local storage. Please wait..." + + { + vgroups=$(vgdisplay -C | awk '{ print $1" "; }') + vgremove -f $vgroups + + dd if=/dev/zero of=$DRIVE bs=1K count=1 + blockdev --rereadpt $DRIVE + partprobe -s $DRIVE + + parted $DRIVE -s "mklabel gpt" + parted $DRIVE -s "mkpart primary ext2 0M ${BOOT_SIZE}M" + parted $DRIVE -s "mkpart primary ext2 ${BOOT_SIZE}M ${SPACE}M" + parted $DRIVE -s "set 2 lvm on" + + pvcreate "$DRIVE"2 + pvck + vgcreate /dev/HostVG "$DRIVE"2 + + lvcreate --name Swap --size ${SWAP_SIZE}M /dev/HostVG + lvcreate --name Root --size ${ROOT_SIZE}M /dev/HostVG + lvcreate --name Config --size ${CONFIG_SIZE}M /dev/HostVG + lvcreate --name Logging --size ${LOGGING_SIZE}M /dev/HostVG + lvcreate --name Data -l 100%FREE /dev/HostVG + + mke2fs -j -T ext3 "$DRIVE"1 -L "BOOT" + tune2fs -c 0 -i 0 "$DRIVE"1 + mkswap /dev/HostVG/Swap + mke2fs -j -T ext3 /dev/HostVG/Root -L "ROOT" + tune2fs -c 0 -i 0 /dev/HostVG/Root + mke2fs -j -T ext3 /dev/HostVG/Config -L "CONFIG" + tune2fs -c 0 -i 0 /dev/HostVG/Config + mke2fs -j -T ext3 /dev/HostVG/Logging -L "LOGGING" + tune2fs -c 0 -i 0 /dev/HostVG/Logging + mke2fs -j -T ext3 /dev/HostVG/Data -L "DATA" + tune2fs -c 0 -i 0 /dev/HostVG/Data + } > /var/log/ovirt-partition.log 2>&1 + + printf "Completed!\n\n" + else + printf "No storage device selected.\n" + fi +} + +function confirm +{ + printf "\n" + if [ -n "$DRIVE" ]; then + while true; do + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! If you proceed this will destroy all data on your local system, and !!WARNING!!\n" + printf "!!WARNING!! your hard disk will be irreversably reconfiguration. !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!! !!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!\n" + printf "\n" + printf "\tContinue? (Y/n) " + read + case $REPLY in + Y|y) + perform_partitioning; break ;; + N|n) return ;; + esac + done + else + printf "No storage device selected!\n" + fi +} + +init + +if [ "$1" == "AUTO" ]; then + DRIVE=$OVIRT_VOL + perform_partitioning + printf "[DONE]\n" + exit 0 +else + while true; do + resolve_sizes + + OPTIONS="Configure Review Partition Quit" + PS3="Choose an option: " + + printf "\n" + + select OPTION in $OPTIONS + do + case "$OPTION" in + "Configure") configure ; break ;; + "Review") review ; break ;; + "Partition") confirm ; break ;; + "Quit") exit ;; + esac + done + done +fi diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot index 82d9e48..70a88f1 100755 --- a/scripts/ovirt-firstboot +++ b/scripts/ovirt-firstboot @@ -29,6 +29,11 @@ start () { + if [ -n "$OVIRT_VOL" ]; then + INTERACTIVE="N" + ovirt-config-storage AUTO + fi + ovirt-config-setup } @@ -52,4 +57,3 @@ case "$1" in echo "Usage: ovirt-firstboot {start}" exit 2 esac - -- 1.5.6.5 From mmorsi at redhat.com Mon Nov 17 21:40:03 2008 From: mmorsi at redhat.com (Mohammed Morsi) Date: Mon, 17 Nov 2008 16:40:03 -0500 Subject: [Ovirt-devel] Configuring Networks via oVirt Wui Message-ID: <4921E4B3.2090808@redhat.com> Just took a few screenshots of the network configuration interface and wrote up a short blurb of the current setup. It can be accessed here http://www.ovirt.org/page/Redesigned_Network_Configuration -Mo From hbrock at redhat.com Mon Nov 17 21:43:51 2008 From: hbrock at redhat.com (Hugh O. Brock) Date: Mon, 17 Nov 2008 16:43:51 -0500 Subject: [Ovirt-devel] Re: Configuring Networks via oVirt Wui In-Reply-To: <4921E4B3.2090808@redhat.com> References: <4921E4B3.2090808@redhat.com> Message-ID: <20081117214351.GJ22797@redhat.com> On Mon, Nov 17, 2008 at 04:40:03PM -0500, Mohammed Morsi wrote: > Just took a few screenshots of the network configuration interface and > wrote up a short blurb of the current setup. > > It can be accessed here > http://www.ovirt.org/page/Redesigned_Network_Configuration > Thanks Mo, that's really helpful. I think I understand how it's supposed to work a bit better now. To what extent do we get values like available networks filled in automatically (if at all)? Susan, if you can add something on this to the docs it would be very helpful. Take care, --Hugh From mmorsi at redhat.com Mon Nov 17 22:00:43 2008 From: mmorsi at redhat.com (Mohammed Morsi) Date: Mon, 17 Nov 2008 17:00:43 -0500 Subject: [Ovirt-devel] Re: Configuring Networks via oVirt Wui In-Reply-To: <20081117214351.GJ22797@redhat.com> References: <4921E4B3.2090808@redhat.com> <20081117214351.GJ22797@redhat.com> Message-ID: <4921E98B.9030500@redhat.com> Hugh O. Brock wrote: > On Mon, Nov 17, 2008 at 04:40:03PM -0500, Mohammed Morsi wrote: > >> Just took a few screenshots of the network configuration interface and >> wrote up a short blurb of the current setup. >> >> It can be accessed here >> http://www.ovirt.org/page/Redesigned_Network_Configuration >> >> > > Thanks Mo, that's really helpful. I think I understand how it's > supposed to work a bit better now. > > To what extent do we get values like available networks filled in > automatically (if at all)? > > That was the last bit that was added, the following Monday as the managed-node-config / host-browser bit is the most unfamiliar component to me. Right now whenever the server receives information pertaining to a nic / bonding, it simply creates the specified device w/ a new statically assigned network. The device itself is associated with a new ip address containing the information it received (same information it was previously storing in the nics / bondings tables itself). When the device is updated via the wui, the application takes this information and relays it to the nodes, as it did previously, but ignores information contained in the associated network. Essentially this both sides needs to be changed, eg we need to determine if an existing network can be used (and the requirements for making this decision) when the server receives network information, as well as use the info stored in the networks table when updating nodes from the database. When the network-qpid stuff is inplace that will need to be mapped to this as well. -Mo From dpierce at redhat.com Mon Nov 17 22:08:16 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Mon, 17 Nov 2008 17:08:16 -0500 Subject: [Ovirt-devel] [PATCH node] Added support for local storage configuration. Message-ID: <1226959696-10807-1-git-send-email-dpierce@redhat.com> From: Darryl L. Pierce NOTE: This is a reduxed patch based on Jim Meyering's changes, and includes updates to support automated execution. This patch wipes out the entire disk on the node and replaces it with a set of partitions. The partitions are a raw partition to hold the bootable kernel, and the rest of the disk is taken up as an physical volume. On the physical volume is created the following logical volumes: * SWAP - swap partition * ROOT - to host the node image * CONFIG - to hold node configuration data * LOGGING - to hold local logs * DATA - to hold VM images Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-storage | 224 ++++++++++++++++++++++++++++++++++++++++++ scripts/ovirt-firstboot | 5 + 2 files changed, 229 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index c856ef1..e3b3592 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -1,2 +1,226 @@ #!/bin/bash # +# To automate the partitioning, pass in the specific fields in this order +# ovirt-config-storage [swap size] [boot size] [root size] [logging size] +# +# All sizes are in megabytes +# + +ME=$(basename "$0") +warn() { printf '%s: %s\n' "$ME" "$*" >&2; } +die() { warn "$*"; exit 1; } + +check_partition_sizes() +{ + # FIXME: use this function before performing any partitioning, auto or not + : + # Perform some sanity checks. E.g., + # What if DATA_SIZE ends up zero or negative? + # What if any of those partition sizes is smaller than + # the minimum size for an ext3 partition? Diagnose it here + # or just let the mke2fs failure suffice. +} + +do_configure() +{ + DEVICES=$(for drive in `hal-find-by-capability --capability storage`; do + info=$(lshal -u $drive -s) + if [[ $info =~ "storage.drive_type = 'disk'" ]]; then + lshal -u $drive -s | awk ' /block.device/ { + match($0, "block.device = *'"'"'(.*)'"'"'", device) + printf "%s", device[1] + }' + fi + done) + + DEVICES="$DEVICES Abort" + + select DEVICE in $DEVICES + do + case "$DEVICE" in + "Abort") return ;; + + *) + DRIVE=$DEVICE + SPACE=$(for drive in `hal-find-by-capability --capability storage`; do + info=$(lshal -u $drive -s) + if [[ $info =~ $DRIVE ]]; then + lshal -u $drive -s | awk ' /storage.size/ { + match($0, "storage.size *= *([0-9]+)", device) + printf "%s", device[1] + }' + fi + done) + + SPACE=$(echo "scale=0; $SPACE / (1024 * 1024)" | bc -l) + BOOT_SIZE="256" + ROOT_SIZE="256" + CONFIG_SIZE="5" + LOGGING_SIZE="256" + + for i in swap boot root logging config; do + uc=$(echo $i|tr '[[:lower:]]' '[[:upper:]]') + var=${uc}_SIZE + eval "size=\$$var" + read -p "Change $i partition size (Currently $size MB)? " + if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then + eval "$var=$REPLY" + else + printf "invalid value: '$i'. retaining $size MB.\n" + fi + done + + return + ;; + esac + done +} + +do_review() +{ + if [ -z "$DRIVE" ]; then + printf "\nNo storage device selected.\n" + return + fi + + cat < /var/log/ovirt-partition.log 2>&1 + + printf "Completed!\n\n" +} + +do_confirm() +{ + if [ -z "$DRIVE" ]; then + printf "\nNo storage device selected.\n" + return + fi + + while true; do + sp=' ' + w='!!WARNING' + wb="$w"'!!' + w8="$w$w$w$w$w$w$w$w" + printf '%s!!\n' \ + "$w8" \ + "$w8" \ + "$wb$sp$w" \ + "$wb$sp$w" \ + "$wb If you proceed, this will destroy all data on your local" \ + "$wb system, and your hard disk will be irreversably reconfigured" \ + "$wb$sp$w" \ + "$wb$sp$w" \ + "$w8" \ + "$w8" + printf "\n\tContinue? (Y/n) " + read + case $REPLY in + Y|y) + check_partition_sizes + perform_partitioning + break + ;; + N|n) return ;; + esac + done +} + +MEM_SIZE=$(virsh --readonly -c qemu:///system nodeinfo \ + | awk '/Memory size/ { print $3 }') +case $MEM_SIZE in + ''|*[^0-9]*) die failed to get system memory size;; +esac + +MEM_SIZE=$(echo "scale=0; $MEM_SIZE / 1024" | bc -l) +SWAP_SIZE=$MEM_SIZE + +if [ "$1" == "AUTO" ]; then + DRIVE=$OVIRT_VOL + if [ -n "$OVIRT_BOOT_SIZE" ]; then BOOT_SIZE=$OVIRT_BOOT_SIZE; else BOOT_SIZE=256; fi + if [ -n "$OVIRT_ROOT_SIZE" ]; then ROOT_SIZE=$OVIRT_ROOT_SIZE; else ROOT_SIZE=256; fi + if [ -n "$OVIRT_LOGGING_SIZE" ]; then LOGGING_SIZE=$OVIRT_LOGGING_SIZE; else LOGGING_SIZE=512; fi + if [ -n "$OVIRT_CONFIG_SIZE" ]; then CONFIG_SIZE=$OVIRT_CONFIG_SIZE; else CONFIG_SIZE=5; fi + check_partition_sizes + printf "Partitioning hard disk..." + perform_partitioning + printf "[DONE]\n" + exit 0 +else + while true; do + + OPTIONS="Configure Review Partition Quit" + PS3="Choose an option: " + + printf "\n" + + select OPTION in $OPTIONS + do + case "$OPTION" in + "Configure") do_configure ; break ;; + "Review") do_review ; break ;; + "Partition") do_confirm ; break ;; + "Quit") exit ;; + esac + done + done +fi diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot index 82d9e48..2a334e6 100755 --- a/scripts/ovirt-firstboot +++ b/scripts/ovirt-firstboot @@ -29,6 +29,11 @@ start () { + if [ -n "$OVIRT_VOL" ]; then + INTERACTIVE="N" + ovirt-config-storage AUTO + fi + ovirt-config-setup } -- 1.5.6.5 From jguiditt at redhat.com Mon Nov 17 22:29:32 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Mon, 17 Nov 2008 17:29:32 -0500 Subject: [Ovirt-devel] Questions on the Server Suite UI In-Reply-To: <20081117162333.GZ22797@redhat.com> References: <492181F5.2030607@redhat.com> <20081117162333.GZ22797@redhat.com> Message-ID: <1226960972.25802.3.camel@physical.priv.ovirt.org> On Mon, 2008-11-17 at 11:23 -0500, Hugh O. Brock wrote: > On Mon, Nov 17, 2008 at 09:38:45AM -0500, Bryan Kearney wrote: > > Couple of UI RFEs: > > - Given the richness of the UI, I keep expecting a right click context > > menu. Especially in the tree nav. > > That would be a good idea, yes... paging Mr. Guiditta... > I think this would require some thought to see if it was really worth the effort. I am not a big fan of taking over the browser's native right click behavior, but we could certainly consider it if there is a compelling use case. Right now, however, I do not see what that would be, and quite frankly, I think we have more important things to improve before pursuing this course if there really is interest. -j From pmyers at redhat.com Mon Nov 17 23:00:37 2008 From: pmyers at redhat.com (Perry Myers) Date: Mon, 17 Nov 2008 18:00:37 -0500 Subject: [Ovirt-devel] [PATCH node] Moved network configuration work files to a temporary directory. In-Reply-To: <8763mq3umn.fsf@rho.meyering.net> References: <1226688726-27233-1-git-send-email-dpierce@redhat.com> <8763mq3umn.fsf@rho.meyering.net> Message-ID: <4921F795.70508@redhat.com> Jim Meyering wrote: > "Darryl L. Pierce" wrote: >> Signed-off-by: Darryl L. Pierce >> --- >> scripts/ovirt-config-networking | 22 ++++++++++------------ >> 1 files changed, 10 insertions(+), 12 deletions(-) >> >> diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking >> index 2f8363c..592bef4 100755 >> --- a/scripts/ovirt-config-networking >> +++ b/scripts/ovirt-config-networking >> @@ -1,17 +1,20 @@ >> -#!/bin/bash >> +$#!/bin/bash > > Hi Darryl, > > Typo? > >> # >> # Iterates over the list of network devices on the node and prompts the user >> # to configure each. >> >> +WORKDIR=$(mktemp -d) || exit 1 > > Nothing removes $WORKDIR. > You could just remove it at the end. > Doing it right isn't trivial, but once you've seen the idiom, > it's easy to reuse (this is from coreutils/tests/test-lib.sh). > Just insert this: > > # Remove $WORKDIR upon interrupt (and HUP, PIPE, TERM) and upon normal > # termination, being careful not to change the exit status. > trap '__st=$?; rm -rf "$WORKDIR"; exit $__st' 0 > trap 'exit $?' 1 2 13 15 > >> CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" >> -CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" >> +#CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" >> +CONFIG_LOG_FILE="ovirt-network-setup.log" >> >> function configure_interface >> { >> NIC=$1 >> BRIDGE=ovirtbr`echo $NIC | cut -b4-` >> - IF_FILENAME="/var/tmp/augtool-$NIC" >> - BR_FILENAME="/var/tmp/augtool-$BRIDGE" >> + IF_FILENAME="$WORKDIR/augtool-$NIC" >> + BR_FILENAME="$WORKDIR/augtool-$BRIDGE" >> >> printf "\nConfigure $BRIDGE for use by $NIC..\n\n" >> >> @@ -70,10 +73,6 @@ function setup_menu >> PS3="Please select a network interface to configure:" >> } >> >> -# clean up any left over configurations >> -rm -f /var/tmp/config-augtool >> -rm -f /var/tmp/augtool-* >> - >> setup_menu >> >> select NIC in $NICS >> @@ -88,10 +87,9 @@ done >> >> # Merge together all generated files and run augtool >> >> -cat /var/tmp/augtool-* > /var/tmp/config-augtool >> -printf "save\n" >> /var/tmp/config-augtool >> { >> -augtool < /var/tmp/config-augtool >> +cat $WORKDIR/augtool-* > $WORKDIR/config-augtool >> +printf "save\n" >> /var/tmp/config-augtool > > Oops. one remaining /var/tmp/... > >> +augtool < $WORKDIR/config-augtool > > I've just noticed that these uses of $WORKDIR need to be > double-quoted-for-the-paranoid. > (in case $TMPDIR contains bogus characters). > Also, ideally, you'd run augtool only if all preceding writes > completed without error, so, > > cf="$WORKDIR/config-augtool" > { cat "$WORKDIR"/augtool-* && printf "save\n"; } > "$cf" \ > && augtool < "$cf" > >> service network restart >> } > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE > > I really, really prefer not to program in shell. Agreed. Unfortunately our choices on the Node are limited due to efforts to keep image size small. The options are C and bash presently. Perhaps we should investigate what the cost would be to put *minimal* python environment on the Node. Just core libraries and interpreter. Doing this we could eventually replace this bash stuff with python which is a little more maintainable :) Perry From apevec at redhat.com Tue Nov 18 00:02:46 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 18 Nov 2008 01:02:46 +0100 Subject: [Ovirt-devel] [PATCH ovirt-node] auto-install for standalone mode Message-ID: <1226966566-14783-1-git-send-email-apevec@redhat.com> each ovirt-config-* module is called with AUTO argument when all required boot parameters are specified --- scripts/ovirt-config-logging | 5 ++--- scripts/ovirt-config-networking | 6 +++--- scripts/ovirt-early | 13 ++++++++----- scripts/ovirt-firstboot | 6 ++++-- scripts/ovirt-functions | 13 +++++++++++++ 5 files changed, 30 insertions(+), 13 deletions(-) diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging index 2dd9d9c..4d75be7 100755 --- a/scripts/ovirt-config-logging +++ b/scripts/ovirt-config-logging @@ -129,9 +129,8 @@ function prompt_user { } -# check if we were called to attempt to default -# to remote logging -if [ "$1" = "default" ]; then +# AUTO for auto-install +if [ "$1" = "AUTO" ]; then if [ -z "$OVIRT_SYSLOG_SERVER" -o -z "$OVIRT_SYSLOG_PORT" ]; then printf "\nAttempting to locate remote syslog server..." find_srv syslog udp diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 4ad8af0..0306bfb 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -92,8 +92,8 @@ function setup_menu PS3="Please select a network interface to configure:" } -if [ "$1" == "AUTO" ]; then - configure_interface $OVIRT_MGMT_IFACE AUTO +if [ "$1" == "AUTO" -a -n "$OVIRT_BOOTIF" ]; then + configure_interface $OVIRT_BOOTIF AUTO RESTART="Y" else setup_menu @@ -104,7 +104,7 @@ else case "$NIC" in "Save") RESTART="Y"; break ;; "Quit") exit 0; break ;; - *) configure_interface $NIC $IFACE_NUMBER ;; + *) configure_interface $NIC ;; esac setup_menu done diff --git a/scripts/ovirt-early b/scripts/ovirt-early index 394fce5..d405de6 100755 --- a/scripts/ovirt-early +++ b/scripts/ovirt-early @@ -315,7 +315,7 @@ start() { # oVirt boot parameters # BOOTIF= (appended by pxelinux) # ovirt_init=usb|scsi[:serial#] - # ovirt_vol=BOOT_GB:SWAP_GB:INSTALL_GB:CONFIG_GB:LOGGING_GB + # ovirt_vol=BOOT_MB:SWAP_MB:ROOT_MB:CONFIG_MB:LOGGING_MB # ovirt_local_boot # ovirt_standalone # pxelinux format: ip=::: @@ -339,10 +339,11 @@ start() { # e.g. ovirt_init=usb:Generic_STORAGE_DEVICE_0000145418-0:0 ovirt_init= - # ovirt_vol=BOOT_GB:SWAP_GB:INSTALL_GB:CONFIG_GB:LOGGING_GB + # ovirt_vol=BOOT_MB:SWAP_MB:ROOT_MB:CONFIG_MB:LOGGING_MB # local partition sizes in GB ovirt_vol_boot= - ovirt_vol_install= + ovirt_vol_swap= + ovirt_vol_root= ovirt_vol_config= ovirt_vol_logging= @@ -387,7 +388,7 @@ start() { ;; ovirt_vol=*) i=${i#ovirt_vol=} - eval $(printf $i|awk -F: '{print "ovirt_vol_boot="$1; print "ovirt_vol_install="$2; print "ovirt_vol_config="$3; print "ovirt_vol_logging="$4;}') + eval $(printf $i|awk -F: '{print "ovirt_vol_boot="$1; ovirt_vol_swap="$2; print "ovirt_vol_root="$3; print "ovirt_vol_config="$4; print "ovirt_vol_logging="$5;}') ;; ovirt_local_boot*) ovirt_local_boot=1 @@ -424,12 +425,14 @@ start() { if [ -z "$ip_gateway" ]; then ip_gateway=$gateway fi + cat > $OVIRT_DEFAULTS < References: <1226688504-27016-1-git-send-email-dpierce@redhat.com> <1226923730-16509-1-git-send-email-apevec@redhat.com> <873ahqwn8n.fsf@rho.meyering.net> Message-ID: <49220938.7090001@redhat.com> Jim Meyering wrote: > With iteration upon iteration like this, you can see > how using a shared development/unstable/pu branch (with very > permissive "push" policy) might help. let's try this, I've created ovirt-node fork at: http://repo.or.cz/w/ovirt-node/TEMP.git master branch there is next + outstanding patches for ovirt-node which I think are ready for ack NB: this branch can be rebased at anytime! Please register at repo.or.cz and tell me your login to give you rw right. Then you can, in your ovirt-node git checkout: (initial push) git remote add TEMP ssh://repo.or.cz/srv/git/ovirt-node/TEMP.git git push TEMP YourLocalBranchYouWantToShareWithEverybody:refs/heads/yourreporczlogin From apevec at redhat.com Tue Nov 18 00:32:55 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 18 Nov 2008 01:32:55 +0100 Subject: [Ovirt-devel] Re: [PATCH release] Add build dependencies for the oVirt repositories In-Reply-To: <1226718231-13742-1-git-send-email-pmyers@redhat.com> References: <1226718231-13742-1-git-send-email-pmyers@redhat.com> Message-ID: <49220D37.3040604@redhat.com> Perry Myers wrote: > +Requires: appliance-tools >= 003.7 ack, just this is 003.9 now From apevec at redhat.com Tue Nov 18 00:47:03 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 18 Nov 2008 01:47:03 +0100 Subject: [Ovirt-devel] Re: [PATCH appliance] Create separate data disk for storing iSCSI and NFS for appliance In-Reply-To: <1226700416-11413-2-git-send-email-pmyers@redhat.com> References: <1226700416-11413-1-git-send-email-pmyers@redhat.com> <1226700416-11413-2-git-send-email-pmyers@redhat.com> Message-ID: <49221087.7000009@redhat.com> ACK From apevec at redhat.com Tue Nov 18 00:51:59 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 18 Nov 2008 01:51:59 +0100 Subject: [Ovirt-devel] Re: [PATCH appliance] Move appliance creation out of spec file to Makefile In-Reply-To: <1226700416-11413-3-git-send-email-pmyers@redhat.com> References: <1226700416-11413-1-git-send-email-pmyers@redhat.com> <1226700416-11413-2-git-send-email-pmyers@redhat.com> <1226700416-11413-3-git-send-email-pmyers@redhat.com> Message-ID: <492211AF.1000104@redhat.com> ACK From apevec at redhat.com Tue Nov 18 00:56:24 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 18 Nov 2008 01:56:24 +0100 Subject: [Ovirt-devel] Re: [PATCH appliance] Refactor the create-ovirt-appliance script into several scripts In-Reply-To: <1226700416-11413-4-git-send-email-pmyers@redhat.com> References: <1226700416-11413-1-git-send-email-pmyers@redhat.com> <1226700416-11413-2-git-send-email-pmyers@redhat.com> <1226700416-11413-3-git-send-email-pmyers@redhat.com> <1226700416-11413-4-git-send-email-pmyers@redhat.com> Message-ID: <492212B8.9090405@redhat.com> ACK - since this is a significant change in how appliance is installed, it might be a good to summarize all new steps in a wiki and put link in the commit message? From apevec at redhat.com Tue Nov 18 00:56:54 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 18 Nov 2008 01:56:54 +0100 Subject: [Ovirt-devel] Re: [PATCH recipe] Changes to support removal of second network interface on the appliance In-Reply-To: <1226700416-11413-5-git-send-email-pmyers@redhat.com> References: <1226700416-11413-1-git-send-email-pmyers@redhat.com> <1226700416-11413-2-git-send-email-pmyers@redhat.com> <1226700416-11413-3-git-send-email-pmyers@redhat.com> <1226700416-11413-4-git-send-email-pmyers@redhat.com> <1226700416-11413-5-git-send-email-pmyers@redhat.com> Message-ID: <492212D6.4080803@redhat.com> ACK From pmyers at redhat.com Tue Nov 18 02:14:19 2008 From: pmyers at redhat.com (Perry Myers) Date: Mon, 17 Nov 2008 21:14:19 -0500 Subject: [Ovirt-devel] Re: [PATCH appliance] Refactor the create-ovirt-appliance script into several scripts In-Reply-To: <492212B8.9090405@redhat.com> References: <1226700416-11413-1-git-send-email-pmyers@redhat.com> <1226700416-11413-2-git-send-email-pmyers@redhat.com> <1226700416-11413-3-git-send-email-pmyers@redhat.com> <1226700416-11413-4-git-send-email-pmyers@redhat.com> <492212B8.9090405@redhat.com> Message-ID: <492224FB.8010705@redhat.com> Alan Pevec wrote: > ACK - since this is a significant change in how appliance is installed, > it might be a good to summarize all new steps in a wiki and put link in > the commit message? Agreed. I'll do both before pushing these patches. Perry -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=| From sseago at redhat.com Tue Nov 18 05:35:08 2008 From: sseago at redhat.com (Scott Seago) Date: Tue, 18 Nov 2008 05:35:08 +0000 Subject: [Ovirt-devel] [PATCH] replaced flexigrid-based display for HW and smart pool storage with tree component. Message-ID: <1226986508-16194-1-git-send-email-sseago@redhat.com> Signed-off-by: Scott Seago --- src/app/controllers/hardware_controller.rb | 3 +- src/app/controllers/search_controller.rb | 41 ++++++--- src/app/controllers/smart_pools_controller.rb | 1 + src/app/controllers/storage_controller.rb | 2 +- src/app/models/smart_pool.rb | 20 ++++ src/app/models/storage_pool.rb | 3 +- src/app/models/storage_volume.rb | 7 +- src/app/views/hardware/show_storage.rhtml | 64 +++++++++---- src/app/views/smart_pools/show_storage.rhtml | 63 +++++++++---- src/app/views/storage/show.rhtml | 40 -------- src/app/views/storage/show_volume.rhtml | 127 +++++++++---------------- src/public/javascripts/ovirt.js | 3 +- 12 files changed, 200 insertions(+), 174 deletions(-) diff --git a/src/app/controllers/hardware_controller.rb b/src/app/controllers/hardware_controller.rb index 8c26184..4dda736 100644 --- a/src/app/controllers/hardware_controller.rb +++ b/src/app/controllers/hardware_controller.rb @@ -111,6 +111,7 @@ class HardwareController < PoolController end def show_storage + @storage_tree = @pool.storage_tree(:filter_unavailable => false, :include_used => true).to_json show end @@ -171,7 +172,7 @@ class HardwareController < PoolController id = params[:exclude_pool] storage_pools = StoragePool find_opts = {:include => :hardware_pool, - :conditions => ["pools.id != ?", id]} + :conditions => ["(storage_pools.type != 'LvmStoragePool') and (pools.id != ?)", id]} include_pool = true end super(:full_items => storage_pools,:include_pool => include_pool,:find_opts => find_opts) diff --git a/src/app/controllers/search_controller.rb b/src/app/controllers/search_controller.rb index 3789309..7551242 100644 --- a/src/app/controllers/search_controller.rb +++ b/src/app/controllers/search_controller.rb @@ -19,18 +19,33 @@ class SearchController < ApplicationController - MODELS = {"HardwarePool" => {:controller => "hardware", - :show_action => "quick_summary"}, - "VmResourcePool" => {:controller => "resources", - :show_action => "quick_summary"}, - "Host" => {:controller => "host", - :show_action => "show"}, - "Vm" => {:controller => "vm", - :show_action => "show"}, - "IscsiStoragePool" => {:controller => "storage", - :show_action => "show"}, - "NfsStoragePool" => {:controller => "storage", - :show_action => "show"}} + MODELS = {"HardwarePool" => {:controller => "hardware", + :show_action => "quick_summary", + :searched => true}, + "VmResourcePool" => {:controller => "resources", + :show_action => "quick_summary", + :searched => true}, + "Host" => {:controller => "host", + :show_action => "show", + :searched => true}, + "Vm" => {:controller => "vm", + :show_action => "show", + :searched => true}, + "IscsiStoragePool" => {:controller => "storage", + :show_action => "show", + :searched => true}, + "NfsStoragePool" => {:controller => "storage", + :show_action => "show", + :searched => true}, + "IscsiStorageVolume" => {:controller => "storage", + :show_action => "show_volume", + :searched => false}, + "NfsStorageVolume" => {:controller => "storage", + :show_action => "show_volume", + :searched => false}, + "LvmStorageVolume" => {:controller => "storage", + :show_action => "show_volume", + :searched => false}} MULTI_TYPE_MODELS = {"StoragePool" => ["IscsiStoragePool", "NfsStoragePool"]} @@ -50,7 +65,7 @@ class SearchController < ApplicationController @model_param ||= "" if @model_param == "" - @models = MODELS.keys + @models = MODELS.keys.select {|model| MODELS[model][:searched]} else @models = MULTI_TYPE_MODELS[@model_param] @models ||= [@model_param] diff --git a/src/app/controllers/smart_pools_controller.rb b/src/app/controllers/smart_pools_controller.rb index 0295b63..37ccdad 100644 --- a/src/app/controllers/smart_pools_controller.rb +++ b/src/app/controllers/smart_pools_controller.rb @@ -38,6 +38,7 @@ class SmartPoolsController < PoolController end def show_storage + @storage_tree = @pool.storage_tree(:filter_unavailable => false, :include_used => true).to_json show end diff --git a/src/app/controllers/storage_controller.rb b/src/app/controllers/storage_controller.rb index e3e5522..6e6e3c2 100644 --- a/src/app/controllers/storage_controller.rb +++ b/src/app/controllers/storage_controller.rb @@ -107,7 +107,7 @@ class StorageController < ApplicationController end else respond_to do |format| - format.html { render :layout => 'popup' } + format.html { render :layout => 'selection' } format.xml { render :xml => @storage_volume.to_xml } end end diff --git a/src/app/models/smart_pool.rb b/src/app/models/smart_pool.rb index ac6db5e..772ffef 100644 --- a/src/app/models/smart_pool.rb +++ b/src/app/models/smart_pool.rb @@ -97,4 +97,24 @@ class SmartPool < Pool user_pools[-1] << "break" unless user_pools.empty? user_pools + other_pools end + + # params accepted: + # :vm_to_include - if specified, storage used by this VM is included in the tree + # :filter_unavailable - if true, don't include Storage not currently available + # :include_used - include all storage pools/volumes, even those in use + # for smart pools, filter_unavailable defaults to false and include_used to true + def storage_tree(params = {}) + vm_to_include=params.fetch(:vm_to_include, nil) + filter_unavailable = params.fetch(:filter_unavailable, false) + include_used = params.fetch(:include_used, true) + conditions = "type != 'LvmStoragePool'" + if filter_unavailable + conditions = "(#{conditions}) and (storage_pools.state = '#{StoragePool::STATE_AVAILABLE}')" + end + tagged_storage_pools.find(:all, + :conditions => conditions).collect do |pool| + pool.storage_tree_element(params) + end + end + end diff --git a/src/app/models/storage_pool.rb b/src/app/models/storage_pool.rb index 9c80f54..bab7031 100644 --- a/src/app/models/storage_pool.rb +++ b/src/app/models/storage_pool.rb @@ -97,7 +97,8 @@ class StoragePool < ActiveRecord::Base :name => display_name, :available => false, :create_volume => user_subdividable, - :selected => false} + :selected => false, + :is_pool => true} conditions = nil unless include_used conditions = "vms.id is null" diff --git a/src/app/models/storage_volume.rb b/src/app/models/storage_volume.rb index 56cdcef..39b72d5 100644 --- a/src/app/models/storage_volume.rb +++ b/src/app/models/storage_volume.rb @@ -80,6 +80,10 @@ class StorageVolume < ActiveRecord::Base return false end + def deletable + storage_pool.user_subdividable and vms.empty? and (lvm_storage_pool.nil? or lvm_storage_pool.storage_volumes.empty?) + end + def storage_tree_element(params = {}) vm_to_include=params.fetch(:vm_to_include, nil) filter_unavailable = params.fetch(:filter_unavailable, true) @@ -95,7 +99,8 @@ class StorageVolume < ActiveRecord::Base vm_ids.include?(vm_to_include.id))), :create_volume => supports_lvm_subdivision, :selected => (!vm_ids.empty? and vm_to_include and vm_to_include.id and - (vm_ids.include?(vm_to_include.id)))} + (vm_ids.include?(vm_to_include.id))), + :is_pool => false} if lvm_storage_pool if return_hash[:available] return_hash[:available] = lvm_storage_pool.storage_volumes.full_vm_list.empty? diff --git a/src/app/views/hardware/show_storage.rhtml b/src/app/views/hardware/show_storage.rhtml index 5ade456..6a91161 100644 --- a/src/app/views/hardware/show_storage.rhtml +++ b/src/app/views/hardware/show_storage.rhtml @@ -1,5 +1,5 @@ +
<% if @pool.storage_pools.size != 0 %>
- <%= render :partial => "/storage/grid", :locals => { :table_id => "storage_grid", - :hwpool => @pool, - :exclude_pool => nil, - :on_select => "storage_select", - :is_popup => false} %> +
+
+
    +
    +
    diff --git a/src/app/views/smart_pools/show_storage.rhtml b/src/app/views/smart_pools/show_storage.rhtml index 7cf425a..9a9b78e 100644 --- a/src/app/views/smart_pools/show_storage.rhtml +++ b/src/app/views/smart_pools/show_storage.rhtml @@ -5,10 +5,44 @@
    + +
    <% if @pool.tagged_storage_pools.size != 0 %>
    - <%= render :partial => "/storage/grid", :locals => { :table_id => "smart_storage_grid", - :hwpool => @pool, - :pool_controller => "smart_pools", - :exclude_pool => nil, - :on_select => "smart_storage_select", - :is_popup => false} %> +
    +
    +
      +
      +
      diff --git a/src/app/views/storage/show.rhtml b/src/app/views/storage/show.rhtml index 123cf20..a4cc1c2 100644 --- a/src/app/views/storage/show.rhtml +++ b/src/app/views/storage/show.rhtml @@ -40,51 +40,11 @@ <%=h @storage_pool.state %>
      <%- content_for :right do -%> -
      Volumes
      - -
      - -
      <%- end -%> <%= confirmation_dialog("confirm_delete_storage", "Are you sure?", "delete_storage_pool()") %> - diff --git a/src/public/javascripts/ovirt.js b/src/public/javascripts/ovirt.js index d84b3d9..e0e3dc8 100644 --- a/src/public/javascripts/ovirt.js +++ b/src/public/javascripts/ovirt.js @@ -62,6 +62,7 @@ function add_storage(url) { resource_ids: storage.toString() }, function(data,status){; $(document).trigger('close.facebox'); + // FIXME: this always reloads the tab for now grid = $("#storage_grid"); if (grid.size()>0 && grid != null) { grid.flexReload(); @@ -256,7 +257,7 @@ function empty_summary(element_id, label){ function get_selected_storage() { - return get_selected_checkboxes("storage_grid_form"); + return get_selected_checkboxes("storage_tree_form"); } function validate_storage_for_move() { -- 1.5.6.5 From sseago at redhat.com Tue Nov 18 05:53:28 2008 From: sseago at redhat.com (Scott Seago) Date: Tue, 18 Nov 2008 00:53:28 -0500 Subject: [Ovirt-devel] [PATCH server] Implement "poweroff" in the WUI. In-Reply-To: <1225900646-15307-1-git-send-email-clalance@redhat.com> References: <> <1225900646-15307-1-git-send-email-clalance@redhat.com> Message-ID: <49225858.5060104@redhat.com> Chris Lalancette wrote: > Implement the concept of "poweroff" for VMs in the WUI, and in the backend > taskomatic bits. This is the counterpart to "shutdown"; while > shutdown does a graceful shutdown of the guest (with an ACPI event), poweroff > pull the plug. This is necessary for situations in which the guest > doesn't understand the ACPI event (like 2.4 based Linux guests), where the > ACPI event fails for some reason, or where you just want to pull the plug. > > Signed-off-by: Chris Lalancette > --- > src/app/controllers/resources_controller.rb | 3 ++- > src/app/models/vm.rb | 3 +++ > src/app/models/vm_task.rb | 9 +++++++++ > src/task-omatic/task_vm.rb | 22 ++++++++++++---------- > src/task-omatic/taskomatic.rb | 1 + > 5 files changed, 27 insertions(+), 11 deletions(-) > > From a reviewing the code it looks like a reasonable approach. I haven't had a chance to test it yet, but if you've tested it in an appliance, then ACK. Otherwise I'll fire up an appliance tomorrow and test it out. Scott From clalance at redhat.com Tue Nov 18 06:38:16 2008 From: clalance at redhat.com (Chris Lalancette) Date: Tue, 18 Nov 2008 07:38:16 +0100 Subject: [Ovirt-devel] [PATCH server] Implement "poweroff" in the WUI. In-Reply-To: <49225858.5060104@redhat.com> References: <> <1225900646-15307-1-git-send-email-clalance@redhat.com> <49225858.5060104@redhat.com> Message-ID: <492262D8.7050403@redhat.com> Scott Seago wrote: > Chris Lalancette wrote: >> Implement the concept of "poweroff" for VMs in the WUI, and in the backend >> taskomatic bits. This is the counterpart to "shutdown"; while >> shutdown does a graceful shutdown of the guest (with an ACPI event), poweroff >> pull the plug. This is necessary for situations in which the guest >> doesn't understand the ACPI event (like 2.4 based Linux guests), where the >> ACPI event fails for some reason, or where you just want to pull the plug. >> >> Signed-off-by: Chris Lalancette >> --- >> src/app/controllers/resources_controller.rb | 3 ++- >> src/app/models/vm.rb | 3 +++ >> src/app/models/vm_task.rb | 9 +++++++++ >> src/task-omatic/task_vm.rb | 22 ++++++++++++---------- >> src/task-omatic/taskomatic.rb | 1 + >> 5 files changed, 27 insertions(+), 11 deletions(-) >> >> > From a reviewing the code it looks like a reasonable approach. I > haven't had a chance to test it yet, but if you've tested it in an > appliance, then ACK. Otherwise I'll fire up an appliance tomorrow and > test it out. Thanks for the review. I did test it out, and it seemed to do the right things in my testing. I mostly just wanted to make sure the minor model changes were fine. I'll push this now. -- Chris Lalancette From clalance at redhat.com Tue Nov 18 06:58:52 2008 From: clalance at redhat.com (Chris Lalancette) Date: Tue, 18 Nov 2008 07:58:52 +0100 Subject: [Ovirt-devel] Questions on the Server Suite UI In-Reply-To: <1226960972.25802.3.camel@physical.priv.ovirt.org> References: <492181F5.2030607@redhat.com> <20081117162333.GZ22797@redhat.com> <1226960972.25802.3.camel@physical.priv.ovirt.org> Message-ID: <492267AC.5040300@redhat.com> Jason Guiditta wrote: > On Mon, 2008-11-17 at 11:23 -0500, Hugh O. Brock wrote: >> On Mon, Nov 17, 2008 at 09:38:45AM -0500, Bryan Kearney wrote: > >>> Couple of UI RFEs: >>> - Given the richness of the UI, I keep expecting a right click context >>> menu. Especially in the tree nav. >> That would be a good idea, yes... paging Mr. Guiditta... >> > I think this would require some thought to see if it was really worth > the effort. I am not a big fan of taking over the browser's native > right click behavior, but we could certainly consider it if there is a > compelling use case. Right now, however, I do not see what that would > be, and quite frankly, I think we have more important things to improve > before pursuing this course if there really is interest. Yes, I agree with Jason here. While I know Zimbra does take over the right-click menu, in general I don't really think it is a good idea. We are in a browser, after all; I might want to "Copy Link Location" or "Select All". This is, of course, totally a subjective/style thing, but it fits in with the principle of least surprise. -- Chris Lalancette From clalance at redhat.com Tue Nov 18 07:01:18 2008 From: clalance at redhat.com (Chris Lalancette) Date: Tue, 18 Nov 2008 08:01:18 +0100 Subject: [Ovirt-devel] [PATCH node] Moved network configuration work files to a temporary directory. In-Reply-To: <4921F795.70508@redhat.com> References: <1226688726-27233-1-git-send-email-dpierce@redhat.com> <8763mq3umn.fsf@rho.meyering.net> <4921F795.70508@redhat.com> Message-ID: <4922683E.1000503@redhat.com> Perry Myers wrote: >> cf="$WORKDIR/config-augtool" >> { cat "$WORKDIR"/augtool-* && printf "save\n"; } > "$cf" \ >> && augtool < "$cf" >> >>> service network restart >>> } > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE >> I really, really prefer not to program in shell. > > Agreed. Unfortunately our choices on the Node are limited due to efforts > to keep image size small. The options are C and bash presently. > > Perhaps we should investigate what the cost would be to put *minimal* > python environment on the Node. Just core libraries and interpreter. > Doing this we could eventually replace this bash stuff with python which > is a little more maintainable :) It's pretty big, the last time I looked. You'll have to go through it again to find out exact numbers, but "minimal" and "Python" really don't belong in the same sentence. -- Chris Lalancette From apevec at redhat.com Tue Nov 18 10:50:02 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 18 Nov 2008 11:50:02 +0100 Subject: [Ovirt-devel] [PATCH ovirt-appliance] make gettree a bit smarted Message-ID: <1227005402-15055-1-git-send-email-apevec@redhat.com> handle both F9 and F10 trees now by using .treeinfo data --- gettree.sh | 69 ++++++++++++++++++++++++++++++++++++++------------- ovirt-appliance.ks | 11 +------- 2 files changed, 52 insertions(+), 28 deletions(-) diff --git a/gettree.sh b/gettree.sh index 67f6cf9..2310f2d 100755 --- a/gettree.sh +++ b/gettree.sh @@ -5,13 +5,32 @@ # e.g. http://download.fedoraproject.org/pub/fedora/linux/releases/9/Fedora/x86_64/os # download minimal Fedora tree: .treeinfo stage2 initrd and kernel +# Requires: wget +# Requires: python-iniparse +# Requires: createrepo + + +# download $destination $URL [$alternative1 ...] +# attempt to download from a list of URLs until it succeeds download() { - local f=$1 - case "$f" in - file://*) cp ${f#file://} . ;; - *) wget --progress=dot:mega --continue $f ;; - esac - printf "." + local destination=$1 + shift + local files="$@" + set +e + rc=0 + for f in $files; do + case "$f" in + file://*) cp ${f#file://} "$destination" ;; + *) wget --directory-prefix="$destination" ---progress=dot:mega --continue "$f" ;; + esac + rc=$? + if [ $rc == 0 ]; then + printf "." + break + fi + done + set -e + return $rc } if [[ $# < 2 ]]; then @@ -24,20 +43,34 @@ fi url=$1 dest=$2 -pushd $dest printf "Downloading minimal Fedora install tree from $url" set -e -download $url/.treeinfo +download "$dest" $url/.treeinfo +python -c ' +from iniparse.ini import INIConfig +ini = INIConfig() +fp = open(".treeinfo") +ini.readfp(fp) +fp.close() +family = ini.general.family +version = ini.general.version +arch = ini.general.arch +kernel = ini['images-'+arch].kernel +initrd = ini['images-'+arch].initrd +stage2 = ini.stage2.mainimage +print "%s %s %s" % (family, version, arch, kernel, initrd, stage2)' | ( read os ver arch kernel initrd stage2 +echo $os $ver $arch > .treeinfo.ova mkdir -p Packages -cd Packages -download $url/Packages/basesystem-8.1-1.noarch.rpm -cd .. +download Packages $url/Packages/basesystem-8.1-1.noarch.rpm $url/Packages/basesystem-10.0-1.noarch.rpm createrepo . -mkdir -p images/pxeboot -cd images -download $url/images/stage2.img -cd pxeboot -download $url/images/pxeboot/initrd.img -download $url/images/pxeboot/vmlinuz +dir="$dest/$(dirname $stage2)" +mkdir -p "$dir" +download "$dir" $url/$stage2 +dir="$dest/$(dirname $kernel)" +mkdir -p "$dir" +download "$dir" $url/$kernel +dir="$dest/$(dirname $initrd)" +mkdir -p "$dir" +download "$dir" $url/$initrd +) echo "done" -popd diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks index 8fabdb7..e9c19be 100644 --- a/ovirt-appliance.ks +++ b/ovirt-appliance.ks @@ -45,16 +45,7 @@ lokkit %post --nochroot set -e - python -c ' -from iniparse.ini import INIConfig -ini = INIConfig() -fp = open("tmp/tree/.treeinfo") -ini.readfp(fp) -fp.close() -family = ini.general.family -version = ini.general.version -arch = ini.general.arch -print "%s %s %s" % (family, version, arch)' | ( read os ver arch + cat tmp/tree/.treeinfo.ova | ( read os ver arch dest=$INSTALL_ROOT/var/www/cobbler/ks_mirror/$os-$ver-$arch printf "Importing $os-$ver-$arch ..." cp -a tmp/tree $dest -- 1.5.6.5 From bkearney at redhat.com Tue Nov 18 12:53:01 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Tue, 18 Nov 2008 07:53:01 -0500 Subject: [Ovirt-devel] Questions on the Server Suite UI In-Reply-To: <492267AC.5040300@redhat.com> References: <492181F5.2030607@redhat.com> <20081117162333.GZ22797@redhat.com> <1226960972.25802.3.camel@physical.priv.ovirt.org> <492267AC.5040300@redhat.com> Message-ID: <4922BAAD.8080709@redhat.com> Chris Lalancette wrote: > Jason Guiditta wrote: >> On Mon, 2008-11-17 at 11:23 -0500, Hugh O. Brock wrote: >>> On Mon, Nov 17, 2008 at 09:38:45AM -0500, Bryan Kearney wrote: >> >>>> Couple of UI RFEs: >>>> - Given the richness of the UI, I keep expecting a right click context >>>> menu. Especially in the tree nav. >>> That would be a good idea, yes... paging Mr. Guiditta... >>> >> I think this would require some thought to see if it was really worth >> the effort. I am not a big fan of taking over the browser's native >> right click behavior, but we could certainly consider it if there is a >> compelling use case. Right now, however, I do not see what that would >> be, and quite frankly, I think we have more important things to improve >> before pursuing this course if there really is interest. > > Yes, I agree with Jason here. While I know Zimbra does take over the > right-click menu, in general I don't really think it is a good idea. We are in > a browser, after all; I might want to "Copy Link Location" or "Select All". > This is, of course, totally a subjective/style thing, but it fits in with the > principle of least surprise. On one hand, i agree with you. This is not the most important issue. On the other, if you are going to go through the effort of doing a single frame.. all ajax UI... then complete the experience. The real issue is that I need to do 3 clicks to add a vm (Select the vm poo, select the vms menu item, select new vm) not counting menu navigation. If there was an easier way to get to the common tasks, that would be just as good. -- bk From hbrock at redhat.com Tue Nov 18 14:40:14 2008 From: hbrock at redhat.com (Hugh O. Brock) Date: Tue, 18 Nov 2008 09:40:14 -0500 Subject: [Ovirt-devel] Questions on the Server Suite UI In-Reply-To: <4922BAAD.8080709@redhat.com> References: <492181F5.2030607@redhat.com> <20081117162333.GZ22797@redhat.com> <1226960972.25802.3.camel@physical.priv.ovirt.org> <492267AC.5040300@redhat.com> <4922BAAD.8080709@redhat.com> Message-ID: <20081118144013.GK22797@redhat.com> On Tue, Nov 18, 2008 at 07:53:01AM -0500, Bryan Kearney wrote: > Chris Lalancette wrote: >> Jason Guiditta wrote: >>> On Mon, 2008-11-17 at 11:23 -0500, Hugh O. Brock wrote: >>>> On Mon, Nov 17, 2008 at 09:38:45AM -0500, Bryan Kearney wrote: >>> >>>>> Couple of UI RFEs: >>>>> - Given the richness of the UI, I keep expecting a right click >>>>> context menu. Especially in the tree nav. >>>> That would be a good idea, yes... paging Mr. Guiditta... >>>> >>> I think this would require some thought to see if it was really worth >>> the effort. I am not a big fan of taking over the browser's native >>> right click behavior, but we could certainly consider it if there is a >>> compelling use case. Right now, however, I do not see what that would >>> be, and quite frankly, I think we have more important things to improve >>> before pursuing this course if there really is interest. >> >> Yes, I agree with Jason here. While I know Zimbra does take over the >> right-click menu, in general I don't really think it is a good idea. We are in >> a browser, after all; I might want to "Copy Link Location" or "Select All". >> This is, of course, totally a subjective/style thing, but it fits in with the >> principle of least surprise. > > On one hand, i agree with you. This is not the most important issue. On > the other, if you are going to go through the effort of doing a single > frame.. all ajax UI... then complete the experience. > > The real issue is that I need to do 3 clicks to add a vm (Select the vm > poo, select the vms menu item, select new vm) not counting menu > navigation. If there was an easier way to get to the common tasks, that > would be just as good. We do have a new User Experience guy coming on board December 1 -- I would suggest having him take a look at the issue and figure out how we can streamline it, maybe without breaking the browser right-click menu. --Hugh From dpierce at redhat.com Tue Nov 18 16:12:41 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Tue, 18 Nov 2008 11:12:41 -0500 Subject: [Ovirt-devel] [PATCH node] Enabled automated network configuration via kernel arguments. Message-ID: <1227024761-16209-1-git-send-email-dpierce@redhat.com> PUSH CANDIDATE: This patch has reworked so that it handles both automated and interactive scenarios. It also contains a fix for a weird situation where, during interactive mode, the user could get into a state where they couldn't configure a device even after selecting it. To invoke automatic network configuration, the user must specify the interface to configure using the OVIRT_MGMT_IFACE kernel argument. The value for this argument is the interface name for the network device to be configured. If supplied, the user can set the IP address, netmask and gateway for this interface using the OVIRT_IP_ADDRESS, OVIRT_IP_NETMASK and OVIRT_IP_GATEWAY respectively. If all of these options are not provided then DHCP is assumed. Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 32 ++++++++++++++++++++++++-------- 1 files changed, 24 insertions(+), 8 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 4ad8af0..bfe35f2 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -3,6 +3,10 @@ # Iterates over the list of network devices on the node and prompts the user # to configure each. +ME=$(basename "$0") +warn() { printf '%s: %s\n' "$ME" "$*" >&2; } +die() { warn "$*"; exit 1; } + WORKDIR=$(mktemp -d) || exit 1 # Remove $WORKDIR upon interrupt (and HUP, PIPE, TERM) and upon normal @@ -17,11 +21,16 @@ function configure_interface { NIC=$1 AUTO=$2 - IPADDR=$OVIRT_IP_ADDRESS - NETMASK=$OVIRT_IP_NETMASK - GATEWAY=$OVIRT_IP_GATEWAY - - BRIDGE=ovirtbr`echo $NIC | cut -b4-` + if [[ "$AUTO" == "AUTO" && + -n "$OVIRT_IP_ADDRESS" && + -n "$OVIRT_IP_NETMASK" && + -n "$OVIRT_IP_GATEWAY" ]]; then + IPADDR=$OVIRT_IP_ADDRESS + NETMASK=$OVIRT_IP_NETMASK + GATEWAY=$OVIRT_IP_GATEWAY + fi + + BRIDGE=ovirtbr$NIC IF_FILENAME="$WORKDIR/augtool-$NIC" BR_FILENAME="$WORKDIR/augtool-$BRIDGE" @@ -40,6 +49,9 @@ function configure_interface # how do you want to configure this device? (dhcp, static IP) while true; do if [ -z "$AUTO" ]; then + IPADDR= + NETMASK= + GATEWAY= read -p "Will $BRIDGE use dynamic addressing? (Y/N) " else if [ -z "$IPADDR" ]; then @@ -59,8 +71,11 @@ function configure_interface printf "\t Gateway: "; read; GATEWAY=$REPLY printf "\nPlease review the details for $BRIDGE:\n" - printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Gateway: $GATEWAY\n" - read -p "Is this correct? (Y/N) " + printf '\t%s\n'\ + "IP Address: $IPADDR"\ + " Netmask: $NETMASK"\ + " Gateway: $GATEWAY" + read -p "Is this correct? (Y/N/A) " else REPLY="Y" fi @@ -71,6 +86,7 @@ function configure_interface BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/NETMASK $NETMASK" break ;; + A|a) return ;; esac ;; esac @@ -118,5 +134,5 @@ if [ "$RESTART" == "Y" ]; then { cat "$WORKDIR"/augtool-* && printf "save\n"; } > $config \ && augtool < $config \ && service network restart - } >> $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE + } >> $CONFIG_LOG_FILE 2>&1 fi -- 1.5.6.5 From pmyers at redhat.com Tue Nov 18 16:37:38 2008 From: pmyers at redhat.com (Perry Myers) Date: Tue, 18 Nov 2008 11:37:38 -0500 Subject: [Ovirt-devel] Re: [PATCH release] Add build dependencies for the oVirt repositories In-Reply-To: <49220D37.3040604@redhat.com> References: <1226718231-13742-1-git-send-email-pmyers@redhat.com> <49220D37.3040604@redhat.com> Message-ID: <4922EF52.3060901@redhat.com> Alan Pevec wrote: > Perry Myers wrote: >> +Requires: appliance-tools >= 003.7 > > ack, just this is 003.9 now pushed with update to 003.9 and addition of python-virtinst >= 0.400 from feedback from Jim. Perry -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=| From pmyers at redhat.com Tue Nov 18 16:41:11 2008 From: pmyers at redhat.com (Perry Myers) Date: Tue, 18 Nov 2008 11:41:11 -0500 Subject: [Ovirt-devel] Re: [PATCH appliance] Refactor the create-ovirt-appliance script into several scripts In-Reply-To: <492224FB.8010705@redhat.com> References: <1226700416-11413-1-git-send-email-pmyers@redhat.com> <1226700416-11413-2-git-send-email-pmyers@redhat.com> <1226700416-11413-3-git-send-email-pmyers@redhat.com> <1226700416-11413-4-git-send-email-pmyers@redhat.com> <492212B8.9090405@redhat.com> <492224FB.8010705@redhat.com> Message-ID: <4922F027.9020308@redhat.com> Perry Myers wrote: > Alan Pevec wrote: >> ACK - since this is a significant change in how appliance is >> installed, it might be a good to summarize all new steps in a wiki and >> put link in the commit message? > > Agreed. I'll do both before pushing these patches. > > Perry > Pushed this patch series (4 patches). Please see wiki at: http://ovirt.org/page/Appliance_Installation As this describes new process for installing the appliance in the next branch. Perry -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=| From jim at meyering.net Tue Nov 18 17:33:58 2008 From: jim at meyering.net (Jim Meyering) Date: Tue, 18 Nov 2008 18:33:58 +0100 Subject: [Ovirt-devel] .gitignore: ignore more build products Message-ID: <8763mlq6pl.fsf@rho.meyering.net> --- There are new build products to ignore. Sort them, and remove a blank line. .gitignore | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 309c35c..83fe611 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,11 @@ configure depcomp install-sh missing -stamp-h1 +ovirt-authorized_keys ovirt-node-image*.gz +ovirt-node-image-*-*iso +ovirt-node-image-*-*iso.sha1sum +ovirt-node-image.iso ovirt-node-image.spec - +repos.ks +stamp-h1 -- 1.6.0.4.1013.gc6a01 From jim at meyering.net Tue Nov 18 17:37:11 2008 From: jim at meyering.net (Jim Meyering) Date: Tue, 18 Nov 2008 18:37:11 +0100 Subject: [Ovirt-devel] another .gitignore Message-ID: <87zljxorzs.fsf@rho.meyering.net> I probably won't pollute the list with any more of these trivial changes. Rather I'll just commit them in the future. >From c9ddfa3925512b776c9296aa95bd05fd23c9a1a4 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 18 Nov 2008 18:36:12 +0100 Subject: [PATCH appliance] .gitignore: ignore more build products --- .gitignore | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/.gitignore b/.gitignore index a30b920..f6f68fa 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,10 @@ config.status configure install-sh missing -stamp-h1 +ovirt-appliance-*-*.tar +ovirt-appliance-*-*.tar.sha1sum ovirt-appliance-*.tar.gz ovirt-appliance.spec +ovirt-authorized_keys +repos.ks +stamp-h1 -- 1.6.0.4.1013.gc6a01 From dpierce at redhat.com Tue Nov 18 18:02:20 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Tue, 18 Nov 2008 13:02:20 -0500 Subject: [Ovirt-devel] [PATCH node] Enabled automated network configuration via kernel arguments. Message-ID: <1227031340-21991-1-git-send-email-dpierce@redhat.com> This patch removes unnecessary kernel argument dependencies and adds support for IPv6. If supplied, the user can set the IP address, netmask and gateway for this interface using the OVIRT_IP_ADDRESS, OVIRT_IP_NETMASK and OVIRT_IP_GATEWAY respectively. If all of these options are not provided then DHCP is assumed. Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 94 ++++++++++++++++++++++++++++++++------- scripts/ovirt-firstboot | 11 +---- 2 files changed, 79 insertions(+), 26 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 4ad8af0..15c09de 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -3,6 +3,10 @@ # Iterates over the list of network devices on the node and prompts the user # to configure each. +ME=$(basename "$0") +warn() { printf '%s: %s\n' "$ME" "$*" >&2; } +die() { warn "$*"; exit 1; } + WORKDIR=$(mktemp -d) || exit 1 # Remove $WORKDIR upon interrupt (and HUP, PIPE, TERM) and upon normal @@ -17,11 +21,15 @@ function configure_interface { NIC=$1 AUTO=$2 - IPADDR=$OVIRT_IP_ADDRESS - NETMASK=$OVIRT_IP_NETMASK - GATEWAY=$OVIRT_IP_GATEWAY - - BRIDGE=ovirtbr`echo $NIC | cut -b4-` + if [[ "$AUTO" == "AUTO" && + -n "$OVIRT_IP_ADDRESS" ]]; then + IPADDR=$OVIRT_IP_ADDRESS + NETMASK=$OVIRT_IP_NETMASK + GATEWAY=$OVIRT_IP_GATEWAY + PREFIX=$OVIRT_IP_PREFIX + fi + + BRIDGE=ovirtbr$NIC IF_FILENAME="$WORKDIR/augtool-$NIC" BR_FILENAME="$WORKDIR/augtool-$BRIDGE" @@ -40,6 +48,21 @@ function configure_interface # how do you want to configure this device? (dhcp, static IP) while true; do if [ -z "$AUTO" ]; then + IPADDR= + NETMASK= + GATEWAY= + IPTYPE= + + IPTYPES="IPv4 IPv6 Abort" + PS3="What type of network will be used? " + select TYPE in $IPTYPES + do + case "$TYPE" in + "Abort") return ;; + *) IPTYPE=$TYPE; break ;; + esac + done + read -p "Will $BRIDGE use dynamic addressing? (Y/N) " else if [ -z "$IPADDR" ]; then @@ -50,27 +73,65 @@ function configure_interface fi case $REPLY in - Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp"; break ;; + Y|y) + if [ "$IPTYPE" == "IPv4" ]; then + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp" + else + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6_AUTOCONF yes" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6_FORWARDING no" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6_INIT yes" + fi + + break ;; N|n) if [ -z "$IPADDR" ]; then printf "\nPlease enter the network details for $BRIDGE:\n" - printf "\tIP Address: "; read; IPADDR=$REPLY - printf "\t Netmask: "; read; NETMASK=$REPLY - printf "\t Gateway: "; read; GATEWAY=$REPLY + + if [ "$IPTYPE" == "IPv4" ]; then + printf "\tIP Address: "; read; IPADDR=$REPLY + printf "\t Netmask: "; read; NETMASK=$REPLY + printf "\t Gateway: "; read; GATEWAY=$REPLY + else + printf "\tIP Address: "; read; IPADDR=$REPLY + fi printf "\nPlease review the details for $BRIDGE:\n" - printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Gateway: $GATEWAY\n" - read -p "Is this correct? (Y/N) " + if [ "$IPTYPE" == "IPv4" ]; then + printf '\t%s\n'\ + "IP Address: $IPADDR"\ + " Netmask: $NETMASK"\ + " Gateway: $GATEWAY" + else + printf '\t%s\n'\ + "IP Address: $IPADDR" + fi + read -p "Is this correct? (Y/N/A) " else REPLY="Y" fi case $REPLY in Y|y) - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPADDR $IPADDR" - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/NETMASK $NETMASK" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO none" + case "$IPTYPE" in + "IPv4") + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPADDR $IPADDR" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/NETMASK $NETMASK" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/GATEWAY $GATEWAY" + break + ;; + + "IPv6") + BR_CONFIG="$BR_COFNIG\nset $BR_ROOT/IPV6INIT=yes" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6ADDR $IPADDR" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6_AUTCONF=no" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6_FORWARDING=no" + break + ;; + esac break ;; + A|a) return ;; esac ;; esac @@ -89,11 +150,12 @@ function setup_menu { NICS=$(hal-device | awk '/net.interface/ {match($0, "= '"'"'(.*)'"'"' ", nic); printf("%s ", nic[1]); }') NICS="$NICS Save Quit" - PS3="Please select a network interface to configure:" + PS3="Please select a network interface to configure: " } if [ "$1" == "AUTO" ]; then - configure_interface $OVIRT_MGMT_IFACE AUTO + if [ -n "$OVIRT_IPV6" ]; then IPTYPE="IPv6"; else IPTYPE="IPv4"; fi + configure_interface $OVIRT_BOOTIF AUTO RESTART="Y" else setup_menu @@ -118,5 +180,5 @@ if [ "$RESTART" == "Y" ]; then { cat "$WORKDIR"/augtool-* && printf "save\n"; } > $config \ && augtool < $config \ && service network restart - } >> $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE + } >> $CONFIG_LOG_FILE 2>&1 fi diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot index ed4ad2d..82d9e48 100755 --- a/scripts/ovirt-firstboot +++ b/scripts/ovirt-firstboot @@ -29,16 +29,7 @@ start () { - INTERACTIVE="Y" - - if [ -n "$OVIRT_MGMT_IFACE" ]; then - INTERACTIVE="N" - ovirt-config-networking AUTO - fi - - if [ "$INTERACTIVE" == "Y" ]; then - ovirt-config-setup - fi + ovirt-config-setup } case "$1" in -- 1.5.6.5 From berrange at redhat.com Tue Nov 18 18:48:02 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Tue, 18 Nov 2008 18:48:02 +0000 Subject: [Ovirt-devel] [PATCH node] Enabled automated network configuration via kernel arguments. In-Reply-To: <1227031340-21991-1-git-send-email-dpierce@redhat.com> References: <1227031340-21991-1-git-send-email-dpierce@redhat.com> Message-ID: <20081118184802.GF22772@redhat.com> On Tue, Nov 18, 2008 at 01:02:20PM -0500, Darryl L. Pierce wrote: > This patch removes unnecessary kernel argument dependencies and adds support for IPv6. > > If supplied, the user can set the IP address, netmask and gateway for > this interface using the OVIRT_IP_ADDRESS, OVIRT_IP_NETMASK and > OVIRT_IP_GATEWAY respectively. If all of these options are not provided > then DHCP is assumed. > > Signed-off-by: Darryl L. Pierce > --- > scripts/ovirt-config-networking | 94 ++++++++++++++++++++++++++++++++------- > scripts/ovirt-firstboot | 11 +---- > 2 files changed, 79 insertions(+), 26 deletions(-) > > diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking > index 4ad8af0..15c09de 100755 > --- a/scripts/ovirt-config-networking > +++ b/scripts/ovirt-config-networking > @@ -3,6 +3,10 @@ > # Iterates over the list of network devices on the node and prompts the user > # to configure each. > > +ME=$(basename "$0") > +warn() { printf '%s: %s\n' "$ME" "$*" >&2; } > +die() { warn "$*"; exit 1; } > + > WORKDIR=$(mktemp -d) || exit 1 > > # Remove $WORKDIR upon interrupt (and HUP, PIPE, TERM) and upon normal > @@ -17,11 +21,15 @@ function configure_interface > { > NIC=$1 > AUTO=$2 > - IPADDR=$OVIRT_IP_ADDRESS > - NETMASK=$OVIRT_IP_NETMASK > - GATEWAY=$OVIRT_IP_GATEWAY > - > - BRIDGE=ovirtbr`echo $NIC | cut -b4-` > + if [[ "$AUTO" == "AUTO" && > + -n "$OVIRT_IP_ADDRESS" ]]; then > + IPADDR=$OVIRT_IP_ADDRESS > + NETMASK=$OVIRT_IP_NETMASK > + GATEWAY=$OVIRT_IP_GATEWAY > + PREFIX=$OVIRT_IP_PREFIX > + fi > + > + BRIDGE=ovirtbr$NIC > IF_FILENAME="$WORKDIR/augtool-$NIC" > BR_FILENAME="$WORKDIR/augtool-$BRIDGE" > > @@ -40,6 +48,21 @@ function configure_interface > # how do you want to configure this device? (dhcp, static IP) > while true; do > if [ -z "$AUTO" ]; then > + IPADDR= > + NETMASK= > + GATEWAY= > + IPTYPE= > + > + IPTYPES="IPv4 IPv6 Abort" > + PS3="What type of network will be used? " > + select TYPE in $IPTYPES > + do > + case "$TYPE" in > + "Abort") return ;; > + *) IPTYPE=$TYPE; break ;; > + esac > + done This is wrong. You can have IPv4 only, IPv6 only (unlikely) or IPv4+IPv6 co-existing (likely). So you have to be able to setup IP details for each. Also, this is using inconsistent/mixed concepts. You're asking for netmask with IPv4 and prefix with IPv6. > + > read -p "Will $BRIDGE use dynamic addressing? (Y/N) " This is insufficient for IPv6. With IPv4 you have a choice of - Static config - Stateful autoconfig (ie DHCP) With IPv6 you have a choice of - Static config - Stateful autoconf (ie DHCPv6) - Stateless autoconf (fully automatic) I think you're better off combining the questions into one, so - Do you want to enable IPv4 ? no/static/dhcp If static => Prompt for IPv4 address, prefix or netmask (allow them to enter either and figure out which they provided yourself), and gateway - Do you want to enable IPv6 ? no/static/dhcp6/autoconf If static => Prompt for IPv6 address and prefix. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From jguiditt at redhat.com Tue Nov 18 19:49:18 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Tue, 18 Nov 2008 14:49:18 -0500 Subject: [Ovirt-devel] [PATCH server] DB change to support larger numbers. In-Reply-To: <1226952991-25573-1-git-send-email-jguiditt@redhat.com> References: <1226952991-25573-1-git-send-email-jguiditt@redhat.com> Message-ID: <1227037758-6768-1-git-send-email-jguiditt@redhat.com> Fix migration number, 029 was already taken. Since we store mem, storage, etc in KB, we need an 8 byte int. This patch change all tables with this type of data to support larger size. Signed-off-by: Jason Guiditta --- src/db/migrate/030_update_integer_size.rb | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) create mode 100644 src/db/migrate/030_update_integer_size.rb diff --git a/src/db/migrate/030_update_integer_size.rb b/src/db/migrate/030_update_integer_size.rb new file mode 100644 index 0000000..5c67d48 --- /dev/null +++ b/src/db/migrate/030_update_integer_size.rb @@ -0,0 +1,22 @@ +class UpdateIntegerSize < ActiveRecord::Migration + def self.up + #Since we store mem, storage, etc in KB, we need an 8 byte int. + #Change all tables with this type of data to support larger size + + change_column :hosts, :memory, :integer, :limit => 8 + change_column :storage_volumes, :size, :integer, :limit => 8 + change_column :quotas, :total_vmemory, :integer, :limit => 8 + change_column :quotas, :total_storage, :integer, :limit => 8 + change_column :vms, :memory_allocated, :integer, :limit => 8 + change_column :vms, :memory_used, :integer, :limit => 8 + end + + def self.down + change_column :hosts, :memory, :integer, :limit => 4 + change_column :storage_volumes, :size, :integer, :limit => 4 + change_column :quotas, :total_vmemory, :integer, :limit => 4 + change_column :quotas, :total_storage, :integer, :limit => 4 + change_column :vms, :memory_allocated, :integer, :limit => 4 + change_column :vms, :memory_used, :integer, :limit => 4 + end +end -- 1.5.6.5 From jguiditt at redhat.com Tue Nov 18 21:39:21 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Tue, 18 Nov 2008 16:39:21 -0500 Subject: [Ovirt-devel] [PATCH] replaced flexigrid-based display for HW and smart pool storage with tree component. In-Reply-To: <1226986508-16194-1-git-send-email-sseago@redhat.com> References: <1226986508-16194-1-git-send-email-sseago@redhat.com> Message-ID: <1227044361.6686.7.camel@physical.priv.ovirt.org> Overall works well for me, some comments inline, plus that bit of filtering we discussed in irc - lvm volumes should be filtered from add storage list. On Tue, 2008-11-18 at 05:35 +0000, Scott Seago wrote: > Signed-off-by: Scott Seago > --- > src/app/controllers/hardware_controller.rb | 3 +- > src/app/controllers/search_controller.rb | 41 ++++++--- > src/app/controllers/smart_pools_controller.rb | 1 + > src/app/controllers/storage_controller.rb | 2 +- > src/app/models/smart_pool.rb | 20 ++++ > src/app/models/storage_pool.rb | 3 +- > src/app/models/storage_volume.rb | 7 +- > src/app/views/hardware/show_storage.rhtml | 64 +++++++++---- > src/app/views/smart_pools/show_storage.rhtml | 63 +++++++++---- > src/app/views/storage/show.rhtml | 40 -------- > src/app/views/storage/show_volume.rhtml | 127 +++++++++---------------- > src/public/javascripts/ovirt.js | 3 +- > 12 files changed, 200 insertions(+), 174 deletions(-) > > diff --git a/src/app/controllers/hardware_controller.rb b/src/app/controllers/hardware_controller.rb > index 8c26184..4dda736 100644 > --- a/src/app/controllers/hardware_controller.rb > +++ b/src/app/controllers/hardware_controller.rb > @@ -111,6 +111,7 @@ class HardwareController < PoolController > end > > def show_storage > + @storage_tree = @pool.storage_tree(:filter_unavailable => false, :include_used => true).to_json > show > end > > @@ -171,7 +172,7 @@ class HardwareController < PoolController > id = params[:exclude_pool] > storage_pools = StoragePool > find_opts = {:include => :hardware_pool, > - :conditions => ["pools.id != ?", id]} > + :conditions => ["(storage_pools.type != 'LvmStoragePool') and (pools.id != ?)", id]} > include_pool = true > end > super(:full_items => storage_pools,:include_pool => include_pool,:find_opts => find_opts) > diff --git a/src/app/controllers/search_controller.rb b/src/app/controllers/search_controller.rb > index 3789309..7551242 100644 > --- a/src/app/controllers/search_controller.rb > +++ b/src/app/controllers/search_controller.rb > @@ -19,18 +19,33 @@ > > class SearchController < ApplicationController > > - MODELS = {"HardwarePool" => {:controller => "hardware", > - :show_action => "quick_summary"}, > - "VmResourcePool" => {:controller => "resources", > - :show_action => "quick_summary"}, > - "Host" => {:controller => "host", > - :show_action => "show"}, > - "Vm" => {:controller => "vm", > - :show_action => "show"}, > - "IscsiStoragePool" => {:controller => "storage", > - :show_action => "show"}, > - "NfsStoragePool" => {:controller => "storage", > - :show_action => "show"}} > + MODELS = {"HardwarePool" => {:controller => "hardware", > + :show_action => "quick_summary", > + :searched => true}, > + "VmResourcePool" => {:controller => "resources", > + :show_action => "quick_summary", > + :searched => true}, > + "Host" => {:controller => "host", > + :show_action => "show", > + :searched => true}, > + "Vm" => {:controller => "vm", > + :show_action => "show", > + :searched => true}, > + "IscsiStoragePool" => {:controller => "storage", > + :show_action => "show", > + :searched => true}, > + "NfsStoragePool" => {:controller => "storage", > + :show_action => "show", > + :searched => true}, > + "IscsiStorageVolume" => {:controller => "storage", > + :show_action => "show_volume", > + :searched => false}, > + "NfsStorageVolume" => {:controller => "storage", > + :show_action => "show_volume", > + :searched => false}, > + "LvmStorageVolume" => {:controller => "storage", > + :show_action => "show_volume", > + :searched => false}} > > MULTI_TYPE_MODELS = {"StoragePool" => ["IscsiStoragePool", "NfsStoragePool"]} > > @@ -50,7 +65,7 @@ class SearchController < ApplicationController > @model_param ||= "" > > if @model_param == "" > - @models = MODELS.keys > + @models = MODELS.keys.select {|model| MODELS[model][:searched]} > else > @models = MULTI_TYPE_MODELS[@model_param] > @models ||= [@model_param] > diff --git a/src/app/controllers/smart_pools_controller.rb b/src/app/controllers/smart_pools_controller.rb > index 0295b63..37ccdad 100644 > --- a/src/app/controllers/smart_pools_controller.rb > +++ b/src/app/controllers/smart_pools_controller.rb > @@ -38,6 +38,7 @@ class SmartPoolsController < PoolController > end > > def show_storage > + @storage_tree = @pool.storage_tree(:filter_unavailable => false, :include_used => true).to_json > show > end > > diff --git a/src/app/controllers/storage_controller.rb b/src/app/controllers/storage_controller.rb > index e3e5522..6e6e3c2 100644 > --- a/src/app/controllers/storage_controller.rb > +++ b/src/app/controllers/storage_controller.rb > @@ -107,7 +107,7 @@ class StorageController < ApplicationController > end > else > respond_to do |format| > - format.html { render :layout => 'popup' } > + format.html { render :layout => 'selection' } > format.xml { render :xml => @storage_volume.to_xml } > end > end > diff --git a/src/app/models/smart_pool.rb b/src/app/models/smart_pool.rb > index ac6db5e..772ffef 100644 > --- a/src/app/models/smart_pool.rb > +++ b/src/app/models/smart_pool.rb > @@ -97,4 +97,24 @@ class SmartPool < Pool > user_pools[-1] << "break" unless user_pools.empty? > user_pools + other_pools > end Excellent to see documentation of code, makes it so much easier to understand > + > + # params accepted: > + # :vm_to_include - if specified, storage used by this VM is included in the tree > + # :filter_unavailable - if true, don't include Storage not currently available > + # :include_used - include all storage pools/volumes, even those in use > + # for smart pools, filter_unavailable defaults to false and include_used to true > + def storage_tree(params = {}) > + vm_to_include=params.fetch(:vm_to_include, nil) > + filter_unavailable = params.fetch(:filter_unavailable, false) > + include_used = params.fetch(:include_used, true) > + conditions = "type != 'LvmStoragePool'" > + if filter_unavailable > + conditions = "(#{conditions}) and (storage_pools.state = '#{StoragePool::STATE_AVAILABLE}')" > + end > + tagged_storage_pools.find(:all, > + :conditions => conditions).collect do |pool| > + pool.storage_tree_element(params) > + end > + end > + > end > diff --git a/src/app/models/storage_pool.rb b/src/app/models/storage_pool.rb > index 9c80f54..bab7031 100644 > --- a/src/app/models/storage_pool.rb > +++ b/src/app/models/storage_pool.rb > @@ -97,7 +97,8 @@ class StoragePool < ActiveRecord::Base > :name => display_name, > :available => false, > :create_volume => user_subdividable, > - :selected => false} > + :selected => false, > + :is_pool => true} > conditions = nil > unless include_used > conditions = "vms.id is null" > diff --git a/src/app/models/storage_volume.rb b/src/app/models/storage_volume.rb > index 56cdcef..39b72d5 100644 > --- a/src/app/models/storage_volume.rb > +++ b/src/app/models/storage_volume.rb > @@ -80,6 +80,10 @@ class StorageVolume < ActiveRecord::Base > return false > end > > + def deletable > + storage_pool.user_subdividable and vms.empty? and (lvm_storage_pool.nil? or lvm_storage_pool.storage_volumes.empty?) > + end > + > def storage_tree_element(params = {}) > vm_to_include=params.fetch(:vm_to_include, nil) > filter_unavailable = params.fetch(:filter_unavailable, true) > @@ -95,7 +99,8 @@ class StorageVolume < ActiveRecord::Base > vm_ids.include?(vm_to_include.id))), > :create_volume => supports_lvm_subdivision, > :selected => (!vm_ids.empty? and vm_to_include and vm_to_include.id and > - (vm_ids.include?(vm_to_include.id)))} > + (vm_ids.include?(vm_to_include.id))), > + :is_pool => false} > if lvm_storage_pool > if return_hash[:available] > return_hash[:available] = lvm_storage_pool.storage_volumes.full_vm_list.empty? > diff --git a/src/app/views/hardware/show_storage.rhtml b/src/app/views/hardware/show_storage.rhtml > index 5ade456..6a91161 100644 > --- a/src/app/views/hardware/show_storage.rhtml > +++ b/src/app/views/hardware/show_storage.rhtml > @@ -1,5 +1,5 @@ > > > + > >
      > <% if @pool.storage_pools.size != 0 %> >
      > - <%= render :partial => "/storage/grid", :locals => { :table_id => "storage_grid", > - :hwpool => @pool, > - :exclude_pool => nil, > - :on_select => "storage_select", > - :is_popup => false} %> > +
      Please extract this style into a class > +
      > +
        > +
        > +
        >
        > >
        > diff --git a/src/app/views/smart_pools/show_storage.rhtml b/src/app/views/smart_pools/show_storage.rhtml > index 7cf425a..9a9b78e 100644 > --- a/src/app/views/smart_pools/show_storage.rhtml > +++ b/src/app/views/smart_pools/show_storage.rhtml > @@ -5,10 +5,44 @@ > >
        > > + > + > >
        > <% if @pool.tagged_storage_pools.size != 0 %> >
        > - <%= render :partial => "/storage/grid", :locals => { :table_id => "smart_storage_grid", > - :hwpool => @pool, > - :pool_controller => "smart_pools", > - :exclude_pool => nil, > - :on_select => "smart_storage_select", > - :is_popup => false} %> > +
        css class > +
        > +
          > +
          > +
          >
          > >
          > diff --git a/src/app/views/storage/show.rhtml b/src/app/views/storage/show.rhtml > index 123cf20..a4cc1c2 100644 > --- a/src/app/views/storage/show.rhtml > +++ b/src/app/views/storage/show.rhtml > @@ -40,51 +40,11 @@ > <%=h @storage_pool.state %>
          >
          > <%- content_for :right do -%> > -
          Volumes
          > - > -
          > - > -
          > > <%- end -%> > > <%= confirmation_dialog("confirm_delete_storage", "Are you sure?", "delete_storage_pool()") %> > > - > diff --git a/src/public/javascripts/ovirt.js b/src/public/javascripts/ovirt.js > index d84b3d9..e0e3dc8 100644 > --- a/src/public/javascripts/ovirt.js > +++ b/src/public/javascripts/ovirt.js > @@ -62,6 +62,7 @@ function add_storage(url) > { resource_ids: storage.toString() }, > function(data,status){; > $(document).trigger('close.facebox'); > + // FIXME: this always reloads the tab for now > grid = $("#storage_grid"); > if (grid.size()>0 && grid != null) { > grid.flexReload(); > @@ -256,7 +257,7 @@ function empty_summary(element_id, label){ > > function get_selected_storage() > { > - return get_selected_checkboxes("storage_grid_form"); > + return get_selected_checkboxes("storage_tree_form"); > } > function validate_storage_for_move() > { From pmyers at redhat.com Tue Nov 18 21:43:10 2008 From: pmyers at redhat.com (Perry Myers) Date: Tue, 18 Nov 2008 16:43:10 -0500 Subject: [Ovirt-devel] [PATCH appliance] Add -f flag to create-ovirt-network Message-ID: <1227044590-17817-1-git-send-email-pmyers@redhat.com> -f indicates that: 1. Don't abort if NetworkManager is installed (Note: with NetworkManager enabled, -e parameter will not work properly since some interfaces are controlled via NetworkManager and some would need to be controlled via standard network init script. Without -e parameter, the libvirt controlled ovirtbr0 works fine) 2. Don't prompt for overwriting interface specified with -e parameter So use -f at your own risk! Signed-off-by: Perry Myers --- create-ovirt-network | 8 +++++--- ovirt-appliance-functions | 13 +++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/create-ovirt-network b/create-ovirt-network index 00b56ba..b7a4526 100755 --- a/create-ovirt-network +++ b/create-ovirt-network @@ -5,17 +5,19 @@ usage() { case $# in 1) warn "$1"; try_h; exit 1;; esac cat < /dev/null 2>&1 \ - && die "NetworkManager is running, disable and use standard network scripts before proceeding" + service NetworkManager status > /dev/null 2>&1 ; netman_status=$? + if [ $netman_status -eq 0 ]; then + if [ $force -ne 1 ]; then + die "NetworkManager is running, disable and use standard network scripts before proceeding" + elif [ -n "$bridge" ]; then + echo "WARNING! NetworkManager running and bridge ($bridge) specified" + echo "WARNING! This combination will most likely not work." + fi + fi service iptables status > /dev/null 2>&1 \ || service iptables start > /dev/null 2>&1 -- 1.6.0.3 From jim at meyering.net Tue Nov 18 21:59:48 2008 From: jim at meyering.net (Jim Meyering) Date: Tue, 18 Nov 2008 22:59:48 +0100 Subject: [Ovirt-devel] [PATCH ovirt-appliance] make gettree a bit smarted In-Reply-To: <1227005402-15055-1-git-send-email-apevec@redhat.com> (Alan Pevec's message of "Tue, 18 Nov 2008 11:50:02 +0100") References: <1227005402-15055-1-git-send-email-apevec@redhat.com> Message-ID: <87od0cpuej.fsf@rho.meyering.net> Alan Pevec wrote: > handle both F9 and F10 trees now by using .treeinfo data Hi Alan, Nice patch! There was one fatal typo. I've suggested a fix for that, along with a couple other minor things. There's a nit in subject: s/ted$/ter/ > --- > gettree.sh | 69 ++++++++++++++++++++++++++++++++++++++------------- > ovirt-appliance.ks | 11 +------- > 2 files changed, 52 insertions(+), 28 deletions(-) > > diff --git a/gettree.sh b/gettree.sh > index 67f6cf9..2310f2d 100755 > --- a/gettree.sh > +++ b/gettree.sh > @@ -5,13 +5,32 @@ > # e.g. http://download.fedoraproject.org/pub/fedora/linux/releases/9/Fedora/x86_64/os > # download minimal Fedora tree: .treeinfo stage2 initrd and kernel > > +# Requires: wget > +# Requires: python-iniparse > +# Requires: createrepo > + > + > +# download $destination $URL [$alternative1 ...] > +# attempt to download from a list of URLs until it succeeds > download() { > - local f=$1 > - case "$f" in > - file://*) cp ${f#file://} . ;; > - *) wget --progress=dot:mega --continue $f ;; > - esac > - printf "." > + local destination=$1 > + shift > + local files="$@" > + set +e > + rc=0 > + for f in $files; do > + case "$f" in quotes not needed in "case": case $f in > + file://*) cp ${f#file://} "$destination" ;; > + *) wget --directory-prefix="$destination" ---progress=dot:mega --continue "$f" ;; Too many "-": s/---/--/ And that line is too long, so: *) wget --directory-prefix="$destination" \ --progress=dot:mega --continue "$f" ;; > + esac > + rc=$? > + if [ $rc == 0 ]; then > + printf "." > + break > + fi > + done > + set -e > + return $rc > } > > if [[ $# < 2 ]]; then > @@ -24,20 +43,34 @@ fi > url=$1 > dest=$2 > > -pushd $dest > printf "Downloading minimal Fedora install tree from $url" > set -e > -download $url/.treeinfo > +download "$dest" $url/.treeinfo > +python -c ' > +from iniparse.ini import INIConfig > +ini = INIConfig() > +fp = open(".treeinfo") > +ini.readfp(fp) > +fp.close() > +family = ini.general.family > +version = ini.general.version > +arch = ini.general.arch > +kernel = ini['images-'+arch].kernel > +initrd = ini['images-'+arch].initrd > +stage2 = ini.stage2.mainimage > +print "%s %s %s" % (family, version, arch, kernel, initrd, stage2)' | ( read os ver arch kernel initrd stage2 > +echo $os $ver $arch > .treeinfo.ova > mkdir -p Packages > -cd Packages > -download $url/Packages/basesystem-8.1-1.noarch.rpm > -cd .. > +download Packages $url/Packages/basesystem-8.1-1.noarch.rpm $url/Packages/basesystem-10.0-1.noarch.rpm To be safe, better to quote things and split long lines for readability: download Packages "$url/Packages/basesystem-8.1-1.noarch.rpm" \ "$url/Packages/basesystem-10.0-1.noarch.rpm" > createrepo . > -mkdir -p images/pxeboot > -cd images > -download $url/images/stage2.img > -cd pxeboot > -download $url/images/pxeboot/initrd.img > -download $url/images/pxeboot/vmlinuz > +dir="$dest/$(dirname $stage2)" > +mkdir -p "$dir" > +download "$dir" $url/$stage2 Add quotes: download "$dir" "$url/$stage2" > +dir="$dest/$(dirname $kernel)" > +mkdir -p "$dir" > +download "$dir" $url/$kernel And here ^^ > +dir="$dest/$(dirname $initrd)" > +mkdir -p "$dir" > +download "$dir" $url/$initrd and here download "$dir" "$url/$initrd" > +) > echo "done" > -popd > diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks > index 8fabdb7..e9c19be 100644 > --- a/ovirt-appliance.ks > +++ b/ovirt-appliance.ks > @@ -45,16 +45,7 @@ lokkit > > %post --nochroot > set -e > - python -c ' > -from iniparse.ini import INIConfig > -ini = INIConfig() > -fp = open("tmp/tree/.treeinfo") > -ini.readfp(fp) > -fp.close() > -family = ini.general.family > -version = ini.general.version > -arch = ini.general.arch > -print "%s %s %s" % (family, version, arch)' | ( read os ver arch > + cat tmp/tree/.treeinfo.ova | ( read os ver arch > dest=$INSTALL_ROOT/var/www/cobbler/ks_mirror/$os-$ver-$arch > printf "Importing $os-$ver-$arch ..." > cp -a tmp/tree $dest I see it's just context, but this should be cp -a tmp/tree "$dest" From apevec at redhat.com Tue Nov 18 22:36:31 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 18 Nov 2008 23:36:31 +0100 Subject: [Ovirt-devel] [PATCH appliance] make gettree.sh a bit smarter In-Reply-To: <87od0cpuej.fsf@rho.meyering.net> References: <87od0cpuej.fsf@rho.meyering.net> Message-ID: <1227047791-793-1-git-send-email-apevec@redhat.com> handle both F9 and F10 trees by using .treeinfo metadata Signed-off-by: Alan Pevec --- gettree.sh | 72 ++++++++++++++++++++++++++++++++++++++------------- ovirt-appliance.ks | 13 +-------- 2 files changed, 55 insertions(+), 30 deletions(-) diff --git a/gettree.sh b/gettree.sh index 67f6cf9..68b7434 100755 --- a/gettree.sh +++ b/gettree.sh @@ -5,13 +5,32 @@ # e.g. http://download.fedoraproject.org/pub/fedora/linux/releases/9/Fedora/x86_64/os # download minimal Fedora tree: .treeinfo stage2 initrd and kernel +# Requires: wget +# Requires: python-iniparse +# Requires: createrepo + +# download $destination $URL [$alternative1 ...] +# attempt to download from a list of URLs until it succeeds download() { - local f=$1 - case "$f" in - file://*) cp ${f#file://} . ;; - *) wget --progress=dot:mega --continue $f ;; - esac - printf "." + local destination=$1 + shift + local files="$@" + set +e + rc=0 + for f in $files; do + case $f in + file://*) cp ${f#file://} "$destination" ;; + *) wget --directory-prefix="$destination" \ + --progress=dot:mega --continue "$f" ;; + esac + rc=$? + if [ $rc == 0 ]; then + printf "." + break + fi + done + set -e + return $rc } if [[ $# < 2 ]]; then @@ -23,21 +42,36 @@ fi url=$1 dest=$2 - -pushd $dest +set -x printf "Downloading minimal Fedora install tree from $url" set -e -download $url/.treeinfo +download "$dest" $url/.treeinfo +python -c 'from iniparse.ini import INIConfig +ini = INIConfig() +fp = open("'"$dest"'.treeinfo") +ini.readfp(fp) +fp.close() +family = ini.general.family +version = ini.general.version +arch = ini.general.arch +kernel = ini["images-"+arch].kernel +initrd = ini["images-"+arch].initrd +stage2 = ini.stage2.mainimage +print "%s %s %s %s %s %s" % (family, version, arch, kernel, initrd, stage2)' | \ +( +read os ver arch kernel initrd stage2 +echo $os $ver $arch > "$dest/.treeinfo.ova" mkdir -p Packages -cd Packages -download $url/Packages/basesystem-8.1-1.noarch.rpm -cd .. +download Packages "$url/Packages/basesystem-8.1-1.noarch.rpm" \ "$url/Packages/basesystem-10.0-1.noarch.rpm" createrepo . -mkdir -p images/pxeboot -cd images -download $url/images/stage2.img -cd pxeboot -download $url/images/pxeboot/initrd.img -download $url/images/pxeboot/vmlinuz +dir="$dest/$(dirname $stage2)" +mkdir -p "$dir" +download "$dir" "$url/$stage2" +dir="$dest/$(dirname $kernel)" +mkdir -p "$dir" +download "$dir" "$url/$kernel" +dir="$dest/$(dirname $initrd)" +mkdir -p "$dir" +download "$dir" "$url/$initrd" +) echo "done" -popd diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks index f9bfcd5..5cb4e1c 100644 --- a/ovirt-appliance.ks +++ b/ovirt-appliance.ks @@ -54,18 +54,9 @@ lokkit fi set -e - python -c ' -from iniparse.ini import INIConfig -ini = INIConfig() -fp = open("tmp/tree/.treeinfo") -ini.readfp(fp) -fp.close() -family = ini.general.family -version = ini.general.version -arch = ini.general.arch -print "%s %s %s" % (family, version, arch)' | ( read os ver arch + cat tmp/tree/.treeinfo.ova | ( read os ver arch dest=$INSTALL_ROOT/var/www/cobbler/ks_mirror/$os-$ver-$arch printf "Importing $os-$ver-$arch ..." - cp -a tmp/tree $dest + cp -a tmp/tree "$dest" ) %end -- 1.5.6.5 From apevec at redhat.com Tue Nov 18 22:54:07 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 18 Nov 2008 23:54:07 +0100 Subject: [Ovirt-devel] [PATCH appliance] make gettree.sh a bit smarter In-Reply-To: <87od0cpuej.fsf@rho.meyering.net> References: <87od0cpuej.fsf@rho.meyering.net> Message-ID: <1227048847-2036-1-git-send-email-apevec@redhat.com> handle both F9 and F10 trees by using .treeinfo metadata REPOST with few more fixes Signed-off-by: Alan Pevec --- gettree.sh | 75 ++++++++++++++++++++++++++++++++++++++-------------- ovirt-appliance.ks | 13 +------- 2 files changed, 57 insertions(+), 31 deletions(-) diff --git a/gettree.sh b/gettree.sh index 67f6cf9..523a40b 100755 --- a/gettree.sh +++ b/gettree.sh @@ -5,13 +5,32 @@ # e.g. http://download.fedoraproject.org/pub/fedora/linux/releases/9/Fedora/x86_64/os # download minimal Fedora tree: .treeinfo stage2 initrd and kernel +# Requires: wget +# Requires: python-iniparse +# Requires: createrepo + +# download $destination $URL [$alternative1 ...] +# attempt to download from a list of URLs until it succeeds download() { - local f=$1 - case "$f" in - file://*) cp ${f#file://} . ;; - *) wget --progress=dot:mega --continue $f ;; - esac - printf "." + local destination=$1 + shift + local files="$@" + set +e + rc=0 + for f in $files; do + case $f in + file://*) cp ${f#file://} "$destination" ;; + *) wget --directory-prefix="$destination" \ + --progress=dot:mega --continue "$f" ;; + esac + rc=$? + if [ $rc == 0 ]; then + printf "." + break + fi + done + set -e + return $rc } if [[ $# < 2 ]]; then @@ -24,20 +43,36 @@ fi url=$1 dest=$2 -pushd $dest printf "Downloading minimal Fedora install tree from $url" set -e -download $url/.treeinfo -mkdir -p Packages -cd Packages -download $url/Packages/basesystem-8.1-1.noarch.rpm -cd .. -createrepo . -mkdir -p images/pxeboot -cd images -download $url/images/stage2.img -cd pxeboot -download $url/images/pxeboot/initrd.img -download $url/images/pxeboot/vmlinuz +download "$dest" $url/.treeinfo +python -c 'from iniparse.ini import INIConfig +ini = INIConfig() +fp = open("'"$dest"'.treeinfo") +ini.readfp(fp) +fp.close() +family = ini.general.family +version = ini.general.version +arch = ini.general.arch +kernel = ini["images-"+arch].kernel +initrd = ini["images-"+arch].initrd +stage2 = ini.stage2.mainimage +print "%s %s %s %s %s %s" % (family, version, arch, kernel, initrd, stage2)' | \ +( +read os ver arch kernel initrd stage2 +echo $os $ver $arch > "$dest/.treeinfo.ova" +mkdir -p "$dest/Packages" +download "$dest/Packages" "$url/Packages/basesystem-8.1-1.noarch.rpm" \ + "$url/Packages/basesystem-10.0-1.noarch.rpm" +createrepo "$dest" +dir="$dest/$(dirname $stage2)" +mkdir -p "$dir" +download "$dir" "$url/$stage2" +dir="$dest/$(dirname $kernel)" +mkdir -p "$dir" +download "$dir" "$url/$kernel" +dir="$dest/$(dirname $initrd)" +mkdir -p "$dir" +download "$dir" "$url/$initrd" +) echo "done" -popd diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks index f9bfcd5..5cb4e1c 100644 --- a/ovirt-appliance.ks +++ b/ovirt-appliance.ks @@ -54,18 +54,9 @@ lokkit fi set -e - python -c ' -from iniparse.ini import INIConfig -ini = INIConfig() -fp = open("tmp/tree/.treeinfo") -ini.readfp(fp) -fp.close() -family = ini.general.family -version = ini.general.version -arch = ini.general.arch -print "%s %s %s" % (family, version, arch)' | ( read os ver arch + cat tmp/tree/.treeinfo.ova | ( read os ver arch dest=$INSTALL_ROOT/var/www/cobbler/ks_mirror/$os-$ver-$arch printf "Importing $os-$ver-$arch ..." - cp -a tmp/tree $dest + cp -a tmp/tree "$dest" ) %end -- 1.5.6.5 From pmyers at redhat.com Tue Nov 18 22:56:46 2008 From: pmyers at redhat.com (Perry Myers) Date: Tue, 18 Nov 2008 17:56:46 -0500 Subject: [Ovirt-devel] [PATCH REPOST appliance] Add -f flag to create-ovirt-network Message-ID: <1227049006-18660-1-git-send-email-pmyers@redhat.com> -f indicates that: 1. Don't abort if NetworkManager is installed (Note: with NetworkManager enabled, -e parameter will not work properly since some interfaces are controlled via NetworkManager and some would need to be controlled via standard network init script. Without -e parameter, the libvirt controlled ovirtbr0 works fine) 2. Don't prompt for overwriting interface specified with -e parameter So use -f at your own risk! This repost makes it so that the NetworkManager check is only done from the create-ovirt-network script. That way only -f is needed in that script Signed-off-by: Perry Myers --- create-ovirt-network | 9 ++++++--- ovirt-appliance-functions | 17 ++++++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/create-ovirt-network b/create-ovirt-network index 00b56ba..f7fc673 100755 --- a/create-ovirt-network +++ b/create-ovirt-network @@ -5,17 +5,19 @@ usage() { case $# in 1) warn "$1"; try_h; exit 1;; esac cat < /dev/null 2>&1 \ - && die "NetworkManager is running, disable and use standard network scripts before proceeding" - service iptables status > /dev/null 2>&1 \ || service iptables start > /dev/null 2>&1 chkconfig iptables on @@ -83,6 +82,18 @@ do_checks() { chkconfig libvirtd on } +check_net() { + service NetworkManager status > /dev/null 2>&1 ; netman_status=$? + if [ $netman_status -eq 0 ]; then + if [ $force -ne 1 ]; then + die "NetworkManager is running, disable and use standard network scripts before proceeding" + elif [ -n "$bridge" ]; then + echo "WARNING! NetworkManager running and bridge ($bridge) specified" + echo "WARNING! This combination will most likely not work." + fi + fi +} + gen_bridge() { cat << EOF -- 1.6.0.3 From mmorsi at redhat.com Wed Nov 19 00:36:52 2008 From: mmorsi at redhat.com (Mohammed Morsi) Date: Tue, 18 Nov 2008 19:36:52 -0500 Subject: [Ovirt-devel] [PATCH REPOST appliance] Add -f flag to create-ovirt-network In-Reply-To: <1227049006-18660-1-git-send-email-pmyers@redhat.com> References: <1227049006-18660-1-git-send-email-pmyers@redhat.com> Message-ID: <49235FA4.2090804@redhat.com> Perry Myers wrote: > -f indicates that: > 1. Don't abort if NetworkManager is installed (Note: with NetworkManager > enabled, -e parameter will not work properly since some interfaces > are controlled via NetworkManager and some would need to be controlled > via standard network init script. Without -e parameter, the libvirt > controlled ovirtbr0 works fine) > 2. Don't prompt for overwriting interface specified with -e parameter > > So use -f at your own risk! > > This repost makes it so that the NetworkManager check is only done > from the create-ovirt-network script. That way only -f is needed > in that script > > Signed-off-by: Perry Myers > --- > create-ovirt-network | 9 ++++++--- > ovirt-appliance-functions | 17 ++++++++++++++--- > 2 files changed, 20 insertions(+), 6 deletions(-) > > diff --git a/create-ovirt-network b/create-ovirt-network > index 00b56ba..f7fc673 100755 > --- a/create-ovirt-network > +++ b/create-ovirt-network > @@ -5,17 +5,19 @@ > usage() { > case $# in 1) warn "$1"; try_h; exit 1;; esac > cat < -Usage: $ME [-e eth] > +Usage: $ME [-e eth] [-f] > -e: ethernet device to use as bridge (i.e. eth1) > + -f: force install of networking > -h: display this help and exit > EOF > } > > err=0 help=0 > bridge= > -while getopts :e:h c; do > +while getopts :e:fh c; do > case $c in > e) bridge=$OPTARG;; > + f) force=1;; > h) help=1;; > '?') err=1; warn "invalid option: \`-$OPTARG'";; > :) err=1; warn "missing argument to \`-$OPTARG' option";; > @@ -26,6 +28,7 @@ test $err = 1 && { try_h; exit 1; } > test $help = 1 && { usage; exit 0; } > > do_checks > +check_net > > cleanup_old_nets > > @@ -46,7 +49,7 @@ if [ -n "$bridge" ]; then > && die "$bridge already attached to other bridge $attached_bridge" > > # Check to make sure that the system is not already using the interface > - if test -f $NET_SCRIPTS/ifcfg-$bridge ; then > + if [[ $force != 1 && -f $NET_SCRIPTS/ifcfg-$bridge ]]; then > echo "$NET_SCRIPTS/ifcfg-$bridge is present, are you sure you wish to" > echo "overwrite this file? [y/N]? " > read yesno > diff --git a/ovirt-appliance-functions b/ovirt-appliance-functions > index a81660e..de28caa 100644 > --- a/ovirt-appliance-functions > +++ b/ovirt-appliance-functions > @@ -44,6 +44,8 @@ NODE_DISK_SIZE=128M > imgdir=$IMGDIR_DEFAULT > name=$NAME_DEFAULT > > +force=0 > + > do_checks() { > # first, check to see we are root > if [ $( id -u ) -ne 0 ]; then > @@ -71,9 +73,6 @@ do_checks() { > die "Must have the $PACKAGES packages installed" > fi > > - service NetworkManager status > /dev/null 2>&1 \ > - && die "NetworkManager is running, disable and use standard network scripts before proceeding" > - > service iptables status > /dev/null 2>&1 \ > || service iptables start > /dev/null 2>&1 > chkconfig iptables on > @@ -83,6 +82,18 @@ do_checks() { > chkconfig libvirtd on > } > > +check_net() { > + service NetworkManager status > /dev/null 2>&1 ; netman_status=$? > + if [ $netman_status -eq 0 ]; then > + if [ $force -ne 1 ]; then > + die "NetworkManager is running, disable and use standard network scripts before proceeding" > + elif [ -n "$bridge" ]; then > + echo "WARNING! NetworkManager running and bridge ($bridge) specified" > + echo "WARNING! This combination will most likely not work." > + fi > + fi > +} > + > gen_bridge() { > cat << EOF > > ACK. Works for me. -Mo From sseago at redhat.com Wed Nov 19 05:36:46 2008 From: sseago at redhat.com (Scott Seago) Date: Wed, 19 Nov 2008 00:36:46 -0500 Subject: [Ovirt-devel] [PATCH] replaced flexigrid-based display for HW and smart pool storage with tree component. In-Reply-To: <1227044361.6686.7.camel@physical.priv.ovirt.org> References: <1226986508-16194-1-git-send-email-sseago@redhat.com> <1227044361.6686.7.camel@physical.priv.ovirt.org> Message-ID: <4923A5EE.1090306@redhat.com> Jason Guiditta wrote: > Overall works well for me, some comments inline, plus that bit of > filtering we discussed in irc - lvm volumes should be filtered from add > storage list. > > > OK I addressed your comments in the patch and pushed. Scott From apevec at redhat.com Wed Nov 19 14:57:40 2008 From: apevec at redhat.com (Alan Pevec) Date: Wed, 19 Nov 2008 15:57:40 +0100 Subject: [Ovirt-devel] [PATCH recipe] force qemu-img subpkg Message-ID: <1227106660-5832-1-git-send-email-apevec@redhat.com> otherwise /usr/bin/qemu-img (libvirt dep) gets resolved by F9 GA qemu monolithic RPM --- ovirt-recipe.spec.in | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/ovirt-recipe.spec.in b/ovirt-recipe.spec.in index bf01b34..ea51c3a 100644 --- a/ovirt-recipe.spec.in +++ b/ovirt-recipe.spec.in @@ -42,6 +42,10 @@ Requires: rubygem-qpid Requires: qpidc Requires: qmf Requires: livecd-tools >= 020 +# Stupid yum dep solver pulls in older 'qemu' to resolve +# /usr/bin/qemu-img dep. This forces it to pick the new +# qemu-img RPM. +Requires: qemu-img %description Thincrust oVirt Server Appliance Recipe -- 1.5.6.5 From apevec at redhat.com Wed Nov 19 15:01:06 2008 From: apevec at redhat.com (Alan Pevec) Date: Wed, 19 Nov 2008 16:01:06 +0100 Subject: [Ovirt-devel] [PATCH appliance] force qemu-img subpkg Message-ID: <1227106866-6218-1-git-send-email-apevec@redhat.com> otherwise /usr/bin/qemu-img gets resolved by F9 GA qemu monolithic RPM --- ovirt-appliance.spec.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ovirt-appliance.spec.in b/ovirt-appliance.spec.in index 191fc2d..a5ea3df 100644 --- a/ovirt-appliance.spec.in +++ b/ovirt-appliance.spec.in @@ -13,7 +13,7 @@ URL: http://ovirt.org/ # is fixed, these Requires should be fixed. Requires: libvirt >= 0.4.6-2 Requires: kvm >= 78-4 -Requires: /usr/bin/qemu-img +Requires: qemu-img Requires: augeas %define app_root %{_datadir}/%{name} -- 1.5.6.5 From pmyers at redhat.com Wed Nov 19 16:10:22 2008 From: pmyers at redhat.com (Perry Myers) Date: Wed, 19 Nov 2008 11:10:22 -0500 Subject: [Ovirt-devel] [PATCH node-image] Build process creates a manifest tar that can be used in comparing builds of the node Message-ID: <1227111022-3049-1-git-send-email-pmyers@redhat.com> Signed-off-by: Perry Myers --- .gitignore | 1 + ovirt-node-image.ks | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 0 deletions(-) diff --git a/.gitignore b/.gitignore index 83fe611..62670cd 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,6 @@ ovirt-node-image-*-*iso ovirt-node-image-*-*iso.sha1sum ovirt-node-image.iso ovirt-node-image.spec +ovirt-node-image-manifests*.tar repos.ks stamp-h1 diff --git a/ovirt-node-image.ks b/ovirt-node-image.ks index 3a6f399..6d6fd16 100644 --- a/ovirt-node-image.ks +++ b/ovirt-node-image.ks @@ -16,6 +16,13 @@ touch /.autorelabel %end +%post +# Create initial manifests +mkdir -p /etc/manifests +rpm -qa > /etc/manifests/package-manifest.txt +du -akx --exclude=./var/cache/yum > /etc/manifests/file-manifest.txt +%end + %include common-blacklist.ks %post --nochroot @@ -47,3 +54,21 @@ linux0=1 && /append / { append0=$0 } mv $LIVE_ROOT/isolinux/isolinux.cfg.standalone $LIVE_ROOT/isolinux/isolinux.cfg %end + +%post +# Create post-image processing manifests +rpm -qa > /etc/manifests/package-manifest-post.txt +du -akx --exclude=./var/cache/yum > /etc/manifests/file-manifest-post.txt + +ver=$(rpm -q --qf '%{version}' ovirt-node) +rel=$(rpm -q --qf '%{release}' ovirt-node) +arch=$(rpm -q --qf '%{arch}' ovirt-node) +echo "oVirt Node release $ver-$rel-$arch" > /etc/manifests/ovirt-release +tar -cvf ovirt-node-image-manifests-$ver-$rel.$arch.tar -C /etc manifests +%end + +%post --nochroot +# Move manifest tar to build directory +mv $INSTALL_ROOT/ovirt-node-image-manifests-*.tar . +%end + -- 1.6.0.3 From pmyers at redhat.com Wed Nov 19 16:16:17 2008 From: pmyers at redhat.com (Perry Myers) Date: Wed, 19 Nov 2008 11:16:17 -0500 Subject: [Ovirt-devel] [PATCH appliance] force qemu-img subpkg In-Reply-To: <1227106866-6218-1-git-send-email-apevec@redhat.com> References: <1227106866-6218-1-git-send-email-apevec@redhat.com> Message-ID: <49243BD1.9040309@redhat.com> Alan Pevec wrote: > otherwise /usr/bin/qemu-img gets resolved by F9 GA > qemu monolithic RPM Simple change, Ack Perry From pmyers at redhat.com Wed Nov 19 16:16:29 2008 From: pmyers at redhat.com (Perry Myers) Date: Wed, 19 Nov 2008 11:16:29 -0500 Subject: [Ovirt-devel] [PATCH recipe] force qemu-img subpkg In-Reply-To: <1227106660-5832-1-git-send-email-apevec@redhat.com> References: <1227106660-5832-1-git-send-email-apevec@redhat.com> Message-ID: <49243BDD.4040106@redhat.com> Alan Pevec wrote: > otherwise /usr/bin/qemu-img (libvirt dep) gets resolved by F9 GA > qemu monolithic RPM Simple change, Ack Perry From jim at meyering.net Wed Nov 19 16:25:57 2008 From: jim at meyering.net (Jim Meyering) Date: Wed, 19 Nov 2008 17:25:57 +0100 Subject: [Ovirt-devel] [PATCH node] Added support for local storage configuration. In-Reply-To: <1226959696-10807-1-git-send-email-dpierce@redhat.com> (Darryl L. Pierce's message of "Mon, 17 Nov 2008 17:08:16 -0500") References: <1226959696-10807-1-git-send-email-dpierce@redhat.com> Message-ID: <87r657of6y.fsf@rho.meyering.net> "Darryl L. Pierce" wrote: > From: Darryl L. Pierce > > NOTE: This is a reduxed patch based on Jim Meyering's changes, and includes > updates to support automated execution. > > This patch wipes out the entire disk on the node and replaces it with > a set of partitions. The partitions are a raw partition to hold the bootable > kernel, and the rest of the disk is taken up as an physical volume. > > On the physical volume is created the following logical volumes: > > * SWAP - swap partition > * ROOT - to host the node image > * CONFIG - to hold node configuration data > * LOGGING - to hold local logs > * DATA - to hold VM images Hi Darryl, I propose to push your change now. Here's a patch that I will then apply on top of it. >From 7ad63cee503f076c72138119260527d529e585a9 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 19 Nov 2008 17:01:18 +0100 Subject: [PATCH node] ovirt-config-storage: handle more than one storage device Default sizes are in one place (before, logging default could be 512 or 256). The interface works with more than one usable disk device: - if there are two or more, the user gets a menu - if there is just one, that is selected with no prompt At the confirm-destroy-your-disk prompt, don't silently treat "Yes" (or any other multi-character reply) like "n". --- scripts/ovirt-config-storage | 146 ++++++++++++++++++++++++++---------------- 1 files changed, 91 insertions(+), 55 deletions(-) diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index e3b3592..81dadef 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -10,6 +10,11 @@ ME=$(basename "$0") warn() { printf '%s: %s\n' "$ME" "$*" >&2; } die() { warn "$*"; exit 1; } +default_boot_size=256 +default_root_size=256 +default_config_size=5 +default_logging_size=256 + check_partition_sizes() { # FIXME: use this function before performing any partitioning, auto or not @@ -21,58 +26,88 @@ check_partition_sizes() # or just let the mke2fs failure suffice. } -do_configure() +# Find a usable/selected storage device along with its size in bytes. +# If there are none, give a diagnostic and return nonzero. +# If there is just one, e.g., /dev/sda, treat it as selected (see below). +# and return 0. If there are two or more, make the user select one +# or decline. Upon decline, return nonzero. Otherwise, print the +# selected name, a space, and its size, then return 0. +# Sample output: "/dev/sda 320072933376" +get_dev_name() { - DEVICES=$(for drive in `hal-find-by-capability --capability storage`; do - info=$(lshal -u $drive -s) - if [[ $info =~ "storage.drive_type = 'disk'" ]]; then - lshal -u $drive -s | awk ' /block.device/ { - match($0, "block.device = *'"'"'(.*)'"'"'", device) - printf "%s", device[1] - }' - fi - done) + local udi_list=$(hal-find-by-capability --capability storage) + if test -z "$udi_list"; then + warn "ERROR: no usable storage devices detected" + return 1 + fi + + 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 + size=$(hal-get-property --udi "$d" --key storage.size) + test -z "$devices" \ + && devices=$block_dev \ + || devices="$devices $block_dev" + test -z "$sizes" \ + && sizes=$size \ + || sizes="$sizes $size" + done - DEVICES="$DEVICES Abort" + # If there's only one device, use it. + case $devices in + '') warn "ERROR: found no usable block device"; return 1;; + *' '*) ;; # found more than one + *) echo "$devices $sizes"; return 0;; # just one + esac - select DEVICE in $DEVICES + # There are two or more; make the user choose. + local choices="$devices Abort" + select device in $choices do - case "$DEVICE" in - "Abort") return ;; - - *) - DRIVE=$DEVICE - SPACE=$(for drive in `hal-find-by-capability --capability storage`; do - info=$(lshal -u $drive -s) - if [[ $info =~ $DRIVE ]]; then - lshal -u $drive -s | awk ' /storage.size/ { - match($0, "storage.size *= *([0-9]+)", device) - printf "%s", device[1] - }' - fi - done) - - SPACE=$(echo "scale=0; $SPACE / (1024 * 1024)" | bc -l) - BOOT_SIZE="256" - ROOT_SIZE="256" - CONFIG_SIZE="5" - LOGGING_SIZE="256" - - for i in swap boot root logging config; do - uc=$(echo $i|tr '[[:lower:]]' '[[:upper:]]') - var=${uc}_SIZE - eval "size=\$$var" - read -p "Change $i partition size (Currently $size MB)? " - if [[ $REPLY =~ ^[0-9]+$ ]] && [[ $REPLY -gt 0 ]]; then - eval "$var=$REPLY" - else - printf "invalid value: '$i'. retaining $size MB.\n" - fi - done - - return - ;; - esac + test "$device" = Abort && return 1 + test -z "$device" && continue + # $REPLY is the selected number; + # use that to map to the corresponding size. + size=$(echo "$sizes"|cut -d' ' -f "$REPLY") + echo "$device $size" + return 0 + done +} + +do_configure() +{ + local name_and_size=$(get_dev_name) || exit 1 + set -- $name_and_size + DRIVE=$1 + local n_bytes=$2 + + SPACE=$(echo "scale=0; $n_bytes / (1024 * 1024)" | bc -l) + echo "selected device: $device ($SPACE MB)" + + for i in swap boot root logging config; do + uc=$(echo $i|tr '[[:lower:]]' '[[:upper:]]') + var=${uc}_SIZE + eval "size=\$$var" + read -p "Change $i partition size (Currently $size MB)? " + r=$REPLY + test -z "$r" && r=$size + if [[ $r =~ ^[0-9]+$ ]] && [[ $r -gt 0 ]]; then + eval "$var=$r" + else + printf "invalid $i size: '$r' retaining $size MB.\n" + fi done } @@ -114,6 +149,7 @@ perform_partitioning() # Exit upon any failure. set -e + # FIXME: save a backup copy, just in case? dd if=/dev/zero of=$DRIVE bs=1K count=1 blockdev --rereadpt $DRIVE partprobe -s $DRIVE @@ -181,6 +217,7 @@ do_confirm() break ;; N|n) return ;; + *) ;; esac done } @@ -194,16 +231,17 @@ esac MEM_SIZE=$(echo "scale=0; $MEM_SIZE / 1024" | bc -l) SWAP_SIZE=$MEM_SIZE +BOOT_SIZE=${OVIRT_BOOT_SIZE=$default_boot_size} +ROOT_SIZE=${OVIRT_ROOT_SIZE=$default_root_size} +LOGGING_SIZE=${OVIRT_LOGGING_SIZE=$default_logging_size} +CONFIG_SIZE=${OVIRT_CONFIG_SIZE=$default_config_size} + if [ "$1" == "AUTO" ]; then + # In "AUTO" mode, OVIRT_VOL should be defined in the environment. DRIVE=$OVIRT_VOL - if [ -n "$OVIRT_BOOT_SIZE" ]; then BOOT_SIZE=$OVIRT_BOOT_SIZE; else BOOT_SIZE=256; fi - if [ -n "$OVIRT_ROOT_SIZE" ]; then ROOT_SIZE=$OVIRT_ROOT_SIZE; else ROOT_SIZE=256; fi - if [ -n "$OVIRT_LOGGING_SIZE" ]; then LOGGING_SIZE=$OVIRT_LOGGING_SIZE; else LOGGING_SIZE=512; fi - if [ -n "$OVIRT_CONFIG_SIZE" ]; then CONFIG_SIZE=$OVIRT_CONFIG_SIZE; else CONFIG_SIZE=5; fi check_partition_sizes printf "Partitioning hard disk..." perform_partitioning - printf "[DONE]\n" exit 0 else while true; do @@ -211,8 +249,6 @@ else OPTIONS="Configure Review Partition Quit" PS3="Choose an option: " - printf "\n" - select OPTION in $OPTIONS do case "$OPTION" in -- 1.6.0.4.1021.g4320 From apevec at redhat.com Wed Nov 19 17:17:31 2008 From: apevec at redhat.com (Alan Pevec) Date: Wed, 19 Nov 2008 18:17:31 +0100 Subject: [Ovirt-devel] Re: [PATCH node] Added support for local storage configuration. In-Reply-To: <1226959696-10807-1-git-send-email-dpierce@redhat.com> References: <1226959696-10807-1-git-send-email-dpierce@redhat.com> Message-ID: <49244A2B.4060303@redhat.com> Darryl L. Pierce wrote: > +++ b/scripts/ovirt-config-storage ... > +if [ "$1" == "AUTO" ]; then > + DRIVE=$OVIRT_VOL OVIRT_VOL -> OVIRT_INIT (will be set by ovirt-early when parsing boot params) vars set by ovirt-early with partition sizes are: OVIRT_VOL_BOOT OVIRT_VOL_SWAP OVIRT_VOL_ROOT OVIRT_VOL_CONFIG OVIRT_VOL_LOGGING This part was modified in the follow up patch, so Jim please amend: OVIRT_(.*)_SIZE -> OVIRT_VOL_\1 +BOOT_SIZE=${OVIRT_BOOT_SIZE=$default_boot_size} +ROOT_SIZE=${OVIRT_ROOT_SIZE=$default_root_size} +LOGGING_SIZE=${OVIRT_LOGGING_SIZE=$default_logging_size} +CONFIG_SIZE=${OVIRT_CONFIG_SIZE=$default_config_size} + if [ "$1" == "AUTO" ]; then + # In "AUTO" mode, OVIRT_VOL should be defined in the environment. DRIVE=$OVIRT_VOL - if [ -n "$OVIRT_BOOT_SIZE" ]; then BOOT_SIZE=$OVIRT_BOOT_SIZE; else BOOT_SIZE=256; fi - if [ -n "$OVIRT_ROOT_SIZE" ]; then ROOT_SIZE=$OVIRT_ROOT_SIZE; else ROOT_SIZE=256; fi - if [ -n "$OVIRT_LOGGING_SIZE" ]; then LOGGING_SIZE=$OVIRT_LOGGING_SIZE; else LOGGING_SIZE=512; fi - if [ -n "$OVIRT_CONFIG_SIZE" ]; then CONFIG_SIZE=$OVIRT_CONFIG_SIZE; else CONFIG_SIZE=5; fi > diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot ... Darryl, please drop this ovirt-firstboot modification from the patch, I have separate patch which uses is_auto_install function instead From jim at meyering.net Wed Nov 19 17:28:42 2008 From: jim at meyering.net (Jim Meyering) Date: Wed, 19 Nov 2008 18:28:42 +0100 Subject: [Ovirt-devel] Re: [PATCH node] Added support for local storage configuration. In-Reply-To: <49244A2B.4060303@redhat.com> (Alan Pevec's message of "Wed, 19 Nov 2008 18:17:31 +0100") References: <1226959696-10807-1-git-send-email-dpierce@redhat.com> <49244A2B.4060303@redhat.com> Message-ID: <87ljvfocad.fsf@rho.meyering.net> Alan Pevec wrote: ... > This part was modified in the follow up patch, so Jim please amend: OVIRT_(.*)_SIZE -> OVIRT_VOL_\1 > > +BOOT_SIZE=${OVIRT_BOOT_SIZE=$default_boot_size} > +ROOT_SIZE=${OVIRT_ROOT_SIZE=$default_root_size} > +LOGGING_SIZE=${OVIRT_LOGGING_SIZE=$default_logging_size} > +CONFIG_SIZE=${OVIRT_CONFIG_SIZE=$default_config_size} > + > if [ "$1" == "AUTO" ]; then > + # In "AUTO" mode, OVIRT_VOL should be defined in the environment. > DRIVE=$OVIRT_VOL > - if [ -n "$OVIRT_BOOT_SIZE" ]; then BOOT_SIZE=$OVIRT_BOOT_SIZE; else BOOT_SIZE=256; fi > - if [ -n "$OVIRT_ROOT_SIZE" ]; then ROOT_SIZE=$OVIRT_ROOT_SIZE; else ROOT_SIZE=256; fi > - if [ -n "$OVIRT_LOGGING_SIZE" ]; then LOGGING_SIZE=$OVIRT_LOGGING_SIZE; else LOGGING_SIZE=512; fi > - if [ -n "$OVIRT_CONFIG_SIZE" ]; then CONFIG_SIZE=$OVIRT_CONFIG_SIZE; else CONFIG_SIZE=5; fi Thanks, Alan. I'll amend with this: diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index 81dadef..efbd56e 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -231,10 +231,10 @@ esac MEM_SIZE=$(echo "scale=0; $MEM_SIZE / 1024" | bc -l) SWAP_SIZE=$MEM_SIZE -BOOT_SIZE=${OVIRT_BOOT_SIZE=$default_boot_size} -ROOT_SIZE=${OVIRT_ROOT_SIZE=$default_root_size} -LOGGING_SIZE=${OVIRT_LOGGING_SIZE=$default_logging_size} -CONFIG_SIZE=${OVIRT_CONFIG_SIZE=$default_config_size} +BOOT_SIZE=${OVIRT_VOL_BOOT=$default_boot_size} +ROOT_SIZE=${OVIRT_VOL_ROOT=$default_root_size} +LOGGING_SIZE=${OVIRT_VOL_LOGGING=$default_logging_size} +CONFIG_SIZE=${OVIRT_VOL_CONFIG=$default_config_size} if [ "$1" == "AUTO" ]; then # In "AUTO" mode, OVIRT_VOL should be defined in the environment. From jim at meyering.net Wed Nov 19 17:31:59 2008 From: jim at meyering.net (Jim Meyering) Date: Wed, 19 Nov 2008 18:31:59 +0100 Subject: [Ovirt-devel] Re: [PATCH node] Added support for local storage configuration. In-Reply-To: <49244A2B.4060303@redhat.com> (Alan Pevec's message of "Wed, 19 Nov 2008 18:17:31 +0100") References: <1226959696-10807-1-git-send-email-dpierce@redhat.com> <49244A2B.4060303@redhat.com> Message-ID: <87bpwboc4w.fsf@rho.meyering.net> Alan Pevec wrote: > Darryl L. Pierce wrote: >> +++ b/scripts/ovirt-config-storage > ... >> +if [ "$1" == "AUTO" ]; then >> + DRIVE=$OVIRT_VOL > OVIRT_VOL -> OVIRT_INIT (will be set by ovirt-early when parsing boot params) > > vars set by ovirt-early with partition sizes are: > OVIRT_VOL_BOOT > OVIRT_VOL_SWAP > OVIRT_VOL_ROOT > OVIRT_VOL_CONFIG > OVIRT_VOL_LOGGING > > This part was modified in the follow up patch, so Jim please amend: OVIRT_(.*)_SIZE -> OVIRT_VOL_\1 Rather, here's an incremental that retains the _SIZE suffix: diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index 81dadef..54d6e42 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -231,10 +231,10 @@ esac MEM_SIZE=$(echo "scale=0; $MEM_SIZE / 1024" | bc -l) SWAP_SIZE=$MEM_SIZE -BOOT_SIZE=${OVIRT_BOOT_SIZE=$default_boot_size} -ROOT_SIZE=${OVIRT_ROOT_SIZE=$default_root_size} -LOGGING_SIZE=${OVIRT_LOGGING_SIZE=$default_logging_size} -CONFIG_SIZE=${OVIRT_CONFIG_SIZE=$default_config_size} +BOOT_SIZE=${OVIRT_VOL_BOOT_SIZE=$default_boot_size} +ROOT_SIZE=${OVIRT_VOL_ROOT_SIZE=$default_root_size} +LOGGING_SIZE=${OVIRT_VOL_LOGGING_SIZE=$default_logging_size} +CONFIG_SIZE=${OVIRT_VOL_CONFIG_SIZE=$default_config_size} if [ "$1" == "AUTO" ]; then # In "AUTO" mode, OVIRT_VOL should be defined in the environment. From mmorsi at redhat.com Wed Nov 19 18:00:42 2008 From: mmorsi at redhat.com (Mohammed Morsi) Date: Wed, 19 Nov 2008 13:00:42 -0500 Subject: [Ovirt-devel] [PATCH server] DB change to support larger numbers. In-Reply-To: <1227037758-6768-1-git-send-email-jguiditt@redhat.com> References: <1226952991-25573-1-git-send-email-jguiditt@redhat.com> <1227037758-6768-1-git-send-email-jguiditt@redhat.com> Message-ID: <4924544A.2010300@redhat.com> Jason Guiditta wrote: > Fix migration number, 029 was already taken. > > Since we store mem, storage, etc in KB, we need an 8 byte int. > This patch change all tables with this type of data to support larger size. > > ACK. Works for me. -Mo From pmyers at redhat.com Wed Nov 19 18:19:07 2008 From: pmyers at redhat.com (Perry Myers) Date: Wed, 19 Nov 2008 13:19:07 -0500 Subject: [Ovirt-devel] [PATCH REPOST node-image] Build process creates a manifest tar that can be used in comparing builds of the node Message-ID: <1227118747-4707-1-git-send-email-pmyers@redhat.com> Incorporated some changes from Alan, Dan and Jim to provide: 1. directory manifests suitable for xdu 2. srpm manifests 3. Remove manifests from built node to save space 4. Fix du cmd to use absolute paths Signed-off-by: Perry Myers --- .gitignore | 1 + ovirt-node-image.ks | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 0 deletions(-) diff --git a/.gitignore b/.gitignore index 83fe611..62670cd 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,6 @@ ovirt-node-image-*-*iso ovirt-node-image-*-*iso.sha1sum ovirt-node-image.iso ovirt-node-image.spec +ovirt-node-image-manifests*.tar repos.ks stamp-h1 diff --git a/ovirt-node-image.ks b/ovirt-node-image.ks index 3a6f399..c974173 100644 --- a/ovirt-node-image.ks +++ b/ovirt-node-image.ks @@ -16,6 +16,17 @@ touch /.autorelabel %end +%post +# Create initial manifests +manifests=/tmp/manifests +mkdir -p $manifests +rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' | sort \ + > $manifests/rpm-manifest.txt +rpm -qa --qf '%{sourcerpm}\n' | sort -u > $manifests/srpm-manifest.txt +du -akx --exclude=/var/cache/yum / > $manifests/file-manifest.txt +du -x --exclude=/var/cache/yum / > $manifests/dir-manifest.txt +%end + %include common-blacklist.ks %post --nochroot @@ -47,3 +58,27 @@ linux0=1 && /append / { append0=$0 } mv $LIVE_ROOT/isolinux/isolinux.cfg.standalone $LIVE_ROOT/isolinux/isolinux.cfg %end + +%post +# Create post-image processing manifests +manifests=/tmp/manifests +mkdir -p $manifests +rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' | sort \ + > $manifests/rpm-manifest-post.txt +rpm -qa --qf '%{sourcerpm}\n' | sort -u > $manifests/srpm-manifest-post.txt +du -akx --exclude=/var/cache/yum / > $manifests/file-manifest-post.txt +du -x --exclude=/var/cache/yum / > $manifests/dir-manifest-post.txt + +ver=$(rpm -q --qf '%{version}' ovirt-node) +rel=$(rpm -q --qf '%{release}' ovirt-node) +arch=$(rpm -q --qf '%{arch}' ovirt-node) +echo "oVirt Node release $ver-$rel-$arch" > $manifests/ovirt-release +tar -cvf ovirt-node-image-manifests-$ver-$rel.$arch.tar -C /tmp manifests +rm -Rf $manifests +%end + +%post --nochroot +# Move manifest tar to build directory +mv $INSTALL_ROOT/ovirt-node-image-manifests-*.tar . +%end + -- 1.6.0.3 From dpierce at redhat.com Wed Nov 19 18:29:14 2008 From: dpierce at redhat.com (Darryl L. Pierce) Date: Wed, 19 Nov 2008 13:29:14 -0500 Subject: [Ovirt-devel] [PATCH node] Enabled automated network configuration via kernel arguments. Message-ID: <1227119354-22511-1-git-send-email-dpierce@redhat.com> To configure IPv4 the user passes the kernel argument OVIRT_IPV4 with one of the following values: dhcp or static. If another value is passed then the script shows an error an exits. If static is passed, then the following kernel arguments are expected: OVIRT_IPV4_ADDRESS, OVIRT_IPV4_NETMASK and OVIRT_IPV4_GATEWAY. To configure IPv6 the user passes the kernel argument OVIRT_IPV6 with one of the following values: auto, dhcp or manual. If another value is passed then the script shows an error and exits. If manual was passwd then the following kernel argument must be passed with a valid value: OVIRT_IPV6_ADDRESS. Signed-off-by: Darryl L. Pierce --- scripts/ovirt-config-networking | 235 +++++++++++++++++++++++++++----------- 1 files changed, 167 insertions(+), 68 deletions(-) diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 2f8363c..2f8c5df 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -3,95 +3,194 @@ # Iterates over the list of network devices on the node and prompts the user # to configure each. +ME=$(basename "$0") +warn() { printf '%s: %s\n' "$ME" "$*" >&2; } +die() { warn "$*"; exit 1; } + +WORKDIR=$(mktemp -d) || exit 1 + +# Remove $WORKDIR upon interrupt (and HUP, PIPE, TERM) and upon normal +# termination, being careful not to change the exit status. +trap '__st=$?; rm -rf "$WORKDIR"; exit $__st' 0 +trap 'exit $?' 1 2 13 15 + CONFIG_FILE_ROOT="/file/etc/sysconfig/network-scripts/ifcfg" CONFIG_LOG_FILE="/var/log/ovirt-network-setup.log" function configure_interface { - NIC=$1 - BRIDGE=ovirtbr`echo $NIC | cut -b4-` - IF_FILENAME="/var/tmp/augtool-$NIC" - BR_FILENAME="/var/tmp/augtool-$BRIDGE" + local NIC=$1 + local AUTO=$2 + if [[ "$AUTO" == "AUTO" && + -n "$OVIRT_IP_ADDRESS" ]]; then + IPADDR=$OVIRT_IP_ADDRESS + NETMASK=$OVIRT_IP_NETMASK + GATEWAY=$OVIRT_IP_GATEWAY + PREFIX=$OVIRT_IP_PREFIX + fi + + local BRIDGE=ovirtbr$NIC + local IF_FILENAME="$WORKDIR/augtool-$NIC" + local BR_FILENAME="$WORKDIR/augtool-$BRIDGE" printf "\nConfigure $BRIDGE for use by $NIC..\n\n" - IF_ROOT="$CONFIG_FILE_ROOT-$NIC" - IF_CONFIG="rm $IF_ROOT\nset $IF_ROOT/DEVICE $NIC" + local IF_ROOT="$CONFIG_FILE_ROOT-$NIC" + local IF_CONFIG="rm $IF_ROOT\nset $IF_ROOT/DEVICE $NIC" - BR_ROOT="$CONFIG_FILE_ROOT-$BRIDGE" - BR_CONFIG="rm $BR_ROOT\nset $BR_ROOT/DEVICE $BRIDGE" + local BR_ROOT="$CONFIG_FILE_ROOT-$BRIDGE" + local BR_CONFIG="rm $BR_ROOT\nset $BR_ROOT/DEVICE $BRIDGE" BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/TYPE bridge" BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/PEERNTP yes" BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/DELAY 0" IF_CONFIG="$IF_CONFIG\nset $IF_ROOT/BRIDGE $BRIDGE" - # how do you want to configure this device? (dhcp, static IP) - while true; do - printf "Will $BRIDGE use dynamic addressing? (Y/N) " - read - case $REPLY in - Y|y) BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp"; break ;; - N|n) - printf "\nPlease enter the network details for $BRIDGE:\n" - printf "\tIP Address: "; read; IPADDR=$REPLY - printf "\t Netmask: "; read; NETMASK=$REPLY - printf "\t Broadcast: "; read; BROADCAST=$REPLY - printf "\t Gateway: "; read; GATEWAY=$REPLY - - printf "\nPlease review the details for $BRIDGE:\n" - printf "\tIP Address: $IPADDR\n \t Netmask: $NETMASK\n\t Broadcast: $BROADCAST\n\t Gateway: $GATEWAY\n" - printf "Is this correct? (Y/N) " - read - case $REPLY in - Y|y) - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPADDR $IPADDR" - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BROADCAST $BROADCAST" - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/NETMASK $NETMASK" + local BR_CONFIG_BASE=BR_CONFIG + + if [ -z "$AUTO" ]; then + while true; do + printf "\n" + read -p "Enable IPv4 support ([S]tatic IP, [D]HCP, [N]o or [A]bort)? " + case $REPLY in + D|d) + use_ipv4_dhcp + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp" + ;; + S|s) + printf "\n" + read -p "IP Address: "; IPADDR=$REPLY + read -p " Netmask: "; NETMASK=$REPLY + read -p " Gateway: "; GATEWAY=$REPLY + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/BOOTPROTO none" + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IPADDR $IPADDR" + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/NETMASK $NETMASK" + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/GATEWAY $GATEWAY" + ;; + A|a) return ;; + esac + + printf "\n" + read -p "Enable IPv6 supprt ([S]tatic, [D]HCPv6, A[u]to, [N]o)? " + case $REPLY in + S|s) + read -p "IPv6 Address: "; IPADDR=$REPLY + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IPV6INIT yes" + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IP6ADDR $IPADDR" + ;; + D|d) + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IPV6INIT yes" + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IPV6AUTCONF no" + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IPV6FORWARDING no" + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/DHCPV6C yes" + ;; + U|u) + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IPV6INIT yes" + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IPV6FORWARDING no" + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IPV6AUTOCONF yes" + ;; + A|a) return ;; + esac + + printf "\n" + read -p "Is this correct (Y/N/A)? " + case $REPLY in + Y|y) + IF_CONFIG="$IF_CONFIG\nset $IF_ROOT/ONBOOT yes" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/ONBOOT yes" + + printf "$IF_CONFIG\n" > $IF_FILENAME + printf "$BR_CONFIG\n" > $BR_FILENAME break - ;; - esac - ;; - esac - done - - IF_CONFIG="$IF_CONFIG\nset $IF_ROOT/ONBOOT yes" - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/ONBOOT yes" - - printf "$IF_CONFIG\n" > $IF_FILENAME - printf "$BR_CONFIG\n" > $BR_FILENAME - - echo + ;; + N|n) BR_CONFIG=BR_CONFIG_BASE ;; + A|a) return ;; + esac + done + else + if [ -n "$OVIRT_IPV6" ]; then + case "$OVIRT_IPV6" in + "auto") + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IPV6INIT yes" + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IPV6FORWARDING no" + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IPV6_AUTOCONF yes" + ;; + "dhcp") + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IPV6INIT yes" + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IPV6_AUTCONF no" + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IPV6FORWARDING no" + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/DHCPV6C yes" + ;; + "manual") + if [ -n "$OVIRT_IPV6_ADDRESS" ]; then + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IPV6INIT yes" + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IP6ADDR $OVIRT_IPV6_ADDRESS" + else + die "Missing required argument: OVIRT_IPV6_ADDRESS" + fi + ;; + *) die "Invalid OVIRT_IPV6 value: $OVIRT_IPV6" ;; + esac + fi + + if [ -n "$OVIRT_IPV4" ]; then + case "$OVIRT_IPV4" in + "static") + if [[ -n "$OVIRT_IPV4_ADDRESS" && + -n "$OVIRT_IPV4_NETMASK" && + -n "$OVIRT_IPV4_GATEWAY" ]]; then + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/IPADDR $OVIRT_IPV4_ADDRESS" + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/NETMASK $OVIRT_IPV4_NETMASK" + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/GATEWAY $OVIRT_IPV4_GATEWAY" + else + die "Missing IPv4 static address details" + fi + ;; + "dhcp") + BR_CONFIG="$BR_CONFIG\n set $BR_ROOT/BOOTPROTO dhcp" + ;; + *) die "Invalid OVIRT_IPV4 value: $OVIRT_IPV4" ;; + esac + fi + + IF_CONFIG="$IF_CONFIG\nset $IF_ROOT/ONBOOT yes" + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/ONBOOT yes" + + printf "$IF_CONFIG\n" > $IF_FILENAME + printf "$BR_CONFIG\n" > $BR_FILENAME + fi } function setup_menu { NICS=$(hal-device | awk '/net.interface/ {match($0, "= '"'"'(.*)'"'"' ", nic); printf("%s ", nic[1]); }') - NICS="$NICS Quit" - PS3="Please select a network interface to configure:" + NICS="$NICS Save Quit" + PS3="Please select a network interface to configure: " } -# clean up any left over configurations -rm -f /var/tmp/config-augtool -rm -f /var/tmp/augtool-* - -setup_menu - -select NIC in $NICS -do - printf "\n" - case "$NIC" in - "Quit") break ;; - *) configure_interface $NIC $IFACE_NUMBER ;; - esac +if [ "$1" == "AUTO" ]; then + configure_interface $OVIRT_BOOTIF AUTO + RESTART="Y" +else setup_menu -done - -# Merge together all generated files and run augtool - -cat /var/tmp/augtool-* > /var/tmp/config-augtool -printf "save\n" >> /var/tmp/config-augtool -{ -augtool < /var/tmp/config-augtool -service network restart -} > $CONFIG_LOG_FILE 2>> $CONFIG_LOG_FILE + select NIC in $NICS + do + printf "\n" + case "$NIC" in + "Save") RESTART="Y"; break ;; + "Quit") exit 0; break ;; + *) configure_interface $NIC $IFACE_NUMBER ;; + esac + setup_menu + done +fi + +if [ "$RESTART" == "Y" ]; then + { + printf "Configuring network.\n" + config="$WORKDIR"/config-augtool + { cat "$WORKDIR"/augtool-* && printf "save\n"; } > $config \ + && augtool < $config \ + && service network restart + } >> $CONFIG_LOG_FILE 2>&1 +fi -- 1.5.6.5 From mmorsi at redhat.com Wed Nov 19 19:25:29 2008 From: mmorsi at redhat.com (Mohammed Morsi) Date: Wed, 19 Nov 2008 14:25:29 -0500 Subject: [Ovirt-devel] [PATCH server] Test/fixture revamp. In-Reply-To: <1226953264-25753-1-git-send-email-jguiditt@redhat.com> References: <1226952991-25573-1-git-send-email-jguiditt@redhat.com> <1226953264-25753-1-git-send-email-jguiditt@redhat.com> Message-ID: <49246829.8030908@redhat.com> Jason Guiditta wrote: > NOTE: This patch relies on previous one that changes int size of db tables. > > > Redoing the test fixtures to take advantage of rails 2.1 'foxy fixtures'. > This means very few ids, except for a couple special cases. This not only > gets us closer to current rails standards, but makes the fixtures more readable > and maintainable, which hopefully translates into making it less painful to > write comprehensive tests for new code (and build out better tests for > existing code). > > A side effect of this is that I have been trimming unneeded fixture entries > and renaming many of the ones we are keeping so it is more clear what they are, > as well as general cleanup of incorrect things like quotes where they shouldn't > be. > > Signed-off-by: Jason Guiditta > --- > src/test/fixtures/bondings.yml | 26 ++-- > src/test/fixtures/bondings_nics.yml | 15 -- > src/test/fixtures/cpus.yml | 44 ++--- > src/test/fixtures/hosts.yml | 221 ++++++++++----------- > src/test/fixtures/ip_addresses.yml | 40 +---- > src/test/fixtures/networks.yml | 36 ++-- > src/test/fixtures/nics.yml | 94 +++------ > src/test/fixtures/permissions.yml | 200 ++++--------------- > src/test/fixtures/pools.yml | 163 +++++++--------- > src/test/fixtures/quotas.yml | 88 +++------ > src/test/fixtures/storage_pools.yml | 81 ++------ > src/test/fixtures/storage_volumes.yml | 82 ++++---- > > src/test/fixtures/tasks.yml | 115 +---------- > src/test/fixtures/vms.yml | 174 +++++----------- > src/test/functional/host_controller_test.rb | 36 ++-- > src/test/functional/nic_controller_test.rb | 8 +- > src/test/functional/permission_controller_test.rb | 42 +++-- > src/test/functional/quota_controller_test.rb | 45 +++-- > src/test/functional/resources_controller_test.rb | 42 +++-- > src/test/functional/storage_controller_test.rb | 40 +++-- > src/test/functional/task_controller_test.rb | 4 +- > src/test/functional/vm_controller_test.rb | 41 +++-- > src/test/unit/active_record_env_test.rb | 10 +- > src/test/unit/host_browser_awaken_test.rb | 3 +- > src/test/unit/ip_address_test.rb | 13 +- > src/test/unit/permission_test.rb | 12 +- > src/test/unit/pool_test.rb | 8 +- > src/test/unit/storage_pool_test.rb | 5 +- > src/test/unit/storage_volume_test.rb | 4 +- > src/test/unit/task_test.rb | 11 +- > src/test/unit/vm_test.rb | 4 + > 31 files changed, 641 insertions(+), 1066 deletions(-) > delete mode 100644 src/test/fixtures/bondings_nics.yml > > Sorry for taking so long to get to this, but in the meantime Scott committed a change to the storage pools / volumes fixures, adding a 'state' field which causes conflicts in this commit. I removed those bits from this patch, applied it, and then manually copied your changes over, integrating scott's updates in as well, then tested it. Everything works great, including the unit and functional tests, and I scanned the code and nothing looks off. So ACK pending the resolution of that storage_pools / volumes issue and everything still works after. Great work. -Mo From pmyers at redhat.com Wed Nov 19 21:04:50 2008 From: pmyers at redhat.com (Perry Myers) Date: Wed, 19 Nov 2008 16:04:50 -0500 Subject: [Ovirt-devel] [PATCH] Fix docs packaging Message-ID: <1227128692-6716-1-git-send-email-pmyers@redhat.com> This patch series fixes up the docs spec file so that kickstart syntax like --excludedocs don't affect it. Since the ovirt-docs RPM's only purpose is to package docs, it doesn't make sense to tag the files with %doc. This also changes the location of the files to be in /usr/share/ovirt-docs so we need to update the symlink that ovirt-server uses From pmyers at redhat.com Wed Nov 19 21:04:51 2008 From: pmyers at redhat.com (Perry Myers) Date: Wed, 19 Nov 2008 16:04:51 -0500 Subject: [Ovirt-devel] [PATCH docs] Fix spec file so that these docs are not flagged with %doc In-Reply-To: <1227128692-6716-1-git-send-email-pmyers@redhat.com> References: <1227128692-6716-1-git-send-email-pmyers@redhat.com> Message-ID: <1227128692-6716-2-git-send-email-pmyers@redhat.com> Since the only purpose for installing the ovirt-docs rpm is to have these docs, it doesn't make sense to flag the contents with %doc Signed-off-by: Perry Myers --- ovirt-docs.spec.in | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ovirt-docs.spec.in b/ovirt-docs.spec.in index 856d73d..9d09979 100644 --- a/ovirt-docs.spec.in +++ b/ovirt-docs.spec.in @@ -11,6 +11,8 @@ URL: http://www.ovirt.org/ BuildRequires: publican BuildRequires: publican-ovirt +%define app_root %{_datadir}/%{name} + %description Provides the documentation for oVirt @@ -22,25 +24,24 @@ Provides the documentation for oVirt %configure make -mv oVirt_Installation_Guide/publish/en-US/oVirt/1.0/html/Installation_Guide oVirt_Server_Suite_Installation_Guide -mv oVirt_Installation_Guide/publish/en-US/oVirt/1.0/pdf/Installation_Guide/Installation_Guide.pdf oVirt_Server_Suite_Installation_Guide.pdf - -mv Using_the_oVirt_Admin_UI/publish/en-US/oVirt_Server_Suite/0.6/html/Using_the_oVirt_Server_Suite_User_Interface Using_the_oVirt_Server_Suite_User_Interface -mv Using_the_oVirt_Admin_UI/publish/en-US/oVirt_Server_Suite/0.6/pdf/Using_the_oVirt_Server_Suite_User_Interface/Using_the_oVirt_Server_Suite_User_Interface.pdf Using_the_oVirt_Server_Suite_User_Interface.pdf - %install %{__rm} -rf %{buildroot} mkdir %{buildroot} +%{__install} -d -m0755 %{buildroot}%{app_root} +%{__cp} -a oVirt_Installation_Guide/publish/en-US/oVirt_Server_Suite/0/html/Installation_Guide %{buildroot}%{app_root}/oVirt_Server_Suite_Installation_Guide +%{__install} oVirt_Installation_Guide/publish/en-US/oVirt_Server_Suite/0/pdf/Installation_Guide/Installation_Guide.pdf %{buildroot}%{app_root}/oVirt_Server_Suite_Installation_Guide.pdf +%{__cp} -a Using_the_oVirt_Admin_UI/publish/en-US/oVirt_Server_Suite/0.1/html/Using_the_oVirt_Server_Suite_User_Interface %{buildroot}%{app_root}/Using_the_oVirt_Server_Suite_User_Interface +%{__install} Using_the_oVirt_Admin_UI/publish/en-US/oVirt_Server_Suite/0.1/pdf/Using_the_oVirt_Server_Suite_User_Interface/Using_the_oVirt_Server_Suite_User_Interface.pdf %{buildroot}%{app_root}/Using_the_oVirt_Server_Suite_User_Interface.pdf %clean %{__rm} -rf %{buildroot} %files %defattr(-, root, root, -) -%doc oVirt_Server_Suite_Installation_Guide -%doc oVirt_Server_Suite_Installation_Guide.pdf -%doc Using_the_oVirt_Server_Suite_User_Interface -%doc Using_the_oVirt_Server_Suite_User_Interface.pdf +%{app_root}/oVirt_Server_Suite_Installation_Guide +%{app_root}/oVirt_Server_Suite_Installation_Guide.pdf +%{app_root}/Using_the_oVirt_Server_Suite_User_Interface +%{app_root}/Using_the_oVirt_Server_Suite_User_Interface.pdf %changelog * Thu Sep 18 2008 Perry Myers 0.93-0 -- 1.6.0.3 From pmyers at redhat.com Wed Nov 19 21:04:52 2008 From: pmyers at redhat.com (Perry Myers) Date: Wed, 19 Nov 2008 16:04:52 -0500 Subject: [Ovirt-devel] [PATCH server] Move location of docs source since ovirt-docs spec file has changed In-Reply-To: <1227128692-6716-2-git-send-email-pmyers@redhat.com> References: <1227128692-6716-1-git-send-email-pmyers@redhat.com> <1227128692-6716-2-git-send-email-pmyers@redhat.com> Message-ID: <1227128692-6716-3-git-send-email-pmyers@redhat.com> Signed-off-by: Perry Myers --- ovirt-server.spec.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ovirt-server.spec.in b/ovirt-server.spec.in index e2620d1..961c3fb 100644 --- a/ovirt-server.spec.in +++ b/ovirt-server.spec.in @@ -152,7 +152,7 @@ fi %daemon_chkconfig_post -d ovirt-taskomatic # Set up the symlink for ovirt-docs so that online help works -docs_dir=$(rpm -q --queryformat '/usr/share/doc/%{NAME}-%{VERSION}' ovirt-docs) +docs_dir=$(rpm -q --queryformat '/usr/share/%{NAME}' ovirt-docs) %{__rm} /usr/share/ovirt-server/public/help %{__ln_s} $docs_dir/Using_the_oVirt_Server_Suite_User_Interface/ %{app_root}/public/help -- 1.6.0.3 From mmorsi at redhat.com Wed Nov 19 21:20:59 2008 From: mmorsi at redhat.com (Mohammed Morsi) Date: Wed, 19 Nov 2008 16:20:59 -0500 Subject: [Ovirt-devel] [PATCH docs] Fix spec file so that these docs are not flagged with %doc In-Reply-To: <1227128692-6716-2-git-send-email-pmyers@redhat.com> References: <1227128692-6716-1-git-send-email-pmyers@redhat.com> <1227128692-6716-2-git-send-email-pmyers@redhat.com> Message-ID: <4924833B.4010002@redhat.com> Perry Myers wrote: > Since the only purpose for installing the ovirt-docs rpm is to have > these docs, it doesn't make sense to flag the contents with %doc > > ACK. Fixes the build error w/ the docs project. -Mo From mmorsi at redhat.com Wed Nov 19 21:21:16 2008 From: mmorsi at redhat.com (Mohammed Morsi) Date: Wed, 19 Nov 2008 16:21:16 -0500 Subject: [Ovirt-devel] [PATCH server] Move location of docs source since ovirt-docs spec file has changed In-Reply-To: <1227128692-6716-3-git-send-email-pmyers@redhat.com> References: <1227128692-6716-1-git-send-email-pmyers@redhat.com> <1227128692-6716-2-git-send-email-pmyers@redhat.com> <1227128692-6716-3-git-send-email-pmyers@redhat.com> Message-ID: <4924834C.8000301@redhat.com> Perry Myers wrote: > Signed-off-by: Perry Myers > --- > ovirt-server.spec.in | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/ovirt-server.spec.in b/ovirt-server.spec.in > index e2620d1..961c3fb 100644 > --- a/ovirt-server.spec.in > +++ b/ovirt-server.spec.in > @@ -152,7 +152,7 @@ fi > %daemon_chkconfig_post -d ovirt-taskomatic > > # Set up the symlink for ovirt-docs so that online help works > -docs_dir=$(rpm -q --queryformat '/usr/share/doc/%{NAME}-%{VERSION}' ovirt-docs) > +docs_dir=$(rpm -q --queryformat '/usr/share/%{NAME}' ovirt-docs) > %{__rm} /usr/share/ovirt-server/public/help > %{__ln_s} $docs_dir/Using_the_oVirt_Server_Suite_User_Interface/ %{app_root}/public/help > > ACK From jguiditt at redhat.com Wed Nov 19 21:23:58 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Wed, 19 Nov 2008 16:23:58 -0500 Subject: [Ovirt-devel] [PATCH server] Test/fixture revamp. In-Reply-To: <49246829.8030908@redhat.com> References: <49246829.8030908@redhat.com> Message-ID: <1227129838-4008-1-git-send-email-jguiditt@redhat.com> Mo, thanks for testing, I have rebased and merged the patch with Scott's new stuff, should still be fine. Please give it a go, and I will push when I hear back from you. Redoing the test fixtures to take advantage of rails 2.1 'foxy fixtures'. This means very few ids, except for a couple special cases. This not only gets us closer to current rails standards, but makes the fixtures more readable and maintainable, which hopefully translates into making it less painful to write comprehensive tests for new code (and build out better tests for existing code). A side effect of this is that I have been trimming unneeded fixture entries and renaming many of the ones we are keeping so it is more clear what they are, as well as general cleanup of incorrect things like quotes where they shouldn't be. Signed-off-by: Jason Guiditta --- src/test/fixtures/bondings.yml | 26 ++-- src/test/fixtures/bondings_nics.yml | 15 -- src/test/fixtures/cpus.yml | 44 ++--- src/test/fixtures/hosts.yml | 221 ++++++++++----------- src/test/fixtures/ip_addresses.yml | 40 +---- src/test/fixtures/networks.yml | 36 ++-- src/test/fixtures/nics.yml | 94 +++------ src/test/fixtures/permissions.yml | 200 ++++--------------- src/test/fixtures/pools.yml | 163 +++++++--------- src/test/fixtures/quotas.yml | 88 +++------ src/test/fixtures/storage_pools.yml | 93 ++------- src/test/fixtures/storage_volumes.yml | 88 ++++----- src/test/fixtures/tasks.yml | 115 +---------- src/test/fixtures/vms.yml | 174 +++++----------- src/test/functional/host_controller_test.rb | 36 ++-- src/test/functional/nic_controller_test.rb | 8 +- src/test/functional/permission_controller_test.rb | 42 +++-- src/test/functional/quota_controller_test.rb | 45 +++-- src/test/functional/resources_controller_test.rb | 42 +++-- src/test/functional/storage_controller_test.rb | 40 +++-- src/test/functional/task_controller_test.rb | 4 +- src/test/functional/vm_controller_test.rb | 41 +++-- src/test/unit/active_record_env_test.rb | 10 +- src/test/unit/host_browser_awaken_test.rb | 3 +- src/test/unit/ip_address_test.rb | 13 +- src/test/unit/permission_test.rb | 12 +- src/test/unit/pool_test.rb | 8 +- src/test/unit/storage_pool_test.rb | 5 +- src/test/unit/storage_volume_test.rb | 4 +- src/test/unit/task_test.rb | 11 +- src/test/unit/vm_test.rb | 4 + 31 files changed, 643 insertions(+), 1082 deletions(-) delete mode 100644 src/test/fixtures/bondings_nics.yml diff --git a/src/test/fixtures/bondings.yml b/src/test/fixtures/bondings.yml index ee1939d..40d856c 100644 --- a/src/test/fixtures/bondings.yml +++ b/src/test/fixtures/bondings.yml @@ -1,15 +1,17 @@ mailservers_managed_node_bonding: - name: Production Network - interface_name: mailbonding0 - bonding_type_id: <%= Fixtures.identify(:link_aggregation_bonding_type) %> - host_id: <%= Fixtures.identify(:mailservers_managed_node) %> - arp_ping_address: 172.31.0.100 - arp_interval: 0 - vlan_id: <%= Fixtures.identify(:dhcp_vlan_one) %> + name: Production Network + interface_name: mailbonding0 + bonding_type: link_aggregation_bonding_type + host: mailservers_managed_node + arp_ping_address: 172.31.0.100 + arp_interval: 0 + vlan: dhcp_vlan_one + nics: mailserver_nic_one, mailserver_nic_two mediaserver_managed_node_bonding: - name: Fileserver Network - interface_name: mediabonding0 - bonding_type_id: <%= Fixtures.identify(:link_aggregation_bonding_type) %> - host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> - vlan_id: <%= Fixtures.identify(:dhcp_vlan_one) %> + name: Fileserver Network + interface_name: mediabonding0 + bonding_type: link_aggregation_bonding_type + host: mediaserver_managed_node + vlan: dhcp_vlan_one + nics: mediaserver_nic_one, mediaserver_nic_two diff --git a/src/test/fixtures/bondings_nics.yml b/src/test/fixtures/bondings_nics.yml deleted file mode 100644 index 607ff8b..0000000 --- a/src/test/fixtures/bondings_nics.yml +++ /dev/null @@ -1,15 +0,0 @@ -mailservers_managed_node_bonding_nic_1: - bonding_id: <%= Fixtures.identify(:mailservers_managed_node_bonding) %> - nic_id: <%= Fixtures.identify(:mailserver_nic_one) %> - -mailservers_managed_node_bonding_nic_2: - bonding_id: <%= Fixtures.identify(:mailservers_managed_node_bonding) %> - nic_id: <%= Fixtures.identify(:mailserver_nic_two) %> - -mediaservers_managed_node_bonding_nic_1: - bonding_id: <%= Fixtures.identify(:mediaserver_managed_node_bonding) %> - nic_id: <%= Fixtures.identify(:mediaserver_nic_one) %> - -mediaservers_managed_node_bonding_nic_2: - bonding_id: <%= Fixtures.identify(:mediaserver_managed_node_bonding) %> - nic_id: <%= Fixtures.identify(:mediaserver_nic_two) %> diff --git a/src/test/fixtures/cpus.yml b/src/test/fixtures/cpus.yml index 995b433..c49e574 100644 --- a/src/test/fixtures/cpus.yml +++ b/src/test/fixtures/cpus.yml @@ -1,65 +1,55 @@ -# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html - -one: - id: 1 - host_id: 10 +prod_corp_com_1: + host: prod_corp_com cpu_number: 1 core_number: 1 number_of_cores: 2 vendor: 'intel' -two: - id: 2 - host_id: 10 +prod_corp_com_2: + host: prod_corp_com cpu_number: 1 core_number: 2 number_of_cores: 2 vendor: 'intel' -three: - id: 3 - host_id: 10 +prod_corp_com_3: + host: prod_corp_com cpu_number: 2 core_number: 1 number_of_cores: 4 vendor: 'intel' -four: - id: 4 - host_id: 10 +prod_corp_com_4: + host: prod_corp_com cpu_number: 2 core_number: 2 number_of_cores: 4 vendor: 'intel' -five: - id: 5 - host_id: 10 +prod_corp_com_5: + host: prod_corp_com cpu_number: 2 core_number: 3 number_of_cores: 4 vendor: 'intel' -six: - id: 6 - host_id: 10 +buildserver_managed_node_1: + host: buildserver_managed_node cpu_number: 2 core_number: 4 number_of_cores: 4 vendor: 'intel' -seven: - id: 7 - host_id: 10 +buildserver_managed_node_2: + host: buildserver_managed_node cpu_number: 3 core_number: 1 number_of_cores: 1 vendor: 'intel' -seven: - id: 8 - host_id: 10 +buildserver_managed_node_3: + host: buildserver_managed_node cpu_number: 4 core_number: 1 number_of_cores: 1 - vendor: 'intel' + vendor: 'amd' diff --git a/src/test/fixtures/hosts.yml b/src/test/fixtures/hosts.yml index 28282c2..31e7580 100644 --- a/src/test/fixtures/hosts.yml +++ b/src/test/fixtures/hosts.yml @@ -1,137 +1,122 @@ -one: - id: 1 - uuid: '1148fdf8-961d-11dc-9387-001558c41534' - hostname: 'prod.corp.com' - arch: 'i686' +prod_corp_com: + uuid: 1148fdf8-961d-11dc-9387-001558c41534 + hostname: prod.corp.com + arch: i686 memory: 18384 is_disabled: 0 - hypervisor_type: 'xen' - hardware_pool_id: 3 -two: - id: 2 - uuid: '1f2a8694-961d-11dc-9387-001558c41534' - hostname: 'myworkstation.dev.corp.com' - arch: 'i386' + state: available + hypervisor_type: xen + hardware_pool: corp_com +workstation_corp_com: + uuid: 1f2a8694-961d-11dc-9387-001558c41534 + hostname: workstation.corp.com + arch: i386 memory: 2048 is_disabled: 0 - hypervisor_type: 'qemu' - hardware_pool_id: 4 -three: - id: 3 - uuid: '58a85f44-75fd-4934-805f-88e45b40d4b4' - hostname: 'macworkstation.foobar.com' - arch: 'mips' + hypervisor_type: qemu + hardware_pool: corp_com +macworkstation_qa_corp_com: + uuid: 58a85f44-75fd-4934-805f-88e45b40d4b4 + hostname: macworkstation.qa.corp.com + arch: mips memory: 2048 is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: 3 -four: - id: 4 - uuid: '520bbb34-6515-490e-9d07-0c8b14f76805' - hostname: 'fedoraworkstation.foobar.com' - arch: 'i386' + hypervisor_type: kvm + hardware_pool: corp_com_qa +fedoraworkstation_qa_corp_com: + uuid: 520bbb34-6515-490e-9d07-0c8b14f76805 + hostname: fedoraworkstation.qa.corp.com + arch: i386 memory: 2048 is_disabled: 1 - hypervisor_type: 'kvm' - hardware_pool_id: 3 -five: - id: 5 - uuid: '2e422f66-324e-48d4-973f-0b91b33070f9' - hostname: 'pipeline.foobar.com' - arch: 'xeon' + hypervisor_type: kvm + hardware_pool: corp_com_qa +pipeline_qa_corp_com: + uuid: 2e422f66-324e-48d4-973f-0b91b33070f9 + hostname: pipeline.qa.corp.com + arch: xeon memory: 1048576 is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: 3 -six: - id: 6 - uuid: 'bb0ce7c7-f234-49ae-84b5-6f4fd8bddcaa' - hostname: 'prod.foobar.com' - arch: 'xeon' + hypervisor_type: kvm + hardware_pool: corp_com_qa +app_qa_corp_com: + uuid: bb0ce7c7-f234-49ae-84b5-6f4fd8bddcaa + hostname: app.qa.corp.com + arch: xeon memory: 16384 is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: 3 -seven: - id: 7 - uuid: '6ae3d22e-97e0-4d86-9712-5395b20a0f45' - hostname: 'mystation.dev.corp.com' - arch: 'i686' + hypervisor_type: kvm + hardware_pool: corp_com_qa +issue_qa_corp_com: + uuid: ec0d86de-657b-48f6-b7cc-e733a3f9a834 + hostname: issue.qa.corp.com + arch: x86 + memory: 4096 + is_disabled: 0 + hypervisor_type: kvm + hardware_pool: corp_com_qa +db_dev_corp_com: + uuid: 81c15560-dbf4-45f5-9b75-106cdbd63aeb + hostname: db.dev.corp.com + arch: x86 + memory: 4096 + is_disabled: 0 + hypervisor_type: kvm + hardware_pool: corp_com_dev +mystation_dev_corp_com: + uuid: 6ae3d22e-97e0-4d86-9712-5395b20a0f45 + hostname: mystation.dev.corp.com + arch: i686 memory: 2048 is_disabled: 0 - hypervisor_type: 'xen' - hardware_pool_id: 4 -eight: - id: 8 - uuid: 'ec0d86de-657b-48f6-b7cc-e733a3f9a834' - hostname: 'issue.qa.corp.com' - arch: 'x86' - memory: 4096 - is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: 5 -nine: - id: 9 - uuid: '81c15560-dbf4-45f5-9b75-106cdbd63aeb' - hostname: 'somehost' - arch: 'x86' - memory: 4096 - is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: 3 -ten: - id: 10 - uuid: '75f8d5f3-faf0-4308-9f20-e4b03d013a27' - hostname: 'node3.priv.ovirt.org' - arch: 'x86_64' - memory: 4194304 - is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: 1 - state: "available" - + hypervisor_type: xen + hardware_pool: corp_com_dev +node3_priv_ovirt_org: + uuid: 75f8d5f3-faf0-4308-9f20-e4b03d013a27 + hostname: node3.priv.ovirt.org + arch: x86_64 + memory: 4194304 + is_disabled: 0 + hypervisor_type: kvm + hardware_pool: default + state: available mailservers_managed_node: - uuid: '182a8596-961d-11dc-9387-001558c41534' - hostname: 'mail.mynetwork.com' - arch: 'i386' - memory: 16384 - is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: <%= Fixtures.identify(:prodops_pool) %> - + uuid: 182a8596-961d-11dc-9387-001558c41534 + hostname: mail.mynetwork.com + arch: i386 + memory: 16384 + is_disabled: 0 + hypervisor_type: kvm + hardware_pool: corp_com_prod fileserver_managed_node: - uuid: '928ad8172-9723-11dc-9387-001558c41534' - hostname: 'files.mynetwork.com' - arch: 'x86_64' - memory: 32768 - is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: <%= Fixtures.identify(:prodops_pool) %> - + uuid: 928ad8172-9723-11dc-9387-001558c41534 + hostname: files.mynetwork.com + arch: x86_64 + memory: 32768 + is_disabled: 0 + hypervisor_type: kvm + hardware_pool: corp_com_prod ldapserver_managed_node: - uuid: '919ae372-9156-11dc-9387-001558c41534' - hostname: 'ldap.mynetwork.com' - arch: 'i386' - memory: 16384 - is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: <%= Fixtures.identify(:prodops_pool) %> - + uuid: 919ae372-9156-11dc-9387-001558c41534 + hostname: ldap.mynetwork.com + arch: i386 + memory: 16384 + is_disabled: 0 + hypervisor_type: kvm + hardware_pool: corp_com_prod buildserver_managed_node: - uuid: '6293acd9-2784-11dc-9387-001558c41534' - hostname: 'build.mynetwork.com' - arch: 'x86_64' - memory: 65536 - is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: <%= Fixtures.identify(:prodops_pool) %> - + uuid: 6293acd9-2784-11dc-9387-001558c41534 + hostname: build.mynetwork.com + arch: x86_64 + memory: 65536 + is_disabled: 0 + hypervisor_type: kvm + hardware_pool: corp_com_prod mediaserver_managed_node: - uuid: '6293acd9-2784-11dc-9387-001558c41534' - hostname: 'build.mynetwork.com' - arch: 'x86_64' - memory: 65536 - is_disabled: 0 - hypervisor_type: 'kvm' - hardware_pool_id: <%= Fixtures.identify(:prodops_pool) %> - + uuid: 6293acd9-2784-11dc-9387-001558c41534 + hostname: build.mynetwork.com + arch: x86_64 + memory: 65536 + is_disabled: 0 + hypervisor_type: kvm + hardware_pool: corp_com_prod diff --git a/src/test/fixtures/ip_addresses.yml b/src/test/fixtures/ip_addresses.yml index aed3811..b19e9e1 100644 --- a/src/test/fixtures/ip_addresses.yml +++ b/src/test/fixtures/ip_addresses.yml @@ -1,37 +1,5 @@ -ip_v4_one: - nic_id: <%= Fixtures.identify(:nic_one) %> - type: IpV4Address - address: 1.2.3.4 - netmask: 255.255.255.0 - gateway: 1.2.3.1 - broadcast: 1.2.3.255 - -ip_v4_two: - nic_id: <%= Fixtures.identify(:nic_two) %> - type: IpV4Address - address: 2.3.4.5 - netmask: 255.255.255.0 - gateway: 1.2.3.1 - broadcast: 2.3.4.255 - -ip_v4_three: - nic_id: <%= Fixtures.identify(:nic_three) %> - type: IpV4Address - address: 3.4.5.6 - netmask: 255.255.255.0 - gateway: 3.4.5.1 - broadcast: 3.4.5.255 - -ip_v4_four: - nic_id: <%= Fixtures.identify(:nic_four) %> - type: IpV4Address - address: 3.4.5.6 - netmask: 255.255.255.0 - gateway: 3.4.5.1 - broadcast: 3.4.5.255 - ip_v4_mailserver_nic_one: - nic_id: <%= Fixtures.identify(:mailserver_nic_one) %> + nic: mailserver_nic_one type: IpV4Address address: 172.31.0.15 netmask: 255.255.255.0 @@ -39,13 +7,13 @@ ip_v4_mailserver_nic_one: broadcast: 172.31.0.255 ip_v4_ldapserver_nic_one: - nic_id: <%= Fixtures.identify(:ldapserver_nic_one) %> + nic: ldapserver_nic_one type: IpV4Address address: 172.31.0.25 gateway: 172.31.0.1 ip_v4_buildserver_nic_one: - nic_id: <%= Fixtures.identify(:buildserver_nic_two) %> + nic: buildserver_nic_two type: IpV4Address address: 172.31.0.31 netmask: 255.255.255.0 @@ -53,7 +21,7 @@ ip_v4_buildserver_nic_one: broadcast: 172.31.0.255 ip_v4_mailservers_managed_node_bonding: - bonding_id: <%= Fixtures.identify(:mailservers_managed_node_bonding) %> + bonding: mailservers_managed_node_bonding type: IpV4Address address: 192.168.50.100 netmask: 255.255.255.0 diff --git a/src/test/fixtures/networks.yml b/src/test/fixtures/networks.yml index cb50c0c..1ea2c7c 100644 --- a/src/test/fixtures/networks.yml +++ b/src/test/fixtures/networks.yml @@ -1,33 +1,33 @@ static_vlan_one: - type: 'Vlan' - name: 'Static Vlan 1' - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + type: Vlan + name: Static Vlan 1 + boot_type: boot_type_static_ip number: 1 dhcp_vlan_one: - type: 'Vlan' - name: 'DHCP Vlan 1' - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + type: Vlan + name: DHCP Vlan 1 + boot_type: boot_type_dhcp number: 2 bootp_vlan_one: - type: 'Vlan' - name: 'BOOTP Vlan 1' - boot_type_id: <%= Fixtures.identify(:boot_type_bootp) %> + type: Vlan + name: BOOTP Vlan 1 + boot_type: boot_type_bootp number: 3 static_physical_network_one: - type: 'PhysicalNetwork' - name: 'Static Physical Network 1' - boot_type_id: <%= Fixtures.identify(:boot_type_static_ip) %> + type: PhysicalNetwork + name: Static Physical Network 1 + boot_type: boot_type_static_ip dhcp_physical_network_one: - type: 'PhysicalNetwork' - name: 'DHCP Physical Network 1' - boot_type_id: <%= Fixtures.identify(:boot_type_dhcp) %> + type: PhysicalNetwork + name: DHCP Physical Network 1 + boot_type: boot_type_dhcp bootp_physical_network_one: - type: 'PhysicalNetwork' - name: 'BOOTP Physical Network 1' - boot_type_id: <%= Fixtures.identify(:boot_type_bootp) %> + type: PhysicalNetwork + name: BOOTP Physical Network 1 + boot_type: boot_type_bootp diff --git a/src/test/fixtures/nics.yml b/src/test/fixtures/nics.yml index 7f65ef6..a7851ff 100644 --- a/src/test/fixtures/nics.yml +++ b/src/test/fixtures/nics.yml @@ -1,84 +1,56 @@ -nic_one: - id: 1 - mac: '00:11:22:33:44:55' - bandwidth: 100 - host_id: 10 - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> -nic_two: - id: 2 - mac: 'AA:BB:CC:DD:EE:FF' - usage_type: '2' - bandwidth: 1000 - host_id: 10 - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> -nic_three: - id: 3 - mac: '00:FF:11:EE:22:DD' - usage_type: '1' - bandwidth: 10 - host_id: 10 - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> -nic_four: - id: 4 - mac: '00:FF:11:EE:22:DD' - usage_type: '1' - bandwidth: 10 - host_id: 10 - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> - mailserver_nic_one: - mac: '00:11:22:33:44:55' - usage_type: '1' + mac: 00:11:22:33:44:55 + usage_type: 1 bandwidth: 100 - host_id: <%= Fixtures.identify(:mailservers_managed_node) %> - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> + host: mailservers_managed_node + physical_network: dhcp_physical_network_one mailserver_nic_two: - mac: '22:11:33:66:44:55' - usage_type: '1' + mac: 22:11:33:66:44:55 + usage_type: 1 bandwidth: 100 - host_id: <%= Fixtures.identify(:mailservers_managed_node) %> - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> + host: mailservers_managed_node + physical_network: dhcp_physical_network_one fileserver_nic_one: - mac: '00:99:00:99:13:07' - usage_type: '1' + mac: 00:99:00:99:13:07 + usage_type: 1 bandwidth: 100 - host_id: <%= Fixtures.identify(:fileserver_managed_node) %> - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> + host: fileserver_managed_node + physical_network: dhcp_physical_network_one ldapserver_nic_one: - mac: '00:03:02:00:09:06' - usage_type: '1' + mac: 00:03:02:00:09:06 + usage_type: 1 bandwidth: 100 - bridge: 'ovirtbr0' - host_id: <%= Fixtures.identify(:ldapserver_managed_node) %> - physical_network_id: <%= Fixtures.identify(:static_physical_network_one) %> + bridge: ovirtbr0 + host: ldapserver_managed_node + physical_network: static_physical_network_one buildserver_nic_one: - mac: '07:17:19:65:03:38' - usage_type: '1' + mac: 07:17:19:65:03:38 + usage_type: 1 bandwidth: 100 - host_id: <%= Fixtures.identify(:buildserver_managed_node) %> - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> + host: buildserver_managed_node + physical_network: dhcp_physical_network_one buildserver_nic_two: - mac: '07:17:19:65:03:39' - usage_type: '1' + mac: 07:17:19:65:03:39 + usage_type: 1 bandwidth: 100 - host_id: <%= Fixtures.identify(:buildserver_managed_node) %> - physical_network_id: <%= Fixtures.identify(:static_physical_network_one) %> + host: buildserver_managed_node + physical_network: static_physical_network_one mediaserver_nic_one: - mac: '07:17:19:65:03:32' - usage_type: '1' + mac: 07:17:19:65:03:32 + usage_type: 1 bandwidth: 100 - host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> + host: mediaserver_managed_node + physical_network: dhcp_physical_network_one mediaserver_nic_two: - mac: '07:17:19:65:03:31' - usage_type: '1' + mac: 07:17:19:65:03:31 + usage_type: 1 bandwidth: 100 - host_id: <%= Fixtures.identify(:mediaserver_managed_node) %> - physical_network_id: <%= Fixtures.identify(:dhcp_physical_network_one) %> + host: mediaserver_managed_node + physical_network: dhcp_physical_network_one diff --git a/src/test/fixtures/permissions.yml b/src/test/fixtures/permissions.yml index e86a42e..4fff79e 100644 --- a/src/test/fixtures/permissions.yml +++ b/src/test/fixtures/permissions.yml @@ -1,161 +1,39 @@ -one: - id: 1 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 1 -two: - id: 2 - user_role: 'Administrator' - uid: 'jadmin' - pool_id: 3 -three: - id: 3 - user_role: 'User' - uid: 'buser' - pool_id: 10 -four: - id: 4 - user_role: 'Monitor' - uid: 'auser' - pool_id: 10 -five: - id: 5 - user_role: 'Administrator' - uid: 'kadmin' - pool_id: 6 -six: - id: 6 - user_role: 'Monitor' - uid: 'auser' - pool_id: 6 -seven: - id: 7 - user_role: 'User' - uid: 'luser' - pool_id: 7 -eight: - id: 8 - user_role: 'User' - uid: 'muser' - pool_id: 7 -nine: - id: 9 - user_role: 'Monitor' - uid: 'iuser' - pool_id: 7 -ten: - id: 10 - user_role: 'Administrator' - uid: 'qadmin' - pool_id: 6 -eleven: - id: 11 - user_role: 'Monitor' - uid: 'iuser' - pool_id: 6 -twelve: - id: 12 - user_role: 'User' - uid: 'buser' - pool_id: 2 -thirteen: - id: 13 - user_role: 'User' - uid: 'yuser' - pool_id: 9 -fourteen: - id: 14 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 2 - inherited_from_id: 1 -fifteen: - id: 15 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 3 - inherited_from_id: 1 -sixteen: - id: 16 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 4 - inherited_from_id: 1 -seventeen: - id: 17 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 5 - inherited_from_id: 1 -eighteen: - id: 18 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 6 - inherited_from_id: 1 -nineteen: - id: 19 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 7 - inherited_from_id: 1 -twenty: - id: 20 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 8 - inherited_from_id: 1 -twentyone: - id: 21 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 9 - inherited_from_id: 1 -twentytwo: - id: 22 - user_role: 'Super Admin' - uid: 'ovirtadmin' - pool_id: 10 - inherited_from_id: 1 -twentythree: - id: 23 - user_role: 'Administrator' - uid: 'jadmin' - pool_id: 4 - inherited_from_id: 2 -twentyfour: - id: 24 - user_role: 'Administrator' - uid: 'jadmin' - pool_id: 5 - inherited_from_id: 2 -twentyfive: - id: 25 - user_role: 'Administrator' - uid: 'jadmin' - pool_id: 6 - inherited_from_id: 2 -twentysix: - id: 26 - user_role: 'Administrator' - uid: 'jadmin' - pool_id: 7 - inherited_from_id: 2 -twentyseven: - id: 27 - user_role: 'Administrator' - uid: 'jadmin' - pool_id: 8 - inherited_from_id: 2 -twentyeight: - id: 28 - user_role: 'Administrator' - uid: 'jadmin' - pool_id: 9 - inherited_from_id: 2 -twentynine: - id: 29 - user_role: 'Administrator' - uid: 'jadmin' - pool_id: 10 - inherited_from_id: 2 +ovirtadmin_root: + user_role: Super Admin + uid: ovirtadmin + pool: root_dir_pool +ovirtadmin_default: + user_role: Super Admin + uid: ovirtadmin + pool: default + inherited_from_id: <%= Fixtures.identify(:ovirtadmin_root) %> +ovirtadmin_hardware_pool: + user_role: Super Admin + uid: ovirtadmin + pool: hw_dir_pool + inherited_from_id: <%= Fixtures.identify(:ovirtadmin_root) %> +ovirtadmin_users_pool: + user_role: Super Admin + uid: ovirtadmin + pool: smart_dir_pool + inherited_from_id: <%= Fixtures.identify(:ovirtadmin_root) %> +ovirtadmin_corp_com_pool: + user_role: Super Admin + uid: ovirtadmin + pool: corp_com + inherited_from_id: <%= Fixtures.identify(:ovirtadmin_root) %> +ovirtadmin_corp_com_production_vmpool: + user_role: Super Admin + uid: ovirtadmin + pool: corp_com_production_vmpool + inherited_from_id: <%= Fixtures.identify(:ovirtadmin_root) %> +ovirtadmin_prodops_pool: + user_role: Super Admin #Monitor + uid: ovirtadmin + pool: corp_com_prod + inherited_from_id: <%= Fixtures.identify(:ovirtadmin_root) %> +ovirtadmin_corp_com_qa_pool: + user_role: Monitor + uid: ovirtadmin + pool: corp_com_qa + inherited_from_id: <%= Fixtures.identify(:ovirtadmin_root) %> \ No newline at end of file diff --git a/src/test/fixtures/pools.yml b/src/test/fixtures/pools.yml index 181a75b..1c810b3 100644 --- a/src/test/fixtures/pools.yml +++ b/src/test/fixtures/pools.yml @@ -1,100 +1,77 @@ -one: - id: 1 - name: 'default' - type: 'HardwarePool' - parent_id: 12 - created_at: '2008-02-13 15:42:43.417883' - updated_at: '2008-02-14 16:41:42.417883' - lft: 3 +root_dir_pool: + name: root + type: DirectoryPool + lft: 1 + rgt: 26 +hw_dir_pool: + name: hardware + type: DirectoryPool + parent_id: <%= Fixtures.identify(:root_dir_pool) %> + lft: 2 + rgt: 19 +smart_dir_pool: + name: users + type: DirectoryPool + parent_id: <%= Fixtures.identify(:root_dir_pool) %> + lft: 20 + rgt: 25 +ovirtadmin_dir_pool: + name: ovirtadmin + type: DirectoryPool + parent_id: <%= Fixtures.identify(:smart_dir_pool) %> + lft: 21 rgt: 24 -two: - id: 2 - name: 'foobar hosts' - type: 'VmResourcePool' - parent_id: 1 +default: + name: default + type: HardwarePool + parent_id: <%= Fixtures.identify(:hw_dir_pool) %> + lft: 3 + rgt: 18 +corp_com: + name: corp.com + type: HardwarePool + parent_id: <%= Fixtures.identify(:default) %> lft: 4 - rgt: 5 -three: - id: 3 - name: 'corp.com' - type: 'HardwarePool' - parent_id: 1 - lft: 6 - rgt: 23 -four: - id: 4 - name: 'corp.com dev' - type: 'HardwarePool' - parent_id: 3 - lft: 7 + rgt: 17 +corp_com_prod: + name: Production Operations + type: HardwarePool + parent_id: <%= Fixtures.identify(:corp_com) %> + lft: 5 rgt: 8 -five: - id: 5 - name: 'corp.com qa' - type: 'HardwarePool' - parent_id: 3 +corp_com_qa: + name: corp.com qa + type: HardwarePool + parent_id: <%= Fixtures.identify(:corp_com) %> lft: 9 - rgt: 20 -six: - id: 6 - name: 'corp.com production vms' - type: 'VmResourcePool' - parent_id: 3 - lft: 21 - rgt: 22 -seven: - id: 7 - name: 'foobar' - type: 'VmResourcePool' - parent_id: 5 + rgt: 12 +corp_com_dev: + name: corp.com dev + type: HardwarePool + parent_id: <%= Fixtures.identify(:corp_com) %> + lft: 13 + rgt: 16 +corp_com_production_vmpool: + name: corp.com production vmpool + type: VmResourcePool + parent_id: <%= Fixtures.identify(:corp_com_prod) %> + lft: 6 + rgt: 7 +corp_qa_vmpool: + name: corp.com qa vms + type: VmResourcePool + parent_id: <%= Fixtures.identify(:corp_com_qa) %> lft: 10 rgt: 11 -eight: - id: 8 - name: 'some foobar hardware' - type: 'HardwarePool' - parent_id: 5 - lft: 12 +corp_com_dev_vmpool: + name: corp.com dev vmpool + type: VmResourcePool + parent_id: <%= Fixtures.identify(:corp_com_dev) %> + lft: 14 rgt: 15 -nine: - id: 9 - name: 'some more foobar hardware' - type: 'HardwarePool' - parent_id: 8 - lft: 13 - rgt: 14 -ten: - id: 10 - name: 'yet another pool' - type: 'VmResourcePool' - parent_id: 5 - lft: 16 - rgt: 17 -prodops_pool: - id: 11 - name: 'Production Operations' - type: 'HardwarePool' - parent_id: 5 - lft: 18 - rgt: 19 -hw_dir_pool: - id: 12 - name: 'hardware' - type: 'DirectoryPool' - parent_id: 13 - lft: 2 - rgt: 25 -root_dir_pool: - id: 13 - name: 'root' - type: 'DirectoryPool' - lft: 1 - rgt: 28 -smart_dir_pool: - id: 14 - name: 'hardware' - type: 'DirectoryPool' - parent_id: 13 - lft: 26 - rgt: 27 - +qa_testing_smartpool: + name: qa testing + type: SmartPool + parent_id: <%= Fixtures.identify(:ovirtadmin_dir_pool) %> + lft: 22 + rgt: 23 diff --git a/src/test/fixtures/quotas.yml b/src/test/fixtures/quotas.yml index 037fd67..f953d3a 100644 --- a/src/test/fixtures/quotas.yml +++ b/src/test/fixtures/quotas.yml @@ -1,65 +1,35 @@ -# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html -one: - id: 1 +default_quota: total_vcpus: 30 - total_vmemory: 2097152 + total_vmemory: 204800000 total_vnics: 20 - total_storage: 104857600 + total_storage: 41943040000 total_vms: 20 - pool_id: 1 -two: - id: 2 + pool: default +corp_com_quota: total_vcpus: 32 - total_vmemory: 16765 + total_vmemory: 51200000 + total_vnics: 20 + total_storage: 10485760000 + total_vms: 32 + pool: corp_com +corp_com_dev_quota: + total_vcpus: 4 + total_vmemory: 12288000 total_vnics: 5 - total_storage: 1000000 - total_vms: 13 - pool_id: 3 -three: - id: 3 - total_vcpus: 2 - total_vmemory: - total_vnics: - total_storage: - total_vms: - pool_id: 4 -four: - id: 4 - total_vcpus: - total_vmemory: - total_vnics: - total_storage: - total_vms: 2 - pool_id: 6 -five: - id: 5 - total_vcpus: 3 - total_vmemory: 1024 - total_vnics: - total_storage: 150 - total_vms: - pool_id: 5 -six: - id: 6 + total_storage: 2621440000 + total_vms: 8 + pool: corp_com_dev +corp_com_qa_quota: total_vcpus: 4 - total_vmemory: 5096 - total_vnics: 3 - total_storage: 1024 - total_vms: 2 - pool_id: 5 -seven: - id: 7 - total_vcpus: - total_vmemory: - total_vnics: 1 - total_storage: 112233 - total_vms: - pool_id: 11 -eight: - id: 8 - total_vcpus: 20 - total_vmemory: 2097152 - total_vnics: 30 - total_storage: 1111111111 - total_vms: 20 - pool_id: 7 + total_vmemory: 12288000 + total_vnics: 5 + total_storage: 2621440000 + total_vms: 8 + pool: corp_com_qa +corp_com_prod_quota: + total_vcpus: 4 + total_vmemory: 12288000 + total_vnics: 5 + total_storage: 2621440000 + total_vms: 8 + pool: corp_com_prod diff --git a/src/test/fixtures/storage_pools.yml b/src/test/fixtures/storage_pools.yml index d52bf51..ac72f99 100644 --- a/src/test/fixtures/storage_pools.yml +++ b/src/test/fixtures/storage_pools.yml @@ -1,75 +1,18 @@ -one: - id: 1 - hardware_pool_id: 3 - ip_addr: '127.0.0.1' - type: 'IscsiStoragePool' - port: 53 - target: 'footarget' - state: 'available' -two: - id: 2 - hardware_pool_id: 4 - type: 'NfsStoragePool' - ip_addr: '127.0.0.1' - export_path: '/tmp/foopath' - state: 'available' -three: - id: 3 - hardware_pool_id: 4 - type: 'NfsStoragePool' - ip_addr: '192.168.50.1' - export_path: '/tmp/barpath' - state: 'available' -four: - id: 4 - hardware_pool_id: 9 - type: 'IscsiStoragePool' - port: 121 - ip_addr: '192.168.50.1' - target: 'rubarb' - hardware_pool_id: 1 - state: 'available' -five: - id: 5 - hardware_pool_id: 9 - type: 'NfsStoragePool' - ip_addr: '192.168.50.2' - export_path: '/tmp/thepath' - state: 'available' -six: - id: 6 - hardware_pool_id: 9 - type: 'NfsStoragePool' - ip_addr: '192.168.50.3' - export_path: '/tmp/anotherpath' - state: 'available' -seven: - id: 7 - hardware_pool_id: 9 - type: 'NfsStoragePool' - ip_addr: '192.168.50.4' - export_path: '/tmp/apath' - state: 'available' -eight: - id: 8 - hardware_pool_id: 9 - ip_addr: '192.168.50.2' - type: 'IscsiStoragePool' - port: 531 - target: 'bartarget' - state: 'available' -nine: - id: 9 - hardware_pool_id: 9 - type: 'NfsStoragePool' - ip_addr: '1.2.3.4' - export_path: '/tmp/somepath' - state: 'available' -ten: - id: 10 - hardware_pool_id: 9 - type: 'IscsiStoragePool' - ip_addr: '192.168.50.3' - port: 539 - target: 'stayontarget' - state: 'available' +corp_com_ovirtpriv_storage: + hardware_pool: corp_com + ip_addr: 192.168.50.2 + type: IscsiStoragePool + port: 3260 + target: ovirtpriv:storage + state: available +corp_com_nfs_ovirtnfs: + hardware_pool: corp_com + type: NfsStoragePool + ip_addr: 192.168.50.2 + export_path: /ovirtnfs +corp_com_dev_nfs_ovirtnfs: + hardware_pool: corp_com_dev + type: NfsStoragePool + ip_addr: 192.168.50.3 + export_path: /devnfs + state: available diff --git a/src/test/fixtures/storage_volumes.yml b/src/test/fixtures/storage_volumes.yml index 4761d95..a3711bf 100644 --- a/src/test/fixtures/storage_volumes.yml +++ b/src/test/fixtures/storage_volumes.yml @@ -1,46 +1,42 @@ -# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html -one: - id: 1 - lun: 'abcd' - size: '10485760' - path: '/tmp/foobar' - storage_pool_id: 1 - type: 'IscsiStorageVolume' - state: 'available' -two: - id: 2 - size: '20485760' - path: '/home/secretstuff' - storage_pool_id: 2 - type: 'NfsStorageVolume' - filename: 'secretstuff' - state: 'available' -three: - id: 3 - lun: 'abcd' - size: '14221672' - path: - storage_pool_id: 1 - type: 'IscsiStorageVolume' - state: 'available' -four: - id: 4 - lun: '49723e4d-32e6-469e-8019-913a3dc1bb5d' - size: '01223542' - storage_pool_id: 4 - type: 'IscsiStorageVolume' - state: 'available' -five: - id: 5 - size: '42424242' - storage_pool_id: 2 - type: 'NfsStorageVolume' - filename: 'foobar' - state: 'available' -six: - id: 6 - size: '007007' - storage_pool_id: 6 - type: 'NfsStorageVolume' - filename: 'barfoo' - state: 'available' +ovirtpriv_storage_lun_1: + lun: lun-1 + size: 3145728 + path: /dev/disk/by-id/scsi-S_beaf321011 + storage_pool: corp_com_ovirtpriv_storage + type: IscsiStorageVolume + state: available +ovirtpriv_storage_lun_2: + lun: lun-2 + size: 3145728 + path: /dev/disk/by-id/scsi-S_beaf321012 + storage_pool: corp_com_ovirtpriv_storage + type: IscsiStorageVolume + state: pending_setup +ovirtpriv_storage_lun_3: + lun: lun-3 + size: 3145728 + path: /dev/disk/by-id/scsi-S_beaf321013 + storage_pool: corp_com_ovirtpriv_storage + type: IscsiStorageVolume + state: available +ovirt_nfs_disk_1: + size: 3145728 + path: /mnt/a3q49Sj4Sfmae1bV/disk1.dsk + storage_pool: corp_com_nfs_ovirtnfs + type: NfsStorageVolume + filename: disk1.dsk + state: pending_setup +ovirt_nfs_disk_2: + size: 3145728 + path: /mnt/a3q49Sj4Sfmae1bV/disk2.dsk + storage_pool: corp_com_nfs_ovirtnfs + type: NfsStorageVolume + filename: disk2.dsk + state: pending_setup +ovirt_nfs_disk_3: + size: 3145728 + path: /mnt/a3q49Sj4Sfmae1bV/disk3.dsk + storage_pool: corp_com_nfs_ovirtnfs + type: NfsStorageVolume + filename: disk3.dsk + state: pending_setup diff --git a/src/test/fixtures/tasks.yml b/src/test/fixtures/tasks.yml index 404543c..7f1e0bf 100644 --- a/src/test/fixtures/tasks.yml +++ b/src/test/fixtures/tasks.yml @@ -1,110 +1,9 @@ -one: - id: 1 - user: 'admin' - action: 'create_vm' - state: 'queued' +shutdown_production_httpd_appliance_task: + user: ovirtadmin + action: shutdown_vm + state: running args: - created_at: '2008-02-13 15:42:43.417883' - time_started: - time_ended: + created_at: 2008-02-13 15:42:43.417883 message: - type: 'VmTask' - task_target_type: 'Vm' - task_target_id: 5 -two: - id: 2 - user: 'admin' - action: 'refresh_pool' - state: 'queued' - created_at: '2008-01-13 15:40:13.417883' - type: 'StorageTask' - task_target_type: 'StoragePool' - task_target_id: 1 -three: - id: 3 - user: 'luser' - action: 'start_vm' - state: 'finished' - created_at: '2002-12-14 05:12:23.417883' - time_started: '2002-12-14 05:12:23.417884' - time_ended: '2002-12-14 05:12:23.417885' - message: 'finished!' - type: 'VmTask' - task_target_type: 'Vm' - task_target_id: 7 -four: - id: 4 - user: 'buser' - action: 'pause_vm' - state: 'running' - created_at: '2015-11-23 15:12:43.417883' - time_started: '2015-11-23 15:12:43.417885' - type: 'VmTask' - task_target_type: 'Vm' - task_target_id: 2 -five: - id: 5 - user: 'admin' - action: 'pause_vm' - state: 'running' - created_at: '2015-11-23 15:12:43.417883' - time_started: '2015-11-23 15:12:43.417885' - type: 'VmTask' - task_target_type: 'Vm' - task_target_id: 3 -six: - id: 6 - user: 'buser' - action: 'clear_vms' - state: 'canceled' - created_at: '2001-01-03 01:01:01.417883' - time_started: '2001-01-03 01:05:01.417885' - time_ended: '2001-01-03 01:05:19.417885' - message: 'task cancelled' - type: 'HostTask' - task_target_type: 'Host' - task_target_id: 9 -seven: - id: 7 - user: 'yuser' - action: 'refresh_pool' - state: 'failed' - created_at: '2001-05-10 13:47:53.417883' - time_started: '2001-05-10 13:49:12.417885' - time_ended: '2001-01-10 13:49:15.417885' - message: 'task failed, insufficient permissions' - type: 'StorageTask' - task_target_type: 'StoragePool' - task_target_id: 4 -eight: - id: 8 - user: 'yuser' - action: 'refresh_pool' - state: 'finished' - created_at: '2001-05-10 13:51:53.417883' - time_started: '2001-05-10 13:53:12.417885' - time_ended: '2001-01-10 14:04:15.417885' - message: 'completed' - type: 'StorageTask' - task_target_type: 'StoragePool' - task_target_id: 4 -nine: - id: 9 - user: 'kadmin' - action: 'save_vm' - state: 'paused' - created_at: '2008-04-20 04:00:00.417883' - time_started: '2008-04-20 20:00:00.417885' - message: 'paused' - type: 'VmTask' - task_target_type: 'Vm' - task_target_id: 12 -ten: - id: 10 - user: 'kadmin' - action: 'shutdown_vm' - state: 'queued' - created_at: '2008-04-20 20:05:30.417883' - type: 'VmTask' - task_target_type: 'Vm' - task_target_id: 12 + type: VmTask + task_target: production_httpd_vm (Vm) diff --git a/src/test/fixtures/vms.yml b/src/test/fixtures/vms.yml index ca783e6..ca0d63f 100644 --- a/src/test/fixtures/vms.yml +++ b/src/test/fixtures/vms.yml @@ -1,168 +1,104 @@ -one: - id: 1 - uuid: 'dd2573c3-b97d-493d-bedf-6a8369c965e9' - description: 'production httpd appliance' +production_httpd_vm: + uuid: dd2573c3-b97d-493d-bedf-6a8369c965e9 + description: production httpd appliance num_vcpus_allocated: 2 num_vcpus_used: 2 memory_allocated: 262144 - memory_used: 1024 - vnic_mac_addr: '23:51:90:A1:13:37' - state: 'stopped' + memory_used: 131072 + vnic_mac_addr: 23:51:90:A1:13:37 + state: stopped needs_restart: 0 - boot_device: 'hd' - host_id: 1 - vm_resource_pool_id: 7 -two: - id: 2 - uuid: '89e62d32-04d9-4351-b573-b1a253397296' - description: 'production mysqld appliance' + boot_device: hd + host: prod_corp_com + vm_resource_pool: corp_com_production_vmpool +production_mysqld_vm: + uuid: 89e62d32-04d9-4351-b573-b1a253397296 + description: production mysqld appliance num_vcpus_allocated: 2 num_vcpus_used: 1 memory_allocated: 2048 memory_used: 512 - vnic_mac_addr: '15:99:FE:ED:11:EE' - state: 'running' + vnic_mac_addr: 15:99:FE:ED:11:EE + state: running needs_restart: 0 - boot_device: 'network' - host_id: 1 - vm_resource_pool_id: 7 -three: - id: 3 - uuid: 'e2714087-3a71-460c-8112-23e044f0aa1c' - description: 'production ftpd appliance' + boot_device: network + host: prod_corp_com + vm_resource_pool: corp_com_production_vmpool +production_ftpd_vm: + uuid: e2714087-3a71-460c-8112-23e044f0aa1c + description: production ftpd appliance num_vcpus_allocated: 2 num_vcpus_used: 1 memory_allocated: 1024 memory_used: 512 - vnic_mac_addr: 'FF:AA:BB:00:11:55' - state: 'stopped' + vnic_mac_addr: FF:AA:BB:00:11:55 + state: stopped needs_restart: 1 - boot_device: 'cdrom' - host_id: 1 - vm_resource_pool_id: 7 -four: - id: 4 - uuid: '95454587-24e0-4a52-bb0f-c16abf7433d0' - description: 'production postgresql appliance' + boot_device: cdrom + host: prod_corp_com + vm_resource_pool: corp_com_production_vmpool +production_postgresql_vm: + uuid: 95454587-24e0-4a52-bb0f-c16abf7433d0 + description: production postgresql appliance num_vcpus_allocated: 2 num_vcpus_used: 2 memory_allocated: 2048 memory_used: 1536 - vnic_mac_addr: '48:24:12:93:42:11' - state: 'running' + vnic_mac_addr: 48:24:12:93:42:11 + state: running needs_restart: 0 - boot_device: 'hd' - host_id: 1 - vm_resource_pool_id: 7 -five: - id: 5 - uuid: 'aae029b7-0e9a-4327-8f8a-8447f473a75b' - description: 'foobar pipeline stage1: dev' - num_vcpus_allocated: 2 - num_vcpus_used: 2 - memory_allocated: 2048 - memory_used: 2048 - vnic_mac_addr: '19:18:17:16:15:14' - state: 'running' - needs_restart: 0 - boot_device: 'hd' - host_id: 5 - vm_resource_pool_id: 2 -six: - id: 6 - uuid: 'd02d27b9-328b-4d70-8237-28557e053cb6' - description: 'foobar pipeline stage2: qa' - num_vcpus_allocated: 2 - num_vcpus_used: 2 - memory_allocated: 4096 - memory_used: 4098 - vnic_mac_addr: '25:62:A1:0F:EE:BB' - state: 'running' - needs_restart: 0 - boot_device: 'hd' - host_id: 5 - vm_resource_pool_id: 2 -seven: - id: 7 - uuid: '56f9d73d-d7bb-48d1-bc0e-0308fc22c504' - description: 'foobar pipeline stage3: stage1' + boot_device: hd + host: myworkstation_dev_corp_com + vm_resource_pool: corp_com_production_vmpool +foobar_prod1_vm: + uuid: 786c824a-392f-4bce-b5bb-6765f810acd1 + description: foobar prod1 num_vcpus_allocated: 2 num_vcpus_used: 2 memory_allocated: 4096 memory_used: 4096 - vnic_mac_addr: '42:42:42:42:42:42' - state: 'running' + vnic_mac_addr: FF:FF:FF:EE:EE:EE + state: running needs_restart: 0 - boot_device: 'cdrom' - host_id: 5 - vm_resource_pool_id: 2 -eight: - id: 8 - uuid: '1135ffad-78c7-437c-95c6-74302cf48198' - description: 'foobar pipeline stage3: stage2' - num_vcpus_allocated: 2 - num_vcpus_used: 2 - memory_allocated: 4096 - memory_used: 4096 - vnic_mac_addr: '24:24:24:24:24:24' - state: 'running' - needs_restart: 0 - boot_device: 'cdrom' - host_id: 5 - vm_resource_pool_id: 2 -nine: - id: 9 - uuid: '786c824a-392f-4bce-b5bb-6765f810acd1' - description: 'foobar prod1' - num_vcpus_allocated: 2 - num_vcpus_used: 2 - memory_allocated: 4096 - memory_used: 4096 - vnic_mac_addr: 'FF:FF:FF:EE:EE:EE' - state: 'running' - needs_restart: 0 - boot_device: 'cdrom' - host_id: 6 + boot_device: cdrom + host: fedoraworkstation_foobar_com vm_resource_pool_id: 2 ten: - id: 10 - uuid: '24b9a994-d415-481d-ace8-1d810b601eb6' - description: 'foobar prod2' + uuid: 24b9a994-d415-481d-ace8-1d810b601eb6 + description: foobar prod2 num_vcpus_allocated: 2 num_vcpus_used: 2 memory_allocated: 4096 memory_used: 4096 - vnic_mac_addr: 'EE:EE:EE:FF:FF:FF' - state: 'running' + vnic_mac_addr: EE:EE:EE:FF:FF:FF + state: running needs_restart: 0 - boot_device: 'cdrom' + boot_device: cdrom host_id: 6 vm_resource_pool_id: 2 eleven: - id: 11 - uuid: '9b2c3c73-1abe-460e-b671-b8b7b6719e4c' - description: 'corp.com errata appliance' + uuid: 9b2c3c73-1abe-460e-b671-b8b7b6719e4c + description: corp.com errata appliance num_vcpus_allocated: 2 num_vcpus_used: 2 memory_allocated: 2048 memory_used: 2048 - vnic_mac_addr: '77:77:77:77:77:77' - state: 'running' + vnic_mac_addr: 77:77:77:77:77:77 + state: running needs_restart: 0 - boot_device: 'network' + boot_device: network host_id: 8 vm_resource_pool_id: 6 twelve: - id: 12 - uuid: '552134c7-b0ad-4607-bbf5-d6b9a33c2476' - description: 'corp.com bugzilla appliance' + uuid: 552134c7-b0ad-4607-bbf5-d6b9a33c2476 + description: corp.com bugzilla appliance num_vcpus_allocated: 2 num_vcpus_used: 2 memory_allocated: 2048 memory_used: 2048 - vnic_mac_addr: '77:77:77:77:77:77' - state: 'running' + vnic_mac_addr: 77:77:77:77:77:77 + state: running needs_restart: 0 - boot_device: 'network' + boot_device: network host_id: 8 vm_resource_pool_id: 6 diff --git a/src/test/functional/host_controller_test.rb b/src/test/functional/host_controller_test.rb index 9dc73e9..9a97009 100644 --- a/src/test/functional/host_controller_test.rb +++ b/src/test/functional/host_controller_test.rb @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2008 Red Hat, Inc. # Written by Scott Seago # @@ -31,7 +31,7 @@ class HostControllerTest < Test::Unit::TestCase @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @first_id = hosts(:one).id + @host_id = hosts(:prod_corp_com).id end def test_index @@ -50,7 +50,7 @@ class HostControllerTest < Test::Unit::TestCase end def test_show - get :show, :id => @first_id + get :show, :id => @host_id assert_response :success assert_template 'show' @@ -60,10 +60,10 @@ class HostControllerTest < Test::Unit::TestCase end def test_new - get :new, :hardware_pool_id => 1 + get :new, :hardware_pool_id => pools(:default).id assert_response :redirect - assert_redirected_to :controller => 'hardware', :action => 'show', :id => 1 + assert_redirected_to :controller => 'hardware', :action => 'show', :id => pools(:default).id end def test_create @@ -78,32 +78,32 @@ class HostControllerTest < Test::Unit::TestCase end def test_edit - get :edit, :id => @first_id + get :edit, :id => @host_id assert_response :redirect - assert_redirected_to :action => 'show', :id => @first_id + assert_redirected_to :action => 'show', :id => @host_id assert_not_nil assigns(:host) assert assigns(:host).valid? end def test_update - post :update, :id => @first_id + post :update, :id => @host_id assert_response :redirect - assert_redirected_to :action => 'show', :id => @first_id + assert_redirected_to :action => 'show', :id => @host_id end def test_destroy - assert_nothing_raised { - Host.find(@first_id) - } - - post :destroy, :id => @first_id + #FIXME: this controller method does nothing, do we even need it or a test? + post :destroy, :id => @host_id assert_response :redirect - assert_redirected_to :action => 'show', :id => @first_id + assert_redirected_to :action => 'show', :id => @host_id + end - assert_nothing_raised { - Host.find(@first_id) - } + def test_disable_host + post :host_action, :action_type => 'disable', :id => @host_id + assert_response :success + json = ActiveSupport::JSON.decode(@response.body) + assert_equal 'Host was successfully disabled', json['alert'] end end diff --git a/src/test/functional/nic_controller_test.rb b/src/test/functional/nic_controller_test.rb index 673e399..8a8776a 100644 --- a/src/test/functional/nic_controller_test.rb +++ b/src/test/functional/nic_controller_test.rb @@ -24,14 +24,14 @@ require 'nic_controller' class NicController; def rescue_action(e) raise e end; end class NicControllerTest < Test::Unit::TestCase - fixtures :nics, :permissions + fixtures :permissions, :pools, :nics def setup @controller = NicController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @first_id = nics(:nic_one).id + @first_id = nics(:fileserver_nic_one).id end def test_show @@ -45,10 +45,10 @@ class NicControllerTest < Test::Unit::TestCase end def test_new - get :new, :host_id => 1 + get :new, :host_id => pools(:default).id assert_response :redirect - assert_redirected_to :controller => 'host', :action => 'show', :id => 1 + assert_redirected_to :controller => 'host', :action => 'show', :id => pools(:default).id end end diff --git a/src/test/functional/permission_controller_test.rb b/src/test/functional/permission_controller_test.rb index 45e7ec5..c32100a 100644 --- a/src/test/functional/permission_controller_test.rb +++ b/src/test/functional/permission_controller_test.rb @@ -1,4 +1,4 @@ - + # Copyright (C) 2008 Red Hat, Inc. # Written by Scott Seago # @@ -24,18 +24,18 @@ require 'permission_controller' class PermissionController; def rescue_action(e) raise e end; end class PermissionControllerTest < Test::Unit::TestCase - fixtures :permissions + fixtures :permissions, :pools def setup @controller = PermissionController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @first_id = permissions(:one).id + @permission_id = permissions(:ovirtadmin_default).id end def test_show - get :show, :id => @first_id + get :show, :id => @permission_id assert_response :success assert_template 'show' @@ -45,7 +45,7 @@ class PermissionControllerTest < Test::Unit::TestCase end def test_new - get :new, :pool_id => 1 + get :new, :pool_id => pools(:default).id assert_response :success assert_template 'new' @@ -55,26 +55,32 @@ class PermissionControllerTest < Test::Unit::TestCase def test_create num_permissions = Permission.count - - post :create, :permission => { :user_role => 'Administrator', :uid => 'admin', :pool_id => 2} - + post :create, :permission => { :user_role => 'Administrator', + :uid => 'admin', + :pool_id => pools(:corp_com_production_vmpool).id} assert_response :success - assert_equal num_permissions + 1, Permission.count end def test_destroy - assert_nothing_raised { - Permission.find(@first_id) - } - - post :destroy, :id => @first_id + post :destroy, :id => @permission_id assert_response :redirect - assert_redirected_to :controller => 'hardware', :action => 'show', :id => 1 + assert_redirected_to :controller => 'hardware', :action => 'show', :id => pools(:default).id + assert_equal "ovirtadmin permissions were revoked successfully" , flash[:notice] + end + def test_no_perms_to_destroy + post :destroy, :id => permissions(:ovirtadmin_corp_com_qa_pool).id + assert_response :redirect + assert_redirected_to :controller => 'hardware', :action => 'show', :id => pools(:corp_com_qa).id + assert_equal "You do not have permission to delete this permission record" , flash[:notice] + end - assert_raise(ActiveRecord::RecordNotFound) { - Permission.find(@first_id) - } + #FIXME: write the code to make this a real test! + def test_bad_id_on_destroy +# post :destroy, :id => bad_id +# assert_response :success +# The controller needs to gracefully handle ActiveRecord::RecordNotFound, +# which it does not right now. end end diff --git a/src/test/functional/quota_controller_test.rb b/src/test/functional/quota_controller_test.rb index c87faef..dd44dfc 100644 --- a/src/test/functional/quota_controller_test.rb +++ b/src/test/functional/quota_controller_test.rb @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2008 Red Hat, Inc. # Written by Scott Seago # @@ -24,18 +24,18 @@ require 'quota_controller' class QuotaController; def rescue_action(e) raise e end; end class QuotaControllerTest < Test::Unit::TestCase - fixtures :quotas + fixtures :quotas, :pools def setup @controller = QuotaController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @first_id = quotas(:one).id + @quota_id = quotas(:default_quota).id end def test_show - get :show, :id => @first_id + get :show, :id => @quota_id assert_response :success assert_template 'show' @@ -45,7 +45,7 @@ class QuotaControllerTest < Test::Unit::TestCase end def test_new - get :new, :pool_id => 1 + get :new, :pool_id => pools(:default).id assert_response :success assert_template 'new' @@ -56,7 +56,7 @@ class QuotaControllerTest < Test::Unit::TestCase def test_create num_quotas = Quota.count - post :create, :quota => { :pool_id => 8 } + post :create, :quota => { :pool_id => pools(:default).id } assert_response :success @@ -64,7 +64,7 @@ class QuotaControllerTest < Test::Unit::TestCase end def test_edit - get :edit, :id => @first_id + get :edit, :id => @quota_id assert_response :success assert_template 'edit' @@ -74,22 +74,31 @@ class QuotaControllerTest < Test::Unit::TestCase end def test_update - post :update, :id => @first_id + post :update, :id => @quota_id assert_response :success end def test_destroy - pool = nil - assert_nothing_raised { - quota = Quota.find(@first_id) - pool = quota.pool - } - - post :destroy, :id => @first_id + post :destroy, :id => @quota_id assert_response :success + json = ActiveSupport::JSON.decode(@response.body) + assert_equal 'Quota was successfully deleted.', json['alert'] + end + + def test_not_destroyed + assert true #How do we make it return failure message? + end + + def test_no_perms_to_destroy + post :destroy, :id => quotas(:corp_com_dev_quota).id + assert_response :redirect #Is this really what we want? Or should we just pop up the login page? + end - assert_raise(ActiveRecord::RecordNotFound) { - Quota.find(@first_id) - } + #FIXME: write the code to make this a real test! + def test_bad_id_on_destroy +# post :destroy, :id => bad_id +# assert_response :success +# The controller needs to gracefully handle ActiveRecord::RecordNotFound, +# which it does not right now. end end diff --git a/src/test/functional/resources_controller_test.rb b/src/test/functional/resources_controller_test.rb index 49e8d0e..8e3989b 100644 --- a/src/test/functional/resources_controller_test.rb +++ b/src/test/functional/resources_controller_test.rb @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2008 Red Hat, Inc. # Written by Scott Seago # @@ -18,8 +18,20 @@ # also available at http://www.gnu.org/copyleft/gpl.html. require File.dirname(__FILE__) + '/../test_helper' +require 'resources_controller' + +# Re-raise errors caught by the controller. +class ResourcesController; def rescue_action(e) raise e end; end class ResourcesControllerTest < ActionController::TestCase + fixtures :permissions, :pools + + def setup + @controller = ResourcesController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + def test_index get :index assert_response :success @@ -27,45 +39,39 @@ class ResourcesControllerTest < ActionController::TestCase end def test_new - get :new, :parent_id => 1 + get :new, :parent_id => pools(:default).id assert_response :success end def test_create assert_difference('VmResourcePool.count') do - post :create, :vm_resource_pool => { :name => 'foo_resource_pool' }, :parent_id => 1 + post :create, :vm_resource_pool => { :name => 'foo_resource_pool' }, :parent_id => pools(:default).id end assert_response :success end def test_show - get :show, :id => 2 + get :show, :id => pools(:corp_com_production_vmpool).id assert_response :success end - def test_get - get :edit, :id => 2 + def test_edit + get :edit, :id => pools(:corp_com_production_vmpool).id assert_response :success end def test_update - put :update, :id => 2, :vm_resource_pool => { } + put :update, :id => pools(:corp_com_production_vmpool).id, :vm_resource_pool => { } assert_response :redirect assert_redirected_to :action => 'list' end - def test_destroy - pool = nil - assert_nothing_raised { - pool = VmResourcePool.find(10).parent.id - } - - post :destroy, :id => 10 + def test_destroy_valid_pool + post :destroy, :id => pools(:corp_com_production_vmpool).id assert_response :success - - assert_raise(ActiveRecord::RecordNotFound) { - VmResourcePool.find(10) - } + json = ActiveSupport::JSON.decode(@response.body) + assert_equal 'Virtual Machine Pool was successfully deleted.', json['alert'] end + end diff --git a/src/test/functional/storage_controller_test.rb b/src/test/functional/storage_controller_test.rb index a9f7eb9..a448fdf 100644 --- a/src/test/functional/storage_controller_test.rb +++ b/src/test/functional/storage_controller_test.rb @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2008 Red Hat, Inc. # Written by Scott Seago # @@ -24,14 +24,15 @@ require 'storage_controller' class StorageController; def rescue_action(e) raise e end; end class StorageControllerTest < Test::Unit::TestCase - fixtures :storage_volumes, :storage_pools + fixtures :permissions, :pools, :storage_volumes, :storage_pools def setup @controller = StorageController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @first_id = storage_volumes(:one).id + @lun_1_id = storage_volumes(:ovirtpriv_storage_lun_1).id + @ovirtpriv_storage_id = storage_pools(:corp_com_ovirtpriv_storage).id end def test_index @@ -50,7 +51,7 @@ class StorageControllerTest < Test::Unit::TestCase end def test_show - get :show, :id => @first_id + get :show, :id => @ovirtpriv_storage_id assert_response :success assert_template 'show' @@ -60,7 +61,7 @@ class StorageControllerTest < Test::Unit::TestCase end def test_new - get :new, :hardware_pool_id => 4 + get :new, :hardware_pool_id => pools(:corp_com).id assert_response :success assert_template 'new' @@ -80,7 +81,7 @@ class StorageControllerTest < Test::Unit::TestCase end def test_edit - get :edit, :id => @first_id + get :edit, :id => @ovirtpriv_storage_id assert_response :success assert_template 'edit' @@ -90,22 +91,27 @@ class StorageControllerTest < Test::Unit::TestCase end def test_update - post :update, :id => @first_id + post :update, :id => @ovirtpriv_storage_id assert_response :success end def test_destroy - hw_pool_id = nil - assert_nothing_raised { - pool = StoragePool.find(@first_id) - hw_pool_id = pool.hardware_pool.id - } - - post :destroy, :id => @first_id + post :destroy, :id => @ovirtpriv_storage_id assert_response :success + json = ActiveSupport::JSON.decode(@response.body) + assert_equal 'Storage Pool was successfully deleted.', json['alert'] + end + + def test_no_perms_to_destroy + post :destroy, :id => storage_pools(:corp_com_dev_nfs_ovirtnfs).id + assert_response :redirect #Is this really what we want? Or should we just pop up the login page? + end - assert_raise(ActiveRecord::RecordNotFound) { - StoragePool.find(@first_id) - } + #FIXME: write the code to make this a real test! + def test_bad_id_on_destroy +# post :destroy, :id => bad_id +# assert_response :success +# The controller needs to gracefully handle ActiveRecord::RecordNotFound, +# which it does not right now. end end diff --git a/src/test/functional/task_controller_test.rb b/src/test/functional/task_controller_test.rb index a9578b6..3b90756 100644 --- a/src/test/functional/task_controller_test.rb +++ b/src/test/functional/task_controller_test.rb @@ -31,11 +31,11 @@ class TaskControllerTest < Test::Unit::TestCase @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @first_id = tasks(:one).id + @task_id = tasks(:shutdown_production_httpd_appliance_task).id end def test_show - get :show, :id => @first_id + get :show, :id => @task_id assert_response :success assert_template 'show' diff --git a/src/test/functional/vm_controller_test.rb b/src/test/functional/vm_controller_test.rb index 3744f4a..7936f01 100644 --- a/src/test/functional/vm_controller_test.rb +++ b/src/test/functional/vm_controller_test.rb @@ -24,18 +24,19 @@ require 'vm_controller' class VmController; def rescue_action(e) raise e end; end class VmControllerTest < Test::Unit::TestCase - fixtures :vms + fixtures :permissions, :pools, :vms def setup @controller = VmController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @first_id = vms(:one).id + @vm_id = vms(:production_httpd_vm).id + @default_pool = pools(:default) end def test_show - get :show, :id => @first_id + get :show, :id => @vm_id assert_response :success assert_template 'show' @@ -45,7 +46,7 @@ class VmControllerTest < Test::Unit::TestCase end def test_new - get :new, :hardware_pool_id => 1 + get :new, :hardware_pool_id => @default_pool.id assert_response :redirect assert_redirected_to :controller => 'resources', :action => 'show' @@ -56,7 +57,14 @@ class VmControllerTest < Test::Unit::TestCase def test_create num_vms = Vm.count - post :create, :vm_resource_pool_name => 'foobar', :hardware_pool_id => 1, :vm => { :uuid => 'f43b298c-1e65-46fa-965f-0f6fb9ffaa10', :description => 'descript', :num_vcpus_allocated => 4, :memory_allocated => 262144, :vnic_mac_addr => 'AA:BB:CC:DD:EE:FF', :boot_device => 'network' } + post :create, :vm_resource_pool_name => 'foobar', + :hardware_pool_id => @default_pool.id, + :vm => { :uuid => 'f43b298c-1e65-46fa-965f-0f6fb9ffaa10', + :description => 'descript', + :num_vcpus_allocated => 4, + :memory_allocated => 262144, + :vnic_mac_addr => 'AA:BB:CC:DD:EE:FF', + :boot_device => 'network' } assert_response :success @@ -64,31 +72,30 @@ class VmControllerTest < Test::Unit::TestCase end def test_edit - get :edit, :id => @first_id + get :edit, :id => @vm_id assert_response :success assert_template 'edit' assert_not_nil assigns(:vm) - assert assigns(:vm).valid? + assert assigns(:vm).valid?, assigns(:vm).errors.inspect end def test_update - post :update, :id => @first_id, :vm => {} + post :update, :id => @vm_id, :vm => {} assert_response :success end def test_destroy - pool = nil - assert_nothing_raised { - pool = Vm.find(@first_id).vm_resource_pool_id - } - - post :destroy, :id => @first_id + assert_difference 'Vm.count', -1 do + post :destroy, :id => @vm_id + end assert_response :success + json = ActiveSupport::JSON.decode(@response.body) + assert_equal 'Virtual Machine was successfully deleted.', json['alert'] + end - assert_raise(ActiveRecord::RecordNotFound) { - Vm.find(@first_id) - } + def test_not_destroyed + assert true end end diff --git a/src/test/unit/active_record_env_test.rb b/src/test/unit/active_record_env_test.rb index 1b42cf5..30db689 100644 --- a/src/test/unit/active_record_env_test.rb +++ b/src/test/unit/active_record_env_test.rb @@ -21,11 +21,19 @@ require File.dirname(__FILE__) + '/../test_helper' require File.dirname(__FILE__) + '/../../dutils/active_record_env' class ActiveRecordEnvTest < Test::Unit::TestCase - fixtures :pools, :storage_pools, :hosts, :cpus, :vms, :tasks + fixtures :pools, :hosts, :vms, :boot_types, + :networks, :nics, :ip_addresses, :permissions, :quotas, + :storage_pools, :storage_volumes, :tasks def test_can_find_hosts database_connect hosts = Host.find(:all, :limit => 2) assert_not_nil hosts, 'you have no hosts list!' end + +# def test_can_get_nested_set +# pools = HardwarePool.get_default_pool.full_set_nested(:method => :json_hash_element, +# :privilege => Permission::PRIV_VIEW, :user => get_login_user) +# flunk 'pools contains: ' << pools.inspect +# end end diff --git a/src/test/unit/host_browser_awaken_test.rb b/src/test/unit/host_browser_awaken_test.rb index 4e6f803..d251e90 100644 --- a/src/test/unit/host_browser_awaken_test.rb +++ b/src/test/unit/host_browser_awaken_test.rb @@ -22,8 +22,7 @@ $: << File.join(File.dirname(__FILE__), "../../dutils") $: << File.join(File.dirname(__FILE__), "../../host-browser") require File.dirname(__FILE__) + '/../test_helper' -require 'test/unit' -require 'flexmock/test_unit' +require 'flexmock/test_unit' #probably should move this into test_helper TESTING=true diff --git a/src/test/unit/ip_address_test.rb b/src/test/unit/ip_address_test.rb index 152578e..5ecff77 100644 --- a/src/test/unit/ip_address_test.rb +++ b/src/test/unit/ip_address_test.rb @@ -1,8 +1,13 @@ -require 'test_helper' +require File.dirname(__FILE__) + '/../test_helper' class IpAddressTest < ActiveSupport::TestCase - # Replace this with your real tests. - def test_truth - assert true + fixtures :boot_types, :bondings, :networks, :nics, :ip_addresses + + def test_can_retrieve_nic + assert_equal ip_addresses(:ip_v4_mailserver_nic_one).nic.bandwidth.to_s, '100' + end + + def test_can_get_ipaddress_object + assert_equal ip_addresses(:ip_v4_mailserver_nic_one).address, '172.31.0.15' end end diff --git a/src/test/unit/permission_test.rb b/src/test/unit/permission_test.rb index 3c27b9f..5e2c7ba 100644 --- a/src/test/unit/permission_test.rb +++ b/src/test/unit/permission_test.rb @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2008 Red Hat, Inc. # Written by Scott Seago # @@ -23,7 +23,13 @@ class PermissionTest < Test::Unit::TestCase fixtures :permissions # Replace this with your real tests. - def test_truth - assert true + def test_simple_permission + assert_equal permissions(:ovirtadmin_root).user_role, 'Super Admin' + assert_equal permissions(:ovirtadmin_root).pool.name, 'root' + end + + def test_permission_with_parent + assert_equal permissions(:ovirtadmin_default).inherited_from_id, permissions(:ovirtadmin_root).id + assert_equal permissions(:ovirtadmin_default).parent_permission, permissions(:ovirtadmin_root) end end diff --git a/src/test/unit/pool_test.rb b/src/test/unit/pool_test.rb index c591e58..6f20f9f 100644 --- a/src/test/unit/pool_test.rb +++ b/src/test/unit/pool_test.rb @@ -23,7 +23,11 @@ class PoolTest < Test::Unit::TestCase fixtures :pools # Replace this with your real tests. - def test_truth - assert true + def test_get_name + assert_equal(pools(:corp_com_prod).name, 'Production Operations') + end + + def test_get_parent + assert_equal(pools(:corp_com_prod).parent.name, 'corp.com') end end diff --git a/src/test/unit/storage_pool_test.rb b/src/test/unit/storage_pool_test.rb index a446904..8cc8d1b 100644 --- a/src/test/unit/storage_pool_test.rb +++ b/src/test/unit/storage_pool_test.rb @@ -22,8 +22,7 @@ require File.dirname(__FILE__) + '/../test_helper' class StoragePoolTest < Test::Unit::TestCase fixtures :storage_pools - # Replace this with your real tests. - def test_truth - assert true + def test_hardware_pool_relationship + assert_equal 'corp.com', storage_pools(:corp_com_ovirtpriv_storage).hardware_pool.name end end diff --git a/src/test/unit/storage_volume_test.rb b/src/test/unit/storage_volume_test.rb index 5422706..d0a89f4 100644 --- a/src/test/unit/storage_volume_test.rb +++ b/src/test/unit/storage_volume_test.rb @@ -23,7 +23,7 @@ class StorageVolumeTest < Test::Unit::TestCase fixtures :storage_volumes # Replace this with your real tests. - def test_truth - assert true + def test_relationship_to_storage_pool + assert_equal 'corp.com', storage_volumes(:ovirtpriv_storage_lun_1).storage_pool.hardware_pool.name end end diff --git a/src/test/unit/task_test.rb b/src/test/unit/task_test.rb index e9b64b4..33a3bd8 100644 --- a/src/test/unit/task_test.rb +++ b/src/test/unit/task_test.rb @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2008 Red Hat, Inc. # Written by Scott Seago # @@ -20,10 +20,11 @@ require File.dirname(__FILE__) + '/../test_helper' class TaskTest < Test::Unit::TestCase - fixtures :tasks + fixtures :pools, :hosts, :vms, :permissions, :tasks - # Replace this with your real tests. - def test_truth - assert true + def test_exercise_task_relationships + assert_equal tasks(:shutdown_production_httpd_appliance_task).task_target.vm_resource_pool.name, 'corp.com production vmpool' + assert_equal tasks(:shutdown_production_httpd_appliance_task).task_target.host.hostname, 'prod.corp.com' end + end diff --git a/src/test/unit/vm_test.rb b/src/test/unit/vm_test.rb index a9ed9dc..a196130 100644 --- a/src/test/unit/vm_test.rb +++ b/src/test/unit/vm_test.rb @@ -88,4 +88,8 @@ class VmTest < Test::Unit::TestCase assert_equal @vm.cobbler_system_name, @vm.uuid, "VMs should be using the UUID as their Cobbler system name." end + + def test_get_pending_state + assert_equal 'stopped', vms(:production_httpd_vm).get_pending_state + end end -- 1.5.6.5 From jguiditt at redhat.com Wed Nov 19 21:28:36 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Wed, 19 Nov 2008 16:28:36 -0500 Subject: [Ovirt-devel] [PATCH server] JS Tree testing files. Message-ID: <1227130116-4343-1-git-send-email-jguiditt@redhat.com> This patch: * Adds the standard_tree (actual widget vs nav) test harness * Cleans up the tree.rhtml to account for some previous restructuring * Moves sample json data into a 'test' subfolder. I am looking into some more proper javascript testing systems, so this will undoubtedly be changing again in the near future. Signed-off-by: Jason Guiditta --- .../views/layouts/components/standard_tree.rhtml | 105 ++++++++++++++ src/app/views/layouts/components/tree.rhtml | 11 +- src/public/javascripts/smart_nav_test_data.js | 151 -------------------- .../javascripts/test/smart_nav_sample_data.js | 151 ++++++++++++++++++++ .../javascripts/test/storage_tree_sample_data.js | 58 ++++++++ 5 files changed, 320 insertions(+), 156 deletions(-) create mode 100644 src/app/views/layouts/components/standard_tree.rhtml delete mode 100644 src/public/javascripts/smart_nav_test_data.js create mode 100644 src/public/javascripts/test/smart_nav_sample_data.js create mode 100644 src/public/javascripts/test/storage_tree_sample_data.js diff --git a/src/app/views/layouts/components/standard_tree.rhtml b/src/app/views/layouts/components/standard_tree.rhtml new file mode 100644 index 0000000..d4390c3 --- /dev/null +++ b/src/app/views/layouts/components/standard_tree.rhtml @@ -0,0 +1,105 @@ + + + + + + + <%= yield :title -%> + <%= stylesheet_link_tag 'ovirt-tree/tree' %> + + <%= javascript_include_tag "jquery-1.2.6.min.js" -%> + <%= javascript_include_tag "jquery.ui-1.5.2/ui/packed/ui.core.packed.js" -%> + <%= javascript_include_tag "test/storage_tree_sample_data.js" -%> + <%= javascript_include_tag "test/smart_nav_sample_data.js" -%> + <%= javascript_include_tag "jquery.form.js" -%> + <%= javascript_include_tag "trimpath-template-1.0.38.js" %> + <%= javascript_include_tag "ovirt.tree.js" %> + + + + + + +



          +
          +
            +
            + + +
            +
              +
              + + + diff --git a/src/app/views/layouts/components/tree.rhtml b/src/app/views/layouts/components/tree.rhtml index 063a6df..402c6e3 100644 --- a/src/app/views/layouts/components/tree.rhtml +++ b/src/app/views/layouts/components/tree.rhtml @@ -6,10 +6,15 @@ <%= yield :title -%> + <%= stylesheet_link_tag 'ovirt-tree/tree' %> + <%= javascript_include_tag "jquery-1.2.6.min.js" -%> <%= javascript_include_tag "jquery.livequery.min.js" -%> - <%= javascript_include_tag "smart_nav_test_data.js" -%> + <%= javascript_include_tag "jquery.ui-1.5.2/ui/packed/ui.core.packed.js" -%> + <%= javascript_include_tag "test/smart_nav_sample_data.js" -%> <%= javascript_include_tag "jquery.form.js" -%> + <%= javascript_include_tag "trimpath-template-1.0.38.js" %> + <%= javascript_include_tag "ovirt.tree.js" %> <%= javascript_include_tag "ovirt.js" -%> diff --git a/src/app/views/storage/show.rhtml b/src/app/views/storage/show.rhtml index a4cc1c2..7e02f32 100644 --- a/src/app/views/storage/show.rhtml +++ b/src/app/views/storage/show.rhtml @@ -10,6 +10,11 @@ <%= image_tag "icon_refresh.png" %> Refresh + <%if @storage_pool.user_subdividable -%> + <%= link_to image_tag("icon_addstorage.png") + " Add new Volume", + {:controller => 'storage', :action => 'new_volume', :storage_pool_id => @storage_pool.id}, + :rel=>"facebox[.bolder]", :class=>"selection_facebox" %> + <% end %> <%= image_tag "icon_x.png" %> Delete diff --git a/src/app/views/storage/show_volume.rhtml b/src/app/views/storage/show_volume.rhtml index bd1642f..f85feaa 100644 --- a/src/app/views/storage/show_volume.rhtml +++ b/src/app/views/storage/show_volume.rhtml @@ -6,7 +6,7 @@ <%if @can_modify -%> <%if @storage_volume.supports_lvm_subdivision and @storage_volume.vms.empty? -%> <%= link_to image_tag("icon_addstorage.png") + " Add new Volume", - {:controller => 'storage', :action => 'new_lvm_volume', :source_volume_id => @storage_volume.id}, + {:controller => 'storage', :action => 'new_volume', :source_volume_id => @storage_volume.id}, :rel=>"facebox[.bolder]", :class=>"selection_facebox" %> <% end %> <%if @storage_volume.deletable -%> diff --git a/src/app/models/nfs_storage_pool.rb b/src/db/migrate/031_add_storage_pool_capacity.rb similarity index 81% copy from src/app/models/nfs_storage_pool.rb copy to src/db/migrate/031_add_storage_pool_capacity.rb index a27944b..dc8e5d4 100644 --- a/src/app/models/nfs_storage_pool.rb +++ b/src/db/migrate/031_add_storage_pool_capacity.rb @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2008 Red Hat, Inc. # Written by Scott Seago # @@ -17,12 +17,12 @@ # MA 02110-1301, USA. A copy of the GNU General Public License is # also available at http://www.gnu.org/copyleft/gpl.html. -class NfsStoragePool < StoragePool - - validates_presence_of :ip_addr, :export_path - validates_uniqueness_of :ip_addr, :scope => :export_path +class AddStoragePoolCapacity < ActiveRecord::Migration + def self.up + add_column :storage_pools, :capacity, :integer, :limit => 8 + end - def label_components - "#{export_path}" + def self.down + drop_column :storage_pools, :capacity end end -- 1.5.6.5 From pmyers at redhat.com Thu Nov 20 21:48:39 2008 From: pmyers at redhat.com (Perry Myers) Date: Thu, 20 Nov 2008 16:48:39 -0500 Subject: [Ovirt-devel] [PATCH node-image] Fix RPMs to be forcefully removed individually instead of in blocks In-Reply-To: <871vx6jcuo.fsf@rho.meyering.net> References: <1227165922-13924-1-git-send-email-pmyers@redhat.com> <871vx6jcuo.fsf@rho.meyering.net> Message-ID: <4925DB37.7090600@redhat.com> Jim Meyering wrote: > Perry Myers wrote: >> Some dependencies changed in F10 so some of the $RPM blocks in the >> blacklist were failing. To ensure that a missing RPM doesn't stop >> the uninstalling of other RPMs we remove each RPM individually. >> >> In addition, cronie now brings in exim so remove that forcefully >> >> On F10-x86_64 node-image RPM size is at 50MB with this patch. >> >> NOTE: I've tested building this as an F10 Node, someone should try an F9 Node. My smoketest >> consisted of booting a physical node using this image via PXE. It came up, contacted the >> server and showed up as available in the UI. Further testing should probably be done before >> committing, but I figured I would get the patch out for people to evaluate. > > ACK. > Worked for me on F10. > I confirmed that appliance and node3 started and poked around on both. Great :) This was pushed minus the line that removes the .pp files in /etc/selinux > If nothing requires gpg on the node, we can save 1.4MB by > removing the /usr/bin/{gpg2,gpgv2,gpg-agent} binaries alone. > There might be a few associated libraries, too... I don't think gpg is used at all probably ok to remove Perry -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=| From dhuff at redhat.com Thu Nov 20 22:31:29 2008 From: dhuff at redhat.com (David Huff) Date: Thu, 20 Nov 2008 17:31:29 -0500 Subject: [Ovirt-devel] [PATCH node-image] Added subpackage for srpms, ovirt-node-image-srpms Message-ID: <1227220289-9800-1-git-send-email-dhuff@redhat.com> Workaround which uses pungi to downoad srpms and create a srpm.iso. This patch takes alot from ovirt-release ovirt.mk. Packages srpms into a new subrpm which only contains the source iso. Adds new RPM flag pungi_srpms to toggle srpm iso creation. --- Makefile.am | 47 ++++++++++++++++++++++++++++++++++++++++++++++ ovirt-node-image.spec.in | 32 ++++++++++++++++++++++++++++++- 2 files changed, 78 insertions(+), 1 deletions(-) diff --git a/Makefile.am b/Makefile.am index 61f826f..d34c8a1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -65,6 +65,8 @@ RPMDIR = $$(rpm --eval '%{_rpmdir}') RPM_FLAGS = --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)" RPM_FLAGS += $(if $(_ovirt_dev),--define "extra_release .$(GIT_RELEASE)") RPM_FLAGS += --define "source_iso 1" +RPM_FLAGS += --define "pungi_srpms 1" +SRC_KS = $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/src.ks repos.ks: ( \ @@ -125,6 +127,51 @@ $(NVR).$(PKG_FMT).$(SUM): $(NVR).$(PKG_FMT) $(PACKAGE).$(PKG_FMT) node: $(NVR).$(PKG_FMT).$(SUM) +$(PACKAGE).source source: $(NVR).$(PKG_FMT).$(SUM).source + +$(NVR).$(PKG_FMT).$(SUM).source: $(NVR).$(PKG_FMT).source + +$(NVR).$(PKG_FMT).source: + @mkdir -p $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree/pungi + @sudo rm -Rf $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree/pungi/* + @( if [ -n "$(FEDORA_URL)" ]; then \ + echo "repo --name=f$(FEDORA) --baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/\$$basearch/os" ; \ + echo "repo --name=f$(FEDORA)-updates --baseurl=$(FEDORA_URL)/updates/$(FEDORA)/\$$basearch" ; \ + echo "repo --name=f$(FEDORA)-updates-newkey --baseurl=$(FEDORA_URL)/updates/$(FEDORA)/\$$basearch.newkey" ; \ + echo "repo --name=f$(FEDORA)-src --baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/source/SRPMS" ; \ + echo "repo --name=f$(FEDORA)-updates-src --baseurl=$(FEDORA_URL)/updates/$(FEDORA)/SRPMS" ; \ + echo "repo --name=f$(FEDORA)-updates-src-newkey --baseurl=$(FEDORA_URL)/updates/$(FEDORA)/SRPMS.newkey" ; \ + else \ + echo "repo --name=f$(FEDORA) --mirrorlist=$(FEDORA_MIRROR)?repo=fedora-$(FEDORA)&arch=\$$basearch" ; \ + echo "repo --name=f$(FEDORA)-updates --mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-f$(FEDORA)&arch=\$$basearch" ; \ + echo "repo --name=f$(FEDORA)-updates-newkey --mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-f$(FEDORA).newkey&arch=\$$basearch" ; \ + echo "repo --name=f$(FEDORA)-src --mirrorlist=$(FEDORA_MIRROR)?repo=fedora-source-$(FEDORA)&arch=src" ; \ + echo "repo --name=f$(FEDORA)-updates-src --mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-source-f$(FEDORA)&arch=src" ; \ + echo "repo --name=f$(FEDORA)-updates-src-newkey --mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-source-f$(FEDORA).newkey&arch=src" ; \ + fi ; \ + echo "repo --name=ovirt-org --baseurl=$(OVIRT_URL)/$(FEDORA)/\$$basearch" ; \ + echo "repo --name=ovirt-org-src --baseurl=$(OVIRT_URL)/$(FEDORA)/src" ; \ + echo "#repo --name=thincrust-net --baseurl=$(THINCRUST_URL)/noarch" ; \ + echo "#repo --name=thincrust-net-src --baseurl=$(THINCRUST_URL)/srpms" ; \ + echo "#repo --name=ovirt-local --baseurl=file://$(OVIRT_CACHE_DIR)/ovirt" ; \ + echo "%packages --nobase" ; \ + grep -v '^-' /usr/share/appliance-os/includes/base-pkgs.ks ; \ + echo "lokkit" ; \ + for dir in $(SUBDIRS); do \ + echo "ovirt-$$dir" ; \ + test -f $$dir/common-pkgs.ks && grep -v '^-' $$dir/common-pkgs.ks ; \ + done ; \ + echo "%end" ) > $(SRC_KS) + cd $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree/pungi && \ + pungi -G --ver=$(PACKAGE) -c $(SRC_KS) --cachedir=$(OVIRT_CACHE_DIR)/yum + cd $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree/pungi && \ + sudo pungi --sourceiso --ver=$(PACKAGE) -c $(SRC_KS) --cachedir=$(OVIRT_CACHE_DIR)/yum + sudo mv $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree/pungi/$(PACKAGE)/source/iso/Fedora-$(PACKAGE)-source.iso ./$(PACKAGE)-source.iso + sudo sudo chown -R $(USER) ./$(PACKAGE)-source.iso + sudo sudo chown -R $(USER) $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree/pungi + sudo rm -Rf $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree/pungi + @rm $(SRC_KS) + rpms: dist node rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz diff --git a/ovirt-node-image.spec.in b/ovirt-node-image.spec.in index 009a499..851a475 100644 --- a/ovirt-node-image.spec.in +++ b/ovirt-node-image.spec.in @@ -1,5 +1,6 @@ #include pre-built image ISO as source %{!?source_iso: %define source_iso 0} +%{!?pungi_srpms: %define pungi_srpms 0} Summary: oVirt Node ISO image Name: ovirt-node-image @@ -29,9 +30,21 @@ Requires: appliance-tools >= 003.9 The ISO boot image for oVirt Node booting from CDROM device. At the moment, this RPM just packages prebuilt ISO. +%if %{pungi_srpms} +%package srpms +Summary: oVirt Node source ISO image +Group: Applications/System +BuildRequires: pungi + +%description srpms +The source rpms for the ISO boot image for oVirt Node. At the moment, this RPM just contains a iso of the srpms + +%define image_source_iso %{name}-source.iso +%endif + %prep %setup -q -%if ! %{source_iso} +%if ! %{source_iso} || %{pungi_srpms} ./configure %endif @@ -42,6 +55,12 @@ make %{?ovirt_cache_dir: OVIRT_CACHE_DIR=%{ovirt_cache_dir}} \ %{?ovirt_url: OVIRT_URL=%{ovirt_url}} \ %{name}.iso %endif +%if %{pungi_srpms} + make %{?ovirt_cache_dir: OVIRT_CACHE_DIR=%{ovirt_cache_dir}} \ + %{?ovirt_local_repo: OVIRT_LOCAL_REPO=%{ovirt_local_repo}} \ + %{?ovirt_url: OVIRT_URL=%{ovirt_url}} \ + %{name}.source +%endif %install %{__rm} -rf %{buildroot} @@ -49,6 +68,9 @@ mkdir %{buildroot} %{__install} -d -m0755 %{buildroot}%{app_root} %{__install} -p -m0644 %{image_iso} %{buildroot}%{app_root} +%if %{pungi_srpms} + %{__install} -p -m0644 %{image_source_iso} %{buildroot}%{app_root} +%endif %{__install} -d -m0755 %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-pxe %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-flash %{buildroot}%{_sbindir} @@ -71,7 +93,15 @@ mkdir %{buildroot} %{_sbindir}/edit-livecd %{_sbindir}/livecd-setauth +%if %{pungi_srpms} +%files srpms +%{app_root}/%{name}-source.iso +%endif + %changelog +* Thu Nov 20 2008 David Huff 0.93 +- add pungi source iso + * Thu Jul 03 2008 Perry Myers 0.92-0 - Only store ISO in SRPM, and generate PXE from that during build -- 1.5.5.1 From apevec at redhat.com Thu Nov 20 22:59:46 2008 From: apevec at redhat.com (Alan Pevec) Date: Thu, 20 Nov 2008 23:59:46 +0100 Subject: [Ovirt-devel] Re: [PATCH node] Enabled automated network configuration via kernel arguments. In-Reply-To: <1227201011-19627-1-git-send-email-dpierce@redhat.com> References: <1227201011-19627-1-git-send-email-dpierce@redhat.com> Message-ID: <4925EBE2.1010608@redhat.com> > + local BR_CONFIG_BASE=BR_CONFIG this should prolly be local BR_CONFIG_BASE=$BR_CONFIG > + N|n) BR_CONFIG=BR_CONFIG_BASE ;; this should prolly be N|n) BR_CONFIG=$BR_CONFIG_BASE ;; with this, ACK finally! :) From pmyers at redhat.com Thu Nov 20 23:22:00 2008 From: pmyers at redhat.com (Perry Myers) Date: Thu, 20 Nov 2008 18:22:00 -0500 Subject: [Ovirt-devel] [PATCH recipe] Switched console tty0 and ttyS0 so that serial console works properly in F10 Message-ID: <1227223321-20319-1-git-send-email-pmyers@redhat.com> Signed-off-by: Perry Myers --- appliances/ovirt/files/cobbler-import | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/appliances/ovirt/files/cobbler-import b/appliances/ovirt/files/cobbler-import index bcb5497..32e6fd1 100644 --- a/appliances/ovirt/files/cobbler-import +++ b/appliances/ovirt/files/cobbler-import @@ -51,7 +51,7 @@ popd cobbler distro add --name="oVirt-Node-$node_arch" --arch=$node_arch \ --initrd=$node_dir/tftpboot/initrd0.img --kernel=$node_dir/tftpboot/vmlinuz0 \ - --kopts="rootflags=loop root=/ovirt-node-image.iso rootfstype=iso9660 ro console=ttyS0,115200n8 console=tty0" + --kopts="rootflags=loop root=/ovirt-node-image.iso rootfstype=iso9660 ro console=tty0 console=ttyS0,115200n8" cobbler profile add --name=oVirt-Node-$node_arch --distro=oVirt-Node-$node_arch cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$node_arch \ -- 1.6.0.3 From pmyers at redhat.com Thu Nov 20 23:22:01 2008 From: pmyers at redhat.com (Perry Myers) Date: Thu, 20 Nov 2008 18:22:01 -0500 Subject: [Ovirt-devel] [PATCH node-image] Switched console tty0 and ttyS0 so that serial console works properly in F10 In-Reply-To: <1227223321-20319-1-git-send-email-pmyers@redhat.com> References: <1227223321-20319-1-git-send-email-pmyers@redhat.com> Message-ID: <1227223321-20319-2-git-send-email-pmyers@redhat.com> Signed-off-by: Perry Myers --- common-install.ks | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/common-install.ks b/common-install.ks index f535323..4d3610b 100644 --- a/common-install.ks +++ b/common-install.ks @@ -7,6 +7,6 @@ firewall --disabled part / --size 550 --fstype ext2 services --enabled=ntpd,ntpdate,collectd,iptables,network # This requires a new fixed version of livecd-creator to honor the --append settings. -bootloader --timeout=5 --append="console=ttyS0,115200n8 console=tty0" +bootloader --timeout=5 --append="console=tty0 console=ttyS0,115200n8" rootpw --iscrypted Xa8QeYfWrtscM -- 1.6.0.3 From pmyers at redhat.com Thu Nov 20 23:41:46 2008 From: pmyers at redhat.com (Perry Myers) Date: Thu, 20 Nov 2008 18:41:46 -0500 Subject: [Ovirt-devel] [PATCH appliance] Build appliance w/o docs Message-ID: <1227224506-20499-1-git-send-email-pmyers@redhat.com> This cuts the appliance images down by a few hundred MB. Compressed w/ bz2 the appliance is approx 340MB. This worked for me on F10 build, but I'd like a few others to test before I commit.x Signed-off-by: Perry Myers --- ovirt-appliance.ks | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks index 5f478ea..833d260 100644 --- a/ovirt-appliance.ks +++ b/ovirt-appliance.ks @@ -26,7 +26,7 @@ reboot %include repos.ks -%packages --nobase +%packages --excludedocs --nobase %include /usr/share/appliance-os/includes/base-pkgs.ks ovirt-recipe lokkit -- 1.6.0.3 From pmyers at redhat.com Fri Nov 21 01:39:37 2008 From: pmyers at redhat.com (Perry Myers) Date: Thu, 20 Nov 2008 20:39:37 -0500 Subject: [Ovirt-devel] [PATCH node-image] Use minimal selinux configuration and add modules selectively Message-ID: <1227231577-21257-1-git-send-email-pmyers@redhat.com> Signed-off-by: Perry Myers --- common-blacklist.ks | 3 --- common-pkgs.ks | 2 +- common-post.ks | 20 ++++++++++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/common-blacklist.ks b/common-blacklist.ks index 48702da..3c89236 100644 --- a/common-blacklist.ks +++ b/common-blacklist.ks @@ -118,9 +118,6 @@ find /usr/share -type d -exec rmdir {} \; > /dev/null 2>&1 echo "Cleanup excess selinux modules" $RM /usr/share/selinux -# FIXME: We shouldn't remove all of the modules, just selected ones -# need to do more fine grained black/white listing for this -#$RM /etc/selinux/targeted/modules/active/modules/* echo "Running image-minimizer..." %end diff --git a/common-pkgs.ks b/common-pkgs.ks index a35519f..80993d6 100644 --- a/common-pkgs.ks +++ b/common-pkgs.ks @@ -12,7 +12,7 @@ kvm syslinux ovirt-node ovirt-node-selinux -selinux-policy-targeted +selinux-policy-minimum vim-minimal -audit-libs-python -hdparm diff --git a/common-post.ks b/common-post.ks index 7497b20..2d4ce15 100644 --- a/common-post.ks +++ b/common-post.ks @@ -3,6 +3,26 @@ echo "Starting Kickstart Post" PATH=/sbin:/usr/sbin:/bin:/usr/bin export PATH +# Import SELinux Modules +echo "Enabling selinux modules" +SEMODULES="base automount avahi consolekit cyrus dhcp dnsmasq guest hal ipsec \ +iscsi kerberos kerneloops ldap lockdev logadm mozilla ntp polkit portmap qemu \ +rpcbind sasl snmp stunnel sysstat tcpd unprivuser unconfined usbmodules \ +userhelper virt" + +lokkit -v --selinuxtype=minimum +tmpdir=$(mktemp -d) + +for semodule in $SEMODULES; do + mv /usr/share/selinux/minimum/$semodule.pp.bz2 $tmpdir + bunzip2 $tmpdir/$semodule.pp.bz2 +done + +ls $tmpdir/*.pp | grep -Ev "base.pp|enableaudit.pp" \ + | xargs semodule -v -b $tmpdir/base.pp -i +semodule -v -B +rm -Rf $tmpdir + echo "Running ovirt-install-host stateless" /usr/sbin/ovirt-install-node stateless -- 1.6.0.3 From pmyers at redhat.com Fri Nov 21 05:22:22 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 21 Nov 2008 00:22:22 -0500 Subject: [Ovirt-devel] [PATCH REPOST node-image] Use minimal selinux configuration and add modules selectively Message-ID: <1227244943-22510-1-git-send-email-pmyers@redhat.com> Repost of patch. Original patch forgot to include ovirt-node-selinux.pp in the list of selinux modules to install. Signed-off-by: Perry Myers --- common-blacklist.ks | 3 --- common-pkgs.ks | 2 +- common-post.ks | 24 ++++++++++++++++++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/common-blacklist.ks b/common-blacklist.ks index 48702da..3c89236 100644 --- a/common-blacklist.ks +++ b/common-blacklist.ks @@ -118,9 +118,6 @@ find /usr/share -type d -exec rmdir {} \; > /dev/null 2>&1 echo "Cleanup excess selinux modules" $RM /usr/share/selinux -# FIXME: We shouldn't remove all of the modules, just selected ones -# need to do more fine grained black/white listing for this -#$RM /etc/selinux/targeted/modules/active/modules/* echo "Running image-minimizer..." %end diff --git a/common-pkgs.ks b/common-pkgs.ks index a35519f..80993d6 100644 --- a/common-pkgs.ks +++ b/common-pkgs.ks @@ -12,7 +12,7 @@ kvm syslinux ovirt-node ovirt-node-selinux -selinux-policy-targeted +selinux-policy-minimum vim-minimal -audit-libs-python -hdparm diff --git a/common-post.ks b/common-post.ks index 7497b20..42c055f 100644 --- a/common-post.ks +++ b/common-post.ks @@ -3,6 +3,30 @@ echo "Starting Kickstart Post" PATH=/sbin:/usr/sbin:/bin:/usr/bin export PATH +# Import SELinux Modules +echo "Enabling selinux modules" +SEMODULES="base automount avahi consolekit cyrus dhcp dnsmasq guest hal ipsec \ +iscsi kerberos kerneloops ldap lockdev logadm mozilla ntp ovirt-node-selinux \ +polkit portmap qemu rpcbind sasl snmp stunnel sysstat tcpd unprivuser \ +unconfined usbmodules userhelper virt" + +lokkit -v --selinuxtype=minimum +tmpdir=$(mktemp -d) + +for semodule in $SEMODULES; do + if [ -f /usr/share/selinux/minimum/$semodule.pp.bz2 ]; then + mv /usr/share/selinux/minimum/$semodule.pp.bz2 $tmpdir + bunzip2 $tmpdir/$semodule.pp.bz2 + else + mv /usr/share/selinux/minimum/$semodule.pp $tmpdir + fi +done + +ls $tmpdir/*.pp | grep -Ev "base.pp|enableaudit.pp" \ + | xargs semodule -v -b $tmpdir/base.pp -i +semodule -v -B +rm -Rf $tmpdir + echo "Running ovirt-install-host stateless" /usr/sbin/ovirt-install-node stateless -- 1.6.0.3 From pmyers at redhat.com Fri Nov 21 05:22:23 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 21 Nov 2008 00:22:23 -0500 Subject: [Ovirt-devel] [PATCH node] Add selinux policy .pp file to minimum selinux type In-Reply-To: <1227244943-22510-1-git-send-email-pmyers@redhat.com> References: <1227244943-22510-1-git-send-email-pmyers@redhat.com> Message-ID: <1227244943-22510-2-git-send-email-pmyers@redhat.com> Signed-off-by: Perry Myers --- ovirt-node.spec.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index 2a01b7c..1d3679f 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -6,7 +6,7 @@ Source0: %{name}-%{version}.tar.gz License: GPLv2+ Group: Applications/System -%define selinux_variants mls strict targeted +%define selinux_variants mls strict targeted minimum %define selinux_policyver %(sed -n 's,.*selinux-policy-\([^/]*\)/.*,\1,p' /usr/share/selinux/devel/policyhelp) %define modulename %{name}-selinux Source1: %{modulename}.te -- 1.6.0.3 From pmyers at redhat.com Fri Nov 21 05:52:30 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 21 Nov 2008 00:52:30 -0500 Subject: [Ovirt-devel] [PATCH node-image] Add minimal python into the Node Message-ID: <1227246750-22792-1-git-send-email-pmyers@redhat.com> core python libs and interpreter are added to facilitate scripting Node size increases by approx 4MB compressed This patch removes all of the .py files installed by python RPM since the .pyc and .pyo files are already present and the source shouldn't be strictly needed. Signed-off-by: Perry Myers --- common-blacklist.ks | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common-blacklist.ks b/common-blacklist.ks index 3c89236..2f2c950 100644 --- a/common-blacklist.ks +++ b/common-blacklist.ks @@ -11,9 +11,9 @@ echo "Removing excess RPMs" # However, this is just an install-time dependency; we can remove # it afterwards, which we do here RPMS="system-config-firewall-tui system-config-network-tui rhpl \ - rpm-python dbus-python kudzu newt-python newt" + rpm-python dbus-python kudzu newt-python newt libsemanage-python" -RPMS="$RPMS kpartx mkinitrd isomd5sum dmraid python python-libs checkpolicy" +RPMS="$RPMS kpartx mkinitrd isomd5sum dmraid checkpolicy" # Remove additional RPMs forcefully RPMS="$RPMS gamin pm-utils kbd usermode vbetool ConsoleKit hdparm \ @@ -91,7 +91,7 @@ blacklist="/boot /etc/alsa /etc/pki /usr/share/hwdata/MonitorsDB \ /usr/share/tc /usr/share/emacs /usr/share/info /usr/kerberos \ /usr/src /usr/etc /usr/games /usr/include /usr/local \ /usr/sbin/{dell*,sasldblistusers2,build-locale-archive,glibc_post_upgrade.*}" -blacklist_lib="/usr/lib{,64}/python2.5 /usr/lib{,64}/gconv \ +blacklist_lib="/usr/lib{,64}/gconv \ /usr/{,lib64}/tc /usr/lib{,64}/tls /usr/lib{,64}/sse2 \ /usr/lib{,64}/pkgconfig /usr/lib{,64}/nss /usr/lib{,64}/X11 \ /usr/lib{,64}/games /usr/lib{,64}/alsa-lib /usr/lib{,64}/fs/reiserfs \ @@ -119,6 +119,9 @@ find /usr/share -type d -exec rmdir {} \; > /dev/null 2>&1 echo "Cleanup excess selinux modules" $RM /usr/share/selinux +echo "Removing python source files" +find / -name *.py -exec rm -f {} \; + echo "Running image-minimizer..." %end -- 1.6.0.3 From pmyers at redhat.com Fri Nov 21 06:24:32 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 21 Nov 2008 01:24:32 -0500 Subject: [Ovirt-devel] [PATCH node-image] Add X libraries back into the node for console display support Message-ID: <1227248672-23136-1-git-send-email-pmyers@redhat.com> Also add a few other packages that will be of use Signed-off-by: Perry Myers --- common-blacklist.ks | 2 +- common-pkgs.ks | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletions(-) diff --git a/common-blacklist.ks b/common-blacklist.ks index 2f2c950..d5488ac 100644 --- a/common-blacklist.ks +++ b/common-blacklist.ks @@ -93,7 +93,7 @@ blacklist="/boot /etc/alsa /etc/pki /usr/share/hwdata/MonitorsDB \ /usr/sbin/{dell*,sasldblistusers2,build-locale-archive,glibc_post_upgrade.*}" blacklist_lib="/usr/lib{,64}/gconv \ /usr/{,lib64}/tc /usr/lib{,64}/tls /usr/lib{,64}/sse2 \ - /usr/lib{,64}/pkgconfig /usr/lib{,64}/nss /usr/lib{,64}/X11 \ + /usr/lib{,64}/pkgconfig /usr/lib{,64}/nss \ /usr/lib{,64}/games /usr/lib{,64}/alsa-lib /usr/lib{,64}/fs/reiserfs \ /usr/lib{,64}/krb5 /usr/lib{,64}/hal /usr/lib{,64}/gio \ /lib/terminfo/d /lib/terminfo/v /lib/terminfo/a \ diff --git a/common-pkgs.ks b/common-pkgs.ks index 80993d6..627c828 100644 --- a/common-pkgs.ks +++ b/common-pkgs.ks @@ -14,6 +14,28 @@ ovirt-node ovirt-node-selinux selinux-policy-minimum vim-minimal +libpng +xorg-x11-filesystem +libX11 +libxcb +libXdmcp +libXau +mesa-libGLU +mesa-libGL +libXfixes +libXext +libXxf86vm +libXdamage +libdrm +libXrender +freetype +fontconfig +sudo +python +python-libs +gdbm +db4 +m2crypto -audit-libs-python -hdparm -ustr -- 1.6.0.3 From pmyers at redhat.com Fri Nov 21 06:25:01 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 21 Nov 2008 01:25:01 -0500 Subject: [Ovirt-devel] [PATCH node-image] Open up additional ports for guest consoles Message-ID: <1227248701-23192-1-git-send-email-pmyers@redhat.com> Signed-off-by: Perry Myers --- common-post.ks | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common-post.ks b/common-post.ks index 42c055f..664e9d6 100644 --- a/common-post.ks +++ b/common-post.ks @@ -58,8 +58,8 @@ cat > /etc/sysconfig/iptables << \EOF -A INPUT -p tcp --dport 16509 -j ACCEPT # SSH -A INPUT -p tcp --dport 22 -j ACCEPT -# VNC consoles --A INPUT -p tcp -m multiport --dports 5900:6000 -j ACCEPT +# guest consoles +-A INPUT -p tcp -m multiport --dports 5800:6000 -j ACCEPT # migration -A INPUT -p tcp -m multiport --dports 49152:49216 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -- 1.6.0.3 From berrange at redhat.com Fri Nov 21 11:17:08 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Fri, 21 Nov 2008 11:17:08 +0000 Subject: [Ovirt-devel] Some architecture diagrams Message-ID: <20081121111708.GJ15131@redhat.com> There's a number of high level architecture diagrams on the website giving an overview of what's going on, but since they're aimed at people getting to know the project they're not very detailed. I felt I wanted some additional more technically detailed/ focused diagrams to illustrate what we're doing to developers actually writing code for the project. And so by the power of XFig http://ovirt.org/page/ArchDiagrams I'm attaching a tar.gz with the original XFig sources, so if people have improvements to make they can fix them up directly. Perhaps we should put them in source control somewhere ? Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -------------- next part -------------- A non-text attachment was scrubbed... Name: ovirt-diagrams.tar.gz Type: application/x-gzip Size: 139406 bytes Desc: not available URL: From apevec at redhat.com Fri Nov 21 12:31:56 2008 From: apevec at redhat.com (Alan Pevec) Date: Fri, 21 Nov 2008 13:31:56 +0100 Subject: [Ovirt-devel] Re: [PATCH node-image] Use minimal selinux configuration and add modules selectively In-Reply-To: <1227231577-21257-1-git-send-email-pmyers@redhat.com> References: <1227231577-21257-1-git-send-email-pmyers@redhat.com> Message-ID: <4926AA3C.708@redhat.com> > -selinux-policy-targeted > +selinux-policy-minimum -minimum subpkg doesn't exist for F9. What are the chances to get this in f9-updates or should be we just switch to F10 completely for the Node image? I'll check how does building with F10 repos on F9 build host work. From apevec at redhat.com Fri Nov 21 12:45:28 2008 From: apevec at redhat.com (Alan Pevec) Date: Fri, 21 Nov 2008 13:45:28 +0100 Subject: [Ovirt-devel] Re: Some architecture diagrams In-Reply-To: <20081121111708.GJ15131@redhat.com> References: <20081121111708.GJ15131@redhat.com> Message-ID: <4926AD68.1020202@redhat.com> Daniel P. Berrange wrote: > http://ovirt.org/page/ArchDiagrams Excellent, thanks Dan for doing this! > I'm attaching a tar.gz with the original XFig sources, so if people have > improvements to make they can fix them up directly. Perhaps we should > put them in source control somewhere ? yes, I guess most logical place is ovirt-docs.git, just open a subfolder e.g. Developers_Guide where we could collect other design details, when they become stable enough, that we currently have in wiki and list archive. This won't be included in docs rpm for now, but our docs people might use that eventually for other Guides. From bkearney at redhat.com Fri Nov 21 12:54:33 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Fri, 21 Nov 2008 07:54:33 -0500 Subject: [Ovirt-devel] [PATCH node-image] Add minimal python into the Node In-Reply-To: <1227246750-22792-1-git-send-email-pmyers@redhat.com> References: <1227246750-22792-1-git-send-email-pmyers@redhat.com> Message-ID: <4926AF89.1060100@redhat.com> Perry Myers wrote: > core python libs and interpreter are added to facilitate scripting > Node size increases by approx 4MB compressed > > This patch removes all of the .py files installed by python RPM > since the .pyc and .pyo files are already present and the source > shouldn't be strictly needed. > > Signed-off-by: Perry Myers > --- > common-blacklist.ks | 9 ++++++--- > 1 files changed, 6 insertions(+), 3 deletions(-) > > diff --git a/common-blacklist.ks b/common-blacklist.ks > index 3c89236..2f2c950 100644 > --- a/common-blacklist.ks > +++ b/common-blacklist.ks > @@ -11,9 +11,9 @@ echo "Removing excess RPMs" > # However, this is just an install-time dependency; we can remove > # it afterwards, which we do here > RPMS="system-config-firewall-tui system-config-network-tui rhpl \ > - rpm-python dbus-python kudzu newt-python newt" > + rpm-python dbus-python kudzu newt-python newt libsemanage-python" > > -RPMS="$RPMS kpartx mkinitrd isomd5sum dmraid python python-libs checkpolicy" > +RPMS="$RPMS kpartx mkinitrd isomd5sum dmraid checkpolicy" > > # Remove additional RPMs forcefully > RPMS="$RPMS gamin pm-utils kbd usermode vbetool ConsoleKit hdparm \ > @@ -91,7 +91,7 @@ blacklist="/boot /etc/alsa /etc/pki /usr/share/hwdata/MonitorsDB \ > /usr/share/tc /usr/share/emacs /usr/share/info /usr/kerberos \ > /usr/src /usr/etc /usr/games /usr/include /usr/local \ > /usr/sbin/{dell*,sasldblistusers2,build-locale-archive,glibc_post_upgrade.*}" > -blacklist_lib="/usr/lib{,64}/python2.5 /usr/lib{,64}/gconv \ > +blacklist_lib="/usr/lib{,64}/gconv \ > /usr/{,lib64}/tc /usr/lib{,64}/tls /usr/lib{,64}/sse2 \ > /usr/lib{,64}/pkgconfig /usr/lib{,64}/nss /usr/lib{,64}/X11 \ > /usr/lib{,64}/games /usr/lib{,64}/alsa-lib /usr/lib{,64}/fs/reiserfs \ > @@ -119,6 +119,9 @@ find /usr/share -type d -exec rmdir {} \; > /dev/null 2>&1 > echo "Cleanup excess selinux modules" > $RM /usr/share/selinux > > +echo "Removing python source files" > +find / -name *.py -exec rm -f {} \; > + > echo "Running image-minimizer..." > %end > Does this mean the startup stuff can use python? -- bk From dpierce at redhat.com Fri Nov 21 13:31:30 2008 From: dpierce at redhat.com (Darryl Pierce) Date: Fri, 21 Nov 2008 08:31:30 -0500 Subject: [Ovirt-devel] Re: [PATCH node] Enabled automated network configuration via kernel arguments. In-Reply-To: <4925EBE2.1010608@redhat.com> References: <1227201011-19627-1-git-send-email-dpierce@redhat.com> <4925EBE2.1010608@redhat.com> Message-ID: <4926B832.9040404@redhat.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Alan Pevec wrote: >> + local BR_CONFIG_BASE=BR_CONFIG > > this should prolly be local BR_CONFIG_BASE=$BR_CONFIG > >> + N|n) BR_CONFIG=BR_CONFIG_BASE ;; > > this should prolly be N|n) BR_CONFIG=$BR_CONFIG_BASE ;; > > with this, ACK finally! :) Fixed and pushed. Phew. :) - -- Darryl L. Pierce : GPG KEYID: 6C4E7F1B -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAkkmuC4ACgkQjaT4DmxOfxsG8wCgxEorv4iz1sNJf/Td2yFozIcQ K1kAmwXMjQSu5+0gcuYqnGX1095Tqhxq =RG9c -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: dpierce.vcf Type: text/x-vcard Size: 333 bytes Desc: not available URL: From apevec at redhat.com Fri Nov 21 13:43:38 2008 From: apevec at redhat.com (Alan Pevec) Date: Fri, 21 Nov 2008 14:43:38 +0100 Subject: [Ovirt-devel] Re: [PATCH node-image] Add minimal python into the Node In-Reply-To: <4926AF89.1060100@redhat.com> References: <1227246750-22792-1-git-send-email-pmyers@redhat.com> <4926AF89.1060100@redhat.com> Message-ID: <4926BB0A.9010702@redhat.com> Bryan Kearney wrote: > Does this mean the startup stuff can use python? yes, but not right now for this release. Also this patch needs to be tested, so please try it out. From pmyers at redhat.com Fri Nov 21 13:54:17 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 21 Nov 2008 08:54:17 -0500 Subject: [Ovirt-devel] Re: [PATCH node-image] Use minimal selinux configuration and add modules selectively In-Reply-To: <4926AA3C.708@redhat.com> References: <1227231577-21257-1-git-send-email-pmyers@redhat.com> <4926AA3C.708@redhat.com> Message-ID: <4926BD89.9020609@redhat.com> Alan Pevec wrote: >> -selinux-policy-targeted >> +selinux-policy-minimum > > -minimum subpkg doesn't exist for F9. What are the chances to get this > in f9-updates > or should be we just switch to F10 completely for the Node image? > I'll check how does building with F10 repos on F9 build host work. > I think we should switch to F10 completely. But if we must support F9 for a short term, can't we just provide selinux-policy-minimum in the ovirt.org repo until everyone is converted to F10? Perry -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=| From mmorsi at redhat.com Fri Nov 21 17:12:46 2008 From: mmorsi at redhat.com (Mohammed Morsi) Date: Fri, 21 Nov 2008 12:12:46 -0500 Subject: [Ovirt-devel] FWD: Additional Interface Tests Message-ID: <4926EC0E.1090207@redhat.com> Forwarding the new selenium interface test cases I recieved from jdong to the list for additional review. -Mo -------------- next part -------------- A non-text attachment was scrubbed... Name: managing_storage_servers.rb Type: application/x-ruby Size: 9211 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: managing_storage_servers_smartpool.rb Type: application/x-ruby Size: 4498 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: working_with_hardware_pools.rb Type: application/x-ruby Size: 8620 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Working_with_smartpool.rb Type: application/x-ruby Size: 4389 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: working_with_virtual_machines.rb Type: application/x-ruby Size: 2511 bytes Desc: not available URL: From apevec at redhat.com Fri Nov 21 17:38:44 2008 From: apevec at redhat.com (Alan Pevec) Date: Fri, 21 Nov 2008 18:38:44 +0100 Subject: [Ovirt-devel] Re: [PATCH node-image] Added subpackage for srpms, ovirt-node-image-srpms In-Reply-To: <1227220289-9800-1-git-send-email-dhuff@redhat.com> References: <1227220289-9800-1-git-send-email-dhuff@redhat.com> Message-ID: <4926F224.8080006@redhat.com> > +RPM_FLAGS += --define "pungi_srpms 1" we don't need to have that enabled by default, only for release builds so make it conditional on _ovirt_dev (like extra_release two lines above) From pmyers at redhat.com Fri Nov 21 18:03:02 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 21 Nov 2008 13:03:02 -0500 Subject: [Ovirt-devel] [PATCH node-image] Change to build RPM w/ supplied ISO, but SRPM w/o ISO Message-ID: <1227290582-28724-1-git-send-email-pmyers@redhat.com> This way we don't distribute the SRPM w/ the ISO embedded in it, only the RPM contains that. Signed-off-by: Perry Myers --- Makefile.am | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 61f826f..b5d732d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -60,11 +60,10 @@ _ovirt_dev = \ $(srcdir)/*.spec.in && echo 1 || :) git_head = $$(git log -1 --pretty=format:%h) -GIT_RELEASE = $$(date --utc +%Y%m%d%H%M%S)git$(git_head) +GIT_RELEASE = $(shell date --utc +%Y%m%d%H%M%S)git$(git_head) RPMDIR = $$(rpm --eval '%{_rpmdir}') RPM_FLAGS = --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)" RPM_FLAGS += $(if $(_ovirt_dev),--define "extra_release .$(GIT_RELEASE)") -RPM_FLAGS += --define "source_iso 1" repos.ks: ( \ @@ -126,7 +125,8 @@ $(NVR).$(PKG_FMT).$(SUM): $(NVR).$(PKG_FMT) $(PACKAGE).$(PKG_FMT) node: $(NVR).$(PKG_FMT).$(SUM) rpms: dist node - rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz + rpmbuild $(RPM_FLAGS) --define "source_iso 1" -ta $(distdir).tar.gz + rpmbuild $(RPM_FLAGS) -ts $(distdir).tar.gz publish: rpms mkdir -p $(OVIRT_CACHE_DIR) -- 1.6.0.3 From imain at redhat.com Fri Nov 21 21:41:41 2008 From: imain at redhat.com (Ian Main) Date: Fri, 21 Nov 2008 13:41:41 -0800 Subject: [Ovirt-devel] [PATCH recipe] Switched console tty0 and ttyS0 so that serial console works properly in F10 In-Reply-To: <1227223321-20319-1-git-send-email-pmyers@redhat.com> References: <1227223321-20319-1-git-send-email-pmyers@redhat.com> Message-ID: <20081121134141.7a3a44c2@tp.mains.net> I haven't tried this on f10 yet, but I know on f9 it won't work. The last console becomes /dev/console so on machines with no serial port it'll bail on boot. There's a slight possibility that it got changed in f10 but I don't have an f10 machine yet to test with. I'll try to remedy that shortly however. Also I would think that you could try disabling the serial ports in the bios to test this. I'll try to test this afternoon.. sounds like Alan is getting patches in place to build f10 on f9 machine. Ian On Thu, 20 Nov 2008 18:22:00 -0500 Perry Myers wrote: > Signed-off-by: Perry Myers > --- > appliances/ovirt/files/cobbler-import | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/appliances/ovirt/files/cobbler-import b/appliances/ovirt/files/cobbler-import > index bcb5497..32e6fd1 100644 > --- a/appliances/ovirt/files/cobbler-import > +++ b/appliances/ovirt/files/cobbler-import > @@ -51,7 +51,7 @@ popd > > cobbler distro add --name="oVirt-Node-$node_arch" --arch=$node_arch \ > --initrd=$node_dir/tftpboot/initrd0.img --kernel=$node_dir/tftpboot/vmlinuz0 \ > - --kopts="rootflags=loop root=/ovirt-node-image.iso rootfstype=iso9660 ro console=ttyS0,115200n8 console=tty0" > + --kopts="rootflags=loop root=/ovirt-node-image.iso rootfstype=iso9660 ro console=tty0 console=ttyS0,115200n8" > > cobbler profile add --name=oVirt-Node-$node_arch --distro=oVirt-Node-$node_arch > cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$node_arch \ > -- > 1.6.0.3 > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel From imain at redhat.com Fri Nov 21 22:16:50 2008 From: imain at redhat.com (Ian Main) Date: Fri, 21 Nov 2008 14:16:50 -0800 Subject: [Ovirt-devel] [PATCH server] Replace host-status with db-omatic. Message-ID: <1227305810-18829-1-git-send-email-imain@redhat.com> This patch replaces host-status with db-omatic (formerly qpid-db-sync). This uses the qpid console to recieve events from libvirt-qpid on various nodes and update state in the database directly. It also uses heartbeating from the libvirt-qpid agents so it knows when a host or agent dies. Signed-off-by: Ian Main --- conf/ovirt-db-omatic | 53 +++++++ conf/ovirt-host-status | 53 ------- ovirt-server.spec.in | 12 +- scripts/ovirt-server-install | 2 +- src/db-omatic/db_omatic.rb | 316 ++++++++++++++++++++++++++++++++++++++++ src/host-status/host-status.rb | 240 ------------------------------ 6 files changed, 376 insertions(+), 300 deletions(-) create mode 100755 conf/ovirt-db-omatic delete mode 100755 conf/ovirt-host-status create mode 100755 src/db-omatic/db_omatic.rb delete mode 100755 src/host-status/host-status.rb diff --git a/conf/ovirt-db-omatic b/conf/ovirt-db-omatic new file mode 100755 index 0000000..f8337e0 --- /dev/null +++ b/conf/ovirt-db-omatic @@ -0,0 +1,53 @@ +#!/bin/bash +# +# +# ovirt-db-omatic startup script for ovirt-db-omatic +# +# chkconfig: - 97 03 +# description: ovirt-db-omatic is an essential component of the \ +# ovirt VM manager. +# + +[ -r /etc/sysconfig/ovirt-rails ] && . /etc/sysconfig/ovirt-rails + +export RAILS_ENV="${RAILS_ENV:-production}" + +DAEMON=/usr/share/ovirt-server/db-omatic/db_omatic.rb + +. /etc/init.d/functions + +start() { + echo -n "Starting ovirt-db-omatic: " + daemon $DAEMON + RETVAL=$? + echo +} + +stop() { + echo -n "Shutting down ovirt-db-omatic: " + killproc db_omatic.rb + RETVAL=$? + echo +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + status) + status $DAEMON + RETVAL=$? + ;; + *) + echo "Usage: ovirt-db-omatic {start|stop|restart|status}" + exit 1 + ;; +esac +exit $RETVAL diff --git a/conf/ovirt-host-status b/conf/ovirt-host-status deleted file mode 100755 index 0b43552..0000000 --- a/conf/ovirt-host-status +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# -# -# ovirt-host-status startup script for ovirt-host-status -# -# chkconfig: - 97 03 -# description: ovirt-host-status is an essential component of the \ -# ovirt VM manager. -# - -[ -r /etc/sysconfig/ovirt-rails ] && . /etc/sysconfig/ovirt-rails - -export RAILS_ENV="${RAILS_ENV:-production}" - -DAEMON=/usr/share/ovirt-server/host-status/host-status.rb - -. /etc/init.d/functions - -start() { - echo -n "Starting ovirt-host-status: " - daemon $DAEMON - RETVAL=$? - echo -} - -stop() { - echo -n "Shutting down ovirt-host-status: " - killproc host-status.rb - RETVAL=$? - echo -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - status) - status $DAEMON - RETVAL=$? - ;; - *) - echo "Usage: ovirt-host-status {start|stop|restart|status}" - exit 1 - ;; -esac -exit $RETVAL diff --git a/ovirt-server.spec.in b/ovirt-server.spec.in index d9e3f78..be24fbf 100644 --- a/ovirt-server.spec.in +++ b/ovirt-server.spec.in @@ -73,11 +73,11 @@ mkdir %{buildroot} touch %{buildroot}%{_localstatedir}/log/%{name}/mongrel.log touch %{buildroot}%{_localstatedir}/log/%{name}/rails.log touch %{buildroot}%{_localstatedir}/log/%{name}/taskomatic.log -touch %{buildroot}%{_localstatedir}/log/%{name}/host-status.log +touch %{buildroot}%{_localstatedir}/log/%{name}/db-omatic.log %{__install} -p -m0644 %{pbuild}/conf/%{name}.conf %{buildroot}%{_sysconfdir}/httpd/conf.d %{__install} -Dp -m0755 %{pbuild}/conf/ovirt-host-browser %{buildroot}%{_initrddir} -%{__install} -Dp -m0755 %{pbuild}/conf/ovirt-host-status %{buildroot}%{_initrddir} +%{__install} -Dp -m0755 %{pbuild}/conf/ovirt-db-omatic %{buildroot}%{_initrddir} %{__install} -Dp -m0755 %{pbuild}/conf/ovirt-host-collect %{buildroot}%{_initrddir} %{__install} -Dp -m0755 %{pbuild}/conf/ovirt-mongrel-rails %{buildroot}%{_initrddir} %{__install} -Dp -m0755 %{pbuild}/conf/ovirt-mongrel-rails.sysconf %{buildroot}%{_sysconfdir}/sysconfig/ovirt-mongrel-rails @@ -147,7 +147,7 @@ fi # on; otherwise, we respect the choices the administrator already has made. # check this by seeing if each daemon is already installed %daemon_chkconfig_post -d ovirt-host-browser -%daemon_chkconfig_post -d ovirt-host-status +%daemon_chkconfig_post -d ovirt-db-omatic %daemon_chkconfig_post -d ovirt-host-collect %daemon_chkconfig_post -d ovirt-mongrel-rails %daemon_chkconfig_post -d ovirt-taskomatic @@ -160,12 +160,12 @@ docs_dir=$(rpm -q --queryformat '/usr/share/%{NAME}' ovirt-docs) %preun if [ "$1" = 0 ] ; then /sbin/service ovirt-host-browser stop > /dev/null 2>&1 - /sbin/service ovirt-host-status stop > /dev/null 2>&1 + /sbin/service ovirt-db-omatic stop > /dev/null 2>&1 /sbin/service ovirt-host-collect stop > /dev/null 2>&1 /sbin/service ovirt-mongrel-rails stop > /dev/null 2>&1 /sbin/service ovirt-taskomatic stop > /dev/null 2>&1 /sbin/chkconfig --del ovirt-host-browser - /sbin/chkconfig --del ovirt-host-status + /sbin/chkconfig --del ovirt-db-omatic /sbin/chkconfig --del ovirt-host-collect /sbin/chkconfig --del ovirt-mongrel-rails /sbin/chkconfig --del ovirt-taskomatic @@ -178,7 +178,7 @@ fi %{_sbindir}/ovirt-update-search %{_bindir}/ovirt-add-host %{_initrddir}/ovirt-host-browser -%{_initrddir}/ovirt-host-status +%{_initrddir}/ovirt-db-omatic %{_initrddir}/ovirt-host-collect %{_initrddir}/ovirt-mongrel-rails %{_initrddir}/ovirt-taskomatic diff --git a/scripts/ovirt-server-install b/scripts/ovirt-server-install index afa2a64..5eb1afe 100755 --- a/scripts/ovirt-server-install +++ b/scripts/ovirt-server-install @@ -20,7 +20,7 @@ STEP_FILE=/etc/ntp/step-tickers SASL_FILE=/etc/sasl2/libvirt.conf LDAP_CFG=${OVIRT_DIR}/config/ldap.yml -OVIRT_SVCS="ovirt-host-browser ovirt-host-keyadd ovirt-host-status \ +OVIRT_SVCS="ovirt-host-browser ovirt-host-keyadd ovirt-db-omatic \ ovirt-host-collect ovirt-mongrel-rails ovirt-taskomatic" ENABLE_SVCS="ntpdate ntpd httpd postgresql libvirtd collectd" diff --git a/src/db-omatic/db_omatic.rb b/src/db-omatic/db_omatic.rb new file mode 100755 index 0000000..d93e935 --- /dev/null +++ b/src/db-omatic/db_omatic.rb @@ -0,0 +1,316 @@ +#!/usr/bin/ruby + +$: << File.join(File.dirname(__FILE__), "../dutils") + +require "rubygems" +require "qpid" +require 'monitor' +require 'dutils' +require 'daemons' +require 'optparse' +include Daemonize + + +class DbOmatic < Qpid::Qmf::Console + + # Use monitor mixin for mutual exclusion around checks to heartbeats + # and updates to objects/heartbeats. + + include MonitorMixin + + def initialize() + super() + @cached_objects = {} + @heartbeats = {} + + database_connect + end + + def update_domain_state(domain, state_override = nil) + vm = Vm.find(:first, :conditions => [ "uuid = ?", domain['uuid'] ]) + if vm == nil + puts "VM Not found in database, must be created by user. giving up." + next + end + + if state_override != nil + state = state_override + else + # FIXME: Some of these translations don't seem right. Shouldn't we be using + # the libvirt states throughout ovirt? + case domain['state'] + when "nostate" + state = Vm::STATE_PENDING + when "running" + state = Vm::STATE_RUNNING + when "blocked" + state = Vm::STATE_SUSPENDED #? + when "paused" + state = Vm::STATE_SUSPENDED + when "shutdown" + state = Vm::STATE_STOPPED + when "shutoff" + state = Vm::STATE_STOPPED + when "crashed" + state = Vm::STATE_STOPPED + else + state = Vm::STATE_PENDING + end + end + + puts "Updating VM #{domain['name']} to state #{state}" + vm.state = state + vm.save + end + + def update_host_state(host_info, state) + db_host = Host.find(:first, :conditions => [ "hostname = ?", host_info['hostname'] ]) + if db_host + puts "Marking host #{host_info['hostname']} as state #{state}." + db_host.state = state + db_host.hypervisor_type = host_info['hypervisorType'] + db_host.arch = host_info['model'] + db_host.memory = host_info['memory'] + # XXX: Could be added.. + #db_host.mhz = host_info['mhz'] + # XXX: Not even sure what this is.. :) + #db_host.lock_version = 2 + # XXX: This would just be for init.. + #db_host.is_disabled = 0 + db_host.save + else + # FIXME: This would be a newly registered host. We could put it in the database. + puts "Unknown host, probably not registered yet??" + end + end + + def object_props(broker, obj) + target = obj.klass_key[0] + return if target != "com.redhat.libvirt" + + type = obj.klass_key[1] + + # I just sync this whole thing because there shouldn't be a lot of contention here.. + synchronize do + values = @cached_objects[obj.object_id.to_s] + + new_object = false + + if values == nil + values = {} + @cached_objects[obj.object_id.to_s] = values + + # Save the agent and broker bank so that we can tell what objects + # are expired when the heartbeat for them stops. + values[:broker_bank] = obj.object_id.broker_bank + values[:agent_bank] = obj.object_id.agent_bank + values[:class_type] = obj.klass_key[1] + values[:timed_out] = false + puts "New object type #{type}" + + new_object = true + end + + domain_state_change = false + + obj.properties.each do |key, newval| + if values[key.to_s] != newval + values[key.to_s] = newval + #puts "new value for property #{key} : #{newval}" + if type == "domain" and key.to_s == "state" + domain_state_change = true + end + end + end + + if domain_state_change + update_domain_state(values) + end + + if new_object + if type == "node" + update_host_state(values, Host::STATE_AVAILABLE) + end + end + end + end + + def object_stats(broker, obj) + target = obj.klass_key[0] + return if target != "com.redhat.libvirt" + type = obj.klass_key[1] + + synchronize do + values = @cached_objects[obj.object_id.to_s] + if !values + values = {} + @cached_objects[obj.object_id.to_s] = values + + values[:broker_bank] = obj.object_id.broker_bank + values[:agent_bank] = obj.object_id.agent_bank + values[:class_type] = obj.klass_key[1] + values[:timed_out] = false + end + obj.statistics.each do |key, newval| + if values[key.to_s] != newval + values[key.to_s] = newval + #puts "new value for statistic #{key} : #{newval}" + end + end + end + end + + def heartbeat(agent, timestamp) + return if agent == nil + synchronize do + bank_key = "#{agent.agent_bank}.#{agent.broker.broker_bank}" + @heartbeats[bank_key] = [agent, timestamp] + end + end + + + def del_agent(agent) + agent_disconnected(agent) + end + + # This method marks objects associated with the given agent as timed out/invalid. Called either + # when the agent heartbeats out, or we get a del_agent callback. + def agent_disconnected(agent) + @cached_objects.keys.each do |objkey| + if @cached_objects[objkey][:broker_bank] == agent.broker.broker_bank and + @cached_objects[objkey][:agent_bank] == agent.agent_bank + + values = @cached_objects[objkey] + puts "Marking object of type #{values[:class_type]} as timed out." + if values[:timed_out] == false + if values[:class_type] == 'node' + update_host_state(values, Host::STATE_UNAVAILABLE) + elsif values[:class_type] == 'domain' + update_domain_state(values, Vm::STATE_UNREACHABLE) + end + end + values[:timed_out] = true + end + end + end + + # The opposite of above, this is called when an agent is alive and well and makes sure + # all of the objects associated with it are marked as valid. + def agent_connected(agent) + + @cached_objects.keys.each do |objkey| + if @cached_objects[objkey][:broker_bank] == agent.broker.broker_bank and + @cached_objects[objkey][:agent_bank] == agent.agent_bank + + values = @cached_objects[objkey] + if values[:timed_out] == true + puts "Marking object of type #{values[:class_type]} as in service." + if values[:class_type] == 'node' + update_host_state(values, Host::STATE_AVAILABLE) + elsif values[:class_type] == 'domain' + update_domain_state(values) + end + values[:timed_out] = false + end + end + end + end + + # This cleans up the database on startup so that everything is marked unavailable etc. + # Once everything comes online it will all be marked as available/up again. + def db_init_cleanup() + db_host = Host.find(:all) + db_host.each do |host| + puts "Marking host #{host.hostname} unavailable" + host.state = Host::STATE_UNAVAILABLE + host.save + end + + db_vm = Vm.find(:all) + db_vm.each do |vm| + puts "Marking vm #{vm.description} as stopped." + vm.state = Vm::STATE_STOPPED + vm.save + end + end + + + # This is the mainloop that is called into as a separate thread. This just loops through + # and makes sure all the agents are still reporting. If they aren't they get marked as + # down. + def check_heartbeats() + while true + sleep(5) + + synchronize do + # Get seconds from the epoch + t = Time.new.to_i + + @heartbeats.keys.each do | key | + agent, timestamp = @heartbeats[key] + + # Heartbeats from qpid are in microseconds, we just need seconds.. + s = timestamp / 1000000000 + delta = t - s + + if delta > 30 + # No heartbeat for 30 seconds.. deal with dead/disconnected agent. + agent_disconnected(agent) + + @heartbeats.delete(key) + else + agent_connected(agent) + end + end + end + end + end +end + + +$logfile = '/var/log/ovirt-server/qpid-db-sync.log' + +def main() + + do_daemon = true + + opts = OptionParser.new do |opts| + opts.on("-h", "--help", "Print help message") do + puts opts + exit + end + opts.on("-n", "--nodaemon", "Run interactively (useful for debugging)") do |n| + do_daemon = false + end + end + begin + opts.parse!(ARGV) + rescue OptionParser::InvalidOption + puts opts + exit + end + + if do_daemon + # XXX: This gets around a problem with paths for the database stuff. + # Normally daemonize would chdir to / but the paths for the database + # stuff are relative so it breaks it.. It's either this or rearrange + # things so the db stuff is included after daemonizing. + pwd = Dir.pwd + daemonize + Dir.chdir(pwd) + STDOUT.reopen $logfile, 'a' + STDERR.reopen STDOUT + end + + dbsync = DbOmatic.new() + s = Qpid::Qmf::Session.new(:console => dbsync, :rcv_events => false) + b = s.add_broker("amqp://localhost:5672") + + dbsync.db_init_cleanup() + + # Call into mainloop.. + dbsync.check_heartbeats() +end + +main() + diff --git a/src/host-status/host-status.rb b/src/host-status/host-status.rb deleted file mode 100755 index cd9e30f..0000000 --- a/src/host-status/host-status.rb +++ /dev/null @@ -1,240 +0,0 @@ -#!/usr/bin/ruby -# -# Copyright (C) 2008 Red Hat, Inc. -# Written by Chris Lalancette -# -# 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. - -$: << File.join(File.dirname(__FILE__), "../dutils") - -require 'rubygems' -require 'libvirt' -require 'optparse' -require 'daemons' -include Daemonize - -$logfile = '/var/log/ovirt-server/host-status.log' - -do_daemon = true -sleeptime = 20 -opts = OptionParser.new do |opts| - opts.on("-h", "--help", "Print help message") do - puts opts - exit - end - opts.on("-n", "--nodaemon", "Run interactively (useful for debugging)") do |n| - do_daemon = !n - end - opts.on("-s N", Integer, "--sleep", "Seconds to sleep between iterations (default is 5 seconds)") do |s| - sleeptime = s - end -end -begin - opts.parse!(ARGV) -rescue OptionParser::InvalidOption - puts opts - exit -end - -if do_daemon - daemonize - STDOUT.reopen $logfile, 'a' - STDERR.reopen STDOUT -end - -# connects to the db in here -require 'dutils' - -def check_state(vm, dom_info, host) - puts 'checking state of vm ' + vm.description - - case dom_info.state - - when Libvirt::Domain::NOSTATE, Libvirt::Domain::SHUTDOWN, - Libvirt::Domain::SHUTOFF, Libvirt::Domain::CRASHED then - if Vm::RUNNING_STATES.include?(vm.state) - # OK, the host thinks this VM is off, while the database thinks it - # is running; we have to kick taskomatic - kick_taskomatic(Vm::STATE_STOPPED, vm, host.id) - end - when Libvirt::Domain::RUNNING, Libvirt::Domain::BLOCKED then - if not Vm::RUNNING_STATES.include?(vm.state) - # OK, the host thinks this VM is running, but it's not marked as running - # in the database; kick taskomatic - kick_taskomatic(Vm::STATE_RUNNING, vm, host.id) - end - when Libvirt::Domain::PAUSED then - if vm.state != Vm::STATE_SUSPENDING and vm.state != Vm::STATE_SUSPENDED - kick_taskomatic(Vm::STATE_SUSPENDED, vm, host.id) - end - else - puts "Unknown vm state...skipping" - end -end - - -def kick_taskomatic(msg, vm, host_id = nil) - print "Kicking taskomatic, state is %s\n" % msg - task = VmTask.new - task.user = "host-status" - task.action = VmTask::ACTION_UPDATE_STATE_VM - task.state = Task::STATE_QUEUED - task.args = host_id ? [msg,host_id].join(',') : msg - task.created_at = Time.now - task.time_started = Time.now - task.task_target = vm - task.save -end - - -def check_status(host) - - # This is in a new process, we need a new database connection. - database_connect - - begin - puts "Connecting to host " + host.hostname - conn = Libvirt::open("qemu+tcp://" + host.hostname + "/system") - rescue - # we couldn't contact the host for whatever reason. Since we can't get - # to this host, we have to mark all vms on it as disconnected or stopped - # or such. - if host.state != Host::STATE_UNAVAILABLE - puts "Updating host state to unavailable: " + host.hostname - host.state = Host::STATE_UNAVAILABLE - host.save - end - - Vm.find(:all, :conditions => [ "host_id = ?", host.id ]).each do |vm| - # Since we can't reach the host on which the vms reside, we mark these - # as STATE_UNREACHABLE. If they come back up we can mark them as - # running again, else they'll be stopped. At least for now the user - # will know what's going on. - # - # If this causes too much trouble in the UI, this can be changed to - # STATE_STOPPED for now until it is resolved of another solution is - # brought forward. - - if vm.state != Vm::STATE_UNREACHABLE: - kick_taskomatic(Vm::STATE_UNREACHABLE, vm) - end - - end - - return - end - - if host.state != Host::STATE_AVAILABLE - puts "Updating host state to available: " + host.hostname - host.state = Host::STATE_AVAILABLE - host.save - end - - begin - vm_ids = conn.list_domains - rescue - puts "Failed to request domain list on host " + host.hostname - conn.close - return - end - - puts "** Host alive, checking vms by id **" - # Here we're going through every vm listed through libvirt. This - # really only lets us find ones that are started that shouldn't be. - vm_ids.each do |vm_id| - puts "VM ID: %d" % [vm_id] - begin - dom = conn.lookup_domain_by_id(vm_id) - rescue - puts "Failed to find domain " + vm.description + " with vm_id ", vm_id - next - end - - vm_uuid = dom.uuid - info = dom.info - - puts "VM UUID: %s" % [vm_uuid] - info = dom.info - - vm = Vm.find(:first, :conditions => [ "uuid = ?", vm_uuid ]) - if vm == nil - puts "VM Not found in database, must be created by user. giving up." - next - end - - check_state(vm, info, host) - end - - puts "** Checking all vms as appear in the database **" - # Now we get a list of all vms that should be on this system and see if - # they are all running. - Vm.find(:all, :conditions => [ "host_id = ?", host.id ]).each do |vm| - - begin - puts "Looking up domain by uuid #{vm.uuid}" - dom = conn.lookup_domain_by_uuid(vm.uuid) - rescue - # OK. We couldn't find the UUID that we thought was there. The only - # explanation is that the domain is dead. - puts "Failed to find domain " + vm.description + ", marking as dead" - kick_taskomatic(Vm::STATE_STOPPED, vm) - next - end - info = dom.info - check_state(vm, info, host) - end - - conn.close -end - -get_credentials - -loop do - - # fork() seems to really mess with our db connection. Need to have this - # in the main connection as well. I verified it's not leaking connections/fds. - database_connect - hosts = Host.find(:all) - - p_count = 0 - hosts.each do |host| - - p_count += 1 - - fork do - check_status(host) - exit 0 - end - - # Only allow up to n_hosts / 5 processes running at a time. If we go above this - # Then we wait for one to exit before continuing. This guarantees it will take - # at most 5 timeouts to check all hosts. - if p_count > hosts.length / 5 - Process.wait - p_count -= 1 - end - - end - - while p_count > 0 - Process.wait - p_count -= 1 - end - - - STDOUT.flush - sleep sleeptime -end -- 1.5.6.5 From pmyers at redhat.com Fri Nov 21 23:29:17 2008 From: pmyers at redhat.com (Perry Myers) Date: Fri, 21 Nov 2008 18:29:17 -0500 Subject: [Ovirt-devel] [PATCH recipe] Switched console tty0 and ttyS0 so that serial console works properly in F10 In-Reply-To: <20081121134141.7a3a44c2@tp.mains.net> References: <1227223321-20319-1-git-send-email-pmyers@redhat.com> <20081121134141.7a3a44c2@tp.mains.net> Message-ID: <4927444D.1010001@redhat.com> Ian Main wrote: > I haven't tried this on f10 yet, but I know on f9 it won't work. The > last console becomes /dev/console so on machines with no serial port > it'll bail on boot. There's a slight possibility that it got changed > in f10 but I don't have an f10 machine yet to test with. I'll try to > remedy that shortly however. Also I would think that you could try > disabling the serial ports in the bios to test this. > > I'll try to test this afternoon.. sounds like Alan is getting patches > in place to build f10 on f9 machine. I should have put a note in the commit msg... I did try this on F10 and it works fine on a machine with no serial port. Tested by creating a fake node with no serial ports on it and seemed to work. So I think perhaps w/ F10 this may be ok. After you build an F10 node via Alan's scripts give it a shot. Perry From apevec at redhat.com Fri Nov 21 23:49:09 2008 From: apevec at redhat.com (Alan Pevec) Date: Sat, 22 Nov 2008 00:49:09 +0100 Subject: [Ovirt-devel] Re: [PATCH recipe] Switched console tty0 and ttyS0 so that serial console works properly in F10 In-Reply-To: <4927444D.1010001@redhat.com> References: <1227223321-20319-1-git-send-email-pmyers@redhat.com> <20081121134141.7a3a44c2@tp.mains.net> <4927444D.1010001@redhat.com> Message-ID: <492748F5.4080603@redhat.com> Perry Myers wrote: > Ian Main wrote: >> I haven't tried this on f10 yet, but I know on f9 it won't work. The >> last console becomes /dev/console so on machines with no serial port >> it'll bail on boot. There's a slight possibility that it got changed >> in f10 but I don't have an f10 machine yet to test with. I'll try to >> remedy that shortly however. Also I would think that you could try >> disabling the serial ports in the bios to test this. >> >> I'll try to test this afternoon.. sounds like Alan is getting patches >> in place to build f10 on f9 machine. > > I should have put a note in the commit msg... I did try this on F10 and > it works fine on a machine with no serial port. Tested by creating a > fake node with no serial ports on it and seemed to work. > > So I think perhaps w/ F10 this may be ok. > > After you build an F10 node via Alan's scripts give it a shot. so it turns out building F10 image on F9 host won't work b/c of selinux differences, semodule install fails in chroot b/c it expects something not present in active selinux policy and there can be only one active... Disabling selinux in ks produces bootable F10 image, but then I hit weird problem: in standalone config setup selection doesn't accept Enter... Anyone seen that with F10-on-F10 builds? From apevec at redhat.com Sat Nov 22 00:31:15 2008 From: apevec at redhat.com (Alan Pevec) Date: Sat, 22 Nov 2008 01:31:15 +0100 Subject: [Ovirt-devel] Re: [PATCH node-image] Use minimal selinux configuration and add modules selectively In-Reply-To: <4926BD89.9020609@redhat.com> References: <1227231577-21257-1-git-send-email-pmyers@redhat.com> <4926AA3C.708@redhat.com> <4926BD89.9020609@redhat.com> Message-ID: <492752D3.3050203@redhat.com> Perry Myers wrote: > Alan Pevec wrote: >>> -selinux-policy-targeted >>> +selinux-policy-minimum >> >> -minimum subpkg doesn't exist for F9. What are the chances to get this >> in f9-updates >> or should be we just switch to F10 completely for the Node image? >> I'll check how does building with F10 repos on F9 build host work. >> > > I think we should switch to F10 completely. But if we must support F9 > for a short term, can't we just provide selinux-policy-minimum in the > ovirt.org repo until everyone is converted to F10? It turns out that's the only way to still support F9 in transition period - backport doesn't look that bad, it's simple addition in the .spec file, building it now. If it looks ok, I'll put it on ovirt.org From clalance at redhat.com Sun Nov 23 13:48:13 2008 From: clalance at redhat.com (Chris Lalancette) Date: Sun, 23 Nov 2008 14:48:13 +0100 Subject: [Ovirt-devel] Problems with db:migrate Message-ID: <49295F1D.8030709@redhat.com> All, I don't have time (nor do I have the knowledge) to track this down, but I thought I would send mail to the list so I remember, and someone can look at this. As far as I can tell, doing: # cd /usr/share/ovirt-server ; rake db:migrate doesn't work anymore (this is on a freshly built appliance as of today). When I first try it, I get an error saying that the database ovirt_development doesn't exist. Odd, but OK, I created the ovirt_development database by hand. Once that is done, the above command does succeed, but it doesn't migrate the production database; it only migrates the ovirt_development database, which, of course, is no good. If someone could look into this, I would appreciate it; my standard workflow involves migrating older databases to newer ones, so this has caused me some problems. -- Chris Lalancette From apevec at redhat.com Sun Nov 23 21:23:15 2008 From: apevec at redhat.com (Alan Pevec) Date: Sun, 23 Nov 2008 22:23:15 +0100 Subject: [Ovirt-devel] Re: Problems with db:migrate In-Reply-To: <49295F1D.8030709@redhat.com> References: <49295F1D.8030709@redhat.com> Message-ID: <4929C9C3.8070806@redhat.com> Chris Lalancette wrote: > # cd /usr/share/ovirt-server ; rake db:migrate > doesn't work anymore (this is on a freshly built appliance as of today). When I > first try it, I get an error saying that the database ovirt_development doesn't > exist. Odd, but OK, I created the ovirt_development database by hand. Once default was changed to development, if you want to use production, set rails env: RAILS_ENV=production rake db:migrate From ccurran at redhat.com Mon Nov 24 03:01:53 2008 From: ccurran at redhat.com (Christopher Curran) Date: Mon, 24 Nov 2008 13:01:53 +1000 Subject: [Ovirt-devel] Some architecture diagrams In-Reply-To: <20081121111708.GJ15131@redhat.com> References: <20081121111708.GJ15131@redhat.com> Message-ID: <492A1921.2060200@redhat.com> Daniel P. Berrange wrote: > There's a number of high level architecture diagrams on the website > giving an overview of what's going on, but since they're aimed at > people getting to know the project they're not very detailed. I felt > I wanted some additional more technically detailed/ focused diagrams > to illustrate what we're doing to developers actually writing code > for the project. And so by the power of XFig > > http://ovirt.org/page/ArchDiagrams > > I'm attaching a tar.gz with the original XFig sources, so if people have > improvements to make they can fix them up directly. Perhaps we should > put them in source control somewhere ? > > Daniel > > ------------------------------------------------------------------------ > > _______________________________________________ > > Thanks Daniel, these diagrams are very useful and will be incorporated into the oVirt Node Deployment Guide. I will get the diagrams converted into SVG for some vector graphics glory too. Diagrams like this are very useful for troubleshooting and explaining the workings of the program to users as well as developers. Thanks once again, this fills one of my requests exactly (whether you were aware of it or not). Chris From apevec at redhat.com Mon Nov 24 09:39:55 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 24 Nov 2008 10:39:55 +0100 Subject: [Ovirt-devel] Re: [PATCH node] Add selinux policy .pp file to minimum selinux type In-Reply-To: <1227244943-22510-2-git-send-email-pmyers@redhat.com> References: <1227244943-22510-1-git-send-email-pmyers@redhat.com> <1227244943-22510-2-git-send-email-pmyers@redhat.com> Message-ID: <492A766B.8060708@redhat.com> Perry Myers wrote: > +++ b/ovirt-node.spec.in > +%define selinux_variants mls strict targeted minimum ack and pushed ( now that I've uploaded selinux-policy-minimum for F9 to ovirt.org yum repo) From apevec at redhat.com Mon Nov 24 10:00:28 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 24 Nov 2008 11:00:28 +0100 Subject: [Ovirt-devel] Re: [PATCH REPOST node-image] Use minimal selinux configuration and add modules selectively In-Reply-To: <1227244943-22510-1-git-send-email-pmyers@redhat.com> References: <1227244943-22510-1-git-send-email-pmyers@redhat.com> Message-ID: <492A7B3C.7030409@redhat.com> Perry Myers wrote: ack - I'll push with one changes: > +for semodule in $SEMODULES; do > + if [ -f /usr/share/selinux/minimum/$semodule.pp.bz2 ]; then > + mv /usr/share/selinux/minimum/$semodule.pp.bz2 $tmpdir > + bunzip2 $tmpdir/$semodule.pp.bz2 > + else elif [ -f /usr/share/selinux/minimum/$semodule.pp ]; then to skip modules not present in F9 > + mv /usr/share/selinux/minimum/$semodule.pp $tmpdir > + fi > +done From apevec at redhat.com Mon Nov 24 11:03:27 2008 From: apevec at redhat.com (Alan Pevec) Date: Mon, 24 Nov 2008 12:03:27 +0100 Subject: [Ovirt-devel] Re: [PATCH REPOST node-image] Use minimal selinux configuration and add modules selectively In-Reply-To: <1227244943-22510-1-git-send-email-pmyers@redhat.com> References: <1227244943-22510-1-git-send-email-pmyers@redhat.com> Message-ID: <492A89FF.8060303@redhat.com> one more change before pusing: > +++ b/common-pkgs.ks selinux-policy-targeted is included by @core group, need to exclude it explicitly: > -selinux-policy-targeted +-selinux-policy-targeted > +selinux-policy-minimum Otherwise, I get No space left (in instroot), first in selinux-policy-targeted %post: Installing: selinux-policy-targeted ##################### [219/224] libsemanage.semanage_make_sandbox: Could not copy files to sandbox /etc/selinux/targeted/modules/tmp. (No space left on device). /usr/sbin/semanage: Could not start semanage transaction then by rpm: rpmdb: write: 0x7f33f2875190, 4096: No space left on device rpmdb: /home/apevec/ovirt-cache/ovirt-node-image-tmp/imgcreate-Fze1gI/install_root/var/lib/rpm/Packages: write failed for page 1624 rpmdb: /home/apevec/ovirt-cache/ovirt-node-image-tmp/imgcreate-Fze1gI/install_root/var/lib/rpm/Packages: unable to flush page: 1624 error: db4 error(28) from db->sync: No space left on device livecd-creator didn't error out on that condition, afaict this error is swallowed already by yum/rpm - yum.runTransaction returned code was 0 From jguiditt at redhat.com Mon Nov 24 14:59:28 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Mon, 24 Nov 2008 09:59:28 -0500 Subject: [Ovirt-devel] [PATCH server] Add time range and data type selection to flexchart. In-Reply-To: <1227196340-9714-1-git-send-email-slinabery@redhat.com> References: <1227196340-9714-1-git-send-email-slinabery@redhat.com> Message-ID: <1227538768.4210.0.camel@physical.priv.ovirt.org> On Thu, 2008-11-20 at 09:52 -0600, Steve Linabery wrote: > Also: > -change color scheme to match tallen prototype pallette > -change SingleBar elements to dynamically resized Canvas objects instead of > HBox objects > -add new route to accept second-resolution timestamps for time range selection ACK, this works for me. From jguiditt at redhat.com Mon Nov 24 19:07:41 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Mon, 24 Nov 2008 14:07:41 -0500 Subject: [Ovirt-devel] [PATCH] refactored storage UI to allow for creating/deleting NFS volumes. In-Reply-To: <1227217357-15936-1-git-send-email-sseago@redhat.com> References: <1227217357-15936-1-git-send-email-sseago@redhat.com> Message-ID: <1227553661.4210.2.camel@physical.priv.ovirt.org> On Thu, 2008-11-20 at 21:42 +0000, Scott Seago wrote: > Storage UI tab now allows for creation of NFS volumes. The UI is similar to the LVM volume creation functionality, except it's done from the NFS pool details pane rather than from tne ISCSI volume pane. ACK, this works for me. -j From clalance at redhat.com Tue Nov 25 10:58:05 2008 From: clalance at redhat.com (Chris Lalancette) Date: Tue, 25 Nov 2008 11:58:05 +0100 Subject: [Ovirt-devel] FYI; increased the appliance / size Message-ID: <492BDA3D.3030503@redhat.com> All, Just a quick heads up that I updated the / filesystem on the ovirt-appliance from 2000MB to 5000MB. With 2000MB, it's basically impossible to develop on, since there is no room for additional packages. Kicking it up to 5000MB leaves the additional room, at a cost of 100MB in the uncompressed image size, and 1.2MB in the compressed image size. In my opinion, that's completely worth it to avoid the headaches I'm having right now to find space. -- Chris Lalancette From apevec at redhat.com Tue Nov 25 12:35:58 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 25 Nov 2008 13:35:58 +0100 Subject: [Ovirt-devel] Re: [PATCH appliance] Build appliance w/o docs In-Reply-To: <1227224506-20499-1-git-send-email-pmyers@redhat.com> References: <1227224506-20499-1-git-send-email-pmyers@redhat.com> Message-ID: <492BF12E.8000709@redhat.com> Perry Myers wrote: > This cuts the appliance images down by a few hundred MB. Compressed > w/ bz2 the appliance is approx 340MB. > > This worked for me on F10 build, but I'd like a few others to test > before I commit.x works fine on F9 ACK, pushed From apevec at redhat.com Tue Nov 25 12:39:22 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 25 Nov 2008 13:39:22 +0100 Subject: [Ovirt-devel] Re: [PATCH node-image] Change to build RPM w/ supplied ISO, but SRPM w/o ISO In-Reply-To: <1227290582-28724-1-git-send-email-pmyers@redhat.com> References: <1227290582-28724-1-git-send-email-pmyers@redhat.com> Message-ID: <492BF1FA.6010701@redhat.com> Perry Myers wrote: > This way we don't distribute the SRPM w/ the ISO embedded in it, > only the RPM contains that. ACK, pushed with a minor optimization: > + rpmbuild $(RPM_FLAGS) --define "source_iso 1" -ta $(distdir).tar.gz -ta -> -tb to build SRPM only once > + rpmbuild $(RPM_FLAGS) -ts $(distdir).tar.gz From apevec at redhat.com Tue Nov 25 13:03:43 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 25 Nov 2008 14:03:43 +0100 Subject: [Ovirt-devel] Re: [PATCH recipe] Switched console tty0 and ttyS0 so that serial console works properly in F10 In-Reply-To: <20081121134141.7a3a44c2@tp.mains.net> References: <1227223321-20319-1-git-send-email-pmyers@redhat.com> <20081121134141.7a3a44c2@tp.mains.net> Message-ID: <492BF7AF.8060002@redhat.com> Ian Main wrote: > I haven't tried this on f10 yet, but I know on f9 it won't work. The last console becomes /dev/console so on machines with no serial port it'll bail on boot. There's a slight possibility that it got changed in f10 but I don't have an f10 machine yet to test with. I'll try to remedy that shortly however. Also I would think that you could try disabling the serial ports in the bios to test this. yeah, F9 fake node with serial and console elements in libvirt XML removed and console=tty0 console=ttyS0,115200n8 boot params fails to boot: ... input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input3 Kernel panic - not synching: Attempted to kill init! From pmyers at redhat.com Tue Nov 25 14:53:29 2008 From: pmyers at redhat.com (Perry Myers) Date: Tue, 25 Nov 2008 09:53:29 -0500 Subject: [Ovirt-devel] FYI; increased the appliance / size In-Reply-To: <492BDA3D.3030503@redhat.com> References: <492BDA3D.3030503@redhat.com> Message-ID: <492C1169.1020804@redhat.com> Chris Lalancette wrote: > All, > Just a quick heads up that I updated the / filesystem on the > ovirt-appliance from 2000MB to 5000MB. With 2000MB, it's basically impossible > to develop on, since there is no room for additional packages. Kicking it up to > 5000MB leaves the additional room, at a cost of 100MB in the uncompressed image > size, and 1.2MB in the compressed image size. In my opinion, that's completely > worth it to avoid the headaches I'm having right now to find space. > That's fine by me... Btw, switching the rootfs disk (sda) to 2GB was my doing and it was for the following reason... Before the appliance-tools folks added tar/tar.bz2 support into appliance-creator they only supported zip as a packaging format. And our original thought was to use raw/zip for appliances. This was problematic since zip has a file size limit of 2GB per file. So I made the sda image as small as I could get it to fit it into those constraints. However, all of that was blown out of the water by the fact that we wanted a 20GB data disk that was easier to create during appliance-creation rather than afterwords... I just never remembered to toggle sda back to something larger. So in the end we are using qcow2/tar.bz2 as the packaging format. Perry -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=| From pmyers at redhat.com Tue Nov 25 14:55:40 2008 From: pmyers at redhat.com (Perry Myers) Date: Tue, 25 Nov 2008 09:55:40 -0500 Subject: [Ovirt-devel] Re: [PATCH recipe] Switched console tty0 and ttyS0 so that serial console works properly in F10 In-Reply-To: <492BF7AF.8060002@redhat.com> References: <1227223321-20319-1-git-send-email-pmyers@redhat.com> <20081121134141.7a3a44c2@tp.mains.net> <492BF7AF.8060002@redhat.com> Message-ID: <492C11EC.1030906@redhat.com> Alan Pevec wrote: > Ian Main wrote: >> I haven't tried this on f10 yet, but I know on f9 it won't work. The >> last console becomes /dev/console so on machines with no serial port >> it'll bail on boot. There's a slight possibility that it got changed >> in f10 but I don't have an f10 machine yet to test with. I'll try to >> remedy that shortly however. Also I would think that you could try >> disabling the serial ports in the bios to test this. > > yeah, F9 fake node with serial and console elements in libvirt XML removed > and console=tty0 console=ttyS0,115200n8 boot params fails to boot: > ... > input: ImExPS/2 Generic Explorer Mouse as > /devices/platform/i8042/serio1/input/input3 > Kernel panic - not synching: Attempted to kill init! > So this patch is ok once we completely move to F10 then, but as long as we've still got people using F9 we can't apply it. Correct? Perry -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=| From jim at meyering.net Tue Nov 25 15:06:54 2008 From: jim at meyering.net (Jim Meyering) Date: Tue, 25 Nov 2008 16:06:54 +0100 Subject: [Ovirt-devel] [PATCH node-image] common-blacklist.ks: Remove unused gnupg: it's almost 5MB uncompressed. Message-ID: <87skpf3kvl.fsf@rho.meyering.net> >From 90f1d42f7b99f8684600540624015827ca8542ed Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 21 Nov 2008 06:59:38 +0100 Subject: [PATCH node-image] common-blacklist.ks: Remove unused gnupg: it's almost 5MB uncompressed. --- common-blacklist.ks | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/common-blacklist.ks b/common-blacklist.ks index 3c89236..75c0418 100644 --- a/common-blacklist.ks +++ b/common-blacklist.ks @@ -19,7 +19,7 @@ RPMS="$RPMS kpartx mkinitrd isomd5sum dmraid python python-libs checkpolicy" RPMS="$RPMS gamin pm-utils kbd usermode vbetool ConsoleKit hdparm \ efibootmgr krb5-workstation linux-atm-libs fedora-release-notes \ slang psmisc gdbm cryptsetup-luks pciutils mtools syslinux db4 \ - wireless-tools radeontool cracklib-dicts cracklib libicu" + wireless-tools radeontool cracklib-dicts cracklib libicu gnupg" # cronie pulls in exim (sendmail) which pulls in all kinds of perl deps RPMS="$RPMS exim perl-version perl-Pod-Simple perl-libs perl-Module-Pluggable \ -- 1.6.0.4.1044.g77718 From jim at meyering.net Tue Nov 25 17:08:43 2008 From: jim at meyering.net (Jim Meyering) Date: Tue, 25 Nov 2008 18:08:43 +0100 Subject: [Ovirt-devel] [PATCH node-image] common-blacklist.ks: Remove unused gnupg: it's almost 5MB uncompressed. In-Reply-To: <87skpf3kvl.fsf@rho.meyering.net> (Jim Meyering's message of "Tue, 25 Nov 2008 16:06:54 +0100") References: <87skpf3kvl.fsf@rho.meyering.net> Message-ID: <87hc5v3f8k.fsf@rho.meyering.net> Jim Meyering wrote: >>From 90f1d42f7b99f8684600540624015827ca8542ed Mon Sep 17 00:00:00 2001 > From: Jim Meyering > - wireless-tools radeontool cracklib-dicts cracklib libicu" > + wireless-tools radeontool cracklib-dicts cracklib libicu gnupg" The package to remove is called gnupg2, not gnupg. Once removed, it reduces the x86_64 image RPM size by 1.4MB, from 54056KB to 52616KB. Here's the corrected patch: >From 423699e74f0d9023dbfc45f44ab4ffc4a9212103 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 21 Nov 2008 06:59:38 +0100 Subject: [PATCH node-image] common-blacklist.ks: Remove unused gnupg2: it's almost 5MB uncompressed. This removal reduces the x86_64 RPM size by 1.4MB, from 54056KB to 52616KB. --- common-blacklist.ks | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/common-blacklist.ks b/common-blacklist.ks index 3c89236..8d43ace 100644 --- a/common-blacklist.ks +++ b/common-blacklist.ks @@ -19,7 +19,7 @@ RPMS="$RPMS kpartx mkinitrd isomd5sum dmraid python python-libs checkpolicy" RPMS="$RPMS gamin pm-utils kbd usermode vbetool ConsoleKit hdparm \ efibootmgr krb5-workstation linux-atm-libs fedora-release-notes \ slang psmisc gdbm cryptsetup-luks pciutils mtools syslinux db4 \ - wireless-tools radeontool cracklib-dicts cracklib libicu" + wireless-tools radeontool cracklib-dicts cracklib libicu gnupg2" # cronie pulls in exim (sendmail) which pulls in all kinds of perl deps RPMS="$RPMS exim perl-version perl-Pod-Simple perl-libs perl-Module-Pluggable \ -- 1.6.0.4.1044.g77718 From sseago at redhat.com Tue Nov 25 18:05:46 2008 From: sseago at redhat.com (Scott Seago) Date: Tue, 25 Nov 2008 18:05:46 +0000 Subject: [Ovirt-devel] [PATCH] fix for bug 467758 Message-ID: <1227636346-28836-1-git-send-email-sseago@redhat.com> Fixed the missing 'edit vm pool quota' links as well as a bug in the 'edit vm pool' form. Signed-off-by: Scott Seago --- src/app/controllers/resources_controller.rb | 6 +++--- src/app/views/resources/_form.rhtml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/controllers/resources_controller.rb b/src/app/controllers/resources_controller.rb index 6a2482c..3c6e3ee 100644 --- a/src/app/controllers/resources_controller.rb +++ b/src/app/controllers/resources_controller.rb @@ -86,7 +86,7 @@ class ResourcesController < PoolController def update begin - @pool.update_attributes!(params[:vm_resource_pool]) + @pool.update_attributes!(params[:pool]) render :json => { :object => "vm_resource_pool", :success => true, :alert => "Virtual Machine Pool was successfully modified." } rescue @@ -160,7 +160,7 @@ class ResourcesController < PoolController super end def pre_create - @pool = VmResourcePool.new(params[:vm_resource_pool]) + @pool = VmResourcePool.new(params[:pool]) super end def pre_edit @@ -172,8 +172,8 @@ class ResourcesController < PoolController end def pre_show @pool = VmResourcePool.find(params[:id]) - @is_hwpool_admin = @pool.parent.can_modify(@user) super + @is_hwpool_admin = @pool.parent.can_modify(@user) end def pre_vm_actions @pool = VmResourcePool.find(params[:id]) diff --git a/src/app/views/resources/_form.rhtml b/src/app/views/resources/_form.rhtml index 0f9fa9f..99054ae 100644 --- a/src/app/views/resources/_form.rhtml +++ b/src/app/views/resources/_form.rhtml @@ -2,6 +2,6 @@ <%= hidden_field_tag 'parent_id', @parent.id %> -<%= text_field_with_label "Name", 'vm_resource_pool', 'name' %> +<%= text_field_with_label "Name", 'pool', 'name' %> -- 1.5.6.5 From imain at redhat.com Tue Nov 25 19:05:18 2008 From: imain at redhat.com (Ian Main) Date: Tue, 25 Nov 2008 11:05:18 -0800 Subject: [Ovirt-devel] [PATCH server] Replace host-status with db-omatic. In-Reply-To: <1227305810-18829-1-git-send-email-imain@redhat.com> References: <1227305810-18829-1-git-send-email-imain@redhat.com> Message-ID: <1227639918-18758-1-git-send-email-imain@redhat.com> This patch replaces host-status with db-omatic (formerly qpid-db-sync). This uses the qpid console to recieve events from libvirt-qpid on various nodes and update state in the database directly. It also uses heartbeating from the libvirt-qpid agents so it knows when a host or agent dies. This update fixes a bug that occurs when a domain is user created; I was using 'next' instead of 'return'. Signed-off-by: Ian Main --- conf/ovirt-db-omatic | 53 +++++++ conf/ovirt-host-status | 53 ------- ovirt-server.spec.in | 12 +- scripts/ovirt-server-install | 2 +- src/db-omatic/db_omatic.rb | 316 ++++++++++++++++++++++++++++++++++++++++ src/host-status/host-status.rb | 240 ------------------------------ 6 files changed, 376 insertions(+), 300 deletions(-) create mode 100755 conf/ovirt-db-omatic delete mode 100755 conf/ovirt-host-status create mode 100755 src/db-omatic/db_omatic.rb delete mode 100755 src/host-status/host-status.rb diff --git a/conf/ovirt-db-omatic b/conf/ovirt-db-omatic new file mode 100755 index 0000000..f8337e0 --- /dev/null +++ b/conf/ovirt-db-omatic @@ -0,0 +1,53 @@ +#!/bin/bash +# +# +# ovirt-db-omatic startup script for ovirt-db-omatic +# +# chkconfig: - 97 03 +# description: ovirt-db-omatic is an essential component of the \ +# ovirt VM manager. +# + +[ -r /etc/sysconfig/ovirt-rails ] && . /etc/sysconfig/ovirt-rails + +export RAILS_ENV="${RAILS_ENV:-production}" + +DAEMON=/usr/share/ovirt-server/db-omatic/db_omatic.rb + +. /etc/init.d/functions + +start() { + echo -n "Starting ovirt-db-omatic: " + daemon $DAEMON + RETVAL=$? + echo +} + +stop() { + echo -n "Shutting down ovirt-db-omatic: " + killproc db_omatic.rb + RETVAL=$? + echo +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + status) + status $DAEMON + RETVAL=$? + ;; + *) + echo "Usage: ovirt-db-omatic {start|stop|restart|status}" + exit 1 + ;; +esac +exit $RETVAL diff --git a/conf/ovirt-host-status b/conf/ovirt-host-status deleted file mode 100755 index 0b43552..0000000 --- a/conf/ovirt-host-status +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# -# -# ovirt-host-status startup script for ovirt-host-status -# -# chkconfig: - 97 03 -# description: ovirt-host-status is an essential component of the \ -# ovirt VM manager. -# - -[ -r /etc/sysconfig/ovirt-rails ] && . /etc/sysconfig/ovirt-rails - -export RAILS_ENV="${RAILS_ENV:-production}" - -DAEMON=/usr/share/ovirt-server/host-status/host-status.rb - -. /etc/init.d/functions - -start() { - echo -n "Starting ovirt-host-status: " - daemon $DAEMON - RETVAL=$? - echo -} - -stop() { - echo -n "Shutting down ovirt-host-status: " - killproc host-status.rb - RETVAL=$? - echo -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - status) - status $DAEMON - RETVAL=$? - ;; - *) - echo "Usage: ovirt-host-status {start|stop|restart|status}" - exit 1 - ;; -esac -exit $RETVAL diff --git a/ovirt-server.spec.in b/ovirt-server.spec.in index d9e3f78..be24fbf 100644 --- a/ovirt-server.spec.in +++ b/ovirt-server.spec.in @@ -73,11 +73,11 @@ mkdir %{buildroot} touch %{buildroot}%{_localstatedir}/log/%{name}/mongrel.log touch %{buildroot}%{_localstatedir}/log/%{name}/rails.log touch %{buildroot}%{_localstatedir}/log/%{name}/taskomatic.log -touch %{buildroot}%{_localstatedir}/log/%{name}/host-status.log +touch %{buildroot}%{_localstatedir}/log/%{name}/db-omatic.log %{__install} -p -m0644 %{pbuild}/conf/%{name}.conf %{buildroot}%{_sysconfdir}/httpd/conf.d %{__install} -Dp -m0755 %{pbuild}/conf/ovirt-host-browser %{buildroot}%{_initrddir} -%{__install} -Dp -m0755 %{pbuild}/conf/ovirt-host-status %{buildroot}%{_initrddir} +%{__install} -Dp -m0755 %{pbuild}/conf/ovirt-db-omatic %{buildroot}%{_initrddir} %{__install} -Dp -m0755 %{pbuild}/conf/ovirt-host-collect %{buildroot}%{_initrddir} %{__install} -Dp -m0755 %{pbuild}/conf/ovirt-mongrel-rails %{buildroot}%{_initrddir} %{__install} -Dp -m0755 %{pbuild}/conf/ovirt-mongrel-rails.sysconf %{buildroot}%{_sysconfdir}/sysconfig/ovirt-mongrel-rails @@ -147,7 +147,7 @@ fi # on; otherwise, we respect the choices the administrator already has made. # check this by seeing if each daemon is already installed %daemon_chkconfig_post -d ovirt-host-browser -%daemon_chkconfig_post -d ovirt-host-status +%daemon_chkconfig_post -d ovirt-db-omatic %daemon_chkconfig_post -d ovirt-host-collect %daemon_chkconfig_post -d ovirt-mongrel-rails %daemon_chkconfig_post -d ovirt-taskomatic @@ -160,12 +160,12 @@ docs_dir=$(rpm -q --queryformat '/usr/share/%{NAME}' ovirt-docs) %preun if [ "$1" = 0 ] ; then /sbin/service ovirt-host-browser stop > /dev/null 2>&1 - /sbin/service ovirt-host-status stop > /dev/null 2>&1 + /sbin/service ovirt-db-omatic stop > /dev/null 2>&1 /sbin/service ovirt-host-collect stop > /dev/null 2>&1 /sbin/service ovirt-mongrel-rails stop > /dev/null 2>&1 /sbin/service ovirt-taskomatic stop > /dev/null 2>&1 /sbin/chkconfig --del ovirt-host-browser - /sbin/chkconfig --del ovirt-host-status + /sbin/chkconfig --del ovirt-db-omatic /sbin/chkconfig --del ovirt-host-collect /sbin/chkconfig --del ovirt-mongrel-rails /sbin/chkconfig --del ovirt-taskomatic @@ -178,7 +178,7 @@ fi %{_sbindir}/ovirt-update-search %{_bindir}/ovirt-add-host %{_initrddir}/ovirt-host-browser -%{_initrddir}/ovirt-host-status +%{_initrddir}/ovirt-db-omatic %{_initrddir}/ovirt-host-collect %{_initrddir}/ovirt-mongrel-rails %{_initrddir}/ovirt-taskomatic diff --git a/scripts/ovirt-server-install b/scripts/ovirt-server-install index afa2a64..5eb1afe 100755 --- a/scripts/ovirt-server-install +++ b/scripts/ovirt-server-install @@ -20,7 +20,7 @@ STEP_FILE=/etc/ntp/step-tickers SASL_FILE=/etc/sasl2/libvirt.conf LDAP_CFG=${OVIRT_DIR}/config/ldap.yml -OVIRT_SVCS="ovirt-host-browser ovirt-host-keyadd ovirt-host-status \ +OVIRT_SVCS="ovirt-host-browser ovirt-host-keyadd ovirt-db-omatic \ ovirt-host-collect ovirt-mongrel-rails ovirt-taskomatic" ENABLE_SVCS="ntpdate ntpd httpd postgresql libvirtd collectd" diff --git a/src/db-omatic/db_omatic.rb b/src/db-omatic/db_omatic.rb new file mode 100755 index 0000000..ba245e6 --- /dev/null +++ b/src/db-omatic/db_omatic.rb @@ -0,0 +1,316 @@ +#!/usr/bin/ruby + +$: << File.join(File.dirname(__FILE__), "../dutils") + +require "rubygems" +require "qpid" +require 'monitor' +require 'dutils' +require 'daemons' +require 'optparse' +include Daemonize + + +class DbOmatic < Qpid::Qmf::Console + + # Use monitor mixin for mutual exclusion around checks to heartbeats + # and updates to objects/heartbeats. + + include MonitorMixin + + def initialize() + super() + @cached_objects = {} + @heartbeats = {} + + database_connect + end + + def update_domain_state(domain, state_override = nil) + vm = Vm.find(:first, :conditions => [ "uuid = ?", domain['uuid'] ]) + if vm == nil + puts "VM Not found in database, must be created by user; ignoring." + return + end + + if state_override != nil + state = state_override + else + # FIXME: Some of these translations don't seem right. Shouldn't we be using + # the libvirt states throughout ovirt? + case domain['state'] + when "nostate" + state = Vm::STATE_PENDING + when "running" + state = Vm::STATE_RUNNING + when "blocked" + state = Vm::STATE_SUSPENDED #? + when "paused" + state = Vm::STATE_SUSPENDED + when "shutdown" + state = Vm::STATE_STOPPED + when "shutoff" + state = Vm::STATE_STOPPED + when "crashed" + state = Vm::STATE_STOPPED + else + state = Vm::STATE_PENDING + end + end + + puts "Updating VM #{domain['name']} to state #{state}" + vm.state = state + vm.save + end + + def update_host_state(host_info, state) + db_host = Host.find(:first, :conditions => [ "hostname = ?", host_info['hostname'] ]) + if db_host + puts "Marking host #{host_info['hostname']} as state #{state}." + db_host.state = state + db_host.hypervisor_type = host_info['hypervisorType'] + db_host.arch = host_info['model'] + db_host.memory = host_info['memory'] + # XXX: Could be added.. + #db_host.mhz = host_info['mhz'] + # XXX: Not even sure what this is.. :) + #db_host.lock_version = 2 + # XXX: This would just be for init.. + #db_host.is_disabled = 0 + db_host.save + else + # FIXME: This would be a newly registered host. We could put it in the database. + puts "Unknown host, probably not registered yet??" + end + end + + def object_props(broker, obj) + target = obj.klass_key[0] + return if target != "com.redhat.libvirt" + + type = obj.klass_key[1] + + # I just sync this whole thing because there shouldn't be a lot of contention here.. + synchronize do + values = @cached_objects[obj.object_id.to_s] + + new_object = false + + if values == nil + values = {} + @cached_objects[obj.object_id.to_s] = values + + # Save the agent and broker bank so that we can tell what objects + # are expired when the heartbeat for them stops. + values[:broker_bank] = obj.object_id.broker_bank + values[:agent_bank] = obj.object_id.agent_bank + values[:class_type] = obj.klass_key[1] + values[:timed_out] = false + puts "New object type #{type}" + + new_object = true + end + + domain_state_change = false + + obj.properties.each do |key, newval| + if values[key.to_s] != newval + values[key.to_s] = newval + #puts "new value for property #{key} : #{newval}" + if type == "domain" and key.to_s == "state" + domain_state_change = true + end + end + end + + if domain_state_change + update_domain_state(values) + end + + if new_object + if type == "node" + update_host_state(values, Host::STATE_AVAILABLE) + end + end + end + end + + def object_stats(broker, obj) + target = obj.klass_key[0] + return if target != "com.redhat.libvirt" + type = obj.klass_key[1] + + synchronize do + values = @cached_objects[obj.object_id.to_s] + if !values + values = {} + @cached_objects[obj.object_id.to_s] = values + + values[:broker_bank] = obj.object_id.broker_bank + values[:agent_bank] = obj.object_id.agent_bank + values[:class_type] = obj.klass_key[1] + values[:timed_out] = false + end + obj.statistics.each do |key, newval| + if values[key.to_s] != newval + values[key.to_s] = newval + #puts "new value for statistic #{key} : #{newval}" + end + end + end + end + + def heartbeat(agent, timestamp) + return if agent == nil + synchronize do + bank_key = "#{agent.agent_bank}.#{agent.broker.broker_bank}" + @heartbeats[bank_key] = [agent, timestamp] + end + end + + + def del_agent(agent) + agent_disconnected(agent) + end + + # This method marks objects associated with the given agent as timed out/invalid. Called either + # when the agent heartbeats out, or we get a del_agent callback. + def agent_disconnected(agent) + @cached_objects.keys.each do |objkey| + if @cached_objects[objkey][:broker_bank] == agent.broker.broker_bank and + @cached_objects[objkey][:agent_bank] == agent.agent_bank + + values = @cached_objects[objkey] + puts "Marking object of type #{values[:class_type]} as timed out." + if values[:timed_out] == false + if values[:class_type] == 'node' + update_host_state(values, Host::STATE_UNAVAILABLE) + elsif values[:class_type] == 'domain' + update_domain_state(values, Vm::STATE_UNREACHABLE) + end + end + values[:timed_out] = true + end + end + end + + # The opposite of above, this is called when an agent is alive and well and makes sure + # all of the objects associated with it are marked as valid. + def agent_connected(agent) + + @cached_objects.keys.each do |objkey| + if @cached_objects[objkey][:broker_bank] == agent.broker.broker_bank and + @cached_objects[objkey][:agent_bank] == agent.agent_bank + + values = @cached_objects[objkey] + if values[:timed_out] == true + puts "Marking object of type #{values[:class_type]} as in service." + if values[:class_type] == 'node' + update_host_state(values, Host::STATE_AVAILABLE) + elsif values[:class_type] == 'domain' + update_domain_state(values) + end + values[:timed_out] = false + end + end + end + end + + # This cleans up the database on startup so that everything is marked unavailable etc. + # Once everything comes online it will all be marked as available/up again. + def db_init_cleanup() + db_host = Host.find(:all) + db_host.each do |host| + puts "Marking host #{host.hostname} unavailable" + host.state = Host::STATE_UNAVAILABLE + host.save + end + + db_vm = Vm.find(:all) + db_vm.each do |vm| + puts "Marking vm #{vm.description} as stopped." + vm.state = Vm::STATE_STOPPED + vm.save + end + end + + + # This is the mainloop that is called into as a separate thread. This just loops through + # and makes sure all the agents are still reporting. If they aren't they get marked as + # down. + def check_heartbeats() + while true + sleep(5) + + synchronize do + # Get seconds from the epoch + t = Time.new.to_i + + @heartbeats.keys.each do | key | + agent, timestamp = @heartbeats[key] + + # Heartbeats from qpid are in microseconds, we just need seconds.. + s = timestamp / 1000000000 + delta = t - s + + if delta > 30 + # No heartbeat for 30 seconds.. deal with dead/disconnected agent. + agent_disconnected(agent) + + @heartbeats.delete(key) + else + agent_connected(agent) + end + end + end + end + end +end + + +$logfile = '/var/log/ovirt-server/qpid-db-sync.log' + +def main() + + do_daemon = true + + opts = OptionParser.new do |opts| + opts.on("-h", "--help", "Print help message") do + puts opts + exit + end + opts.on("-n", "--nodaemon", "Run interactively (useful for debugging)") do |n| + do_daemon = false + end + end + begin + opts.parse!(ARGV) + rescue OptionParser::InvalidOption + puts opts + exit + end + + if do_daemon + # XXX: This gets around a problem with paths for the database stuff. + # Normally daemonize would chdir to / but the paths for the database + # stuff are relative so it breaks it.. It's either this or rearrange + # things so the db stuff is included after daemonizing. + pwd = Dir.pwd + daemonize + Dir.chdir(pwd) + STDOUT.reopen $logfile, 'a' + STDERR.reopen STDOUT + end + + dbsync = DbOmatic.new() + s = Qpid::Qmf::Session.new(:console => dbsync, :rcv_events => false) + b = s.add_broker("amqp://localhost:5672") + + dbsync.db_init_cleanup() + + # Call into mainloop.. + dbsync.check_heartbeats() +end + +main() + diff --git a/src/host-status/host-status.rb b/src/host-status/host-status.rb deleted file mode 100755 index cd9e30f..0000000 --- a/src/host-status/host-status.rb +++ /dev/null @@ -1,240 +0,0 @@ -#!/usr/bin/ruby -# -# Copyright (C) 2008 Red Hat, Inc. -# Written by Chris Lalancette -# -# 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. - -$: << File.join(File.dirname(__FILE__), "../dutils") - -require 'rubygems' -require 'libvirt' -require 'optparse' -require 'daemons' -include Daemonize - -$logfile = '/var/log/ovirt-server/host-status.log' - -do_daemon = true -sleeptime = 20 -opts = OptionParser.new do |opts| - opts.on("-h", "--help", "Print help message") do - puts opts - exit - end - opts.on("-n", "--nodaemon", "Run interactively (useful for debugging)") do |n| - do_daemon = !n - end - opts.on("-s N", Integer, "--sleep", "Seconds to sleep between iterations (default is 5 seconds)") do |s| - sleeptime = s - end -end -begin - opts.parse!(ARGV) -rescue OptionParser::InvalidOption - puts opts - exit -end - -if do_daemon - daemonize - STDOUT.reopen $logfile, 'a' - STDERR.reopen STDOUT -end - -# connects to the db in here -require 'dutils' - -def check_state(vm, dom_info, host) - puts 'checking state of vm ' + vm.description - - case dom_info.state - - when Libvirt::Domain::NOSTATE, Libvirt::Domain::SHUTDOWN, - Libvirt::Domain::SHUTOFF, Libvirt::Domain::CRASHED then - if Vm::RUNNING_STATES.include?(vm.state) - # OK, the host thinks this VM is off, while the database thinks it - # is running; we have to kick taskomatic - kick_taskomatic(Vm::STATE_STOPPED, vm, host.id) - end - when Libvirt::Domain::RUNNING, Libvirt::Domain::BLOCKED then - if not Vm::RUNNING_STATES.include?(vm.state) - # OK, the host thinks this VM is running, but it's not marked as running - # in the database; kick taskomatic - kick_taskomatic(Vm::STATE_RUNNING, vm, host.id) - end - when Libvirt::Domain::PAUSED then - if vm.state != Vm::STATE_SUSPENDING and vm.state != Vm::STATE_SUSPENDED - kick_taskomatic(Vm::STATE_SUSPENDED, vm, host.id) - end - else - puts "Unknown vm state...skipping" - end -end - - -def kick_taskomatic(msg, vm, host_id = nil) - print "Kicking taskomatic, state is %s\n" % msg - task = VmTask.new - task.user = "host-status" - task.action = VmTask::ACTION_UPDATE_STATE_VM - task.state = Task::STATE_QUEUED - task.args = host_id ? [msg,host_id].join(',') : msg - task.created_at = Time.now - task.time_started = Time.now - task.task_target = vm - task.save -end - - -def check_status(host) - - # This is in a new process, we need a new database connection. - database_connect - - begin - puts "Connecting to host " + host.hostname - conn = Libvirt::open("qemu+tcp://" + host.hostname + "/system") - rescue - # we couldn't contact the host for whatever reason. Since we can't get - # to this host, we have to mark all vms on it as disconnected or stopped - # or such. - if host.state != Host::STATE_UNAVAILABLE - puts "Updating host state to unavailable: " + host.hostname - host.state = Host::STATE_UNAVAILABLE - host.save - end - - Vm.find(:all, :conditions => [ "host_id = ?", host.id ]).each do |vm| - # Since we can't reach the host on which the vms reside, we mark these - # as STATE_UNREACHABLE. If they come back up we can mark them as - # running again, else they'll be stopped. At least for now the user - # will know what's going on. - # - # If this causes too much trouble in the UI, this can be changed to - # STATE_STOPPED for now until it is resolved of another solution is - # brought forward. - - if vm.state != Vm::STATE_UNREACHABLE: - kick_taskomatic(Vm::STATE_UNREACHABLE, vm) - end - - end - - return - end - - if host.state != Host::STATE_AVAILABLE - puts "Updating host state to available: " + host.hostname - host.state = Host::STATE_AVAILABLE - host.save - end - - begin - vm_ids = conn.list_domains - rescue - puts "Failed to request domain list on host " + host.hostname - conn.close - return - end - - puts "** Host alive, checking vms by id **" - # Here we're going through every vm listed through libvirt. This - # really only lets us find ones that are started that shouldn't be. - vm_ids.each do |vm_id| - puts "VM ID: %d" % [vm_id] - begin - dom = conn.lookup_domain_by_id(vm_id) - rescue - puts "Failed to find domain " + vm.description + " with vm_id ", vm_id - next - end - - vm_uuid = dom.uuid - info = dom.info - - puts "VM UUID: %s" % [vm_uuid] - info = dom.info - - vm = Vm.find(:first, :conditions => [ "uuid = ?", vm_uuid ]) - if vm == nil - puts "VM Not found in database, must be created by user. giving up." - next - end - - check_state(vm, info, host) - end - - puts "** Checking all vms as appear in the database **" - # Now we get a list of all vms that should be on this system and see if - # they are all running. - Vm.find(:all, :conditions => [ "host_id = ?", host.id ]).each do |vm| - - begin - puts "Looking up domain by uuid #{vm.uuid}" - dom = conn.lookup_domain_by_uuid(vm.uuid) - rescue - # OK. We couldn't find the UUID that we thought was there. The only - # explanation is that the domain is dead. - puts "Failed to find domain " + vm.description + ", marking as dead" - kick_taskomatic(Vm::STATE_STOPPED, vm) - next - end - info = dom.info - check_state(vm, info, host) - end - - conn.close -end - -get_credentials - -loop do - - # fork() seems to really mess with our db connection. Need to have this - # in the main connection as well. I verified it's not leaking connections/fds. - database_connect - hosts = Host.find(:all) - - p_count = 0 - hosts.each do |host| - - p_count += 1 - - fork do - check_status(host) - exit 0 - end - - # Only allow up to n_hosts / 5 processes running at a time. If we go above this - # Then we wait for one to exit before continuing. This guarantees it will take - # at most 5 timeouts to check all hosts. - if p_count > hosts.length / 5 - Process.wait - p_count -= 1 - end - - end - - while p_count > 0 - Process.wait - p_count -= 1 - end - - - STDOUT.flush - sleep sleeptime -end -- 1.5.6.5 From jguiditt at redhat.com Tue Nov 25 19:33:12 2008 From: jguiditt at redhat.com (Jason Guiditta) Date: Tue, 25 Nov 2008 14:33:12 -0500 Subject: [Ovirt-devel] [PATCH] fix for bug 467758 In-Reply-To: <1227636346-28836-1-git-send-email-sseago@redhat.com> References: <1227636346-28836-1-git-send-email-sseago@redhat.com> Message-ID: <1227641592.4400.0.camel@physical.priv.ovirt.org> On Tue, 2008-11-25 at 18:05 +0000, Scott Seago wrote: ACK, this works for me. -j From apevec at redhat.com Tue Nov 25 19:52:33 2008 From: apevec at redhat.com (Alan Pevec) Date: Tue, 25 Nov 2008 20:52:33 +0100 Subject: [Ovirt-devel] Re: [PATCH server] Replace host-status with db-omatic. In-Reply-To: <1227639918-18758-1-git-send-email-imain@redhat.com> References: <1227305810-18829-1-git-send-email-imain@redhat.com> <1227639918-18758-1-git-send-email-imain@redhat.com> Message-ID: <492C5781.40300@redhat.com> ACK - works as advertised Note that qpid/qmf communication is unencrypted, but we're expecting GSSAPI encryption to be available before the final oVirt release. So we're going to push this now to get more testing coverage of the ruby qpid client and qpid/qmf itself and enable encryption when it becomes available. From clalance at redhat.com Tue Nov 25 20:05:47 2008 From: clalance at redhat.com (Chris Lalancette) Date: Tue, 25 Nov 2008 21:05:47 +0100 Subject: [Ovirt-devel] [PATCH]: Add NFS file creation/deletion to taskomatic Message-ID: <492C5A9B.8000901@redhat.com> All, Attached is a patch to implement NFS file creation/deletion in the taskomatic back-end. Actually, this patch does quite a bit more than that: 1) Implement NFS file creation/deletion 2) Fix LVM creation - due to the way I was testing, there was a glaring bug in the implementation that caused it not to work at all on new, raw LUNs 3) Make sure to flip the Pool and Volume states to "available", once things are available. With this patch in place, along with a minor patch to libvirt (updated packages coming soon), I was able to successfully create and delete LVM volumes, NFS files, and then use those newly created LUNs/files in a guest. Caveat: note that NFS file creation can take a *long* time. Basically, we fully allocate the file at creation time, which means we have to write the entire disk full of zeros. During this time, both libvirtd (on the remote node) and taskomatic can't accept any more tasks. This will eventually be fixed by a) making libvirtd multithreaded, and b) making taskomatic fully threaded. Finally: with this in place, a couple of problems come to light. One is that we probably want to give users the ability to choose a sparse file vs. a non-sparse file (but that's a minor change in the frontend and in taskomatic). The second is much more complicated and important; namely, that we need users to be able to assign /dev/sda to iSCSI LUN 3, /dev/sdb to NFS file 2, etc. At the *very* least we need users to be able to specify which device is the root device. In any case, this is future work. Signed-off-by: Chris Lalancette -------------- next part -------------- A non-text attachment was scrubbed... Name: ovirt-taskomatic-nfs-file-create.patch Type: text/x-patch Size: 17199 bytes Desc: not available URL: From imain at redhat.com Tue Nov 25 22:29:19 2008 From: imain at redhat.com (Ian Main) Date: Tue, 25 Nov 2008 14:29:19 -0800 Subject: [Ovirt-devel] Re: [PATCH server] Replace host-status with db-omatic. In-Reply-To: <492C5781.40300@redhat.com> References: <1227305810-18829-1-git-send-email-imain@redhat.com> <1227639918-18758-1-git-send-email-imain@redhat.com> <492C5781.40300@redhat.com> Message-ID: <20081125142919.3713510a@tp.mains.net> On Tue, 25 Nov 2008 20:52:33 +0100 Alan Pevec wrote: > ACK - works as advertised > Note that qpid/qmf communication is unencrypted, but we're expecting GSSAPI encryption to be available before the final oVirt release. So we're going to push this now to get more testing coverage of the ruby qpid client and qpid/qmf itself and enable encryption when it becomes available. > Thanks Alan :) Ian From sseago at redhat.com Tue Nov 25 22:52:42 2008 From: sseago at redhat.com (Scott Seago) Date: Tue, 25 Nov 2008 17:52:42 -0500 Subject: [Ovirt-devel] [PATCH]: Add NFS file creation/deletion to taskomatic In-Reply-To: <492C5A9B.8000901@redhat.com> References: <492C5A9B.8000901@redhat.com> Message-ID: <492C81BA.90105@redhat.com> Chris Lalancette wrote: > All, > Attached is a patch to implement NFS file creation/deletion in the > taskomatic back-end. Actually, this patch does quite a bit more than that: > > 1) Implement NFS file creation/deletion > 2) Fix LVM creation - due to the way I was testing, there was a glaring bug in > the implementation that caused it not to work at all on new, raw LUNs > 3) Make sure to flip the Pool and Volume states to "available", once things are > available. > > With this patch in place, along with a minor patch to libvirt (updated packages > coming soon), I was able to successfully create and delete LVM volumes, NFS > files, and then use those newly created LUNs/files in a guest. > > Caveat: note that NFS file creation can take a *long* time. Basically, we fully > allocate the file at creation time, which means we have to write the entire disk > full of zeros. During this time, both libvirtd (on the remote node) and > taskomatic can't accept any more tasks. This will eventually be fixed by a) > making libvirtd multithreaded, and b) making taskomatic fully threaded. > > Finally: with this in place, a couple of problems come to light. One is that we > probably want to give users the ability to choose a sparse file vs. a non-sparse > file (but that's a minor change in the frontend and in taskomatic). The second > is much more complicated and important; namely, that we need users to be able to > assign /dev/sda to iSCSI LUN 3, /dev/sdb to NFS file 2, etc. At the *very* > least we need users to be able to specify which device is the root device. In > any case, this is future work. > > Signed-off-by: Chris Lalancette > > ------------------------------------------------------------------------ > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel > diff --git a/src/app/controllers/storage_controller.rb > b/src/app/controllers/storage_controller.rb > index 6d171c9..2235b6a 100644 > --- a/src/app/controllers/storage_controller.rb > +++ b/src/app/controllers/storage_controller.rb > @@ -143,12 +143,19 @@ class StorageController < ApplicationController > unless lvm_pool > # FIXME: what should we do about VG/LV names? > # for now auto-create VG name as ovirt_vg_#{@source_volume.id} > - lvm_pool = LvmStoragePool.new(:vg_name => > "ovirt_vg_#{@source_volume.id}", > - :hardware_pool_id => > @source_volume.storage_pool.hardware_pool_id) > + new_params = { :vg_name => "ovirt_vg_#{@source_volume.id}", > + :hardware_pool_id => > @source_volume.storage_pool.hardware_pool_id} > + lvm_pool = StoragePool.factory(StoragePool::LVM, new_params) > lvm_pool.source_volumes << @source_volume > lvm_pool.save! > end > new_volume_internal(lvm_pool, { :storage_pool_id => lvm_pool.id}) > + > + # now that we've created the new pool and volume, make sure to > link that > + # new LVM pool to the source volume > + @source_volume.lvm_pool_id = lvm_pool.id > + @source_volume.save! > + > @storage_volume.lv_owner_perms='0744' > @storage_volume.lv_group_perms='0744' > @storage_volume.lv_mode_perms='0744' You shouldn't have to set the lvm_pool_id for the source volume, as you've already set that relationship from the other side. When the lvm_pool was saved, the source_volume <-> lvm_pool association was saved into the database. Did you run into any particular problems without the latter code? From what I see here, we're essentially setting (and saving) that association twice. > diff --git a/src/app/models/lvm_storage_volume.rb > b/src/app/models/lvm_storage_volume.rb > index 4aac265..8eb1f0e 100644 > --- a/src/app/models/lvm_storage_volume.rb > +++ b/src/app/models/lvm_storage_volume.rb > @@ -25,4 +25,8 @@ class LvmStorageVolume < StorageVolume > def volume_name > "lv_name" > end > + > + def volume_create_params > + return lv_name, size, lv_owner_perms, lv_group_perms, lv_mode_perms > + end > end > diff --git a/src/app/models/nfs_storage_volume.rb > b/src/app/models/nfs_storage_volume.rb > index 2c18d67..61d5795 100644 > --- a/src/app/models/nfs_storage_volume.rb > +++ b/src/app/models/nfs_storage_volume.rb > @@ -25,4 +25,8 @@ class NfsStorageVolume < StorageVolume > def volume_name > "filename" > end > + > + def volume_create_params > + return filename, size, "0744", "0744", "0744" > + end > end Do we want to be able to set the permissions for all volume types? It seems a bit inconsistent to hard-code them for NFS but ask for them in the LVM form. I haven't been able to test it yet -- my appliance build failed, and I don't have time to diagnose/fix that right now, but I'll see what I can do about that tomorrow morning. But we do need to get this in before we build -- so if this works with a fresh appliance build for you we should probably be able to push it. Scott From berrange at redhat.com Wed Nov 26 10:16:05 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Wed, 26 Nov 2008 10:16:05 +0000 Subject: [Ovirt-devel] [PATCH server] Replace host-status with db-omatic. In-Reply-To: <1227639918-18758-1-git-send-email-imain@redhat.com> References: <1227305810-18829-1-git-send-email-imain@redhat.com> <1227639918-18758-1-git-send-email-imain@redhat.com> Message-ID: <20081126101604.GA16540@redhat.com> On Tue, Nov 25, 2008 at 11:05:18AM -0800, Ian Main wrote: > This patch replaces host-status with db-omatic (formerly qpid-db-sync). > This uses the qpid console to recieve events from libvirt-qpid on various > nodes and update state in the database directly. It also uses heartbeating > from the libvirt-qpid agents so it knows when a host or agent dies. Correction - it knows when the libvirt-qpid daemon is non-responsive, which is not the same as the host being dead - it is merely 'possibly' or 'probably' dead. It could be a failure of the network, or of the daemon, or gremlins in the tubes. As long as we're not relying on this detection of death as a guarentee we're fine - to turn the 'probably' into a guarentee we ned to using cluster fencing to STONITH[1] upon libvirt-qpid detecting probable death. Daniel [1] STONITH == Shoot The Other Node In The Head -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From clalance at redhat.com Wed Nov 26 12:05:03 2008 From: clalance at redhat.com (Chris Lalancette) Date: Wed, 26 Nov 2008 13:05:03 +0100 Subject: [Ovirt-devel] [PATCH]: Add NFS file creation/deletion to taskomatic In-Reply-To: <492C81BA.90105@redhat.com> References: <492C5A9B.8000901@redhat.com> <492C81BA.90105@redhat.com> Message-ID: <492D3B6F.2020906@redhat.com> Scott Seago wrote: >> diff --git a/src/app/controllers/storage_controller.rb >> b/src/app/controllers/storage_controller.rb >> index 6d171c9..2235b6a 100644 >> --- a/src/app/controllers/storage_controller.rb >> +++ b/src/app/controllers/storage_controller.rb >> @@ -143,12 +143,19 @@ class StorageController < ApplicationController >> unless lvm_pool >> # FIXME: what should we do about VG/LV names? >> # for now auto-create VG name as ovirt_vg_#{@source_volume.id} >> - lvm_pool = LvmStoragePool.new(:vg_name => >> "ovirt_vg_#{@source_volume.id}", >> - :hardware_pool_id => >> @source_volume.storage_pool.hardware_pool_id) >> + new_params = { :vg_name => "ovirt_vg_#{@source_volume.id}", >> + :hardware_pool_id => >> @source_volume.storage_pool.hardware_pool_id} >> + lvm_pool = StoragePool.factory(StoragePool::LVM, new_params) >> lvm_pool.source_volumes << @source_volume >> lvm_pool.save! >> end >> new_volume_internal(lvm_pool, { :storage_pool_id => lvm_pool.id}) >> + >> + # now that we've created the new pool and volume, make sure to >> link that >> + # new LVM pool to the source volume >> + @source_volume.lvm_pool_id = lvm_pool.id >> + @source_volume.save! >> + >> @storage_volume.lv_owner_perms='0744' >> @storage_volume.lv_group_perms='0744' >> @storage_volume.lv_mode_perms='0744' > You shouldn't have to set the lvm_pool_id for the source volume, as > you've already set that relationship from the other side. When the > lvm_pool was saved, the source_volume <-> lvm_pool association was saved > into the database. Did you run into any particular problems without the > latter code? From what I see here, we're essentially setting (and > saving) that association twice. I have to go back and look at it. I'm pretty sure the lvm_pool_id wasn't being set properly, so I wasn't able to go from the given LVM volume -> LVM Pool -> source volume in taskomatic. >> diff --git a/src/app/models/lvm_storage_volume.rb >> b/src/app/models/lvm_storage_volume.rb >> index 4aac265..8eb1f0e 100644 >> --- a/src/app/models/lvm_storage_volume.rb >> +++ b/src/app/models/lvm_storage_volume.rb >> @@ -25,4 +25,8 @@ class LvmStorageVolume < StorageVolume >> def volume_name >> "lv_name" >> end >> + >> + def volume_create_params >> + return lv_name, size, lv_owner_perms, lv_group_perms, lv_mode_perms >> + end >> end >> diff --git a/src/app/models/nfs_storage_volume.rb >> b/src/app/models/nfs_storage_volume.rb >> index 2c18d67..61d5795 100644 >> --- a/src/app/models/nfs_storage_volume.rb >> +++ b/src/app/models/nfs_storage_volume.rb >> @@ -25,4 +25,8 @@ class NfsStorageVolume < StorageVolume >> def volume_name >> "filename" >> end >> + >> + def volume_create_params >> + return filename, size, "0744", "0744", "0744" >> + end >> end > Do we want to be able to set the permissions for all volume types? It > seems a bit inconsistent to hard-code them for NFS but ask for them in > the LVM form. Yeah, it's a little inconsistent. I didn't like this wart either. Honestly, at the moment, what we should do is: 1) Remove the ability to change the permissions from the LVM UI (since it is basically meaningless at the moment). 2) Just make all volumes, regardless of type, default to 0744. Later on, when we come up with a better idea for permissions, we can implement it the right way. > > I haven't been able to test it yet -- my appliance build failed, and I > don't have time to diagnose/fix that right now, but I'll see what I can > do about that tomorrow morning. But we do need to get this in before we > build -- so if this works with a fresh appliance build for you we should > probably be able to push it. OK. I haven't actually tried yet with a fresh build; I'll do that next, just to make sure things work out of the box. -- Chris Lalancette From doron.fediuck at gmail.com Wed Nov 26 12:24:26 2008 From: doron.fediuck at gmail.com (Doron Fediuck) Date: Wed, 26 Nov 2008 14:24:26 +0200 Subject: [Ovirt-devel] oVirt Managd node sequence Message-ID: <200811261424.26518.doron.fediuck@gmail.com> Hi Guys, I'm looking for information about the managed node's boot sequence. After deep search in the project documentation I can say I can't find it. Where can I find some information about the node's initrd and any other relevant information for stand-alone managed node. Thanks ! Doron. From rjones at redhat.com Wed Nov 26 13:16:14 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Wed, 26 Nov 2008 13:16:14 +0000 Subject: [Ovirt-devel] Packages in the path to getting a Windows binary of libvirt, built from Fedora Message-ID: <20081126131614.GB21661@amd.home.annexia.org> It seems like we should have the base MinGW (Windows cross-compiler) packages in Fedora 11 by the end of this week. This email is to document the additional packages we need to get approved, in order to get the cross-compiled libvirt and virt tools into (or buildable by) Fedora 11. If you want to help out, please start reviewing by following the Bugzilla links, and looking at the approved packaging guidelines at http://fedoraproject.org/wiki/Packaging/MinGW. ** For libvirt itself: mingw32-libgpg-error https://bugzilla.redhat.com/show_bug.cgi?id=467403 mingw32-libgcrypt https://bugzilla.redhat.com/show_bug.cgi?id=467410 mingw32-gnutls https://bugzilla.redhat.com/show_bug.cgi?id=467414 mingw32-gettext https://bugzilla.redhat.com/show_bug.cgi?id=467398 mingw32-libxml2 https://bugzilla.redhat.com/show_bug.cgi?id=467405 mingw32-portablexdr https://bugzilla.redhat.com/show_bug.cgi?id=467324 mingw32-readline https://bugzilla.redhat.com/show_bug.cgi?id=467399 mingw32-termcap https://bugzilla.redhat.com/show_bug.cgi?id=467329 OR a very brave person can try porting ncurses to Windows. mingw32-iconv https://bugzilla.redhat.com/show_bug.cgi?id=467325 mingw32-zlib https://bugzilla.redhat.com/show_bug.cgi?id=454416 mingw32-libvirt https://bugzilla.redhat.com/show_bug.cgi?id=467418 ** For the C based tools (gtk-vnc, virt-viewer, ovirt-viewer, vinagre): All of the above plus: mingw32-gtk2 https://bugzilla.redhat.com/show_bug.cgi?id=467420 mingw32-glib2 https://bugzilla.redhat.com/show_bug.cgi?id=467402 mingw32-cairo https://bugzilla.redhat.com/show_bug.cgi?id=467416 mingw32-jasper https://bugzilla.redhat.com/show_bug.cgi?id=467408 mingw32-libpng https://bugzilla.redhat.com/show_bug.cgi?id=467397 mingw32-libjpeg https://bugzilla.redhat.com/show_bug.cgi?id=467401 mingw32-libtiff (?) Optional dependency for GTK2, but not yet packaged. mingw32-pango https://bugzilla.redhat.com/show_bug.cgi?id=467419 mingw32-atk https://bugzilla.redhat.com/show_bug.cgi?id=467409 mingw32-pixman https://bugzilla.redhat.com/show_bug.cgi?id=467376 mingw32-freetype https://bugzilla.redhat.com/show_bug.cgi?id=467396 mingw32-fontconfig https://bugzilla.redhat.com/show_bug.cgi?id=467413 mingw32-libidn No Bugzilla Review Request yet, see the mercurial repository. http://hg.et.redhat.com/misc/fedora-mingw--devel mingw32-openssl https://bugzilla.redhat.com/show_bug.cgi?id=467395 mingw32-libssh2 No Bugzilla Review Request yet, see the mercurial repository. http://hg.et.redhat.com/misc/fedora-mingw--devel mingw32-gtk-vnc https://bugzilla.redhat.com/show_bug.cgi?id=467421 mingw32-curl No Bugzilla Review Request yet, see the mercurial repository. http://hg.et.redhat.com/misc/fedora-mingw--devel ** For the Python based tools (virt-install, virt-manager etc), we're hoping to go straight to Python 3 on the basis that it will be easier to contribute patches upstream, and it seems the build system for Python 3 will be a bit saner than for Python 2.x. You can help by making sure that all Python software is "Python 3 clean". If you have python 2.6, then just add the '-3' flag to the command line in order to warn about features which are deprecated and will be removed in Python 3. ** For the OCaml based tools (virt-df, virt-top): mingw32-ocaml mingw32-ocaml-calendar mingw32-ocaml-csv mingw32-ocaml-curses mingw32-ocaml-extlib mingw32-ocaml-findlib mingw32-ocaml-lablgl mingw32-ocaml-lablgtk mingw32-ocaml-libvirt mingw32-ocaml-xml-light (None of these are in Bugzilla yet, and for good reason because I may just do them as subpackages of the OCaml packages already in Fedora). ** I haven't had any particular requests for Ruby tools yet. OVirt itself is a standalone appliance and it doesn't need porting to Windows. ovirt-viewer is a C application and is being written concurrently on Linux and Windows anyway. I'm not sure if there are other standalone bits of ovirt which would make sense being ported to Windows. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v From pmyers at redhat.com Wed Nov 26 14:11:23 2008 From: pmyers at redhat.com (Perry Myers) Date: Wed, 26 Nov 2008 09:11:23 -0500 Subject: [Ovirt-devel] oVirt Managd node sequence In-Reply-To: <200811261424.26518.doron.fediuck@gmail.com> References: <200811261424.26518.doron.fediuck@gmail.com> Message-ID: <492D590B.3090002@redhat.com> Doron Fediuck wrote: > Hi Guys, > I'm looking for information about the managed node's boot sequence. > After deep search in the project documentation I can say I can't find it. > > Where can I find some information about the node's initrd and any other > relevant information for stand-alone managed node. Did you see: http://ovirt.org/page/Node_Standalone_Operation which is linked from the front page of the Wiki on ovirt.org? This may help a bit. Alan can also provide you with additional details (which should be making their way on to the Wiki soon) Thanks, Perry From doron.fediuck at gmail.com Wed Nov 26 14:22:52 2008 From: doron.fediuck at gmail.com (Doron Fediuck) Date: Wed, 26 Nov 2008 16:22:52 +0200 Subject: [Ovirt-devel] oVirt Managd node sequence In-Reply-To: <492D590B.3090002@redhat.com> References: <200811261424.26518.doron.fediuck@gmail.com> <492D590B.3090002@redhat.com> Message-ID: <200811261622.55614.doron.fediuck@gmail.com> Hi Peter, Thanks for your answer. I actually had a long look at this page... There are issues there such as: Prompt user to configure disk storage. ovirt-config-storage Install node to disk? I'm interested to see which initrd is running it and what is done there. There's a gap between the grub menu and this functionality, and I'm trying to understand it. Is there a way to see more documentation or the actual initrd and grub.conf ? Thanks again !!! Doron. On Wednesday 26 November 2008 16:11:23 Perry Myers wrote: > Doron Fediuck wrote: > > Hi Guys, > > I'm looking for information about the managed node's boot sequence. > > After deep search in the project documentation I can say I can't find it. > > > > Where can I find some information about the node's initrd and any other > > relevant information for stand-alone managed node. > > Did you see: > http://ovirt.org/page/Node_Standalone_Operation > which is linked from the front page of the Wiki on ovirt.org? > > This may help a bit. Alan can also provide you with additional details > (which should be making their way on to the Wiki soon) > > Thanks, > > Perry From apevec at redhat.com Wed Nov 26 14:43:36 2008 From: apevec at redhat.com (Alan Pevec) Date: Wed, 26 Nov 2008 15:43:36 +0100 Subject: [Ovirt-devel] oVirt Managd node sequence In-Reply-To: <200811261622.55614.doron.fediuck@gmail.com> References: <200811261424.26518.doron.fediuck@gmail.com> <492D590B.3090002@redhat.com> <200811261622.55614.doron.fediuck@gmail.com> Message-ID: <492D6098.3040507@redhat.com> Doron Fediuck wrote: > Hi Peter, > Thanks for your answer. > I actually had a long look at this page... > There are issues there such as: > Prompt user to configure disk storage. > ovirt-config-storage > Install node to disk? Install node to disk using o-c-storage will be in git today, I'm debugging it now. Before standalone config, we had http://ovirt.org/page/Local_Disk_Usage - which is still valid if you're using 0.95. > I'm interested to see which initrd is running it and what > is done there. There's a gap between the grub menu and this live cd uses isolinux not grub > functionality, and I'm trying to understand it. > > Is there a way to see more documentation or the actual initrd and grub.conf ? initrd is standard livecd, we don't modify it. See http://git.fedorahosted.org/git/?p=mkinitrd;a=blob;f=mkliveinitrd You can also examine initrd using http://git.fedorahosted.org/git/?p=mkinitrd;a=blob;f=lsinitrd or pax -zf initrd0.img ; pax -zrf initrd0.img From clalance at redhat.com Wed Nov 26 15:31:36 2008 From: clalance at redhat.com (Chris Lalancette) Date: Wed, 26 Nov 2008 16:31:36 +0100 Subject: [Ovirt-devel] [PATCH]: Add NFS file creation/deletion to taskomatic In-Reply-To: <492D3B6F.2020906@redhat.com> References: <492C5A9B.8000901@redhat.com> <492C81BA.90105@redhat.com> <492D3B6F.2020906@redhat.com> Message-ID: <492D6BD8.9040902@redhat.com> Chris Lalancette wrote: >> You shouldn't have to set the lvm_pool_id for the source volume, as >> you've already set that relationship from the other side. When the >> lvm_pool was saved, the source_volume <-> lvm_pool association was >> saved into the database. Did you run into any particular problems >> without the latter code? From what I see here, we're essentially >> setting (and saving) that association twice. > > I have to go back and look at it. I'm pretty sure the lvm_pool_id > wasn't being set properly, so I wasn't able to go from the given LVM > volume -> LVM Pool -> source volume in taskomatic. Not that I doubted you, but I went back and checked, and it turns out you were right about this. At the time I added this, I must have been running into one of my own bugs. So I've removed this bit of code (I still left the change from LvmPool.new to StoragePool.factory, though). I'll send out an updated patch shortly. -- Chris Lalancette From clalance at redhat.com Wed Nov 26 15:56:58 2008 From: clalance at redhat.com (Chris Lalancette) Date: Wed, 26 Nov 2008 16:56:58 +0100 Subject: [Ovirt-devel] [PATCH]: Add NFS file creation/deletion to taskomatic In-Reply-To: <492C5A9B.8000901@redhat.com> References: <492C5A9B.8000901@redhat.com> Message-ID: <492D71CA.6030802@redhat.com> Chris Lalancette wrote: > All, > Attached is a patch to implement NFS file creation/deletion in the > taskomatic back-end. Actually, this patch does quite a bit more than that: > > 1) Implement NFS file creation/deletion > 2) Fix LVM creation - due to the way I was testing, there was a glaring bug in > the implementation that caused it not to work at all on new, raw LUNs > 3) Make sure to flip the Pool and Volume states to "available", once things are > available. > > With this patch in place, along with a minor patch to libvirt (updated packages > coming soon), I was able to successfully create and delete LVM volumes, NFS > files, and then use those newly created LUNs/files in a guest. > > Caveat: note that NFS file creation can take a *long* time. Basically, we fully > allocate the file at creation time, which means we have to write the entire disk > full of zeros. During this time, both libvirtd (on the remote node) and > taskomatic can't accept any more tasks. This will eventually be fixed by a) > making libvirtd multithreaded, and b) making taskomatic fully threaded. > > Finally: with this in place, a couple of problems come to light. One is that we > probably want to give users the ability to choose a sparse file vs. a non-sparse > file (but that's a minor change in the frontend and in taskomatic). The second > is much more complicated and important; namely, that we need users to be able to > assign /dev/sda to iSCSI LUN 3, /dev/sdb to NFS file 2, etc. At the *very* > least we need users to be able to specify which device is the root device. In > any case, this is future work. Updated patch, that addresses Scott's review comments. There is also a small bug fix in here where I choose hosts that are available and not disabled for storage scanning, rather than any random host. Signed-off-by: Chris Lalancette -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ovirt-taskomatic-nfs-file-create-v2.patch URL: From sseago at redhat.com Wed Nov 26 16:24:19 2008 From: sseago at redhat.com (Scott Seago) Date: Wed, 26 Nov 2008 11:24:19 -0500 Subject: [Ovirt-devel] [PATCH]: Add NFS file creation/deletion to taskomatic In-Reply-To: <492D71CA.6030802@redhat.com> References: <492C5A9B.8000901@redhat.com> <492D71CA.6030802@redhat.com> Message-ID: <492D7833.10206@redhat.com> Chris Lalancette wrote: > > Updated patch, that addresses Scott's review comments. There is also a small > bug fix in here where I choose hosts that are available and not disabled for > storage scanning, rather than any random host. > > Signed-off-by: Chris Lalancette > > ------------------------------------------------------------------------ Looks good now. ACK Scott From clalance at redhat.com Wed Nov 26 16:32:36 2008 From: clalance at redhat.com (Chris Lalancette) Date: Wed, 26 Nov 2008 17:32:36 +0100 Subject: [Ovirt-devel] [PATCH]: Add NFS file creation/deletion to taskomatic In-Reply-To: <492D7833.10206@redhat.com> References: <492C5A9B.8000901@redhat.com> <492D71CA.6030802@redhat.com> <492D7833.10206@redhat.com> Message-ID: <492D7A24.409@redhat.com> Scott Seago wrote: > Chris Lalancette wrote: >> Updated patch, that addresses Scott's review comments. There is also a small >> bug fix in here where I choose hosts that are available and not disabled for >> storage scanning, rather than any random host. >> >> Signed-off-by: Chris Lalancette >> >> ------------------------------------------------------------------------ > Looks good now. > ACK Committed and pushed, thanks Scott. -- Chris Lalancette From imain at redhat.com Wed Nov 26 23:59:50 2008 From: imain at redhat.com (Ian Main) Date: Wed, 26 Nov 2008 15:59:50 -0800 Subject: [Ovirt-devel] [PATCH server] Replace host-status with db-omatic. In-Reply-To: <20081126101604.GA16540@redhat.com> References: <1227305810-18829-1-git-send-email-imain@redhat.com> <1227639918-18758-1-git-send-email-imain@redhat.com> <20081126101604.GA16540@redhat.com> Message-ID: <20081126155950.7cf07e63@tp.mains.net> On Wed, 26 Nov 2008 10:16:05 +0000 "Daniel P. Berrange" wrote: > On Tue, Nov 25, 2008 at 11:05:18AM -0800, Ian Main wrote: > > This patch replaces host-status with db-omatic (formerly qpid-db-sync). > > This uses the qpid console to recieve events from libvirt-qpid on various > > nodes and update state in the database directly. It also uses heartbeating > > from the libvirt-qpid agents so it knows when a host or agent dies. > > Correction - it knows when the libvirt-qpid daemon is non-responsive, > which is not the same as the host being dead - it is merely 'possibly' > or 'probably' dead. It could be a failure of the network, or of the > daemon, or gremlins in the tubes. As long as we're not relying on this > detection of death as a guarentee we're fine - to turn the 'probably' > into a guarentee we ned to using cluster fencing to STONITH[1] upon > libvirt-qpid detecting probable death. Right, yes. Good clarification. Ian From vignesh at atc.tcs.com Fri Nov 28 12:23:47 2008 From: vignesh at atc.tcs.com (Vigneswaran R) Date: Fri, 28 Nov 2008 17:53:47 +0530 Subject: [Ovirt-devel] Re: ovirt-appliance panic on boot Message-ID: <492FE2D3.3000501@atc.tcs.com> Hello, > On 11.11.2008, at 20:57, Alan Pevec wrote: > > Thomas von Steiger wrote: > > I get the same problem with version 0.95. > Thomas > On 11.11.2008, at 19:31, Dennis J. wrote: > > Hi, > > I just installed ovirt version 0.95 and when I start the appliance it panics with the following message: > > RAMDISK: Couldn't find valid RAM disk image starting at 0. > VFS: Cannot open root device "sda2" or unknown-block(0,0) > > Please append a correct "root=" boot option; here are the available partitions: Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) > > Is this a known issue and how can I get the appliance to boot up properly? > > is this i386 or x86_64 ? > > > it's i386. We were also facing the same problem. We solved the problem by recreating the initrd file. Details, 1. mount the ovirt-appliance image # nohup qemu-nbd /var/lib/libvirt/images/ovirt-appliance.img & # modprobe nbd # nbd-client localhost 1024 /dev/nbd0 # kpartx -a /dev/nbd0 # mount /dev/mapper/nbd0p2 /mnt # mount /dev/mapper/nbd0p1 /mnt/boot 2. do a chroot, backup the initrd image and recreate it # chroot /mnt # mv /boot/initrd-2.6.26.6-79.fc9.i686 /root # mkinitrd /boot/initrd-2.6.26.6-79.fc9.i686 2.6.26.6-79.fc9.i686 # exit 3. unmount # umount /mnt # kpartx -d /dev/nbd0 # nbd-client -d /dev/nbd0 4. boot the machine # virsh start ovirt-appliance It solved our problem. ref: http://ovirt.org/page/TroubleShooting Vignesh From apevec at gmail.com Fri Nov 28 12:45:42 2008 From: apevec at gmail.com (Alan Pevec) Date: Fri, 28 Nov 2008 13:45:42 +0100 Subject: [Ovirt-devel] Re: ovirt-appliance panic on boot In-Reply-To: <2be7262f0811280444p2a1e2467pe6d758a0a02fdbd4@mail.gmail.com> References: <492FE2D3.3000501@atc.tcs.com> <2be7262f0811280444p2a1e2467pe6d758a0a02fdbd4@mail.gmail.com> Message-ID: <2be7262f0811280445y60d720fqa3776aefa16105d0@mail.gmail.com> (forgot to reply all) On Fri, Nov 28, 2008 at 1:44 PM, Alan Pevec wrote: > On Fri, Nov 28, 2008 at 1:23 PM, Vigneswaran R wrote: > >> We were also facing the same problem. We solved the problem by >> recreating the initrd file. >> >> Details, >> >> 1. mount the ovirt-appliance image >> >> # nohup qemu-nbd /var/lib/libvirt/images/ovirt-appliance.img & >> # modprobe nbd >> # nbd-client localhost 1024 /dev/nbd0 >> # kpartx -a /dev/nbd0 >> # mount /dev/mapper/nbd0p2 /mnt >> # mount /dev/mapper/nbd0p1 /mnt/boot >> >> 2. do a chroot, backup the initrd image and recreate it >> >> # chroot /mnt >> # mv /boot/initrd-2.6.26.6-79.fc9.i686 /root >> # mkinitrd /boot/initrd-2.6.26.6-79.fc9.i686 2.6.26.6-79.fc9.i686 >> # exit >> >> 3. unmount >> >> # umount /mnt >> # kpartx -d /dev/nbd0 >> # nbd-client -d /dev/nbd0 >> >> 4. boot the machine >> >> # virsh start ovirt-appliance >> >> >> It solved our problem. >> >> ref: http://ovirt.org/page/TroubleShooting >> >> > Excellent, thanks for solving this! > It's strange that appliance-creator produced broken i386 initrd while > x86_64 is ok and there were no errors reported in the build log. I'll take > special care of i386 when doing the next build. > > Cheers, > Alan > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From apevec at redhat.com Sat Nov 29 11:57:16 2008 From: apevec at redhat.com (Alan Pevec) Date: Sat, 29 Nov 2008 12:57:16 +0100 Subject: [Ovirt-devel] [PATCH node] import gptsync Message-ID: <1227959836-17290-1-git-send-email-apevec@redhat.com> >From http://git.fedorahosted.org/git/?p=anaconda.git;a=tree;f=gptsync Needed to enable legacy boot from the local storage with GPT label. License is GPL compatible - BSD License (no advertising). --- Makefile.am | 2 +- configure.ac | 1 + gptsync/.gitignore | 4 + gptsync/Makefile.am | 20 ++ gptsync/README.gptsync | 41 +++++ gptsync/gptsync.c | 470 ++++++++++++++++++++++++++++++++++++++++++++++++ gptsync/gptsync.h | 219 ++++++++++++++++++++++ gptsync/lib.c | 469 +++++++++++++++++++++++++++++++++++++++++++++++ gptsync/os_unix.c | 267 +++++++++++++++++++++++++++ gptsync/showpart.c | 257 ++++++++++++++++++++++++++ gptsync/syslinux_mbr.h | 90 +++++++++ ovirt-node.spec.in | 7 + 12 files changed, 1846 insertions(+), 1 deletions(-) create mode 100644 gptsync/.gitignore create mode 100644 gptsync/Makefile.am create mode 100644 gptsync/README.gptsync create mode 100644 gptsync/gptsync.c create mode 100644 gptsync/gptsync.h create mode 100644 gptsync/lib.c create mode 100644 gptsync/os_unix.c create mode 100644 gptsync/showpart.c create mode 100644 gptsync/syslinux_mbr.h diff --git a/Makefile.am b/Makefile.am index ea49b43..9b54ae6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,7 +16,7 @@ # also available at http://www.gnu.org/copyleft/gpl.html. OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache -SUBDIRS = ovirt-identify-node ovirt-listen-awake +SUBDIRS = ovirt-identify-node ovirt-listen-awake gptsync EXTRA_DIST = \ .gitignore \ diff --git a/configure.ac b/configure.ac index bf66b05..7ba459a 100644 --- a/configure.ac +++ b/configure.ac @@ -15,6 +15,7 @@ test x"$ac_ct_CC:$CFLAGS" = 'xgcc:-g -O2' \ AC_CONFIG_FILES([Makefile ovirt-identify-node/Makefile ovirt-listen-awake/Makefile + gptsync/Makefile ovirt-node.spec ]) AC_OUTPUT diff --git a/gptsync/.gitignore b/gptsync/.gitignore new file mode 100644 index 0000000..2f54301 --- /dev/null +++ b/gptsync/.gitignore @@ -0,0 +1,4 @@ +*.o +.deps +gptsync +showpart diff --git a/gptsync/Makefile.am b/gptsync/Makefile.am new file mode 100644 index 0000000..f4ff1c2 --- /dev/null +++ b/gptsync/Makefile.am @@ -0,0 +1,20 @@ +bin_PROGRAMS = gptsync showpart + +EXTRA_DIST = README.gptsync + +gptsync_SOURCES = \ + gptsync.h \ + syslinux_mbr.h \ + gptsync.c \ + lib.c \ + os_unix.c + +showpart_SOURCES = \ + gptsync.h \ + showpart.c \ + lib.c \ + os_unix.c + +gptsync_CPPFLAGS = $(AM_CPPFLAGS) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPROGNAME=gptsync +showpart_CPPFLAGS = $(AM_CPPFLAGS) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPROGNAME=showpart + diff --git a/gptsync/README.gptsync b/gptsync/README.gptsync new file mode 100644 index 0000000..cb306bd --- /dev/null +++ b/gptsync/README.gptsync @@ -0,0 +1,41 @@ +gptsync is from refit (refit.sf.net). It has been modified to +1) Not prompt if you want to copy +2) Default to Linux native (0x83) instead of fat32 partition id + +The original license follows. + + + rEFIt License +=============== + +Copyright (c) 2006-2007 Christoph Pfisterer +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the + distribution. + + * Neither the name of Christoph Pfisterer nor the names of the + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/gptsync/gptsync.c b/gptsync/gptsync.c new file mode 100644 index 0000000..7074bb8 --- /dev/null +++ b/gptsync/gptsync.c @@ -0,0 +1,470 @@ +/* + * gptsync/gptsync.c + * Platform-independent code for syncing GPT and MBR + * + * Copyright (c) 2006-2007 Christoph Pfisterer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Christoph Pfisterer nor the names of the + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "gptsync.h" + +#include "syslinux_mbr.h" + +// +// MBR functions +// + +static UINTN check_mbr(VOID) +{ + UINTN i, k; + + // check each entry + for (i = 0; i < mbr_part_count; i++) { + // check for overlap + for (k = 0; k < mbr_part_count; k++) { + if (k != i && !(mbr_parts[i].start_lba > mbr_parts[k].end_lba || mbr_parts[k].start_lba > mbr_parts[i].end_lba)) { + Print(L"Status: MBR partition table is invalid, partitions overlap.\n"); + return 1; + } + } + + // check for extended partitions + if (mbr_parts[i].mbr_type == 0x05 || mbr_parts[i].mbr_type == 0x0f || mbr_parts[i].mbr_type == 0x85) { + Print(L"Status: Extended partition found in MBR table, will not touch this disk.\n", + gpt_parts[i].gpt_parttype->name); + return 1; + } + } + + return 0; +} + +static UINTN write_mbr(VOID) +{ + UINTN status; + UINTN i, k; + UINT8 active; + UINT64 lba; + MBR_PARTITION_INFO *table; + BOOLEAN have_bootcode; + + Print(L"\nWriting new MBR...\n"); + + // read MBR data + status = read_sector(0, sector); + if (status != 0) + return status; + + // write partition table + *((UINT16 *)(sector + 510)) = 0xaa55; + + table = (MBR_PARTITION_INFO *)(sector + 446); + active = 0x80; + for (i = 0; i < 4; i++) { + for (k = 0; k < new_mbr_part_count; k++) { + if (new_mbr_parts[k].index == i) + break; + } + if (k >= new_mbr_part_count) { + // unused entry + table[i].flags = 0; + table[i].start_chs[0] = 0; + table[i].start_chs[1] = 0; + table[i].start_chs[2] = 0; + table[i].type = 0; + table[i].end_chs[0] = 0; + table[i].end_chs[1] = 0; + table[i].end_chs[2] = 0; + table[i].start_lba = 0; + table[i].size = 0; + } else { + if (new_mbr_parts[k].active) { + table[i].flags = active; + active = 0x00; + } else + table[i].flags = 0x00; + table[i].start_chs[0] = 0xfe; + table[i].start_chs[1] = 0xff; + table[i].start_chs[2] = 0xff; + table[i].type = new_mbr_parts[k].mbr_type; + table[i].end_chs[0] = 0xfe; + table[i].end_chs[1] = 0xff; + table[i].end_chs[2] = 0xff; + + lba = new_mbr_parts[k].start_lba; + if (lba > 0xffffffffULL) { + Print(L"Warning: Partition %d starts beyond 2 TiB limit\n", i+1); + lba = 0xffffffffULL; + } + table[i].start_lba = (UINT32)lba; + + lba = new_mbr_parts[k].end_lba + 1 - new_mbr_parts[k].start_lba; + if (lba > 0xffffffffULL) { + Print(L"Warning: Partition %d extends beyond 2 TiB limit\n", i+1); + lba = 0xffffffffULL; + } + table[i].size = (UINT32)lba; + } + } + + // add boot code if necessary + have_bootcode = FALSE; + for (i = 0; i < MBR_BOOTCODE_SIZE; i++) { + if (sector[i] != 0) { + have_bootcode = TRUE; + break; + } + } + if (!have_bootcode) { + // no boot code found in the MBR, add the syslinux MBR code + SetMem(sector, MBR_BOOTCODE_SIZE, 0); + CopyMem(sector, syslinux_mbr, SYSLINUX_MBR_SIZE); + } + + // write MBR data + status = write_sector(0, sector); + if (status != 0) + return status; + + Print(L"MBR updated successfully!\n"); + + return 0; +} + +// +// GPT functions +// + +static UINTN check_gpt(VOID) +{ + UINTN i, k; + BOOLEAN found_data_parts; + + if (gpt_part_count == 0) { + Print(L"Status: No GPT partition table, no need to sync.\n"); + return 1; + } + + // check each entry + found_data_parts = FALSE; + for (i = 0; i < gpt_part_count; i++) { + // check sanity + if (gpt_parts[i].end_lba < gpt_parts[i].start_lba) { + Print(L"Status: GPT partition table is invalid.\n"); + return 1; + } + // check for overlap + for (k = 0; k < gpt_part_count; k++) { + if (k != i && !(gpt_parts[i].start_lba > gpt_parts[k].end_lba || gpt_parts[k].start_lba > gpt_parts[i].end_lba)) { + Print(L"Status: GPT partition table is invalid, partitions overlap.\n"); + return 1; + } + } + + // check for partitions kind + if (gpt_parts[i].gpt_parttype->kind == GPT_KIND_FATAL) { + Print(L"Status: GPT partition of type '%s' found, will not touch this disk.\n", + gpt_parts[i].gpt_parttype->name); + return 1; + } + if (gpt_parts[i].gpt_parttype->kind == GPT_KIND_DATA || + gpt_parts[i].gpt_parttype->kind == GPT_KIND_BASIC_DATA) + found_data_parts = TRUE; + } + + if (!found_data_parts) { + Print(L"Status: GPT partition table has no data partitions, no need to sync.\n"); + return 1; + } + + return 0; +} + +// +// compare GPT and MBR tables +// + +#define ACTION_NONE (0) +#define ACTION_NOP (1) +#define ACTION_REWRITE (2) + +static UINTN analyze(VOID) +{ + UINTN action; + UINTN i, k, iter, count_active, detected_parttype; + CHARN *fsname; + UINT64 min_start_lba; + UINTN status; + BOOLEAN have_esp; + + new_mbr_part_count = 0; + + // determine correct MBR types for GPT partitions + if (gpt_part_count == 0) { + Print(L"Status: No GPT partitions defined, nothing to sync.\n"); + return 0; + } + have_esp = FALSE; + for (i = 0; i < gpt_part_count; i++) { + gpt_parts[i].mbr_type = gpt_parts[i].gpt_parttype->mbr_type; + if (gpt_parts[i].gpt_parttype->kind == GPT_KIND_BASIC_DATA) { + // Basic Data: need to look at data in the partition + status = detect_mbrtype_fs(gpt_parts[i].start_lba, &detected_parttype, &fsname); + if (detected_parttype) + gpt_parts[i].mbr_type = detected_parttype; + else + gpt_parts[i].mbr_type = 0x0b; // fallback: FAT32 + } else if (gpt_parts[i].mbr_type == 0xef) { + // EFI System Partition: GNU parted can put this on any partition, + // need to detect file systems + status = detect_mbrtype_fs(gpt_parts[i].start_lba, &detected_parttype, &fsname); + if (!have_esp && (detected_parttype == 0x01 || detected_parttype == 0x0e || detected_parttype == 0x0c)) + ; // seems to be a legitimate ESP, don't change + else if (detected_parttype) + gpt_parts[i].mbr_type = detected_parttype; + else if (have_esp) // make sure there's no more than one ESP per disk + gpt_parts[i].mbr_type = 0x83; // fallback: Linux + } + // NOTE: mbr_type may still be 0 if content detection fails for exotic GPT types or file systems + + if (gpt_parts[i].mbr_type == 0xef) + have_esp = TRUE; + } + + // check for common scenarios + action = ACTION_NONE; + if (mbr_part_count == 0) { + // current MBR is empty + action = ACTION_REWRITE; + } else if (mbr_part_count == 1 && mbr_parts[0].mbr_type == 0xee) { + // MBR has just the EFI Protective partition (i.e. untouched) + action = ACTION_REWRITE; + } + if (action == ACTION_NONE && mbr_part_count > 0) { + if (mbr_parts[0].mbr_type == 0xee && + gpt_parts[0].mbr_type == 0xef && + mbr_parts[0].start_lba == 1 && + mbr_parts[0].end_lba == gpt_parts[0].end_lba) { + // The Apple Way, "EFI Protective" covering the tables and the ESP + action = ACTION_NOP; + if ((mbr_part_count != gpt_part_count && gpt_part_count <= 4) || + (mbr_part_count != 4 && gpt_part_count > 4)) { + // number of partitions has changed + action = ACTION_REWRITE; + } else { + // check partition ranges and types + for (i = 1; i < mbr_part_count; i++) { + if (mbr_parts[i].start_lba != gpt_parts[i].start_lba || + mbr_parts[i].end_lba != gpt_parts[i].end_lba || + (gpt_parts[i].mbr_type && mbr_parts[i].mbr_type != gpt_parts[i].mbr_type)) + // position or type has changed + action = ACTION_REWRITE; + } + } + // check number of active partitions + count_active = 0; + for (i = 0; i < mbr_part_count; i++) + if (mbr_parts[i].active) + count_active++; + if (count_active!= 1) + action = ACTION_REWRITE; + } + } + if (action == ACTION_NONE && mbr_part_count > 0 && mbr_parts[0].mbr_type == 0xef) { + // The XOM Way, all partitions mirrored 1:1 + action = ACTION_REWRITE; + // check partition ranges and types + for (i = 0; i < mbr_part_count; i++) { + if (mbr_parts[i].start_lba != gpt_parts[i].start_lba || + mbr_parts[i].end_lba != gpt_parts[i].end_lba || + (gpt_parts[i].mbr_type && mbr_parts[i].mbr_type != gpt_parts[i].mbr_type)) + // position or type has changed -> better don't touch + action = ACTION_NONE; + } + } + + if (action == ACTION_NOP) { + Print(L"Status: Tables are synchronized, no need to sync.\n"); + return 0; + } else if (action == ACTION_REWRITE) { + Print(L"Status: MBR table must be updated.\n"); + } else { + Print(L"Status: Analysis inconclusive, will not touch this disk.\n"); + return 1; + } + + // generate the new table + + // first entry: EFI Protective + new_mbr_parts[0].index = 0; + new_mbr_parts[0].start_lba = 1; + new_mbr_parts[0].mbr_type = 0xee; + new_mbr_part_count = 1; + + if (gpt_parts[0].mbr_type == 0xef) { + new_mbr_parts[0].end_lba = gpt_parts[0].end_lba; + i = 1; + } else { + min_start_lba = gpt_parts[0].start_lba; + for (k = 0; k < gpt_part_count; k++) { + if (min_start_lba > gpt_parts[k].start_lba) + min_start_lba = gpt_parts[k].start_lba; + } + new_mbr_parts[0].end_lba = min_start_lba - 1; + i = 0; + } + + // add other GPT partitions until the table is full + // TODO: in the future, prioritize partitions by kind + for (; i < gpt_part_count && new_mbr_part_count < 4; i++) { + new_mbr_parts[new_mbr_part_count].index = new_mbr_part_count; + new_mbr_parts[new_mbr_part_count].start_lba = gpt_parts[i].start_lba; + new_mbr_parts[new_mbr_part_count].end_lba = gpt_parts[i].end_lba; + new_mbr_parts[new_mbr_part_count].mbr_type = gpt_parts[i].mbr_type; + new_mbr_parts[new_mbr_part_count].active = FALSE; + + // find matching partition in the old MBR table + for (k = 0; k < mbr_part_count; k++) { + if (mbr_parts[k].start_lba == gpt_parts[i].start_lba) { + // keep type if not detected + if (new_mbr_parts[new_mbr_part_count].mbr_type == 0) + new_mbr_parts[new_mbr_part_count].mbr_type = mbr_parts[k].mbr_type; + // keep active flag + new_mbr_parts[new_mbr_part_count].active = mbr_parts[k].active; + break; + } + } + + if (new_mbr_parts[new_mbr_part_count].mbr_type == 0) + // final fallback: set to a (hopefully) unused type + new_mbr_parts[new_mbr_part_count].mbr_type = 0xc0; + + new_mbr_part_count++; + } + + // make sure there's exactly one active partition + for (iter = 0; iter < 3; iter++) { + // check + count_active = 0; + for (i = 0; i < new_mbr_part_count; i++) + if (new_mbr_parts[i].active) + count_active++; + if (count_active == 1) + break; + + // set active on the first matching partition + if (count_active == 0) { + for (i = 0; i < new_mbr_part_count; i++) { + if ((iter >= 0 && (new_mbr_parts[i].mbr_type == 0x07 || // NTFS + new_mbr_parts[i].mbr_type == 0x0b || // FAT32 + new_mbr_parts[i].mbr_type == 0x0c)) || // FAT32 (LBA) + (iter >= 1 && (new_mbr_parts[i].mbr_type == 0x83)) || // Linux + (iter >= 2 && i > 0)) { + new_mbr_parts[i].active = TRUE; + break; + } + } + } else if (count_active > 1 && iter == 0) { + // too many active partitions, try deactivating the ESP / EFI Protective entry + if ((new_mbr_parts[0].mbr_type == 0xee || new_mbr_parts[0].mbr_type == 0xef) && + new_mbr_parts[0].active) { + new_mbr_parts[0].active = FALSE; + } + } else if (count_active > 1 && iter > 0) { + // too many active partitions, deactivate all but the first one + count_active = 0; + for (i = 0; i < new_mbr_part_count; i++) + if (new_mbr_parts[i].active) { + if (count_active > 0) + new_mbr_parts[i].active = FALSE; + count_active++; + } + } + } + + // dump table + Print(L"\nProposed new MBR partition table:\n"); + Print(L" # A Start LBA End LBA Type\n"); + for (i = 0; i < new_mbr_part_count; i++) { + Print(L" %d %s %12lld %12lld %02x %s\n", + new_mbr_parts[i].index + 1, + new_mbr_parts[i].active ? STR("*") : STR(" "), + new_mbr_parts[i].start_lba, + new_mbr_parts[i].end_lba, + new_mbr_parts[i].mbr_type, + mbr_parttype_name(new_mbr_parts[i].mbr_type)); + } + + return 0; +} + +// +// sync algorithm entry point +// + +UINTN gptsync(VOID) +{ + UINTN status = 0; + UINTN status_gpt, status_mbr; + // BOOLEAN proceed = FALSE; + + // get full information from disk + status_gpt = read_gpt(); + status_mbr = read_mbr(); + if (status_gpt != 0 || status_mbr != 0) + return (status_gpt || status_mbr); + + // cross-check current situation + Print(L"\n"); + status = check_gpt(); // check GPT for consistency + if (status != 0) + return status; + status = check_mbr(); // check MBR for consistency + if (status != 0) + return status; + status = analyze(); // analyze the situation & compose new MBR table + if (status != 0) + return status; + if (new_mbr_part_count == 0) + return status; + + // offer user the choice what to do + // status = input_boolean(STR("\nMay I update the MBR as printed above? [y/N] "), &proceed); + // if (status != 0 || proceed != TRUE) + // return status; + + // adjust the MBR and write it back + status = write_mbr(); + if (status != 0) + return status; + + return status; +} diff --git a/gptsync/gptsync.h b/gptsync/gptsync.h new file mode 100644 index 0000000..d1bf3c2 --- /dev/null +++ b/gptsync/gptsync.h @@ -0,0 +1,219 @@ +/* + * gptsync/gptsync.h + * Common header for gptsync and showpart + * + * Copyright (c) 2006 Christoph Pfisterer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Christoph Pfisterer nor the names of the + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// +// config +// + +#if defined(EFI32) || defined(EFIX64) +#define CONFIG_EFI +#endif + +// +// platform-dependent types +// + +#ifdef CONFIG_EFI + +#include +#include + +#define copy_guid(destguid, srcguid) (CopyMem(destguid, srcguid, 16)) +#define guids_are_equal(guid1, guid2) (CompareMem(guid1, guid2, 16) == 0) + +typedef CHAR16 CHARN; +#define STR(x) L##x + +#endif + + +#ifndef CONFIG_EFI + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +typedef int INTN; +typedef unsigned int UINTN; +typedef uint8_t UINT8; +typedef uint16_t UINT16; +typedef uint32_t UINT32; +typedef uint64_t UINT64; +typedef void VOID; + +typedef int BOOLEAN; +#ifndef FALSE +#define FALSE (0) +#endif +#ifndef TRUE +#define TRUE (1) +#endif + +typedef unsigned short CHAR16; +typedef char CHARN; +#define STR(x) x + +void Print(wchar_t *format, ...); + +// FUTURE: use STR(), #define Print printf + +#define CopyMem memcpy +#define SetMem memset +#define CompareMem memcmp + +#define copy_guid(destguid, srcguid) (memcpy(destguid, srcguid, 16)) +#define guids_are_equal(guid1, guid2) (memcmp(guid1, guid2, 16) == 0) + +#endif + +// +// platform-independent types +// + +typedef struct { + UINT8 flags; + UINT8 start_chs[3]; + UINT8 type; + UINT8 end_chs[3]; + UINT32 start_lba; + UINT32 size; +} MBR_PARTITION_INFO; + +typedef struct { + UINT8 type; + CHARN *name; +} MBR_PARTTYPE; + +typedef struct { + UINT64 signature; + UINT32 spec_revision; + UINT32 header_size; + UINT32 header_crc32; + UINT32 reserved; + UINT64 header_lba; + UINT64 alternate_header_lba; + UINT64 first_usable_lba; + UINT64 last_usable_lba; + UINT8 disk_guid[16]; + UINT64 entry_lba; + UINT32 entry_count; + UINT32 entry_size; + UINT32 entry_crc32; +} GPT_HEADER; + +typedef struct { + UINT8 type_guid[16]; + UINT8 partition_guid[16]; + UINT64 start_lba; + UINT64 end_lba; + UINT64 attributes; + CHAR16 name[36]; +} GPT_ENTRY; + +#define GPT_KIND_SYSTEM (0) +#define GPT_KIND_DATA (1) +#define GPT_KIND_BASIC_DATA (2) +#define GPT_KIND_FATAL (3) + +typedef struct { + UINT8 guid[16]; + UINT8 mbr_type; + CHARN *name; + UINTN kind; +} GPT_PARTTYPE; + +typedef struct { + UINTN index; + UINT64 start_lba; + UINT64 end_lba; + UINTN mbr_type; + UINT8 gpt_type[16]; + GPT_PARTTYPE *gpt_parttype; + BOOLEAN active; +} PARTITION_INFO; + +// +// functions provided by the OS-specific module +// + +UINTN read_sector(UINT64 lba, UINT8 *buffer); +UINTN write_sector(UINT64 lba, UINT8 *buffer); +UINTN input_boolean(CHARN *prompt, BOOLEAN *bool_out); + +// +// vars and functions provided by the common lib module +// + +extern UINT8 empty_guid[16]; + +extern PARTITION_INFO mbr_parts[4]; +extern UINTN mbr_part_count; +extern PARTITION_INFO gpt_parts[128]; +extern UINTN gpt_part_count; + +extern PARTITION_INFO new_mbr_parts[4]; +extern UINTN new_mbr_part_count; + +extern UINT8 sector[512]; + +extern MBR_PARTTYPE mbr_types[]; +extern GPT_PARTTYPE gpt_types[]; +extern GPT_PARTTYPE gpt_dummy_type; + +CHARN * mbr_parttype_name(UINT8 type); +UINTN read_mbr(VOID); + +GPT_PARTTYPE * gpt_parttype(UINT8 *type_guid); +UINTN read_gpt(VOID); + +UINTN detect_mbrtype_fs(UINT64 partlba, UINTN *parttype, CHARN **fsname); + +// +// actual platform-independent programs +// + +UINTN gptsync(VOID); +UINTN showpart(VOID); + +/* EOF */ diff --git a/gptsync/lib.c b/gptsync/lib.c new file mode 100644 index 0000000..271dc99 --- /dev/null +++ b/gptsync/lib.c @@ -0,0 +1,469 @@ +/* + * gptsync/lib.c + * Platform-independent code common to gptsync and showpart + * + * Copyright (c) 2006-2007 Christoph Pfisterer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Christoph Pfisterer nor the names of the + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "gptsync.h" + +// variables + +UINT8 empty_guid[16] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; + +PARTITION_INFO mbr_parts[4]; +UINTN mbr_part_count = 0; +PARTITION_INFO gpt_parts[128]; +UINTN gpt_part_count = 0; + +PARTITION_INFO new_mbr_parts[4]; +UINTN new_mbr_part_count = 0; + +UINT8 sector[512]; + +MBR_PARTTYPE mbr_types[] = { + { 0x01, STR("FAT12 (CHS)") }, + { 0x04, STR("FAT16 <32M (CHS)") }, + { 0x05, STR("Extended (CHS)") }, + { 0x06, STR("FAT16 (CHS)") }, + { 0x07, STR("NTFS/HPFS") }, + { 0x0b, STR("FAT32 (CHS)") }, + { 0x0c, STR("FAT32 (LBA)") }, + { 0x0e, STR("FAT16 (LBA)") }, + { 0x0f, STR("Extended (LBA)") }, + { 0x11, STR("Hidden FAT12 (CHS)") }, + { 0x14, STR("Hidden FAT16 <32M (CHS)") }, + { 0x16, STR("Hidden FAT16 (CHS)") }, + { 0x17, STR("Hidden NTFS/HPFS") }, + { 0x1b, STR("Hidden FAT32 (CHS)") }, + { 0x1c, STR("Hidden FAT32 (LBA)") }, + { 0x1e, STR("Hidden FAT16 (LBA)") }, + { 0x82, STR("Linux swap / Solaris") }, + { 0x83, STR("Linux") }, + { 0x85, STR("Linux Extended") }, + { 0x86, STR("NT FAT volume set") }, + { 0x87, STR("NTFS volume set") }, + { 0x8e, STR("Linux LVM") }, + { 0xa5, STR("FreeBSD") }, + { 0xa6, STR("OpenBSD") }, + { 0xa7, STR("NeXTSTEP") }, + { 0xa8, STR("Mac OS X UFS") }, + { 0xa9, STR("NetBSD") }, + { 0xab, STR("Mac OS X Boot") }, + { 0xac, STR("Apple RAID") }, + { 0xaf, STR("Mac OS X HFS+") }, + { 0xbe, STR("Solaris Boot") }, + { 0xbf, STR("Solaris") }, + { 0xeb, STR("BeOS") }, + { 0xee, STR("EFI Protective") }, + { 0xef, STR("EFI System (FAT)") }, + { 0xfd, STR("Linux RAID") }, + { 0, NULL }, +}; + +GPT_PARTTYPE gpt_types[] = { + { "\x28\x73\x2A\xC1\x1F\xF8\xD2\x11\xBA\x4B\x00\xA0\xC9\x3E\xC9\x3B", 0xef, STR("EFI System (FAT)"), GPT_KIND_SYSTEM }, + { "\x41\xEE\x4D\x02\xE7\x33\xD3\x11\x9D\x69\x00\x08\xC7\x81\xF3\x9F", 0x00, STR("MBR partition scheme"), GPT_KIND_FATAL }, + { "\x16\xE3\xC9\xE3\x5C\x0B\xB8\x4D\x81\x7D\xF9\x2D\xF0\x02\x15\xAE", 0x00, STR("MS Reserved"), GPT_KIND_SYSTEM }, + { "\xA2\xA0\xD0\xEB\xE5\xB9\x33\x44\x87\xC0\x68\xB6\xB7\x26\x99\xC7", 0x00, STR("Basic Data"), GPT_KIND_BASIC_DATA }, + { "\xAA\xC8\x08\x58\x8F\x7E\xE0\x42\x85\xD2\xE1\xE9\x04\x34\xCF\xB3", 0x00, STR("MS LDM Metadata"), GPT_KIND_FATAL }, + { "\xA0\x60\x9B\xAF\x31\x14\x62\x4F\xBC\x68\x33\x11\x71\x4A\x69\xAD", 0x00, STR("MS LDM Data"), GPT_KIND_FATAL }, + { "\x1E\x4C\x89\x75\xEB\x3A\xD3\x11\xB7\xC1\x7B\x03\xA0\x00\x00\x00", 0x00, STR("HP/UX Data"), GPT_KIND_DATA }, + { "\x28\xE7\xA1\xE2\xE3\x32\xD6\x11\xA6\x82\x7B\x03\xA0\x00\x00\x00", 0x00, STR("HP/UX Service"), GPT_KIND_SYSTEM }, + { "\x0F\x88\x9D\xA1\xFC\x05\x3B\x4D\xA0\x06\x74\x3F\x0F\x84\x91\x1E", 0xfd, STR("Linux RAID"), GPT_KIND_DATA }, + { "\x6D\xFD\x57\x06\xAB\xA4\xC4\x43\x84\xE5\x09\x33\xC8\x4B\x4F\x4F", 0x82, STR("Linux Swap"), GPT_KIND_SYSTEM }, + { "\x79\xD3\xD6\xE6\x07\xF5\xC2\x44\xA2\x3C\x23\x8F\x2A\x3D\xF9\x28", 0x8e, STR("Linux LVM"), GPT_KIND_DATA }, + { "\x39\x33\xA6\x8D\x07\x00\xC0\x60\xC4\x36\x08\x3A\xC8\x23\x09\x08", 0x00, STR("Linux Reserved"), GPT_KIND_SYSTEM }, + { "\xB4\x7C\x6E\x51\xCF\x6E\xD6\x11\x8F\xF8\x00\x02\x2D\x09\x71\x2B", 0xa5, STR("FreeBSD Data"), GPT_KIND_DATA }, + { "\xB5\x7C\x6E\x51\xCF\x6E\xD6\x11\x8F\xF8\x00\x02\x2D\x09\x71\x2B", 0x00, STR("FreeBSD Swap"), GPT_KIND_SYSTEM }, + { "\xB6\x7C\x6E\x51\xCF\x6E\xD6\x11\x8F\xF8\x00\x02\x2D\x09\x71\x2B", 0xa5, STR("FreeBSD UFS"), GPT_KIND_DATA }, + { "\xB8\x7C\x6E\x51\xCF\x6E\xD6\x11\x8F\xF8\x00\x02\x2D\x09\x71\x2B", 0x00, STR("FreeBSD Vinum"), GPT_KIND_DATA }, + { "\x00\x53\x46\x48\x00\x00\xAA\x11\xAA\x11\x00\x30\x65\x43\xEC\xAC", 0xaf, STR("Mac OS X HFS+"), GPT_KIND_DATA }, + { "\x00\x53\x46\x55\x00\x00\xAA\x11\xAA\x11\x00\x30\x65\x43\xEC\xAC", 0xa8, STR("Mac OS X UFS"), GPT_KIND_DATA }, + { "\x74\x6F\x6F\x42\x00\x00\xAA\x11\xAA\x11\x00\x30\x65\x43\xEC\xAC", 0xab, STR("Mac OS X Boot"), GPT_KIND_DATA }, + { "\x44\x49\x41\x52\x00\x00\xAA\x11\xAA\x11\x00\x30\x65\x43\xEC\xAC", 0xac, STR("Apple RAID"), GPT_KIND_DATA }, + { "\x44\x49\x41\x52\x4F\x5F\xAA\x11\xAA\x11\x00\x30\x65\x43\xEC\xAC", 0xac, STR("Apple RAID (Offline)"), GPT_KIND_DATA }, + { "\x65\x62\x61\x4C\x00\x6C\xAA\x11\xAA\x11\x00\x30\x65\x43\xEC\xAC", 0x00, STR("Apple Label"), GPT_KIND_SYSTEM }, + { "\x6F\x63\x65\x52\x65\x76\xAA\x11\xAA\x11\x00\x30\x65\x43\xEC\xAC", 0x00, STR("Apple Recovery"), GPT_KIND_BASIC_DATA }, + { "\x7f\x23\x96\x6A\xD2\x1D\xB2\x11\x99\xa6\x08\x00\x20\x73\x66\x31", 0x00, STR("Solaris Reserved"), GPT_KIND_SYSTEM }, + { "\x45\xCB\x82\x6A\xD2\x1D\xB2\x11\x99\xa6\x08\x00\x20\x73\x66\x31", 0xbf, STR("Solaris Boot"), GPT_KIND_DATA }, + { "\x4D\xCF\x85\x6A\xD2\x1D\xB2\x11\x99\xa6\x08\x00\x20\x73\x66\x31", 0xbf, STR("Solaris Root"), GPT_KIND_DATA }, + { "\x6F\xC4\x87\x6A\xD2\x1D\xB2\x11\x99\xa6\x08\x00\x20\x73\x66\x31", 0x00, STR("Solaris Swap"), GPT_KIND_SYSTEM }, + { "\xC3\x8C\x89\x6A\xD2\x1D\xB2\x11\x99\xa6\x08\x00\x20\x73\x66\x31", 0xbf, STR("Solaris Usr"), GPT_KIND_DATA }, + { "\x2B\x64\x8B\x6A\xD2\x1D\xB2\x11\x99\xa6\x08\x00\x20\x73\x66\x31", 0x00, STR("Solaris Backup"), GPT_KIND_SYSTEM }, + { "\xC7\x2A\x8D\x6A\xD2\x1D\xB2\x11\x99\xa6\x08\x00\x20\x73\x66\x31", 0xbf, STR("Solaris Stand"), GPT_KIND_DATA }, + { "\xE9\xF2\x8E\x6A\xD2\x1D\xB2\x11\x99\xa6\x08\x00\x20\x73\x66\x31", 0xbf, STR("Solaris Var"), GPT_KIND_DATA }, + { "\x39\xBA\x90\x6A\xD2\x1D\xB2\x11\x99\xa6\x08\x00\x20\x73\x66\x31", 0xbf, STR("Solaris Home"), GPT_KIND_DATA }, + { "\xA5\x83\x92\x6A\xD2\x1D\xB2\x11\x99\xa6\x08\x00\x20\x73\x66\x31", 0xbf, STR("Solaris ALTSCTR"), GPT_KIND_DATA }, + { "\x3B\x5A\x94\x6A\xD2\x1D\xB2\x11\x99\xa6\x08\x00\x20\x73\x66\x31", 0x00, STR("Solaris Cache"), GPT_KIND_SYSTEM }, + { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, 0, NULL, 0 }, +}; +GPT_PARTTYPE gpt_dummy_type = + { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, 0, STR("Unknown"), GPT_KIND_FATAL }; + +// +// MBR functions +// + +CHARN * mbr_parttype_name(UINT8 type) +{ + int i; + + for (i = 0; mbr_types[i].name; i++) + if (mbr_types[i].type == type) + return mbr_types[i].name; + return STR("Unknown"); +} + +UINTN read_mbr(VOID) +{ + UINTN status; + UINTN i; + BOOLEAN used; + MBR_PARTITION_INFO *table; + + Print(L"\nCurrent MBR partition table:\n"); + + // read MBR data + status = read_sector(0, sector); + if (status != 0) + return status; + + // check for validity + if (*((UINT16 *)(sector + 510)) != 0xaa55) { + Print(L" No MBR partition table present!\n"); + return 1; + } + table = (MBR_PARTITION_INFO *)(sector + 446); + for (i = 0; i < 4; i++) { + if (table[i].flags != 0x00 && table[i].flags != 0x80) { + Print(L" MBR partition table is invalid!\n"); + return 1; + } + } + + // check if used + used = FALSE; + for (i = 0; i < 4; i++) { + if (table[i].start_lba > 0 && table[i].size > 0) { + used = TRUE; + break; + } + } + if (!used) { + Print(L" No partitions defined\n"); + return 0; + } + + // dump current state & fill internal structures + Print(L" # A Start LBA End LBA Type\n"); + for (i = 0; i < 4; i++) { + if (table[i].start_lba == 0 || table[i].size == 0) + continue; + + mbr_parts[mbr_part_count].index = i; + mbr_parts[mbr_part_count].start_lba = (UINT64)table[i].start_lba; + mbr_parts[mbr_part_count].end_lba = (UINT64)table[i].start_lba + (UINT64)table[i].size - 1; + mbr_parts[mbr_part_count].mbr_type = table[i].type; + mbr_parts[mbr_part_count].active = (table[i].flags == 0x80) ? TRUE : FALSE; + + Print(L" %d %s %12lld %12lld %02x %s\n", + mbr_parts[mbr_part_count].index + 1, + mbr_parts[mbr_part_count].active ? STR("*") : STR(" "), + mbr_parts[mbr_part_count].start_lba, + mbr_parts[mbr_part_count].end_lba, + mbr_parts[mbr_part_count].mbr_type, + mbr_parttype_name(mbr_parts[mbr_part_count].mbr_type)); + + mbr_part_count++; + } + + return 0; +} + +// +// GPT functions +// + +GPT_PARTTYPE * gpt_parttype(UINT8 *type_guid) +{ + int i; + + for (i = 0; gpt_types[i].name; i++) + if (guids_are_equal(gpt_types[i].guid, type_guid)) + return &(gpt_types[i]); + return &gpt_dummy_type; +} + +UINTN read_gpt(VOID) +{ + UINTN status; + GPT_HEADER *header; + GPT_ENTRY *entry; + UINT64 entry_lba; + UINTN entry_count, entry_size, i; + + Print(L"\nCurrent GPT partition table:\n"); + + // read GPT header + status = read_sector(1, sector); + if (status != 0) + return status; + + // check signature + header = (GPT_HEADER *)sector; + if (header->signature != 0x5452415020494645ULL) { + Print(L" No GPT partition table present!\n"); + return 0; + } + if (header->spec_revision != 0x00010000UL) { + Print(L" Warning: Unknown GPT spec revision 0x%08x\n", header->spec_revision); + } + if ((512 % header->entry_size) > 0 || header->entry_size > 512) { + Print(L" Error: Invalid GPT entry size (misaligned or more than 512 bytes)\n"); + return 0; + } + + // read entries + entry_lba = header->entry_lba; + entry_size = header->entry_size; + entry_count = header->entry_count; + + for (i = 0; i < entry_count; i++) { + if (((i * entry_size) % 512) == 0) { + status = read_sector(entry_lba, sector); + if (status != 0) + return status; + entry_lba++; + } + entry = (GPT_ENTRY *)(sector + ((i * entry_size) % 512)); + + if (guids_are_equal(entry->type_guid, empty_guid)) + continue; + if (gpt_part_count == 0) { + Print(L" # Start LBA End LBA Type\n"); + } + + gpt_parts[gpt_part_count].index = i; + gpt_parts[gpt_part_count].start_lba = entry->start_lba; + gpt_parts[gpt_part_count].end_lba = entry->end_lba; + gpt_parts[gpt_part_count].mbr_type = 0; + copy_guid(gpt_parts[gpt_part_count].gpt_type, entry->type_guid); + gpt_parts[gpt_part_count].gpt_parttype = gpt_parttype(gpt_parts[gpt_part_count].gpt_type); + gpt_parts[gpt_part_count].active = FALSE; + + Print(L" %d %12lld %12lld %s\n", + gpt_parts[gpt_part_count].index + 1, + gpt_parts[gpt_part_count].start_lba, + gpt_parts[gpt_part_count].end_lba, + gpt_parts[gpt_part_count].gpt_parttype->name); + + gpt_part_count++; + } + if (gpt_part_count == 0) { + Print(L" No partitions defined\n"); + return 0; + } + + return 0; +} + +// +// detect file system type +// + +UINTN detect_mbrtype_fs(UINT64 partlba, UINTN *parttype, CHARN **fsname) +{ + UINTN status; + UINTN signature, score; + UINTN sectsize, clustersize, reserved, fatcount, dirsize, sectcount, fatsize, clustercount; + + *fsname = STR("Unknown"); + *parttype = 0; + + // READ sector 0 / offset 0K + status = read_sector(partlba, sector); + if (status != 0) + return status; + + // detect XFS + signature = *((UINT32 *)(sector)); + if (signature == 0x42534658) { + *parttype = 0x83; + *fsname = STR("XFS"); + return 0; + } + + // detect FAT and NTFS + sectsize = *((UINT16 *)(sector + 11)); + clustersize = sector[13]; + if (sectsize >= 512 && (sectsize & (sectsize - 1)) == 0 && + clustersize > 0 && (clustersize & (clustersize - 1)) == 0) { + // preconditions for both FAT and NTFS are now met + + if (CompareMem(sector + 3, "NTFS ", 8) == 0) { + *parttype = 0x07; + *fsname = STR("NTFS"); + return 0; + } + + score = 0; + // boot jump + if ((sector[0] == 0xEB && sector[2] == 0x90) || + sector[0] == 0xE9) + score++; + // boot signature + if (sector[510] == 0x55 && sector[511] == 0xAA) + score++; + // reserved sectors + reserved = *((UINT16 *)(sector + 14)); + if (reserved == 1 || reserved == 32) + score++; + // number of FATs + fatcount = sector[16]; + if (fatcount == 2) + score++; + // number of root dir entries + dirsize = *((UINT16 *)(sector + 17)); + // sector count (16-bit and 32-bit versions) + sectcount = *((UINT16 *)(sector + 19)); + if (sectcount == 0) + sectcount = *((UINT32 *)(sector + 32)); + // media byte + if (sector[21] == 0xF0 || sector[21] >= 0xF8) + score++; + // FAT size in sectors + fatsize = *((UINT16 *)(sector + 22)); + if (fatsize == 0) + fatsize = *((UINT32 *)(sector + 36)); + + // determine FAT type + dirsize = ((dirsize * 32) + (sectsize - 1)) / sectsize; + clustercount = sectcount - (reserved + (fatcount * fatsize) + dirsize); + clustercount /= clustersize; + + if (score >= 3) { + if (clustercount < 4085) { + *parttype = 0x01; + *fsname = STR("FAT12"); + } else if (clustercount < 65525) { + *parttype = 0x0e; + *fsname = STR("FAT16"); + } else { + *parttype = 0x0c; + *fsname = STR("FAT32"); + } + // TODO: check if 0e and 0c are okay to use, maybe we should use 06 and 0b instead... + return 0; + } + } + + // READ sector 2 / offset 1K + status = read_sector(partlba + 2, sector); + if (status != 0) + return status; + + // detect HFS+ + signature = *((UINT16 *)(sector)); + if (signature == 0x4442) { + *parttype = 0xaf; + if (*((UINT16 *)(sector + 0x7c)) == 0x2B48) + *fsname = STR("HFS Extended (HFS+)"); + else + *fsname = STR("HFS Standard"); + return 0; + } else if (signature == 0x2B48) { + *parttype = 0xaf; + *fsname = STR("HFS Extended (HFS+)"); + return 0; + } + + // detect ext2/ext3 + signature = *((UINT16 *)(sector + 56)); + if (signature == 0xEF53) { + *parttype = 0x83; + if (*((UINT16 *)(sector + 92)) & 0x0004) + *fsname = STR("ext3"); + else + *fsname = STR("ext2"); + return 0; + } + + // READ sector 128 / offset 64K + status = read_sector(partlba + 128, sector); + if (status != 0) + return status; + + // detect ReiserFS + if (CompareMem(sector + 52, "ReIsErFs", 8) == 0 || + CompareMem(sector + 52, "ReIsEr2Fs", 9) == 0 || + CompareMem(sector + 52, "ReIsEr3Fs", 9) == 0) { + *parttype = 0x83; + *fsname = STR("ReiserFS"); + return 0; + } + + // detect Reiser4 + if (CompareMem(sector, "ReIsEr4", 7) == 0) { + *parttype = 0x83; + *fsname = STR("Reiser4"); + return 0; + } + + // READ sector 64 / offset 32K + status = read_sector(partlba + 64, sector); + if (status != 0) + return status; + + // detect JFS + if (CompareMem(sector, "JFS1", 4) == 0) { + *parttype = 0x83; + *fsname = STR("JFS"); + return 0; + } + + // READ sector 16 / offset 8K + status = read_sector(partlba + 16, sector); + if (status != 0) + return status; + + // detect ReiserFS + if (CompareMem(sector + 52, "ReIsErFs", 8) == 0 || + CompareMem(sector + 52, "ReIsEr2Fs", 9) == 0 || + CompareMem(sector + 52, "ReIsEr3Fs", 9) == 0) { + *parttype = 0x83; + *fsname = STR("ReiserFS"); + return 0; + } + + return 0; +} diff --git a/gptsync/os_unix.c b/gptsync/os_unix.c new file mode 100644 index 0000000..b43685b --- /dev/null +++ b/gptsync/os_unix.c @@ -0,0 +1,267 @@ +/* + * gptsync/os_unix.c + * Unix OS glue for gptsync + * + * Copyright (c) 2006 Christoph Pfisterer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Christoph Pfisterer nor the names of the + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "gptsync.h" + +#include + +#define STRINGIFY(s) #s +#define STRINGIFY2(s) STRINGIFY(s) +#define PROGNAME_S STRINGIFY2(PROGNAME) + +// variables + +static int fd; + +// +// error functions +// + +void error(const char *msg, ...) +{ + va_list par; + char buf[4096]; + + va_start(par, msg); + vsnprintf(buf, 4096, msg, par); + va_end(par); + + fprintf(stderr, PROGNAME_S ": %s\n", buf); +} + +void errore(const char *msg, ...) +{ + va_list par; + char buf[4096]; + + va_start(par, msg); + vsnprintf(buf, 4096, msg, par); + va_end(par); + + fprintf(stderr, PROGNAME_S ": %s: %s\n", buf, strerror(errno)); +} + +// +// sector I/O functions +// + +UINTN read_sector(UINT64 lba, UINT8 *buffer) +{ + off_t offset; + off_t result_seek; + ssize_t result_read; + + offset = lba * 512; + result_seek = lseek(fd, offset, SEEK_SET); + if (result_seek != offset) { + errore("Seek to %llu failed", offset); + return 1; + } + + result_read = read(fd, buffer, 512); + if (result_read < 0) { + errore("Data read failed at position %llu", offset); + return 1; + } + if (result_read != 512) { + errore("Data read fell short at position %llu", offset); + return 1; + } + return 0; +} + +UINTN write_sector(UINT64 lba, UINT8 *buffer) +{ + off_t offset; + off_t result_seek; + ssize_t result_write; + + offset = lba * 512; + result_seek = lseek(fd, offset, SEEK_SET); + if (result_seek != offset) { + errore("Seek to %llu failed", offset); + return 1; + } + + result_write = write(fd, buffer, 512); + if (result_write < 0) { + errore("Data write failed at position %llu", offset); + return 1; + } + if (result_write != 512) { + errore("Data write fell short at position %llu", offset); + return 1; + } + return 0; +} + +// +// keyboard input +// + +UINTN input_boolean(CHARN *prompt, BOOLEAN *bool_out) +{ + int c; + + printf("%s", prompt); + fflush(NULL); + + c = getchar(); + if (c == EOF) + return 1; + + if (c == 'y' || c == 'Y') { + printf("Yes\n"); + *bool_out = TRUE; + } else { + printf("No\n"); + *bool_out = FALSE; + } + + return 0; +} + +// +// EFI-style print function +// + +void Print(wchar_t *format, ...) +{ + va_list par; + char formatbuf[256]; + char buf[4096]; + int i; + + for (i = 0; format[i]; i++) + formatbuf[i] = (format[i] > 255) ? '?' : (char)(format[i] & 0xff); + formatbuf[i] = 0; + + va_start(par, format); + vsnprintf(buf, 4096, formatbuf, par); + va_end(par); + + printf("%s", buf); +} + +// +// main entry point +// + +int main(int argc, char *argv[]) +{ + char *filename; + struct stat sb; + int filekind; + UINT64 filesize; + char *reason; + int status; + + // argument check + if (argc != 2) { + fprintf(stderr, "Usage: " PROGNAME_S " \n"); + return 1; + } + filename = argv[1]; + + // set input to unbuffered + fflush(NULL); + setvbuf(stdin, NULL, _IONBF, 0); + + // stat check + if (stat(filename, &sb) < 0) { + errore("Can't stat %.300s", filename); + return 1; + } + + filekind = 0; + filesize = 0; + reason = NULL; + if (S_ISREG(sb.st_mode)) + filesize = sb.st_size; + else if (S_ISBLK(sb.st_mode)) + filekind = 1; + else if (S_ISCHR(sb.st_mode)) + filekind = 2; + else if (S_ISDIR(sb.st_mode)) + reason = "Is a directory"; + else if (S_ISFIFO(sb.st_mode)) + reason = "Is a FIFO"; +#ifdef S_ISSOCK + else if (S_ISSOCK(sb.st_mode)) + reason = "Is a socket"; +#endif + else + reason = "Is an unknown kind of special file"; + + if (reason != NULL) { + error("%.300s: %s", filename, reason); + return 1; + } + + // open file + fd = open(filename, O_RDWR); + if (fd < 0 && errno == EBUSY) { + fd = open(filename, O_RDONLY); +#ifndef NOREADONLYWARN + if (fd >= 0) + printf("Warning: %.300s opened read-only\n", filename); +#endif + } + if (fd < 0) { + errore("Can't open %.300s", filename); + return 1; + } + + // (try to) guard against TTY character devices + if (filekind == 2) { + if (isatty(fd)) { + error("%.300s: Is a TTY device", filename); + return 1; + } + } + + // run sync algorithm + status = PROGNAME(); + printf("\n"); + + // close file + if (close(fd) != 0) { + errore("Error while closing %.300s", filename); + return 1; + } + + return status; +} diff --git a/gptsync/showpart.c b/gptsync/showpart.c new file mode 100644 index 0000000..3d52ba3 --- /dev/null +++ b/gptsync/showpart.c @@ -0,0 +1,257 @@ +/* + * gptsync/showpart.c + * Platform-independent code for analyzing hard disk partitioning + * + * Copyright (c) 2006 Christoph Pfisterer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Christoph Pfisterer nor the names of the + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "gptsync.h" + +// +// memory string search +// + +static INTN FindMem(VOID *Buffer, UINTN BufferLength, VOID *SearchString, UINTN SearchStringLength) +{ + UINT8 *BufferPtr; + UINTN Offset; + + BufferPtr = Buffer; + BufferLength -= SearchStringLength; + for (Offset = 0; Offset < BufferLength; Offset++, BufferPtr++) { + if (CompareMem(BufferPtr, SearchString, SearchStringLength) == 0) + return (INTN)Offset; + } + + return -1; +} + +// +// detect boot code +// + +static UINTN detect_bootcode(UINT64 partlba, CHARN **bootcodename) +{ + UINTN status; + BOOLEAN bootable; + + // read MBR data + status = read_sector(partlba, sector); + if (status != 0) + return status; + + // check bootable signature + if (*((UINT16 *)(sector + 510)) == 0xaa55 && sector[0] != 0) + bootable = TRUE; + else + bootable = FALSE; + *bootcodename = NULL; + + // detect specific boot codes + if (CompareMem(sector + 2, "LILO", 4) == 0 || + CompareMem(sector + 6, "LILO", 4) == 0) { + *bootcodename = STR("LILO"); + + } else if (CompareMem(sector + 3, "SYSLINUX", 8) == 0) { + *bootcodename = STR("SYSLINUX"); + + } else if (FindMem(sector, 512, "ISOLINUX", 8) >= 0) { + *bootcodename = STR("ISOLINUX"); + + } else if (FindMem(sector, 512, "Geom\0Hard Disk\0Read\0 Error\0", 27) >= 0) { + *bootcodename = STR("GRUB"); + + } else if ((*((UINT32 *)(sector + 502)) == 0 && + *((UINT32 *)(sector + 506)) == 50000 && + *((UINT16 *)(sector + 510)) == 0xaa55) || + FindMem(sector, 512, "Starting the BTX loader", 23) >= 0) { + *bootcodename = STR("FreeBSD"); + + } else if (FindMem(sector, 512, "!Loading", 8) >= 0 || + FindMem(sector, 512, "/cdboot\0/CDBOOT\0", 16) >= 0) { + *bootcodename = STR("OpenBSD"); + + } else if (FindMem(sector, 512, "NTLDR", 5) >= 0) { + *bootcodename = STR("Windows NTLDR"); + + } else if (FindMem(sector, 512, "BOOTMGR", 7) >= 0) { + *bootcodename = STR("Windows BOOTMGR (Vista)"); + + } else if (FindMem(sector, 512, "CPUBOOT SYS", 11) >= 0 || + FindMem(sector, 512, "KERNEL SYS", 11) >= 0) { + *bootcodename = STR("FreeDOS"); + + } else if (FindMem(sector, 512, "OS2LDR", 6) >= 0 || + FindMem(sector, 512, "OS2BOOT", 7) >= 0) { + *bootcodename = STR("eComStation"); + + } else if (FindMem(sector, 512, "Be Boot Loader", 14) >= 0) { + *bootcodename = STR("BeOS"); + + } else if (FindMem(sector, 512, "yT Boot Loader", 14) >= 0) { + *bootcodename = STR("ZETA"); + + } else if (FindMem(sector, 512, "\x04" "beos\x06" "system\x05" "zbeos", 18) >= 0) { + *bootcodename = STR("Haiku"); + + } + + if (FindMem(sector, 512, "Non-system disk", 15) >= 0) // dummy FAT boot sector + *bootcodename = STR("None (Non-system disk message)"); + + // TODO: Add a note if a specific code was detected, but the sector is not bootable? + + if (*bootcodename == NULL) { + if (bootable) + *bootcodename = STR("Unknown, but bootable"); + else + *bootcodename = STR("None"); + } + + return 0; +} + +// +// check one partition +// + +static UINTN analyze_part(UINT64 partlba) +{ + UINTN status; + UINTN i; + CHARN *bootcodename; + UINTN parttype; + CHARN *fsname; + + if (partlba == 0) + Print(L"\nMBR contents:\n"); + else + Print(L"\nPartition at LBA %lld:\n", partlba); + + // detect boot code + status = detect_bootcode(partlba, &bootcodename); + if (status) + return status; + Print(L" Boot Code: %s\n", bootcodename); + + if (partlba == 0) + return 0; // short-circuit MBR analysis + + // detect file system + status = detect_mbrtype_fs(partlba, &parttype, &fsname); + if (status) + return status; + Print(L" File System: %s\n", fsname); + + // cross-reference with partition table + for (i = 0; i < gpt_part_count; i++) { + if (gpt_parts[i].start_lba == partlba) { + Print(L" Listed in GPT as partition %d, type %s\n", i+1, + gpt_parts[i].gpt_parttype->name); + } + } + for (i = 0; i < mbr_part_count; i++) { + if (mbr_parts[i].start_lba == partlba) { + Print(L" Listed in MBR as partition %d, type %02x %s%s\n", i+1, + mbr_parts[i].mbr_type, + mbr_parttype_name(mbr_parts[i].mbr_type), + mbr_parts[i].active ? STR(", active") : STR("")); + } + } + + return 0; +} + +// +// check all partitions +// + +static UINTN analyze_parts(VOID) +{ + UINTN i, k; + UINTN status; + BOOLEAN is_dupe; + + // check MBR (bootcode only) + status = analyze_part(0); + if (status) + return status; + + // check partitions listed in GPT + for (i = 0; i < gpt_part_count; i++) { + status = analyze_part(gpt_parts[i].start_lba); + if (status) + return status; + } + + // check partitions listed in MBR, but not in GPT + for (i = 0; i < mbr_part_count; i++) { + if (mbr_parts[i].start_lba == 1 && mbr_parts[i].mbr_type == 0xee) + continue; // skip EFI Protective entry + + is_dupe = FALSE; + for (k = 0; k < gpt_part_count; k++) + if (gpt_parts[k].start_lba == mbr_parts[i].start_lba) + is_dupe = TRUE; + + if (!is_dupe) { + status = analyze_part(mbr_parts[i].start_lba); + if (status) + return status; + } + } + + return 0; +} + +// +// display algorithm entry point +// + +UINTN showpart(VOID) +{ + UINTN status = 0; + UINTN status_gpt, status_mbr; + + // get full information from disk + status_gpt = read_gpt(); + status_mbr = read_mbr(); + if (status_gpt != 0 || status_mbr != 0) + return (status_gpt || status_mbr); + + // analyze all partitions + status = analyze_parts(); + if (status != 0) + return status; + + return status; +} diff --git a/gptsync/syslinux_mbr.h b/gptsync/syslinux_mbr.h new file mode 100644 index 0000000..1c33e11 --- /dev/null +++ b/gptsync/syslinux_mbr.h @@ -0,0 +1,90 @@ +/* + * include/syslinux_mbr.h + * MBR boot code + * + * The boot code in this file was taken from syslinux-3.11. It is covered + * by the following license: + * + ; ----------------------------------------------------------------------- + ; + ; Copyright 2003-2004 H. Peter Anvin - All Rights Reserved + ; + ; Permission is hereby granted, free of charge, to any person + ; obtaining a copy of this software and associated documentation + ; files (the "Software"), to deal in the Software without + ; restriction, including without limitation the rights to use, + ; copy, modify, merge, publish, distribute, sublicense, and/or + ; sell copies of the Software, and to permit persons to whom + ; the Software is furnished to do so, subject to the following + ; conditions: + ; + ; The above copyright notice and this permission notice shall + ; be included in all copies or substantial portions of the Software. + ; + ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + ; OTHER DEALINGS IN THE SOFTWARE. + ; + ; ----------------------------------------------------------------------- + * + */ + +#ifndef __SYSLINUX_MBR_H__ +#define __SYSLINUX_MBR_H__ + + +#define MBR_BOOTCODE_SIZE (440) + + +#define SYSLINUX_MBR_SIZE (304) + +static UINT8 syslinux_mbr[SYSLINUX_MBR_SIZE] = { + 0xfa, 0x31, 0xc0, 0x8e, 0xd8, 0x8e, 0xc0, 0x8e, + 0xd0, 0xbc, 0x00, 0x7c, 0xfb, 0xfc, 0x89, 0xe6, + 0xbf, 0x00, 0x06, 0xb9, 0x00, 0x01, 0xf3, 0xa5, + 0xea, 0x1d, 0x06, 0x00, 0x00, 0x88, 0x16, 0x00, + 0x08, 0xb4, 0x08, 0xcd, 0x13, 0x31, 0xc0, 0x88, + 0xf0, 0x40, 0xa3, 0xf0, 0x06, 0x80, 0xe1, 0x3f, + 0x88, 0x0e, 0xf2, 0x06, 0xbe, 0xbe, 0x07, 0x31, + 0xc0, 0xb9, 0x04, 0x00, 0xf6, 0x04, 0x80, 0x74, + 0x03, 0x40, 0x89, 0xf7, 0x83, 0xc6, 0x10, 0xe2, + 0xf3, 0x83, 0xf8, 0x01, 0x75, 0x73, 0x8a, 0x16, + 0x00, 0x08, 0xb8, 0x00, 0x41, 0xbb, 0xaa, 0x55, + 0x31, 0xc9, 0x30, 0xf6, 0xf9, 0xcd, 0x13, 0x72, + 0x23, 0x81, 0xfb, 0x55, 0xaa, 0x75, 0x1d, 0xf6, + 0xc1, 0x01, 0x74, 0x18, 0x57, 0xbe, 0xe0, 0x06, + 0x8b, 0x5d, 0x08, 0x89, 0x5c, 0x08, 0x8b, 0x5d, + 0x0a, 0x89, 0x5c, 0x0a, 0x8a, 0x16, 0x00, 0x08, + 0xb4, 0x42, 0xeb, 0x2a, 0x57, 0x8b, 0x45, 0x08, + 0x8b, 0x55, 0x0a, 0xf7, 0x36, 0xf2, 0x06, 0x42, + 0x89, 0xd1, 0x31, 0xd2, 0xf7, 0x36, 0xf0, 0x06, + 0x88, 0xc5, 0xd1, 0xe8, 0xd1, 0xe8, 0x24, 0xc0, + 0x08, 0xc1, 0x88, 0xd6, 0x8a, 0x16, 0x00, 0x08, + 0xbb, 0x00, 0x7c, 0xb8, 0x01, 0x02, 0xcd, 0x13, + 0x72, 0x16, 0x5e, 0x81, 0x3e, 0xfe, 0x7d, 0x55, + 0xaa, 0x75, 0x08, 0xfa, 0xea, 0x00, 0x7c, 0x00, + 0x00, 0x77, 0x05, 0xbe, 0xf4, 0x06, 0xeb, 0x03, + 0xbe, 0x0f, 0x07, 0xac, 0x20, 0xc0, 0x74, 0x0c, + 0xb4, 0x0e, 0x8a, 0x3e, 0x62, 0x04, 0xb3, 0x07, + 0xcd, 0x10, 0xeb, 0xef, 0xeb, 0xfe, 0x00, 0x00, + 0x10, 0x00, 0x01, 0x00, 0x00, 0x7c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x4d, 0x69, 0x73, 0x73, + 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x0d, 0x0a, 0x00, 0x4f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, + 0x20, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x20, + 0x6c, 0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x0d, 0x0a, 0x00 +}; + + +#endif /* __SYSLINUX_MBR_H__ */ + +/* EOF */ diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index 1d3679f..ef65bf0 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -99,6 +99,11 @@ cd - %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-install-node %{buildroot}%{_sbindir} %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-uninstall-node %{buildroot}%{_sbindir} +# gptsync +%{__install} -p -m0755 gptsync/gptsync %{buildroot}%{_sbindir} +%{__install} -p -m0755 gptsync/showpart %{buildroot}%{_sbindir} +# + %{__install} -p -m0644 scripts/ovirt-functions %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-early %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-firstboot %{buildroot}%{_initrddir} @@ -176,6 +181,8 @@ fi %{_sbindir}/ovirt-listen-awake %{_sbindir}/ovirt-install-node %{_sbindir}/ovirt-uninstall-node +%{_sbindir}/gptsync +%{_sbindir}/showpart %{_initrddir}/ovirt-early %{_initrddir}/ovirt-firstboot %{_initrddir}/ovirt -- 1.5.6.5 From apevec at redhat.com Sun Nov 30 10:23:01 2008 From: apevec at redhat.com (Alan Pevec) Date: Sun, 30 Nov 2008 11:23:01 +0100 Subject: [Ovirt-devel] [PATCH node-image] minimal ovirt-node-image-pxe subpackage Message-ID: <1228040581-18741-1-git-send-email-apevec@redhat.com> contains only %post script which installs the PXE image in Cobbler, using the ISO from the main ovirt-node-image package --- ovirt-node-image.spec.in | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/ovirt-node-image.spec.in b/ovirt-node-image.spec.in index 009a499..eab9cee 100644 --- a/ovirt-node-image.spec.in +++ b/ovirt-node-image.spec.in @@ -29,6 +29,14 @@ Requires: appliance-tools >= 003.9 The ISO boot image for oVirt Node booting from CDROM device. At the moment, this RPM just packages prebuilt ISO. +%package pxe +Summary: oVirt Node PXE image +Group: Applications/System +Requires: %{name} = %{version}-%{release} + +%description pxe +PXE boot image installer for oVirt Node network boot from oVirt Server. + %prep %setup -q %if ! %{source_iso} @@ -60,6 +68,12 @@ mkdir %{buildroot} %clean %{__rm} -rf %{buildroot} +%post pxe +cd %{app_root} +rm -rf tftpboot +ovirt-pxe %{name}.iso > /dev/null +cobbler sync > /dev/null 2>&1 || : + %files %defattr(-,root,root,0644) %{app_root}/%{name}.iso @@ -71,6 +85,9 @@ mkdir %{buildroot} %{_sbindir}/edit-livecd %{_sbindir}/livecd-setauth +%files pxe +%defattr(0644,root,root,0755) + %changelog * Thu Jul 03 2008 Perry Myers 0.92-0 - Only store ISO in SRPM, and generate PXE from that during build -- 1.5.6.5 From apevec at redhat.com Sun Nov 30 15:07:12 2008 From: apevec at redhat.com (Alan Pevec) Date: Sun, 30 Nov 2008 16:07:12 +0100 Subject: [Ovirt-devel] Re: [PATCH node-image] Add minimal python into the Node In-Reply-To: <1227246750-22792-1-git-send-email-pmyers@redhat.com> References: <1227246750-22792-1-git-send-email-pmyers@redhat.com> Message-ID: <4932AC20.8010507@redhat.com> Perry Myers wrote: > core python libs and interpreter are added to facilitate scripting > Node size increases by approx 4MB compressed > > This patch removes all of the .py files installed by python RPM > since the .pyc and .pyo files are already present and the source > shouldn't be strictly needed. ACK, thanks! We can now use python for the next version of ovirt-config-* scripts, current ones are taking shell scripting to the limit. Pushed with the additional removal of .pyo files b/c optimized bytecode doesn't help much and we save 2MB. Side-effect is that python -O doesn't work, but that's not much used anyway - on my machine I found -O used only by /usr/bin/alacarte and /usr/bin/rpmlint scripts. From rjones at redhat.com Sun Nov 30 17:07:22 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Sun, 30 Nov 2008 17:07:22 +0000 Subject: [Ovirt-devel] ovirt-viewer - a standalone console viewer for oVirt Message-ID: <20081130170722.GA17136@thinkpad> ovirt-viewer is a standalone console viewer application. It is basically a fork of virt-viewer[1], but customized towards ovirt. It can contact the ovirt web interface, authenticate the user, and connect automatically to available virtual machines. For the moment, source only is available here: http://git.et.redhat.com/?p=ovirt-viewer.git;a=summary I'll try and make some Linux and Windows binaries of the app available next week. It's also somewhat alpha at the moment, so ask me if you have any problems. You also need the attached patch on the WUI appliance [note: patch is not final]. Rich. [1] http://freshmeat.net/projects/virtviewer/ -------------- next part -------------- diff --git a/src/app/controllers/vm_controller.rb b/src/app/controllers/vm_controller.rb index ff74a37..459f183 100644 --- a/src/app/controllers/vm_controller.rb +++ b/src/app/controllers/vm_controller.rb @@ -25,6 +25,13 @@ class VmController < ApplicationController before_filter :pre_vm_action, :only => [:vm_action, :cancel_queued_tasks, :console] + def index + @vms = Vm.find(:all) + respond_to do |format| + format.xml { render :xml => @vms.to_xml } + end + end + def show set_perms(@perm_obj) @actions = @vm.get_action_hash(@user) diff --git a/src/config/routes.rb b/src/config/routes.rb index 8d538cb..7e70c92 100644 --- a/src/config/routes.rb +++ b/src/config/routes.rb @@ -55,5 +55,5 @@ ActionController::Routing::Routes.draw do |map| hardware_pools.resources :hosts, :controller => 'host' hardware_pools.resources :storage_pools, :controller => 'storage' end - + map.resources :vms, :controller => 'vm' end From phr at cally.be Sat Nov 15 16:36:10 2008 From: phr at cally.be (Philippe Rodrigues) Date: Sat, 15 Nov 2008 16:36:10 -0000 Subject: [Ovirt-devel] ovirt-appliance 0.95 issue ! Message-ID: <20318.83.134.15.251.1226766955.squirrel@webmail.cally.be> Hi all, First of all, thanks to everybody for your good job. Sorry for my english, I'm not fluent ;-). This is my issue; 1. Made a Fedora 9 fresh install (virtualization enable) with all updates. 2. Follow "install instructions" - Getting Ovirt RPMs - Installing and Running the Appliance (install-node stateful) 3. Reboot. In rebooting step, I saw a problem with collectd deamon (maybe cannot connect ...) 4. I start ovirt-appliance and in the virt-viewer have a kernel panic ! For your information, I encountered the same issue with the previous version (0.93-1) but not with 0.92-1 release ! In attachment, screenshot of ovirt-appliance and collectd log file. Thanks for your help. Best regards, Philippe Rodrigues -------------- next part -------------- A non-text attachment was scrubbed... Name: Screenshot-ovirt-appliance - Virt Viewer.png Type: image/png Size: 20953 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: collectd.log Type: application/octet-stream Size: 12316 bytes Desc: not available URL: From vignesh at atc.tcs.com Fri Nov 28 11:27:08 2008 From: vignesh at atc.tcs.com (Vigneswaran R) Date: Fri, 28 Nov 2008 16:57:08 +0530 Subject: [Ovirt-devel] Re: ovirt-appliance panic on boot Message-ID: <492FD58C.9080605@atc.tcs.com> Hello, > On 11.11.2008, at 20:57, Alan Pevec wrote: > > Thomas von Steiger wrote: > > I get the same problem with version 0.95. > Thomas > On 11.11.2008, at 19:31, Dennis J. wrote: > > Hi, > > I just installed ovirt version 0.95 and when I start the appliance it panics with the following message: > > RAMDISK: Couldn't find valid RAM disk image starting at 0. > VFS: Cannot open root device "sda2" or unknown-block(0,0) > > Please append a correct "root=" boot option; here are the available partitions: Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) > > Is this a known issue and how can I get the appliance to boot up properly? > > is this i386 or x86_64 ? > > > it's i386. We were also facing the same problem. We solved the problem by recreating the initrd file. Details, 1. mount the ovirt-appliance image # nohup qemu-nbd /var/lib/libvirt/images/ovirt-appliance.img & # modprobe nbd # nbd-client localhost 1024 /dev/nbd0 # kpartx -a /dev/nbd0 # mount /dev/mapper/nbd0p2 /mnt # mount /dev/mapper/nbd0p1 /mnt/boot 2. do a chroot, backup the initrd image and recreate it # chroot /mnt # mv /boot/initrd-2.6.26.6-79.fc9.i686 /root # mkinitrd /boot/initrd-2.6.26.6-79.fc9.i686 2.6.26.6-79.fc9.i686 # exit 3. unmount # umount /mnt # kpartx -d /dev/nbd0 # nbd-client -d /dev/nbd0 4. boot the machine # virsh start ovirt-appliance It solved our problem. ref: http://ovirt.org/page/TroubleShooting Vignesh