vagrant-xenserver 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +64 -223
- data/lib/vagrant-xenserver/action/upload_vhd.rb +5 -2
- data/lib/vagrant-xenserver/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d1cc23a51d274952345b4ed8f1f3c9f8e9a2a58
|
4
|
+
data.tar.gz: c8120a254299c1ac2fe863f25b6a1fb0606efe13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c37ac03de57c2361c481530cbc95e69d73918a498f513d872fd152a166fcdc8b45fa7d9c69f240f3b0e0992d7a4159260d7b51d95f27860f5595bb5ecac67e9
|
7
|
+
data.tar.gz: 04e395b2f77f141d45e083c0826f8ae690ca27db6fba83794568ba6d8790944c4e88e148f47c5dcc978715748c490c54445744fb3920fb2e83bf45e9423d6d1b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,251 +1,92 @@
|
|
1
|
-
# Vagrant
|
1
|
+
# Vagrant XenServer Provider
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
[![Dependency Status](https://gemnasium.com/mitchellh/vagrant-aws.png)][gemnasium]
|
6
|
-
</span>
|
3
|
+
This is a Vagrant plugin that adds a XenServer provider, allowing Vagrant to
|
4
|
+
control and provision machines on a XenServer host.
|
7
5
|
|
8
|
-
|
9
|
-
|
6
|
+
## Dependencies
|
7
|
+
* Vagrant >= 1.5(?) (http://www.vagrantup.com/downloads.html)
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
## Features
|
18
|
-
|
19
|
-
* Boot EC2 or VPC instances.
|
20
|
-
* SSH into the instances.
|
21
|
-
* Provision the instances with any built-in Vagrant provisioner.
|
22
|
-
* Minimal synced folder support via `rsync`.
|
23
|
-
* Define region-specifc configurations so Vagrant can manage machines
|
24
|
-
in multiple regions.
|
25
|
-
|
26
|
-
## Usage
|
9
|
+
## Installation
|
10
|
+
```shell
|
11
|
+
vagrant plugin install vagrant-xenserver
|
12
|
+
# Make your linux box look like a Mac :) (maybe)
|
13
|
+
sudo ln -s /bin/tar /bin/bsdtar
|
14
|
+
```
|
27
15
|
|
28
|
-
|
29
|
-
|
30
|
-
|
16
|
+
## XenServer host setup
|
17
|
+
N.B. Currently this will only work on a trunk build of XenServer:
|
18
|
+
```shell
|
19
|
+
# Install netcat
|
20
|
+
yum install --enablerepo=base,extras --disablerepo=citrix -y nc
|
21
|
+
# Setup NAT - NB, this _disable the firewall_ - be careful!
|
22
|
+
echo 1 > /proc/sys/net/ipv4/ip_forward
|
23
|
+
/sbin/iptables -F INPUT
|
31
24
|
|
25
|
+
/sbin/iptables -t nat -A POSTROUTING -o xenbr0 -j MASQUERADE
|
26
|
+
/sbin/iptables -A INPUT -i xenbr0 -p tcp -m tcp --dport 53 -j ACCEPT
|
27
|
+
/sbin/iptables -A INPUT -i xenbr0 -p udp -m udp --dport 53 -j ACCEPT
|
28
|
+
/sbin/iptables -A FORWARD -i xenbr0 -o xenapi -m state --state
|
29
|
+
RELATED,ESTABLISHED -j ACCEPT
|
30
|
+
/sbin/iptables -A FORWARD -i xenapi -o xenbr0 -j ACCEPT
|
32
31
|
```
|
33
|
-
$ vagrant plugin install vagrant-aws
|
34
|
-
...
|
35
|
-
$ vagrant up --provider=aws
|
36
|
-
...
|
37
|
-
```
|
38
|
-
|
39
|
-
Of course prior to doing this, you'll need to obtain an AWS-compatible
|
40
|
-
box file for Vagrant.
|
41
32
|
|
42
|
-
|
33
|
+
# Usage
|
43
34
|
|
44
|
-
|
45
|
-
started is to actually use a dummy AWS box and specify all the details
|
46
|
-
manually within a `config.vm.provider` block. So first, add the dummy
|
47
|
-
box using any name you want:
|
35
|
+
## Converting a VirtualBox box file
|
48
36
|
|
37
|
+
* Download the box file (e.g. https://vagrantcloud.com/ubuntu/trusty64/version/1/provider/virtualbox.box)
|
38
|
+
* Unpack it:
|
39
|
+
```shell
|
40
|
+
mkdir tmp
|
41
|
+
cd tmp
|
42
|
+
tar xvf ../virtualbox.box
|
49
43
|
```
|
50
|
-
|
51
|
-
|
44
|
+
* Convert the disk image using qemu-img
|
45
|
+
```shell
|
46
|
+
qemu-img convert *.vmdk -O vpc box.vhd
|
52
47
|
```
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
48
|
+
* Remove the other files
|
49
|
+
```shell
|
50
|
+
rm -f Vagrantfile box.ovf metadata.json
|
57
51
|
```
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
config.vm.provider :aws do |aws, override|
|
62
|
-
aws.access_key_id = "YOUR KEY"
|
63
|
-
aws.secret_access_key = "YOUR SECRET KEY"
|
64
|
-
aws.keypair_name = "KEYPAIR NAME"
|
65
|
-
|
66
|
-
aws.ami = "ami-7747d01e"
|
67
|
-
|
68
|
-
override.ssh.username = "ubuntu"
|
69
|
-
override.ssh.private_key_path = "PATH TO YOUR PRIVATE KEY"
|
70
|
-
end
|
71
|
-
end
|
52
|
+
* Make a new metadata file
|
53
|
+
```shell
|
54
|
+
echo "{\"provider\": \"xenserver\"}" > metadata.json
|
72
55
|
```
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
This will start an Ubuntu 12.04 instance in the us-east-1 region within
|
77
|
-
your account. And assuming your SSH information was filled in properly
|
78
|
-
within your Vagrantfile, SSH and provisioning will work as well.
|
79
|
-
|
80
|
-
Note that normally a lot of this boilerplate is encoded within the box
|
81
|
-
file, but the box file used for the quick start, the "dummy" box, has
|
82
|
-
no preconfigured defaults.
|
83
|
-
|
84
|
-
If you have issues with SSH connecting, make sure that the instances
|
85
|
-
are being launched with a security group that allows SSH access.
|
86
|
-
|
87
|
-
## Box Format
|
88
|
-
|
89
|
-
Every provider in Vagrant must introduce a custom box format. This
|
90
|
-
provider introduces `aws` boxes. You can view an example box in
|
91
|
-
the [example_box/ directory](https://github.com/mitchellh/vagrant-aws/tree/master/example_box).
|
92
|
-
That directory also contains instructions on how to build a box.
|
93
|
-
|
94
|
-
The box format is basically just the required `metadata.json` file
|
95
|
-
along with a `Vagrantfile` that does default settings for the
|
96
|
-
provider-specific configuration for this provider.
|
97
|
-
|
98
|
-
## Configuration
|
99
|
-
|
100
|
-
This provider exposes quite a few provider-specific configuration options:
|
101
|
-
|
102
|
-
* `access_key_id` - The access key for accessing AWS
|
103
|
-
* `ami` - The AMI id to boot, such as "ami-12345678"
|
104
|
-
* `availability_zone` - The availability zone within the region to launch
|
105
|
-
the instance. If nil, it will use the default set by Amazon.
|
106
|
-
* `instance_ready_timeout` - The number of seconds to wait for the instance
|
107
|
-
to become "ready" in AWS. Defaults to 120 seconds.
|
108
|
-
* `instance_type` - The type of instance, such as "m1.small". The default
|
109
|
-
value of this if not specified is "m1.small".
|
110
|
-
* `keypair_name` - The name of the keypair to use to bootstrap AMIs
|
111
|
-
which support it.
|
112
|
-
* `private_ip_address` - The private IP address to assign to an instance
|
113
|
-
within a [VPC](http://aws.amazon.com/vpc/)
|
114
|
-
* `region` - The region to start the instance in, such as "us-east-1"
|
115
|
-
* `secret_access_key` - The secret access key for accessing AWS
|
116
|
-
* `security_groups` - An array of security groups for the instance. If this
|
117
|
-
instance will be launched in VPC, this must be a list of security group
|
118
|
-
IDs.
|
119
|
-
* `iam_instance_profile_arn` - The Amazon resource name (ARN) of the IAM Instance
|
120
|
-
Profile to associate with the instance
|
121
|
-
* `iam_instance_profile_name` - The name of the IAM Instance Profile to associate
|
122
|
-
with the instance
|
123
|
-
* `subnet_id` - The subnet to boot the instance into, for VPC.
|
124
|
-
* `associate_public_ip` - If true, will associate a public IP address to an instance in a VPC.
|
125
|
-
* `tags` - A hash of tags to set on the machine.
|
126
|
-
* `use_iam_profile` - If true, will use [IAM profiles](http://docs.aws.amazon.com/IAM/latest/UserGuide/instance-profiles.html)
|
127
|
-
for credentials.
|
128
|
-
|
129
|
-
These can be set like typical provider-specific configuration:
|
130
|
-
|
131
|
-
```ruby
|
132
|
-
Vagrant.configure("2") do |config|
|
133
|
-
# ... other stuff
|
134
|
-
|
135
|
-
config.vm.provider :aws do |aws|
|
136
|
-
aws.access_key_id = "foo"
|
137
|
-
aws.secret_access_key = "bar"
|
138
|
-
end
|
139
|
-
end
|
56
|
+
* Create the box:
|
57
|
+
```shell
|
58
|
+
tar cf ../xenserver.box .
|
140
59
|
```
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
that the top-level `region` config must always be specified to choose which
|
145
|
-
region you want to actually use, however. This looks like this:
|
146
|
-
|
147
|
-
```ruby
|
148
|
-
Vagrant.configure("2") do |config|
|
149
|
-
# ... other stuff
|
150
|
-
|
151
|
-
config.vm.provider :aws do |aws|
|
152
|
-
aws.access_key_id = "foo"
|
153
|
-
aws.secret_access_key = "bar"
|
154
|
-
aws.region = "us-east-1"
|
155
|
-
|
156
|
-
# Simple region config
|
157
|
-
aws.region_config "us-east-1", :ami => "ami-12345678"
|
158
|
-
|
159
|
-
# More comprehensive region config
|
160
|
-
aws.region_config "us-west-2" do |region|
|
161
|
-
region.ami = "ami-87654321"
|
162
|
-
region.keypair_name = "company-west"
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
60
|
+
* Add the box:
|
61
|
+
```shell
|
62
|
+
vagrant box add ubuntu xenserver.box
|
166
63
|
```
|
167
64
|
|
168
|
-
|
169
|
-
configurations when that region is used. They otherwise inherit
|
170
|
-
the top-level configurations, as you would probably expect.
|
171
|
-
|
172
|
-
## Networks
|
173
|
-
|
174
|
-
Networking features in the form of `config.vm.network` are not
|
175
|
-
supported with `vagrant-aws`, currently. If any of these are
|
176
|
-
specified, Vagrant will emit a warning, but will otherwise boot
|
177
|
-
the AWS machine.
|
178
|
-
|
179
|
-
## Synced Folders
|
180
|
-
|
181
|
-
There is minimal support for synced folders. Upon `vagrant up`,
|
182
|
-
`vagrant reload`, and `vagrant provision`, the AWS provider will use
|
183
|
-
`rsync` (if available) to uni-directionally sync the folder to
|
184
|
-
the remote machine over SSH.
|
185
|
-
|
186
|
-
This is good enough for all built-in Vagrant provisioners (shell,
|
187
|
-
chef, and puppet) to work!
|
188
|
-
|
189
|
-
## Other Examples
|
190
|
-
|
191
|
-
### Tags
|
192
|
-
|
193
|
-
To use tags, simply define a hash of key/value for the tags you want to associate to your instance, like:
|
65
|
+
## Create a Vagrantfile
|
194
66
|
|
195
67
|
```ruby
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
config.vm.provider "aws" do |aws|
|
200
|
-
aws.tags = {
|
201
|
-
'Name' => 'Some Name',
|
202
|
-
'Some Key' => 'Some Value'
|
203
|
-
}
|
204
|
-
end
|
205
|
-
end
|
206
|
-
```
|
207
|
-
|
208
|
-
### User data
|
68
|
+
# -*- mode: ruby -*-
|
69
|
+
# vi: set ft=ruby :
|
209
70
|
|
210
|
-
|
71
|
+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
72
|
+
VAGRANTFILE_API_VERSION = "2"
|
211
73
|
|
212
|
-
|
213
|
-
|
214
|
-
# ... other stuff
|
215
|
-
|
216
|
-
config.vm.provider "aws" do |aws|
|
217
|
-
# Option 1: a single string
|
218
|
-
aws.user_data = "#!/bin/bash\necho 'got user data' > /tmp/user_data.log\necho"
|
74
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
75
|
+
config.vm.box = "ubuntu"
|
219
76
|
|
220
|
-
|
221
|
-
|
77
|
+
config.vm.provider :xenserver do |xs|
|
78
|
+
xs.xs_host = "st29.uk.xensource.com"
|
79
|
+
xs.xs_username = "root"
|
80
|
+
xs.xs_password = "xenroot"
|
81
|
+
xs.pv = true
|
82
|
+
xs.memory = 2048
|
222
83
|
end
|
223
84
|
end
|
224
|
-
```
|
225
85
|
|
226
|
-
## Development
|
227
|
-
|
228
|
-
To work on the `vagrant-aws` plugin, clone this repository out, and use
|
229
|
-
[Bundler](http://gembundler.com) to get the dependencies:
|
230
|
-
|
231
|
-
```
|
232
|
-
$ bundle
|
233
86
|
```
|
234
87
|
|
235
|
-
|
88
|
+
and then you can do
|
236
89
|
|
237
|
-
```
|
238
|
-
|
239
|
-
```
|
240
|
-
|
241
|
-
If those pass, you're ready to start developing the plugin. You can test
|
242
|
-
the plugin without installing it into your Vagrant environment by just
|
243
|
-
creating a `Vagrantfile` in the top level of this directory (it is gitignored)
|
244
|
-
and add the following line to your `Vagrantfile`
|
245
|
-
```ruby
|
246
|
-
Vagrant.require_plugin "vagrant-aws"
|
247
|
-
```
|
248
|
-
Use bundler to execute Vagrant:
|
249
|
-
```
|
250
|
-
$ bundle exec vagrant up --provider=aws
|
90
|
+
```shell
|
91
|
+
vagrant up --provider=xenserver
|
251
92
|
```
|
@@ -24,8 +24,11 @@ module VagrantPlugins
|
|
24
24
|
|
25
25
|
# Find out if it has already been uploaded
|
26
26
|
vdis = env[:xc].call("VDI.get_all_records", env[:session])['Value']
|
27
|
-
|
28
|
-
|
27
|
+
md5=`dd if=#{box_vhd_file} bs=1M count=1 | md5sum | cut '-d ' -f1`.strip
|
28
|
+
|
29
|
+
@logger.info("md5=#{md5}")
|
30
|
+
|
31
|
+
vdi_tag = "vagrant:" + env[:machine].box.name.to_s + "/" + md5
|
29
32
|
|
30
33
|
vdi_ref_rec = vdis.find { |reference,record|
|
31
34
|
@logger.info(record['tags'].to_s)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-xenserver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Ludlam
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|