Skip to content

Commit 77a8043

Browse files
authored
Merge pull request #1708 from ioito/automated-cherry-pick-of-#1707-upstream-release-4.0
Automated cherry pick of #1707: fix: support container resource
2 parents d2cc546 + 41c8d7b commit 77a8043

File tree

3 files changed

+41
-5
lines changed

3 files changed

+41
-5
lines changed

pkg/cloudprovider/resources.go

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,11 +367,6 @@ type ICloudVM interface {
367367
GetVga() string
368368
GetVdi() string
369369

370-
// GetOSArch() string
371-
// GetOsType() TOsType
372-
// GetOSName() string
373-
// GetBios() string
374-
375370
GetMachine() string
376371
GetInstanceType() string
377372

@@ -418,6 +413,39 @@ type ICloudVM interface {
418413
GetPowerStates() string
419414
GetHealthStatus() string
420415
GetIsolateDeviceIds() ([]string, error)
416+
417+
GetContainers() ([]ICloudContainer, error)
418+
}
419+
420+
type SContainerEnv struct {
421+
Key string
422+
Value string
423+
}
424+
425+
type ICloudContainer interface {
426+
ICloudResource
427+
428+
GetImage() string
429+
GetCommand() []string
430+
GetEnvs() []SContainerEnv
431+
432+
GetStartedAt() time.Time
433+
GetLastFinishedAt() time.Time
434+
GetRestartCount() int
435+
436+
GetVolumentMounts() ([]ICloudVolumeMount, error)
437+
GetDevices() ([]IContainerDevice, error)
438+
}
439+
440+
type ICloudVolumeMount interface {
441+
GetName() string
442+
IsReadOnly() bool
443+
GetType() string
444+
}
445+
446+
type IContainerDevice interface {
447+
GetId() string
448+
GetType() string
421449
}
422450

423451
type ICloudNic interface {

pkg/multicloud/instance_base.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,7 @@ func (instance *SInstanceBase) GetError() error {
102102
func (instance *SInstanceBase) GetIsolateDeviceIds() ([]string, error) {
103103
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetIsolateDeviceIds")
104104
}
105+
106+
func (instance *SInstanceBase) GetContainers() ([]cloudprovider.ICloudContainer, error) {
107+
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetContainers")
108+
}

pkg/multicloud/remotefile/instance.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,3 +292,7 @@ func (self *SInstance) GetHealthStatus() string {
292292
func (self *SInstance) GetIsolateDeviceIds() ([]string, error) {
293293
return nil, cloudprovider.ErrNotSupported
294294
}
295+
296+
func (self *SInstance) GetContainers() ([]cloudprovider.ICloudContainer, error) {
297+
return nil, cloudprovider.ErrNotSupported
298+
}

0 commit comments

Comments
 (0)