knife-xapi 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -111,10 +111,14 @@ class Chef
111
111
  # static-min <= dynamic-min = dynamic-max = static-max
112
112
  xapi.VM.set_memory_limits(vm_ref, memory_size, memory_size, memory_size, memory_size)
113
113
 
114
+ #
114
115
  # setup the Boot args
115
- args = Chef::Config[:knife][:xapi_kernel_params] || "graphical utf8"
116
- ui.msg "Setting Boot Args: #{h.color args, :cyan}"
117
- xapi.VM.set_PV_args( vm_ref, args )
116
+ #
117
+ boot_args = Chef::Config[:knife][:xapi_kernel_params] || "graphical utf8"
118
+ # if no hostname param set hostname to given vm name
119
+ boot_args << "hostname=#{server_name}" unless boot_args.match(/hostname=.+\s?/)
120
+ ui.msg "Setting Boot Args: #{h.color boot_args, :cyan}"
121
+ xapi.VM.set_PV_args( vm_ref, boot_args )
118
122
 
119
123
  # TODO: validate that the vm gets a network here
120
124
  networks = @name_args[1..-1]
@@ -29,13 +29,13 @@ class Chef
29
29
 
30
30
  def run
31
31
  vms = xapi.VM.get_all
32
- printf "%-25s %-46s %-36s \n", "Name Label", "Ref", "UUID"
32
+ printf "%-25s %-12s %-46s %-36s \n", "Name Label", "State", "Ref", "UUID"
33
33
  vms.each do |vm|
34
34
  record = xapi.VM.get_record(vm)
35
35
  # make sure you can't do bad things to these VM's
36
36
  next if record['is_a_template']
37
37
  next if record['name_label'] =~ /control domain/i
38
- printf "%-25s %46s %36s \n", record['name_label'], vm, record['uuid']
38
+ printf "%-25s %-12s %46s %36s \n", record['name_label'], record['power_state'], vm, record['uuid']
39
39
  end
40
40
  end
41
41
 
@@ -1,3 +1,3 @@
1
1
  module KnifeXenserver
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-xapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-07 00:00:00.000000000 Z
12
+ date: 2012-04-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef