Class: Fog::Compute::Openvz::Server

Inherits:
Server show all
Defined in:
lib/fog/openvz/models/compute/server.rb

Instance Attribute Summary

Attributes inherited from Server

#private_key, #private_key_path, #public_key, #public_key_path, #ssh_options, #ssh_port, #username

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Server

#scp, #scp_download, #ssh, #ssh_ip_address, #ssh_ip_address=, #sshable?

Methods inherited from Model

#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#compact(options = {}) ⇒ Object



109
110
111
# File 'lib/fog/openvz/models/compute/server.rb', line 109

def compact(options = {})
  data = service.compact_server(ctid, options)
end

#convert(options = {}) ⇒ Object



105
106
107
# File 'lib/fog/openvz/models/compute/server.rb', line 105

def convert(options = {})
  data = service.convert_server(ctid, options)
end

#destroy(options = {}) ⇒ Object



83
84
85
# File 'lib/fog/openvz/models/compute/server.rb', line 83

def destroy(options = {})
  data = service.destroy_server(ctid, options)
end

#exec(args) ⇒ Object



149
150
151
152
153
154
155
# File 'lib/fog/openvz/models/compute/server.rb', line 149

def exec(args)
  if args.is_a?(String)
    data = service.exec_server(ctid,[ args ])
  else
    data = service.exec_server(ctid,args)
  end
end

#exec2(args) ⇒ Object



157
158
159
160
161
162
163
# File 'lib/fog/openvz/models/compute/server.rb', line 157

def exec2(args)
  if args.is_a?(String)
    data = service.exec2_server(ctid,[ args ])
  else
    data = service.exec2_server(ctid,args)
  end
end

#mount(options = {}) ⇒ Object



87
88
89
# File 'lib/fog/openvz/models/compute/server.rb', line 87

def mount(options = {})
  data = service.mount_server(ctid, options)
end

#persisted?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/fog/openvz/models/compute/server.rb', line 63

def persisted?
  ctid.nil?
end

#public_ip_addressObject



71
72
73
74
75
76
77
# File 'lib/fog/openvz/models/compute/server.rb', line 71

def public_ip_address
  if ip.nil?
    return nil
  else
    return ip.first
  end
end

#public_ip_addressesObject



67
68
69
# File 'lib/fog/openvz/models/compute/server.rb', line 67

def public_ip_addresses
  return ip
end

#quotainit(options = {}) ⇒ Object



145
146
147
# File 'lib/fog/openvz/models/compute/server.rb', line 145

def quotainit(options = {})
  data = service.quotainit_server(ctid, options)
end

#quotaoff(options = {}) ⇒ Object



141
142
143
# File 'lib/fog/openvz/models/compute/server.rb', line 141

def quotaoff(options = {})
  data = service.quotaoff_server(ctid, options)
end

#quotaon(options = {}) ⇒ Object



137
138
139
# File 'lib/fog/openvz/models/compute/server.rb', line 137

def quotaon(options = {})
  data = service.quotaon_server(ctid, options)
end

#ready?Boolean

Returns:

  • (Boolean)


186
187
188
# File 'lib/fog/openvz/models/compute/server.rb', line 186

def ready?
  status == 'running'
end

#reboot(options = {}) ⇒ Object Also known as: restart



99
100
101
# File 'lib/fog/openvz/models/compute/server.rb', line 99

def reboot(options = {})
  data = service.restart_server(ctid, options)
end

#resume(options = {}) ⇒ Object



177
178
179
# File 'lib/fog/openvz/models/compute/server.rb', line 177

def resume(options = {})
  data = service.resume_server(ctid, options)
end

#runscript(args) ⇒ Object



165
166
167
168
169
170
171
# File 'lib/fog/openvz/models/compute/server.rb', line 165

def runscript(args)
  if args.is_a?(String)
    data = service.runscript_server(ctid,[ args ])
  else
    data = service.runscript_server(ctid,args)
  end
end

#saveObject

vzctl create <ctid> [–ostemplate <name>] [–config <name>]

[--layout ploop|simfs] [--hostname <name>] [--name <name>] [--ipadd <addr>]
[--diskspace <kbytes>] [--private <path>] [--root <path>]
[--local_uid <UID>] [--local_gid <GID>]

Raises:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/fog/openvz/models/compute/server.rb', line 42

def save
  requires :ctid
  raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
  meta_hash = {}
  create_options = {
    'ctid' => ctid,
    'ostemplate' => ostemplate,
    'layout' => layout ,
    'hostname' => hostname,
    'name' => name,
    'ipadd' => ipadd,
    'diskspace' => diskspace,
    'private' => private,
    'root' => root,
    'local_uid' => local_uid,
    'local_gid' => local_gid
  }
  data = service.create_server(create_options)
  reload
end

#set(options) ⇒ Object



182
183
184
# File 'lib/fog/openvz/models/compute/server.rb', line 182

def set(options)
  data = service.set_server(ctid,options)
end

#snapshot(options = {}) ⇒ Object



113
114
115
# File 'lib/fog/openvz/models/compute/server.rb', line 113

def snapshot(options = {})
  data = service.snapshot_server(ctid, options)
end

#snapshot_delete(options = {}) ⇒ Object



121
122
123
# File 'lib/fog/openvz/models/compute/server.rb', line 121

def snapshot_delete(options = {})
  data = service.snapshot_delete_server(ctid, options)
end

#snapshot_list(options = {}) ⇒ Object



133
134
135
# File 'lib/fog/openvz/models/compute/server.rb', line 133

def snapshot_list(options = {})
  data = service.snapshot_list_server(ctid, options)
end

#snapshot_mount(options = {}) ⇒ Object



125
126
127
# File 'lib/fog/openvz/models/compute/server.rb', line 125

def snapshot_mount(options = {})
  data = service.snapshot_mount_server(ctid, options)
end

#snapshot_switch(options = {}) ⇒ Object



117
118
119
# File 'lib/fog/openvz/models/compute/server.rb', line 117

def snapshot_switch(options = {})
  data = service.snapshot_switch_server(ctid, options)
end

#snapshot_umount(options = {}) ⇒ Object



129
130
131
# File 'lib/fog/openvz/models/compute/server.rb', line 129

def snapshot_umount(options = {})
  data = service.snapshot_umount_server(ctid, options)
end

#startObject



79
80
81
# File 'lib/fog/openvz/models/compute/server.rb', line 79

def start
  data = service.start_server(ctid)
end

#stop(options = {}) ⇒ Object



95
96
97
# File 'lib/fog/openvz/models/compute/server.rb', line 95

def stop(options = {})
  data = service.stop_server(ctid, options)
end

#suspend(options = {}) ⇒ Object



173
174
175
# File 'lib/fog/openvz/models/compute/server.rb', line 173

def suspend(options = {})
  data = service.suspend_server(ctid, options)
end

#umount(options = {}) ⇒ Object



91
92
93
# File 'lib/fog/openvz/models/compute/server.rb', line 91

def umount(options = {})
  data = service.umount_server(ctid, options)
end