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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e71a5e7cadb1956653b86df342189d60b6da468
4
- data.tar.gz: 6f2128e6f3fdea3108dadc8c8f40cb4d0bd3f694
3
+ metadata.gz: 9d1cc23a51d274952345b4ed8f1f3c9f8e9a2a58
4
+ data.tar.gz: c8120a254299c1ac2fe863f25b6a1fb0606efe13
5
5
  SHA512:
6
- metadata.gz: 7c7df81ce4a9603ccc52c8e43913a38a297e8b3993e80ff593f5af43b506439decb9c1a46d8ab12fb26f4f9fd0a892c4af2596abb2ee21168a18d1f99be83f91
7
- data.tar.gz: a982ff961439ce2c9043fac119fb07288ca348122fec58770df9ace0f6cd4ef49d2de1e24ddac59abac02721cc50ee73314dfa973d770959134248028794b51e
6
+ metadata.gz: 9c37ac03de57c2361c481530cbc95e69d73918a498f513d872fd152a166fcdc8b45fa7d9c69f240f3b0e0992d7a4159260d7b51d95f27860f5595bb5ecac67e9
7
+ data.tar.gz: 04e395b2f77f141d45e083c0826f8ae690ca27db6fba83794568ba6d8790944c4e88e148f47c5dcc978715748c490c54445744fb3920fb2e83bf45e9423d6d1b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
- # 0.1.0 (Unreleased)
1
+ # 0.0.1 (7 July 2014)
2
+
3
+ * Use the md5 of the first meg of VHD to tag the base VDI
4
+ This is much more unique than the name/version pair
5
+
6
+ # 0.0.0 (1 July 2014)
2
7
 
3
8
  * Initial release.
9
+
data/README.md CHANGED
@@ -1,251 +1,92 @@
1
- # Vagrant AWS Provider
1
+ # Vagrant XenServer Provider
2
2
 
3
- <span class="badges">
4
- [![Gem Version](https://badge.fury.io/rb/vagrant-aws.png)][gem]
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
- [gem]: https://rubygems.org/gems/vagrant-aws
9
- [gemnasium]: https://gemnasium.com/mitchellh/vagrant-aws
6
+ ## Dependencies
7
+ * Vagrant >= 1.5(?) (http://www.vagrantup.com/downloads.html)
10
8
 
11
- This is a [Vagrant](http://www.vagrantup.com) 1.2+ plugin that adds an [AWS](http://aws.amazon.com)
12
- provider to Vagrant, allowing Vagrant to control and provision machines in
13
- EC2 and VPC.
14
-
15
- **NOTE:** This plugin requires Vagrant 1.2+,
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
- Install using standard Vagrant 1.1+ plugin installation methods. After
29
- installing, `vagrant up` and specify the `aws` provider. An example is
30
- shown below.
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
- ## Quick Start
33
+ # Usage
43
34
 
44
- After installing the plugin (instructions above), the quickest way to get
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
- $ vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box
51
- ...
44
+ * Convert the disk image using qemu-img
45
+ ```shell
46
+ qemu-img convert *.vmdk -O vpc box.vhd
52
47
  ```
53
-
54
- And then make a Vagrantfile that looks like the following, filling in
55
- your information where necessary.
56
-
48
+ * Remove the other files
49
+ ```shell
50
+ rm -f Vagrantfile box.ovf metadata.json
57
51
  ```
58
- Vagrant.configure("2") do |config|
59
- config.vm.box = "dummy"
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
- And then run `vagrant up --provider=aws`.
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
- In addition to the above top-level configs, you can use the `region_config`
143
- method to specify region-specific overrides within your Vagrantfile. Note
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
- The region-specific configurations will override the top-level
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
- Vagrant.configure("2") do |config|
197
- # ... other stuff
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
- You can specify user data for the instance being booted.
71
+ # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
72
+ VAGRANTFILE_API_VERSION = "2"
211
73
 
212
- ```ruby
213
- Vagrant.configure("2") do |config|
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
- # Option 2: use a file
221
- aws.user_data = File.read("user_data.txt")
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
- Once you have the dependencies, verify the unit tests pass with `rake`:
88
+ and then you can do
236
89
 
237
- ```
238
- $ bundle exec rake
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
- vdi_tag = "vagrant:" + env[:machine].box.name.to_s + "/" + env[:machine].box.version.to_s
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)
@@ -1,6 +1,6 @@
1
1
  module VagrantPlugins
2
2
  module XenServer
3
- VERSION = "0.0.0"
3
+ VERSION = "0.0.1"
4
4
  end
5
5
  end
6
6
 
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.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-02 00:00:00.000000000 Z
11
+ date: 2014-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake