Skip to content

Commit

Permalink
Support setting file system format in bbc
Browse files Browse the repository at this point in the history
  • Loading branch information
duanliguo committed Dec 2, 2021
1 parent 735aeff commit 9fe6817
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 36 deletions.
2 changes: 1 addition & 1 deletion bce/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

// Constants and default values for the package bce
const (
SDK_VERSION = "0.9.98"
SDK_VERSION = "0.9.99"
URI_PREFIX = "/" // now support uri without prefix "v1" so just set root path
DEFAULT_DOMAIN = "baidubce.com"
DEFAULT_PROTOCOL = "http"
Expand Down
4 changes: 4 additions & 0 deletions doc/BBC.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ createInstanceArgs := &CreateInstanceArgs{
RequestToken: "requestToken",
// 指定是否开启numa true为开启,false为关闭
EnableNuma: true,
// 指定系统盘文件系统,当前合法值:xfs,ext4
RootPartitionType: "your-choose-rootPartitionType",
// 指定数据盘文件系统,当前合法值:xfs,ext4
DataPartitionType: "your-choose-dataPartitionType",
// 指定实例绑定标签
Tags: []model.TagModel{
{
Expand Down
4 changes: 1 addition & 3 deletions services/bbc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,6 @@ func (c *Client) InstanceChangeVpc(args *InstanceChangeVpcArgs) error {
return InstanceChangeVpc(c, body)
}


// GetVpcSubnet - get multi instances vpc and subnet
//
// PARAMS:
Expand Down Expand Up @@ -1111,12 +1110,11 @@ func (c *Client) ListCDSVolume(queryArgs *ListCDSVolumeArgs) (*ListCDSVolumeResu
return ListCDSVolume(c, queryArgs)
}


// GetBbcStockWithDeploySet - get the bbc's stock with deploySet
//
// RETURNS:
// - *GetBbcStocksResult: the result of the bbc's stock
// - error: nil if success otherwise the specific error
func (c *Client) GetBbcStockWithDeploySet(args *GetBbcStockArgs) (*GetBbcStocksResult, error) {
return GetStockWithDeploySet(c, args)
}
}
10 changes: 5 additions & 5 deletions services/bbc/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func TestBatchAddIp(t *testing.T) {

func TestBatchAddIpCrossSubnet(t *testing.T) {
batchAddIpCrossSubnetArgs := &BatchAddIpCrossSubnetArgs{
InstanceId: BBC_TestBbcId,
InstanceId: BBC_TestBbcId,
SingleEniAndSubentIps: []SingleEniAndSubentIp{
{
EniId: "eni-cc31j8i1nq5f",
Expand Down Expand Up @@ -716,9 +716,9 @@ func TestListRecycledInstances(t *testing.T) {
func TestInstanceChangeSubnet(t *testing.T) {
args := &InstanceChangeSubnetArgs{
InstanceId: "i-DFlNGqLf",
SubnetId: "sbn-z1y9tcedqnh6",
SubnetId: "sbn-z1y9tcedqnh6",
InternalIp: "10.10.10.1",
Reboot: true,
Reboot: true,
}

err := BBC_CLIENT.InstanceChangeSubnet(args)
Expand Down Expand Up @@ -756,7 +756,7 @@ func TestGetInstanceVnc(t *testing.T) {

func TestGetBbcStockWithDeploySet(t *testing.T) {
queryArgs := &GetBbcStockArgs{
Flavor: "BBC-S3-02",
Flavor: "BBC-S3-02",
DeploySetIds: []string{"dset-0RHZYUfF"},
}
if res, err := BBC_CLIENT.GetBbcStockWithDeploySet(queryArgs); err != nil {
Expand All @@ -769,4 +769,4 @@ func TestGetBbcStockWithDeploySet(t *testing.T) {
}
fmt.Printf("get bbc stock, result : %s", data)
}
}
}
2 changes: 1 addition & 1 deletion services/bbc/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -1178,4 +1178,4 @@ func GetStockWithDeploySet(cli bce.Client, args *GetBbcStockArgs) (*GetBbcStocks
return nil, err
}
return jsonBody, nil
}
}
53 changes: 27 additions & 26 deletions services/bbc/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,17 @@ const (
type InstanceStatus string

const (
InstanceStatusRunning InstanceStatus = "Running"
InstanceStatusStarting InstanceStatus = "Starting"
InstanceStatusStopping InstanceStatus = "Stopping"
InstanceStatusStopped InstanceStatus = "Stopped"
InstanceStatusDeleted InstanceStatus = "Deleted"
InstanceStatusExpired InstanceStatus = "Expired"
InstanceStatusError InstanceStatus = "Error"
InstanceStatusImageProcessing InstanceStatus = "ImageProcessing"
InstanceStatusChangeVpcProcessing InstanceStatus = "ChangeVpc"
InstanceStatusRecycled InstanceStatus = "Recycled"
InstanceStatusRecharging InstanceStatus = "Recharging"

InstanceStatusRunning InstanceStatus = "Running"
InstanceStatusStarting InstanceStatus = "Starting"
InstanceStatusStopping InstanceStatus = "Stopping"
InstanceStatusStopped InstanceStatus = "Stopped"
InstanceStatusDeleted InstanceStatus = "Deleted"
InstanceStatusExpired InstanceStatus = "Expired"
InstanceStatusError InstanceStatus = "Error"
InstanceStatusImageProcessing InstanceStatus = "ImageProcessing"
InstanceStatusChangeVpcProcessing InstanceStatus = "ChangeVpc"
InstanceStatusRecycled InstanceStatus = "Recycled"
InstanceStatusRecharging InstanceStatus = "Recharging"
)

type ImageType string
Expand Down Expand Up @@ -123,6 +122,8 @@ type CreateInstanceArgs struct {
InternalIps []string `json:"internalIps,omitempty"`
RequestToken string `json:"requestToken"`
EnableNuma bool `json:"enableNuma"`
RootPartitionType string `json:"rootPartitionType,omitempty"`
DataPartitionType string `json:"dataPartitionType,omitempty"`
}

type Billing struct {
Expand Down Expand Up @@ -232,7 +233,7 @@ type InstanceChangeSubnetArgs struct {
type InstanceChangeVpcArgs struct {
InstanceId string `json:"instanceId"`
SubnetId string `json:"subnetId"`
InternalIp string `json:"internalIp"`
InternalIp string `json:"internalIp"`
Reboot bool `json:"reboot"`
}

Expand Down Expand Up @@ -316,21 +317,21 @@ type BatchAddIpArgs struct {
}

type BatchAddIpCrossSubnetArgs struct {
InstanceId string `json:"instanceId"`
SingleEniAndSubentIps []SingleEniAndSubentIp `json:"singleEniAndSubentIps"`
ClientToken string `json:"-"`
InstanceId string `json:"instanceId"`
SingleEniAndSubentIps []SingleEniAndSubentIp `json:"singleEniAndSubentIps"`
ClientToken string `json:"-"`
}

type SingleEniAndSubentIp struct {
EniId string `json:"eniId"`
SubnetId string `json:"subnetId"`
SecondaryPrivateIpAddressCount int `json:"secondaryPrivateIpAddressCount"`
IpAndSubnets []IpAndSubnet `json:"ipAndSubnets"`
EniId string `json:"eniId"`
SubnetId string `json:"subnetId"`
SecondaryPrivateIpAddressCount int `json:"secondaryPrivateIpAddressCount"`
IpAndSubnets []IpAndSubnet `json:"ipAndSubnets"`
}

type IpAndSubnet struct {
PrivateIp string `json:"privateIp"`
SubnetId string `json:"subnetId"`
PrivateIp string `json:"privateIp"`
SubnetId string `json:"subnetId"`
}

type BatchAddIpResponse struct {
Expand Down Expand Up @@ -563,8 +564,8 @@ type ListZoneFlavorsArgs struct {
}

type PurchaseReservedArgs struct {
Billing Billing `json:"billing"`
ClientToken string `json:"-"`
Billing Billing `json:"billing"`
ClientToken string `json:"-"`
}

type PrivateIP struct {
Expand Down Expand Up @@ -876,7 +877,7 @@ type DeleteInstanceArgs struct {
}

type GetBbcStockArgs struct {
Flavor string `json:"flavor"`
Flavor string `json:"flavor"`
DeploySetIds []string `json:"deploySetIds"`
}

Expand All @@ -890,4 +891,4 @@ type BbcStock struct {
UpdatedTime string `json:"updatedTime"`
CollectionTime string `json:"collectionTime"`
ZoneName string `json:"logicalZone"`
}
}

0 comments on commit 9fe6817

Please sign in to comment.