+++ /dev/null
-#!/usr/bin/perl -w
-# This is part of "osstest", an automated testing framework for Xen.
-# Copyright (C) 2017 Citrix Inc.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# 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 Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-use strict qw(vars);
-use DBI;
-BEGIN { unshift @INC, qw(.); }
-use Osstest;
-use File::Path;
-use POSIX;
-use Osstest::TestSupport;
-
-
-tsreadconfig();
-
-our @hos;
-
-if (!@ARGV) {
- push @ARGV, 'host';
-}
-foreach my $k (@ARGV) {
- push @hos, selecthost($k);
-}
-
-our $ho;
-
-sub packages_setup () {
- my $repos_url = $r{CentosReposUrl} // (
- "http://cbs.centos.org/repos/virt\$releasever-xen-48-candidate/\$basearch/os/".
- ",http://cbs.centos.org/repos/virt\$releasever-xen-common-candidate/\$basearch/os/"
- );
-
- my @repos_url = ();
- while ($repos_url =~ s/^([^,]+),(.*)$/$2/) {
- push @repos_url, "$1";
- }
- push @repos_url, "$repos_url";
- my $repos = '';
- my $yum_repo_number = 1;
- foreach my $url (@repos_url) {
- $repos .= <<END;
-[osstest-repo-$yum_repo_number]
-name=osstest-repo-$yum_repo_number
-baseurl=$url
-gpgcheck=0
-END
- $yum_repo_number += 1;
- }
- target_putfilecontents_root_stash($ho, 10, $repos,
- "/etc/yum.repos.d/Osstest.repo");
-
- # This packages in necessary, in order to get the right kernel
- # It pull /usr/bin/grub-bootxen.sh (helper to boot Xen by default).
- target_install_packages($ho, qw(centos-release-xen-common));
-
- target_cmd_root($ho, 'yum -y update', 30*60);
-
- my @xen_packages = qw(xen);
- # For vncpasswd
- push @xen_packages, 'tigervnc-server-minimal';
- push @xen_packages, qw(libvirt-daemon-xen libvirt-client)
- if toolstack($ho)->{Name} eq "libvirt";
- target_install_packages($ho, @xen_packages);
-
- if ($ho->{CentosRelease} == 6) {
- target_cmd_root($ho, "grubby --update-kernel=/boot/xen.gz --args='console=hvc0'");
- }
-}
-
-sub adjustconfig () {
- target_editfile_root($ho, '/etc/sysconfig/xencommons',
- sub { target_editfile_kvp_replace("XENCONSOLED_TRACE", "guest") });
-
- target_editfile_root($ho, '/etc/libvirt/libvirtd.conf',
- sub { target_editfile_kvp_replace("log_level", "1") })
- if toolstack($ho)->{Name} eq "libvirt";
-}
-
-
-sub setupboot () {
- logm("ready to boot Xen");
-}
-
-sub setupbridge () {
- my $bridge_xenbr0 = <<END;
-DEVICE=xenbr0
-STP=no
-BRIDGING_OPTS="hello_time=0"
-TYPE=Bridge
-BOOTPROTO=dhcp
-ONBOOT=yes
-END
- target_putfilecontents_root_stash($ho, 10, $bridge_xenbr0,
- "/etc/sysconfig/network-scripts/ifcfg-xenbr0");
-
- # Should be setup by install
- target_editfile_root($ho, "/etc/sysconfig/network-scripts/ifcfg-osstest-if0",
- sub { target_editfile_kvp_replace("BRIDGE", "xenbr0") });
- target_editfile_root($ho, "/etc/sysconfig/network-scripts/ifcfg-osstest-if0",
- sub { target_editfile_kvp_replace("BOOTPROTO", "none") });
-
-
-}
-
-die if @hos > 1;
-$ho= $hos[0];
-packages_setup();
-adjustconfig();
-setupboot();
-setupbridge();