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

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

Instance Method Summary collapse

Instance Method Details

#compact(options = {}) ⇒ Object



107
108
109
# File 'lib/fog/openvz/models/compute/server.rb', line 107

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

#convert(options = {}) ⇒ Object



103
104
105
# File 'lib/fog/openvz/models/compute/server.rb', line 103

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

#destroy(options = {}) ⇒ Object



81
82
83
# File 'lib/fog/openvz/models/compute/server.rb', line 81

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

#exec(args) ⇒ Object



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

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



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

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



85
86
87
# File 'lib/fog/openvz/models/compute/server.rb', line 85

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

#persisted?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/fog/openvz/models/compute/server.rb', line 61

def persisted?
  ctid.nil?
end

#public_ip_addressObject



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

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

#public_ip_addressesObject



65
66
67
# File 'lib/fog/openvz/models/compute/server.rb', line 65

def public_ip_addresses
  return ip
end

#quotainit(options = {}) ⇒ Object



143
144
145
# File 'lib/fog/openvz/models/compute/server.rb', line 143

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

#quotaoff(options = {}) ⇒ Object



139
140
141
# File 'lib/fog/openvz/models/compute/server.rb', line 139

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

#quotaon(options = {}) ⇒ Object



135
136
137
# File 'lib/fog/openvz/models/compute/server.rb', line 135

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

#ready?Boolean

Returns:

  • (Boolean)


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

def ready?
  status == 'running'
end

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



97
98
99
# File 'lib/fog/openvz/models/compute/server.rb', line 97

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

#resume(options = {}) ⇒ Object



175
176
177
# File 'lib/fog/openvz/models/compute/server.rb', line 175

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

#runscript(args) ⇒ Object



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

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:

  • (Fog::Errors::Error)


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

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



179
180
181
# File 'lib/fog/openvz/models/compute/server.rb', line 179

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

#snapshot(options = {}) ⇒ Object



111
112
113
# File 'lib/fog/openvz/models/compute/server.rb', line 111

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

#snapshot_delete(options = {}) ⇒ Object



119
120
121
# File 'lib/fog/openvz/models/compute/server.rb', line 119

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

#snapshot_list(options = {}) ⇒ Object



131
132
133
# File 'lib/fog/openvz/models/compute/server.rb', line 131

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

#snapshot_mount(options = {}) ⇒ Object



123
124
125
# File 'lib/fog/openvz/models/compute/server.rb', line 123

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

#snapshot_switch(options = {}) ⇒ Object



115
116
117
# File 'lib/fog/openvz/models/compute/server.rb', line 115

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

#snapshot_umount(options = {}) ⇒ Object



127
128
129
# File 'lib/fog/openvz/models/compute/server.rb', line 127

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

#startObject



77
78
79
# File 'lib/fog/openvz/models/compute/server.rb', line 77

def start
  data = service.start_server(ctid)
end

#stop(options = {}) ⇒ Object



93
94
95
# File 'lib/fog/openvz/models/compute/server.rb', line 93

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

#suspend(options = {}) ⇒ Object



171
172
173
# File 'lib/fog/openvz/models/compute/server.rb', line 171

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

#umount(options = {}) ⇒ Object



89
90
91
# File 'lib/fog/openvz/models/compute/server.rb', line 89

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