fog-proxmox 0.14.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +28 -4
- data/lib/fog/proxmox/attributes.rb +3 -2
- data/lib/fog/proxmox/auth/token/access_ticket.rb +68 -57
- data/lib/fog/proxmox/auth/token/user_token.rb +79 -66
- data/lib/fog/proxmox/auth/token.rb +66 -60
- data/lib/fog/proxmox/compute/models/disk.rb +6 -1
- data/lib/fog/proxmox/compute/models/disks.rb +1 -1
- data/lib/fog/proxmox/compute/models/interface.rb +1 -1
- data/lib/fog/proxmox/compute/models/interfaces.rb +1 -1
- data/lib/fog/proxmox/compute/models/node.rb +3 -5
- data/lib/fog/proxmox/compute/models/nodes.rb +1 -1
- data/lib/fog/proxmox/compute/models/server.rb +33 -16
- data/lib/fog/proxmox/compute/models/server_config.rb +9 -4
- data/lib/fog/proxmox/compute/models/servers.rb +5 -5
- data/lib/fog/proxmox/compute/models/snapshot.rb +1 -1
- data/lib/fog/proxmox/compute/models/snapshots.rb +1 -1
- data/lib/fog/proxmox/compute/models/storage.rb +3 -2
- data/lib/fog/proxmox/compute/models/storages.rb +2 -2
- data/lib/fog/proxmox/compute/models/task.rb +1 -1
- data/lib/fog/proxmox/compute/models/tasks.rb +1 -0
- data/lib/fog/proxmox/compute/models/volume.rb +2 -1
- data/lib/fog/proxmox/compute/models/volumes.rb +2 -2
- data/lib/fog/proxmox/compute/requests/get_server_config.rb +14 -14
- data/lib/fog/proxmox/compute/requests/get_server_status.rb +17 -17
- data/lib/fog/proxmox/compute/requests/log_task.rb +1 -1
- data/lib/fog/proxmox/core.rb +28 -24
- data/lib/fog/proxmox/errors.rb +2 -1
- data/lib/fog/proxmox/hash.rb +0 -2
- data/lib/fog/proxmox/helpers/controller_helper.rb +3 -4
- data/lib/fog/proxmox/helpers/cpu_helper.rb +13 -6
- data/lib/fog/proxmox/helpers/disk_helper.rb +18 -12
- data/lib/fog/proxmox/helpers/ip_helper.rb +21 -20
- data/lib/fog/proxmox/helpers/nic_helper.rb +23 -14
- data/lib/fog/proxmox/identity/models/domain.rb +7 -3
- data/lib/fog/proxmox/identity/models/domain_type.rb +0 -1
- data/lib/fog/proxmox/identity/models/domains.rb +1 -2
- data/lib/fog/proxmox/identity/models/group.rb +4 -2
- data/lib/fog/proxmox/identity/models/groups.rb +1 -1
- data/lib/fog/proxmox/identity/models/permission.rb +5 -4
- data/lib/fog/proxmox/identity/models/permissions.rb +3 -1
- data/lib/fog/proxmox/identity/models/pool.rb +4 -4
- data/lib/fog/proxmox/identity/models/pools.rb +4 -4
- data/lib/fog/proxmox/identity/models/role.rb +1 -1
- data/lib/fog/proxmox/identity/models/roles.rb +1 -1
- data/lib/fog/proxmox/identity/models/token.rb +4 -3
- data/lib/fog/proxmox/identity/models/token_info.rb +2 -2
- data/lib/fog/proxmox/identity/models/tokens.rb +9 -13
- data/lib/fog/proxmox/identity/models/user.rb +1 -2
- data/lib/fog/proxmox/identity/models/users.rb +1 -1
- data/lib/fog/proxmox/identity/requests/get_user.rb +1 -0
- data/lib/fog/proxmox/identity/requests/list_user_permissions.rb +1 -1
- data/lib/fog/proxmox/network/models/networks.rb +1 -1
- data/lib/fog/proxmox/network/models/node.rb +1 -0
- data/lib/fog/proxmox/network/models/nodes.rb +1 -1
- data/lib/fog/proxmox/string.rb +4 -3
- data/lib/fog/proxmox/version.rb +1 -1
- data/lib/fog/proxmox.rb +1 -3
- data/spec/compute_spec.rb +3 -2
- data/spec/fixtures/proxmox/compute/snapshots.yml +350 -1055
- data/spec/hash_spec.rb +2 -1
- data/spec/helpers/controller_helper_spec.rb +135 -123
- data/spec/helpers/cpu_helper_spec.rb +58 -53
- data/spec/helpers/disk_helper_spec.rb +104 -54
- data/spec/helpers/ip_helper_spec.rb +155 -138
- data/spec/helpers/nic_helper_spec.rb +29 -20
- data/spec/identity_spec.rb +86 -74
- data/spec/proxmox_vcr.rb +3 -3
- metadata +89 -90
- data/.bundle/config +0 -4
- data/.codeclimate.yml +0 -14
- data/.github/CODE_OF_CONDUCT.md +0 -74
- data/.github/CONTRIBUTING.md +0 -20
- data/.github/CONTRIBUTORS.md +0 -9
- data/.github/FUNDING.yml +0 -12
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -35
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -17
- data/.github/ISSUE_TEMPLATE.md +0 -43
- data/.github/SUPPORT.md +0 -9
- data/.github/fogproxmox.png +0 -0
- data/.github/workflows/ci.yml +0 -79
- data/.gitignore +0 -8
- data/.rubocop.yml +0 -13
- data/.ruby-gemset +0 -1
- data/.solargraph.yml +0 -10
- data/.vscode/launch.json +0 -96
- data/.vscode/settings.json +0 -45
- data/.vscode/tasks.json +0 -27
- data/Gemfile +0 -23
- data/Rakefile +0 -58
- data/bin/console +0 -29
- data/bin/setup +0 -29
- data/fog-proxmox.gemspec +0 -63
@@ -24,7 +24,6 @@ module Fog
|
|
24
24
|
module Proxmox
|
25
25
|
# module IpHelper mixins
|
26
26
|
module IpHelper
|
27
|
-
|
28
27
|
CIDRv4_PREFIX = '([0-9]|[1-2][0-9]|3[0-2])'
|
29
28
|
CIDRv4_PREFIX_REGEXP = /^#{CIDRv4_PREFIX}$/
|
30
29
|
IPv4_SRC = "#{Resolv::IPv4::Regex.source.delete_suffix('\z').delete_prefix('\A')}"
|
@@ -33,7 +32,7 @@ module Fog
|
|
33
32
|
CIDRv6_PREFIX_REGEXP = /^#{CIDRv6_PREFIX}$/xi
|
34
33
|
IPv6_SRC = "#{Resolv::IPv6::Regex_8Hex.source.delete_suffix('\z').delete_prefix('\A')}"
|
35
34
|
CIDRv6_REGEXP = Regexp.new("\\A(#{IPv6_SRC})(\/#{CIDRv6_PREFIX})?\\z", Regexp::EXTENDED | Regexp::IGNORECASE)
|
36
|
-
|
35
|
+
|
37
36
|
def self.cidr?(ip)
|
38
37
|
CIDRv4_REGEXP.match?(ip)
|
39
38
|
end
|
@@ -43,15 +42,15 @@ module Fog
|
|
43
42
|
end
|
44
43
|
|
45
44
|
def self.prefix(ip)
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
return unless cidr = CIDRv4_REGEXP.match(ip)
|
46
|
+
|
47
|
+
cidr[7]
|
49
48
|
end
|
50
49
|
|
51
50
|
def self.prefix6(ip)
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
return unless cidr = CIDRv6_REGEXP.match(ip)
|
52
|
+
|
53
|
+
cidr[3]
|
55
54
|
end
|
56
55
|
|
57
56
|
def self.ip?(ip)
|
@@ -71,28 +70,30 @@ module Fog
|
|
71
70
|
end
|
72
71
|
|
73
72
|
def self.ip(ip)
|
74
|
-
|
75
|
-
|
76
|
-
|
73
|
+
return unless cidr = CIDRv4_REGEXP.match(ip)
|
74
|
+
|
75
|
+
cidr[1]
|
77
76
|
end
|
78
77
|
|
79
78
|
def self.ip6(ip)
|
80
|
-
|
81
|
-
|
82
|
-
|
79
|
+
return unless cidr = CIDRv6_REGEXP.match(ip)
|
80
|
+
|
81
|
+
cidr[1]
|
83
82
|
end
|
84
83
|
|
85
|
-
def self.to_cidr(ip,prefix = nil)
|
86
|
-
return nil unless
|
84
|
+
def self.to_cidr(ip, prefix = nil)
|
85
|
+
return nil unless ip?(ip) && (!prefix || cidr_prefix?(prefix))
|
86
|
+
|
87
87
|
cidr = "#{ip}"
|
88
|
-
cidr += "/#{prefix}" if
|
88
|
+
cidr += "/#{prefix}" if cidr_prefix?(prefix)
|
89
89
|
cidr
|
90
90
|
end
|
91
91
|
|
92
|
-
def self.to_cidr6(ip,prefix = nil)
|
93
|
-
return nil unless
|
92
|
+
def self.to_cidr6(ip, prefix = nil)
|
93
|
+
return nil unless ip6?(ip) && (!prefix || cidr6_prefix?(prefix))
|
94
|
+
|
94
95
|
cidr = "#{ip}"
|
95
|
-
cidr += "/#{prefix}" if
|
96
|
+
cidr += "/#{prefix}" if cidr6_prefix?(prefix)
|
96
97
|
cidr
|
97
98
|
end
|
98
99
|
end
|
@@ -30,19 +30,19 @@ module Fog
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def self.model_regexp
|
33
|
-
/^model=(\w+)
|
33
|
+
/^model=(\w+),.+/
|
34
34
|
end
|
35
35
|
|
36
36
|
def self.name_regexp
|
37
|
-
/^name=(\w+)
|
37
|
+
/^name=(\w+),.+/
|
38
38
|
end
|
39
39
|
|
40
40
|
def self.ip_regexp
|
41
|
-
|
41
|
+
%r{^(.+),{1}ip=([\d./]+),?(.+)?$}
|
42
42
|
end
|
43
43
|
|
44
44
|
def self.nic_update_regexp
|
45
|
-
/^(\w+)
|
45
|
+
/^(\w+)={1}([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2}).+/
|
46
46
|
end
|
47
47
|
|
48
48
|
def self.has_model?(nic_value)
|
@@ -75,33 +75,42 @@ module Fog
|
|
75
75
|
|
76
76
|
def self.nic_name(nic)
|
77
77
|
if nic.has_key?(:model)
|
78
|
-
|
78
|
+
'model'
|
79
79
|
elsif nic.has_key?(:name)
|
80
|
-
|
80
|
+
'name'
|
81
81
|
else
|
82
|
-
|
82
|
+
''
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
86
|
def self.set_mac(nic_id, nic_hash)
|
87
|
-
mac_keys = [
|
87
|
+
mac_keys = %i[macaddr hwaddr]
|
88
88
|
nic_value = ''
|
89
89
|
if (nic_hash.keys & mac_keys).empty?
|
90
|
-
nic_value = nic_name(nic_hash) +
|
90
|
+
nic_value = nic_name(nic_hash) + '=' + nic_id
|
91
91
|
else
|
92
92
|
mac_value = nic_hash[mac_keys[0]] if nic_hash.key?(mac_keys[0])
|
93
93
|
mac_value ||= nic_hash[mac_keys[1]] if nic_hash.key?(mac_keys[1])
|
94
|
-
nic_value = nic_id +
|
94
|
+
nic_value = nic_id + '=' + mac_value
|
95
95
|
end
|
96
96
|
nic_value
|
97
97
|
end
|
98
98
|
|
99
99
|
# Convert nic attributes hash into API Proxmox parameters string
|
100
100
|
def self.flatten(nic_hash)
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
101
|
+
if nic_hash[:hwaddr].nil?
|
102
|
+
nic_id = nic_hash[nic_name(nic_hash).to_sym]
|
103
|
+
nic_value = set_mac(nic_id, nic_hash)
|
104
|
+
options = nic_hash.reject do |key, _value|
|
105
|
+
[nic_name(nic_hash).to_sym, :id, :hwaddr, :macaddr].include? key.to_sym
|
106
|
+
end
|
107
|
+
nic_value += ',' + Fog::Proxmox::Hash.stringify(options) unless options.empty?
|
108
|
+
else
|
109
|
+
options = nic_hash.reject do |key, _value|
|
110
|
+
%i[id model macaddr].include? key.to_sym
|
111
|
+
end
|
112
|
+
nic_value = Fog::Proxmox::Hash.stringify(options) unless options.empty?
|
113
|
+
end
|
105
114
|
{ "#{nic_hash[:id]}": nic_value }
|
106
115
|
end
|
107
116
|
|
@@ -31,7 +31,9 @@ module Fog
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def save(new_attributes = {})
|
34
|
-
service.create_domain(type.attributes.merge(new_attributes).merge(attributes.reject
|
34
|
+
service.create_domain(type.attributes.merge(new_attributes).merge(attributes.reject do |attribute|
|
35
|
+
[:type].include? attribute
|
36
|
+
end))
|
35
37
|
reload
|
36
38
|
end
|
37
39
|
|
@@ -43,7 +45,9 @@ module Fog
|
|
43
45
|
|
44
46
|
def update
|
45
47
|
requires :realm
|
46
|
-
service.update_domain(realm, type.attributes.merge(attributes).reject
|
48
|
+
service.update_domain(realm, type.attributes.merge(attributes).reject do |attribute|
|
49
|
+
%i[type realm].include? attribute
|
50
|
+
end)
|
47
51
|
reload
|
48
52
|
end
|
49
53
|
|
@@ -52,7 +56,7 @@ module Fog
|
|
52
56
|
def initialize_type(new_attributes = {})
|
53
57
|
if new_attributes.has_key? :realm
|
54
58
|
realm = new_attributes.delete(:realm)
|
55
|
-
elsif new_attributes.has_key? 'realm'
|
59
|
+
elsif new_attributes.has_key? 'realm'
|
56
60
|
realm = new_attributes.delete('realm')
|
57
61
|
end
|
58
62
|
attributes[:type] = Fog::Proxmox::Identity::DomainType.new(new_attributes)
|
@@ -28,7 +28,7 @@ module Fog
|
|
28
28
|
attribute :members
|
29
29
|
|
30
30
|
def save(options = {})
|
31
|
-
service.create_group((attributes.reject { |attribute| [
|
31
|
+
service.create_group((attributes.reject { |attribute| %i[users members].include? attribute }).merge(options))
|
32
32
|
reload
|
33
33
|
end
|
34
34
|
|
@@ -40,7 +40,9 @@ module Fog
|
|
40
40
|
|
41
41
|
def update
|
42
42
|
requires :groupid
|
43
|
-
service.update_group(identity, attributes.reject
|
43
|
+
service.update_group(identity, attributes.reject do |attribute|
|
44
|
+
%i[groupid users members].include? attribute
|
45
|
+
end)
|
44
46
|
reload
|
45
47
|
end
|
46
48
|
end
|
@@ -40,17 +40,18 @@ module Fog
|
|
40
40
|
|
41
41
|
def initialize_roles(new_attributes = {})
|
42
42
|
roles = new_attributes.delete(:roleid)
|
43
|
-
new_attributes.store(:roles, roles)
|
43
|
+
new_attributes.store(:roles, roles)
|
44
44
|
end
|
45
45
|
|
46
46
|
def initialize_ugid(new_attributes = {})
|
47
47
|
ugs = new_attributes.delete(:ugid)
|
48
|
-
|
48
|
+
case type
|
49
|
+
when 'user'
|
49
50
|
new_attributes.store(:users, ugs)
|
50
|
-
|
51
|
+
when 'group'
|
51
52
|
new_attributes.store(:groups, ugs)
|
52
53
|
end
|
53
|
-
new_attributes.delete(:type)
|
54
|
+
new_attributes.delete(:type)
|
54
55
|
end
|
55
56
|
|
56
57
|
def to_update
|
@@ -31,7 +31,9 @@ module Fog
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def get(type, path, roleid, ugid)
|
34
|
-
all.find
|
34
|
+
all.find do |permission|
|
35
|
+
permission.type == type && permission.path == path && permission.roleid == roleid && permission.ugid == ugid
|
36
|
+
end
|
35
37
|
end
|
36
38
|
|
37
39
|
def destroy(permission_hash)
|
@@ -67,14 +67,14 @@ module Fog
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def has_server?(vmid)
|
70
|
-
has?(
|
70
|
+
has?('vmid', vmid)
|
71
71
|
end
|
72
72
|
|
73
73
|
def has_storage?(storage)
|
74
|
-
has?(
|
74
|
+
has?('storage', storage)
|
75
75
|
end
|
76
|
-
|
77
|
-
private
|
76
|
+
|
77
|
+
private
|
78
78
|
|
79
79
|
def has?(key, vmid)
|
80
80
|
result = false
|
@@ -27,13 +27,13 @@ module Fog
|
|
27
27
|
model Fog::Proxmox::Identity::Pool
|
28
28
|
|
29
29
|
def all
|
30
|
-
pools_with_members =
|
31
|
-
service.list_pools.each { |pool| pools_with_members.push(pool.merge(service.get_pool(pool[
|
30
|
+
pools_with_members = []
|
31
|
+
service.list_pools.each { |pool| pools_with_members.push(pool.merge(service.get_pool(pool['poolid']))) }
|
32
32
|
load pools_with_members
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def get(id)
|
36
|
-
all.find { |pool| pool.identity
|
36
|
+
all.find { |pool| pool.identity == id }
|
37
37
|
end
|
38
38
|
|
39
39
|
def destroy(id)
|
@@ -39,7 +39,7 @@ module Fog
|
|
39
39
|
|
40
40
|
def update
|
41
41
|
requires :roleid
|
42
|
-
service.update_role(roleid, attributes.reject { |attribute| [
|
42
|
+
service.update_role(roleid, attributes.reject { |attribute| %i[roleid special].include? attribute })
|
43
43
|
reload
|
44
44
|
end
|
45
45
|
end
|
@@ -40,10 +40,9 @@ module Fog
|
|
40
40
|
super(new_attributes)
|
41
41
|
end
|
42
42
|
|
43
|
-
|
44
43
|
def save(options = {})
|
45
44
|
requires :tokenid, :userid
|
46
|
-
token_hash = (attributes.reject { |attribute| [
|
45
|
+
token_hash = (attributes.reject { |attribute| %i[userid tokenid info].include? attribute }).merge(options)
|
47
46
|
service.create_token(userid, tokenid, token_hash)
|
48
47
|
reload
|
49
48
|
end
|
@@ -56,7 +55,9 @@ module Fog
|
|
56
55
|
|
57
56
|
def update
|
58
57
|
requires :tokenid, :userid
|
59
|
-
service.update_token(userid, tokenid, attributes.reject
|
58
|
+
service.update_token(userid, tokenid, attributes.reject do |attribute|
|
59
|
+
%i[userid tokenid info].include? attribute
|
60
|
+
end)
|
60
61
|
reload
|
61
62
|
end
|
62
63
|
|
@@ -24,9 +24,9 @@ module Fog
|
|
24
24
|
class TokenInfo < Fog::Model
|
25
25
|
identity :tokenid
|
26
26
|
identity :userid
|
27
|
-
attribute
|
27
|
+
attribute :fulltokenid
|
28
28
|
attribute :info
|
29
|
-
attribute :value
|
29
|
+
attribute :value
|
30
30
|
|
31
31
|
def initialize(new_attributes = {})
|
32
32
|
prepare_service_value(new_attributes)
|
@@ -32,24 +32,20 @@ module Fog
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def get(tokenid)
|
35
|
-
all.find { |token| token.tokenid
|
35
|
+
all.find { |token| token.tokenid == tokenid && token.userid == userid }
|
36
36
|
end
|
37
37
|
|
38
|
-
def all(
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
else
|
45
|
-
raise error
|
46
|
-
end
|
47
|
-
end
|
38
|
+
def all(_options = {})
|
39
|
+
load service.list_tokens(userid)
|
40
|
+
rescue Excon::Error::InternalServerError => e
|
41
|
+
raise e unless e.response.status_line.include? 'no such user'
|
42
|
+
|
43
|
+
[]
|
48
44
|
end
|
49
45
|
|
50
46
|
def create(new_attributes = {})
|
51
|
-
object = new(new_attributes.select { |key, _value| [
|
52
|
-
object.save(new_attributes.reject { |key, _value| [
|
47
|
+
object = new(new_attributes.select { |key, _value| %i[userid tokenid].include? key.to_sym })
|
48
|
+
object.save(new_attributes.reject { |key, _value| %i[userid tokenid].include? key.to_sym })
|
53
49
|
object
|
54
50
|
end
|
55
51
|
end
|
@@ -57,7 +57,7 @@ module Fog
|
|
57
57
|
|
58
58
|
def update
|
59
59
|
requires :userid
|
60
|
-
service.update_user(userid, attributes.reject { |attribute| [
|
60
|
+
service.update_user(userid, attributes.reject { |attribute| %i[userid tokens].include? attribute })
|
61
61
|
reload
|
62
62
|
end
|
63
63
|
|
@@ -76,7 +76,6 @@ module Fog
|
|
76
76
|
def initialize_tokens
|
77
77
|
attributes[:tokens] = Fog::Proxmox::Identity::Tokens.new(service: service, userid: userid)
|
78
78
|
end
|
79
|
-
|
80
79
|
end
|
81
80
|
end
|
82
81
|
end
|
data/lib/fog/proxmox/string.rb
CHANGED
@@ -22,9 +22,10 @@ module Fog
|
|
22
22
|
# module String mixins
|
23
23
|
module String
|
24
24
|
def self.to_boolean(text)
|
25
|
-
return true if text == true
|
26
|
-
return false if text == false
|
27
|
-
|
25
|
+
return true if text == true || text =~ (/(true|t|yes|y|1)$/i)
|
26
|
+
return false if text == false || text.empty? || text =~ (/(false|f|no|n|0)$/i)
|
27
|
+
|
28
|
+
raise ArgumentError, "invalid value for Boolean: \"#{text}\""
|
28
29
|
end
|
29
30
|
end
|
30
31
|
end
|
data/lib/fog/proxmox/version.rb
CHANGED
data/lib/fog/proxmox.rb
CHANGED
@@ -24,7 +24,6 @@ require 'fog/json'
|
|
24
24
|
module Fog
|
25
25
|
# Proxmox module
|
26
26
|
module Proxmox
|
27
|
-
|
28
27
|
require 'fog/proxmox/auth/token'
|
29
28
|
|
30
29
|
autoload :Core, 'fog/proxmox/core'
|
@@ -35,7 +34,7 @@ module Fog
|
|
35
34
|
autoload :Network, 'fog/proxmox/network'
|
36
35
|
|
37
36
|
extend Fog::Provider
|
38
|
-
|
37
|
+
|
39
38
|
service(:identity, 'Identity')
|
40
39
|
service(:compute, 'Compute')
|
41
40
|
service(:storage, 'Storage')
|
@@ -50,6 +49,5 @@ module Fog
|
|
50
49
|
def self.clear_token_cache
|
51
50
|
Fog::Proxmox.token_cache = {}
|
52
51
|
end
|
53
|
-
|
54
52
|
end
|
55
53
|
end
|
data/spec/compute_spec.rb
CHANGED
@@ -277,15 +277,16 @@ describe Fog::Proxmox::Compute do
|
|
277
277
|
|
278
278
|
it 'CRUD snapshots' do
|
279
279
|
VCR.use_cassette('snapshots') do
|
280
|
-
node_name = '
|
280
|
+
node_name = 'proxmox-noris'
|
281
281
|
node = @service.nodes.get node_name
|
282
282
|
vmid = node.servers.next_id
|
283
283
|
server_hash = { vmid: vmid }
|
284
284
|
node.servers.create server_hash
|
285
285
|
# Create
|
286
286
|
snapname = 'snapshot1'
|
287
|
+
vmstate = 0
|
287
288
|
server = node.servers.get vmid
|
288
|
-
snapshot_hash = { name: snapname }
|
289
|
+
snapshot_hash = { name: snapname, vmstate: vmstate }
|
289
290
|
server.snapshots.create(snapshot_hash)
|
290
291
|
# Find by id
|
291
292
|
snapshot = server.snapshots.get snapname
|