vagrant-xenserver 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +103 -25
- data/example_box/install_wheezy.sh +128 -0
- data/example_box/mkbox.sh +17 -0
- data/lib/vagrant-xenserver/action.rb +14 -4
- data/lib/vagrant-xenserver/action/clone_disk.rb +1 -1
- data/lib/vagrant-xenserver/action/clone_vm.rb +35 -0
- data/lib/vagrant-xenserver/action/connect_xs.rb +19 -11
- data/lib/vagrant-xenserver/action/create_template.rb +86 -0
- data/lib/vagrant-xenserver/action/create_vifs.rb +44 -23
- data/lib/vagrant-xenserver/action/create_vm.rb +14 -10
- data/lib/vagrant-xenserver/action/destroy_vm.rb +9 -6
- data/lib/vagrant-xenserver/action/download_xva.rb +96 -0
- data/lib/vagrant-xenserver/action/halt_vm.rb +1 -5
- data/lib/vagrant-xenserver/action/prepare_nfs_valid_ids.rb +1 -1
- data/lib/vagrant-xenserver/action/read_ssh_info.rb +48 -12
- data/lib/vagrant-xenserver/action/read_state.rb +4 -5
- data/lib/vagrant-xenserver/action/resume_vm.rb +3 -3
- data/lib/vagrant-xenserver/action/set_vm_params.rb +28 -0
- data/lib/vagrant-xenserver/action/start_vm.rb +7 -2
- data/lib/vagrant-xenserver/action/suspend_vm.rb +3 -3
- data/lib/vagrant-xenserver/action/upload_vhd.rb +130 -115
- data/lib/vagrant-xenserver/action/upload_xva.rb +63 -50
- data/lib/vagrant-xenserver/config.rb +45 -0
- data/lib/vagrant-xenserver/errors.rb +20 -0
- data/lib/vagrant-xenserver/plugin.rb +8 -0
- data/lib/vagrant-xenserver/util/exnhandler.rb +49 -0
- data/lib/vagrant-xenserver/version.rb +1 -1
- data/locales/en.yml +20 -1
- data/vagrant-xenserver.gemspec +1 -0
- metadata +24 -5
- data/lib/vagrant-xenserver/action/maybe_upload_disk.rb +0 -85
- data/test +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0cec68cbb7af733bd030330a8220b43d73c06b4
|
4
|
+
data.tar.gz: 6d87fb9aa7926950fbaa93df55d395bcfd190032
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f993a2dd8ff4737cf27bc81f3e255af09e3f7f4723c2640ff741a254dc2df846c730e69a65a159b1705bbd1d0fdb9fb818e401f63c3da6e2a23751411258d7ae
|
7
|
+
data.tar.gz: 2ec61fc6f4638f0a77e9051d7744c95e3e43147f5ee7db75c2b90dbda821dfcf0c32e9a1fea6f0749e4ace92f85747e4e185a3295aaeaa44699e15b06849b44d
|
data/README.md
CHANGED
@@ -4,32 +4,63 @@ This is a Vagrant plugin that adds a XenServer provider, allowing Vagrant to
|
|
4
4
|
control and provision machines on a XenServer host.
|
5
5
|
|
6
6
|
## Dependencies
|
7
|
-
* Vagrant >= 1.5
|
7
|
+
* Vagrant >= 1.5 (http://www.vagrantup.com/downloads.html)
|
8
|
+
* qemu-img
|
8
9
|
|
9
10
|
## Installation
|
10
11
|
```shell
|
11
12
|
vagrant plugin install vagrant-xenserver
|
12
13
|
```
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
# XenServer setup
|
16
|
+
|
17
|
+
Make sure the default_SR is set, and that a VHD-based SR is in
|
18
|
+
use. Currently the NFS SR is the recommended storage type.
|
19
|
+
|
20
|
+
# Usage
|
21
|
+
|
22
|
+
## Boxes
|
23
|
+
|
24
|
+
Vagrant-xenserver supports 3 types of boxes today. These are:
|
25
|
+
|
26
|
+
1. XVA URL - the box simply contains a URL that points to an XVA
|
27
|
+
(XenServer export) file.
|
28
|
+
2. XVA - the box contains an XVA (XenServer export).
|
29
|
+
3. VHD - the box contains a VHD file.
|
30
|
+
|
31
|
+
The recommended format is either 1 or 2, and it is suggested that
|
32
|
+
Packer is used to create the XVA files, which is available from
|
33
|
+
https://github.com/xenserver/packer-builder-xenserver . If this is not
|
34
|
+
available, there is an example script in the `example_box` directory
|
35
|
+
that automatically installs a Debian Wheezy guest and exports it. Once
|
36
|
+
an XVA file has been built, this can be turned into a box by archiving
|
37
|
+
it with `tar` with an included `metadata.json` and optionally a
|
38
|
+
`Vagrantfile`. For example, assuming an XVA has been created called
|
39
|
+
`ubuntu-15.10-amd64.xva`, to create an XVA URL box, upload the XVA to
|
40
|
+
your webserver and execute the following:
|
41
|
+
|
16
42
|
```shell
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
/
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
/sbin/iptables -A FORWARD -i xenbr0 -o xenapi -m state --state RELATED,ESTABLISHED -j ACCEPT
|
27
|
-
/sbin/iptables -A FORWARD -i xenapi -o xenbr0 -j ACCEPT
|
43
|
+
echo "{\"provider\": \"xenserver\"}" > metadata.json
|
44
|
+
cat > Vagrantfile <<EOF
|
45
|
+
Vagrant.configure(2) do |config|
|
46
|
+
config.vm.provider :xenserver do |xs|
|
47
|
+
xs.xva_url = "http://my.web.server/ubuntu-15.10-amd64.xva"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
EOF
|
51
|
+
tar cf ubuntu.box metadata.json Vagrantfile
|
28
52
|
```
|
29
53
|
|
30
|
-
|
54
|
+
Or to create an XVA box:
|
55
|
+
|
56
|
+
```shell
|
57
|
+
echo "{\"provider\": \"xenserver\"}" > metadata.json
|
58
|
+
cp /path/to/ubuntu-15.10-amd64.xva box.xva
|
59
|
+
tar cf ubuntu.box metadata.json Vagrantfile
|
60
|
+
```
|
31
61
|
|
32
|
-
|
62
|
+
VHD based boxes are useful if you are converting from a box from
|
63
|
+
another provider. For example, to convert a VirtualBox box file:
|
33
64
|
|
34
65
|
* Download the box file (e.g. https://vagrantcloud.com/ubuntu/trusty64/version/1/provider/virtualbox.box)
|
35
66
|
* Unpack it:
|
@@ -52,9 +83,18 @@ echo "{\"provider\": \"xenserver\"}" > metadata.json
|
|
52
83
|
```
|
53
84
|
* Create the box:
|
54
85
|
```shell
|
55
|
-
tar cf ../
|
86
|
+
tar cf ../ubuntu.box .
|
56
87
|
```
|
57
|
-
|
88
|
+
|
89
|
+
Note that since v0.0.12, vagrant-xenserver will assume by default that
|
90
|
+
boxes have the XenServer tools installed, which may not be the case
|
91
|
+
for converted boxes.
|
92
|
+
|
93
|
+
## Add the box
|
94
|
+
|
95
|
+
Once you've created your box, this can simply be added to vagrant with
|
96
|
+
the following:
|
97
|
+
|
58
98
|
```shell
|
59
99
|
vagrant box add ubuntu xenserver.box
|
60
100
|
```
|
@@ -72,18 +112,56 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
72
112
|
config.vm.box = "ubuntu"
|
73
113
|
|
74
114
|
config.vm.provider :xenserver do |xs|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
115
|
+
xs.xs_host = "st29.uk.xensource.com"
|
116
|
+
xs.xs_username = "root"
|
117
|
+
xs.xs_password = "xenroot"
|
118
|
+
xs.pv = true
|
119
|
+
xs.memory = 2048
|
120
|
+
xs.use_himn = false
|
80
121
|
end
|
81
|
-
end
|
82
122
|
|
123
|
+
config.vm.network "public_network", bridge: "xenbr0"
|
124
|
+
end
|
83
125
|
```
|
84
126
|
|
85
|
-
|
127
|
+
Note that by default there will be no connection to the external
|
128
|
+
network, so most configurations will require a 'public_network'
|
129
|
+
defined as in the above Vagrantfile. To bring the VM up, it should
|
130
|
+
then be as simple as
|
86
131
|
|
87
132
|
```shell
|
88
133
|
vagrant up --provider=xenserver
|
89
134
|
```
|
135
|
+
|
136
|
+
## XenServer host setup for HIMN forwarding
|
137
|
+
|
138
|
+
Since v0.0.12, boxes are assumed to have XenServer tools installed to
|
139
|
+
report the IP address. If the tools are not installed in the box, the
|
140
|
+
plugin supports using the 'host internal management network' (HIMN),
|
141
|
+
which is an internal-only network on which a DHCP server runs. Use of
|
142
|
+
this requires additional setup of dom0:
|
143
|
+
|
144
|
+
N.B. Currently this will only work on XenServer 6.5 and later:
|
145
|
+
```shell
|
146
|
+
# Install netcat (XenServer 7.0 onwards)
|
147
|
+
yum install --enablerepo=base,extras -y nc
|
148
|
+
# Install netcat (XenServer 6.5)
|
149
|
+
yum install --enablerepo=base,extras --disablerepo=citrix -y nc
|
150
|
+
```
|
151
|
+
|
152
|
+
You will also need to copy your ssh key to the Xenserver host:
|
153
|
+
|
154
|
+
ssh-copy-id root@xenserver
|
155
|
+
|
156
|
+
# Changes since 0.0.11
|
157
|
+
Note that since v0.0.11 the use of the host internal management network is now
|
158
|
+
not default. For backwards compatibility, add `use_himn = true` to the provider
|
159
|
+
specific settings in the Vagrantfile. For example:
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
config.vm.provider :xenserver do |xs|
|
163
|
+
xs.use_himn = true
|
164
|
+
end
|
165
|
+
```
|
166
|
+
|
167
|
+
|
@@ -0,0 +1,128 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
set -x
|
5
|
+
|
6
|
+
SERVER=$1
|
7
|
+
USERNAME=$2
|
8
|
+
PASSWORD=$3
|
9
|
+
VMNAME=wheezy
|
10
|
+
DOMAINNAME=local
|
11
|
+
|
12
|
+
SERVERIP=`dig +search +short $SERVER`
|
13
|
+
|
14
|
+
if [ "x$SERVERIP" == "x" ]; then
|
15
|
+
SERVERIP=$SERVER
|
16
|
+
fi
|
17
|
+
|
18
|
+
template=`ssh root@$SERVER "xe template-list name-label='Debian Wheezy 7.0 (64-bit)' --minimal"`
|
19
|
+
vm=`ssh root@$SERVER xe vm-install template=$template new-name-label=$VMNAME`
|
20
|
+
network=`ssh root@$SERVER xe network-list bridge=xenbr0 --minimal`
|
21
|
+
vif=`ssh root@$SERVER xe vif-create vm-uuid=$vm network-uuid=$network device=0`
|
22
|
+
ssh root@$SERVER xe vm-cd-add uuid=$vm cd-name=guest-tools.iso device=3 || ssh root@$SERVER xe vm-cd-add uuid=$vm cd-name=xs-tools.iso device=3
|
23
|
+
|
24
|
+
preseed_blob=`ssh root@$SERVER xe blob-create vm-uuid=$vm name=preseed public=true`
|
25
|
+
preseed_file=/tmp/preseed
|
26
|
+
|
27
|
+
postinstall_blob=`ssh root@$SERVER xe blob-create vm-uuid=$vm name=postinstall public=true`
|
28
|
+
postinstall_file=/tmp/postinstall
|
29
|
+
|
30
|
+
cat > $preseed_file <<EOF
|
31
|
+
d-i debian-installer/locale string en_GB
|
32
|
+
d-i keyboard-configuration/layoutcode string en_GB
|
33
|
+
d-i keyboard-configuration/xkb-keymap string en_GB
|
34
|
+
d-i mirror/country string manual
|
35
|
+
d-i mirror/http/hostname string ftp.uk.debian.org
|
36
|
+
d-i mirror/http/directory string /debian/
|
37
|
+
d-i mirror/http/proxy string
|
38
|
+
#d-i debian-installer/allow_unauthenticated string true
|
39
|
+
#d-i anna/no_kernel_modules boolean true
|
40
|
+
d-i time/zone string string Europe/London
|
41
|
+
d-i partman-auto/method string regular
|
42
|
+
d-i partman-auto/choose_recipe \
|
43
|
+
select All files in one partition (recommended for new users)
|
44
|
+
d-i partman/confirm_write_new_label boolean true
|
45
|
+
d-i partman/choose_partition \
|
46
|
+
select Finish partitioning and write changes to disk
|
47
|
+
d-i partman/confirm boolean true
|
48
|
+
d-i partman/confirm_nooverwrite boolean true
|
49
|
+
|
50
|
+
d-i passwd/make-user boolean true
|
51
|
+
|
52
|
+
d-i passwd/user-fullname string vagrant
|
53
|
+
d-i passwd/user-password password vagrant
|
54
|
+
d-i passwd/user-password-again password vagrant
|
55
|
+
d-i passwd/username string vagrant
|
56
|
+
|
57
|
+
d-i passwd/root-password-again password vagrant
|
58
|
+
d-i passwd/root-password password vagrant
|
59
|
+
|
60
|
+
d-i apt-setup/local0/repository string http://www.uk.xensource.com/deb-guest lenny main
|
61
|
+
d-i debian-installer/allow_unauthenticated boolean true
|
62
|
+
|
63
|
+
popularity-contest popularity-contest/participate boolean false
|
64
|
+
tasksel tasksel/first multiselect standard
|
65
|
+
d-i pkgsel/include string openssh-server vim ntp ethtool tpcdump bridge-util rsync ssmtp strace gdb build-essential xe-guest-utilities wget sudo
|
66
|
+
#d-i mirror/udeb/suite string squeeze
|
67
|
+
#d-i mirror/suite string squeeze
|
68
|
+
#d-i mirror/udeb/suite string sid
|
69
|
+
#d-i mirror/suite string sid
|
70
|
+
d-i grub-installer/only_debian boolean true
|
71
|
+
d-i grub-installer/with_other_os boolean true
|
72
|
+
d-i preseed/late_command string \
|
73
|
+
wget http://$SERVERIP/blob?uuid=$postinstall_blob -O /target/post_install.sh;\
|
74
|
+
chmod 755 /target/post_install.sh; \
|
75
|
+
chroot /target /post_install.sh
|
76
|
+
|
77
|
+
d-i finish-install/reboot_in_progress note
|
78
|
+
#d-i debian-installer/exit/poweroff boolean true
|
79
|
+
#d-i debian-installer/exit/always_halt boolean true
|
80
|
+
#d-i debian-installer/exit/poweroff boolean true
|
81
|
+
|
82
|
+
EOF
|
83
|
+
|
84
|
+
cat > $postinstall_file <<EOF
|
85
|
+
#!/bin/bash
|
86
|
+
|
87
|
+
mount /dev/xvdd /mnt
|
88
|
+
cd /mnt/Linux
|
89
|
+
./install.sh -n
|
90
|
+
|
91
|
+
mkdir ~vagrant/.ssh
|
92
|
+
wget --no-check-certificate \
|
93
|
+
'https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub' \
|
94
|
+
-O ~vagrant/.ssh/authorized_keys
|
95
|
+
chown -R vagrant ~vagrant/.ssh
|
96
|
+
chmod -R go-rwsx ~vagrant/.ssh
|
97
|
+
|
98
|
+
echo 'vagrant ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/99_vagrant
|
99
|
+
chmod 440 /etc/sudoers.d/99_vagrant
|
100
|
+
|
101
|
+
EOF
|
102
|
+
|
103
|
+
scp $preseed_file root@$SERVER:$preseed_file
|
104
|
+
scp $postinstall_file root@$SERVER:$postinstall_file
|
105
|
+
|
106
|
+
ssh root@$SERVER xe blob-put uuid=$preseed_blob filename=$preseed_file
|
107
|
+
rm $preseed_file
|
108
|
+
ssh root@$SERVER rm $preseed_file
|
109
|
+
|
110
|
+
ssh root@$SERVER xe blob-put uuid=$postinstall_blob filename=$postinstall_file
|
111
|
+
rm $postinstall_file
|
112
|
+
ssh root@$SERVER rm $postinstall_file
|
113
|
+
|
114
|
+
ssh root@$SERVER xe vm-param-set uuid=$vm other-config:install-repository=http://ftp.uk.debian.org/debian other-config:debian-release=wheezy
|
115
|
+
ssh root@$SERVER "xe vm-param-set uuid=$vm PV-args=\"auto-install/enable=true url=http://$SERVERIP/blob?uuid=$preseed_blob interface=auto netcfg/dhcp_timeout=600 hostname=$VMNAME domain=$DOMAINNAME\""
|
116
|
+
ssh root@$SERVER xe vm-start uuid=$vm
|
117
|
+
|
118
|
+
sleep 30
|
119
|
+
|
120
|
+
starttime=`ssh root@$SERVER xe vm-param-get uuid=$vm param-name=start-time`
|
121
|
+
ssh root@$SERVER xe event-wait class=vm uuid=$vm start-time=/=$starttime
|
122
|
+
echo "rebooted..."
|
123
|
+
ssh root@$SERVER xe event-wait class=vm uuid=$vm networks=/=
|
124
|
+
echo "networks detected"
|
125
|
+
ssh root@$SERVER xe vm-shutdown uuid=$vm
|
126
|
+
echo $vm
|
127
|
+
|
128
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
server=$1
|
4
|
+
username=$2
|
5
|
+
password=$3
|
6
|
+
|
7
|
+
vm=`./install_wheezy.sh $1 $2 $3 | tail -n 1`
|
8
|
+
rm -rf tmp
|
9
|
+
mkdir tmp
|
10
|
+
curl -k https://$username:$password@$server/export\?uuid=$vm\&use_compression=true -o tmp/box.xva
|
11
|
+
echo "{\"provider\": \"xenserver\"}" > tmp/metadata.json
|
12
|
+
pushd tmp
|
13
|
+
tar cf ../wheezy.box .
|
14
|
+
popd
|
15
|
+
|
16
|
+
|
17
|
+
|
@@ -13,7 +13,11 @@ module VagrantPlugins
|
|
13
13
|
b.use PrepareNFSValidIds
|
14
14
|
b.use SyncedFolderCleanup
|
15
15
|
b.use SyncedFolders
|
16
|
-
b.use
|
16
|
+
b.use Call, IsRunning do |env, b2|
|
17
|
+
if !env[:result]
|
18
|
+
b2.use StartVM
|
19
|
+
end
|
20
|
+
end
|
17
21
|
b.use WaitForCommunicator, ["Running"]
|
18
22
|
b.use PrepareNFSSettings
|
19
23
|
end
|
@@ -28,8 +32,11 @@ module VagrantPlugins
|
|
28
32
|
# Create the VM
|
29
33
|
if !env[:result]
|
30
34
|
b2.use UploadVHD
|
31
|
-
b2.use
|
32
|
-
b2.use
|
35
|
+
b2.use UploadXVA
|
36
|
+
b2.use DownloadXVA
|
37
|
+
b2.use CreateTemplate
|
38
|
+
b2.use CloneVM
|
39
|
+
b2.use SetVMParams
|
33
40
|
b2.use CreateVIFs
|
34
41
|
end
|
35
42
|
b2.use action_boot
|
@@ -216,7 +223,9 @@ module VagrantPlugins
|
|
216
223
|
autoload :UploadXVA, action_root.join('upload_xva')
|
217
224
|
autoload :UploadVHD, action_root.join('upload_vhd')
|
218
225
|
autoload :CloneDisk, action_root.join('clone_disk')
|
219
|
-
autoload :
|
226
|
+
autoload :SetVMParams, action_root.join('set_vm_params')
|
227
|
+
autoload :CloneVM, action_root.join('clone_vm')
|
228
|
+
autoload :CreateTemplate, action_root.join('create_template')
|
220
229
|
autoload :DestroyVM, action_root.join('destroy_vm')
|
221
230
|
autoload :StartVM, action_root.join('start_vm')
|
222
231
|
autoload :HaltVM, action_root.join('halt_vm')
|
@@ -225,6 +234,7 @@ module VagrantPlugins
|
|
225
234
|
autoload :ReadSSHInfo, action_root.join('read_ssh_info')
|
226
235
|
autoload :PrepareNFSSettings, action_root.join('prepare_nfs_settings')
|
227
236
|
autoload :PrepareNFSValidIds, action_root.join('prepare_nfs_valid_ids')
|
237
|
+
autoload :DownloadXVA, action_root.join('download_xva')
|
228
238
|
end
|
229
239
|
end
|
230
240
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "xmlrpc/client"
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module XenServer
|
6
|
+
module Action
|
7
|
+
class CloneVM
|
8
|
+
def initialize(app, env)
|
9
|
+
@app = app
|
10
|
+
@logger = Log4r::Logger.new("vagrant::xenserver::actions::clone_vm")
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(env)
|
14
|
+
template_ref = env[:template]
|
15
|
+
box_name = env[:machine].box.name.to_s
|
16
|
+
box_version = env[:machine].box.version.to_s
|
17
|
+
username = Etc.getlogin
|
18
|
+
|
19
|
+
if env[:machine].provider_config.name.nil?
|
20
|
+
vm_name = "#{username}/#{box_name}/#{box_version}"
|
21
|
+
else
|
22
|
+
vm_name = env[:machine].provider_config.name
|
23
|
+
end
|
24
|
+
|
25
|
+
vm = env[:xc].VM.clone(template_ref, vm_name)
|
26
|
+
env[:xc].VM.provision(vm)
|
27
|
+
|
28
|
+
env[:machine].id = vm
|
29
|
+
|
30
|
+
@app.call env
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require "log4r"
|
2
|
-
require "
|
2
|
+
require "xenapi"
|
3
|
+
require "uri"
|
3
4
|
|
4
5
|
module VagrantPlugins
|
5
6
|
module XenServer
|
@@ -7,22 +8,29 @@ module VagrantPlugins
|
|
7
8
|
class ConnectXS
|
8
9
|
def initialize(app, env)
|
9
10
|
@app = app
|
10
|
-
@logger = Log4r::Logger.new("
|
11
|
+
@logger = Log4r::Logger.new("vagrant::xenserver::actions::connect_xs")
|
11
12
|
end
|
12
13
|
|
13
14
|
def call(env)
|
14
|
-
if not env[:
|
15
|
-
|
16
|
-
|
15
|
+
if not env[:xc]
|
16
|
+
config = env[:machine].provider_config
|
17
|
+
uri = URI::Generic.new(config.xs_use_ssl ? 'https' : 'http',
|
18
|
+
nil,
|
19
|
+
config.xs_host,
|
20
|
+
config.xs_port,
|
21
|
+
nil,
|
22
|
+
"/",
|
23
|
+
nil,
|
24
|
+
nil, nil)
|
25
|
+
env[:xc] = XenApi::Client.new(uri.to_s, timeout = config.api_timeout)
|
26
|
+
|
17
27
|
@logger.info("Connecting to XenServer")
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
if sess_result["Status"] != "Success"
|
28
|
+
|
29
|
+
if not env[:xc].login_with_password(config.xs_username, config.xs_password)
|
22
30
|
raise Errors::LoginError
|
23
31
|
end
|
24
|
-
|
25
|
-
|
32
|
+
|
33
|
+
@logger.info("Connected to XenServer")
|
26
34
|
end
|
27
35
|
|
28
36
|
@app.call(env)
|