Skip to content

Commit 73d61c9

Browse files
allmightyspiffGitHub Enterprise
authored andcommitted
Merge pull request #891 from SoftLayer/issues852
Adds --local flag to `vs create` to force using a local disk instead of SAN
2 parents 87bd33e + f007638 commit 73d61c9

13 files changed

Lines changed: 109 additions & 260 deletions

.travis.yml

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
group: bluezone
2-
language: go
3-
go:
4-
- 1.21.3
5-
addons:
6-
apt:
7-
packages:
8-
- python3
9-
- python3-pip
10-
- python3-setuptools
11-
install:
12-
# Required to install detect-secrets
13-
- echo -e "machine github.ibm.com\n login $CI_USER_TOKEN" > ~/.netrc
14-
- sudo python3 -m pip install -U pip
15-
- sudo pip3 install pyOpenSSL --upgrade
16-
- sudo pip3 install --upgrade "git+https://github.com/ibm/detect-secrets.git@master#egg=detect-secrets"
17-
- curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $GOPATH/bin
18-
before_script:
19-
- go vet $(go list ./... | grep -v "fixtures" | grep -v "vendor")
20-
- go test $(go list ./... | grep -v "fixtures" | grep -v "vendor")
21-
- detect-secrets scan --update .secrets.baseline
22-
- detect-secrets audit .secrets.baseline --report --fail-on-unaudited --omit-instructions
23-
- gosec -exclude-dir=fixture -exclude-dir=plugin/resources -quiet ./...
24-
script:
25-
- go build
2+
jobs:
3+
include:
4+
- language: python
5+
python: 3.12
6+
install:
7+
- echo -e "machine github.ibm.com\n login $CI_USER_TOKEN" > ~/.netrc
8+
- python3 -m pip install -U pip
9+
- pip3 install importlib_metadata
10+
- pip3 install pyOpenSSL --upgrade
11+
- pip3 install --upgrade "git+https://github.com/ibm/detect-secrets.git@master#egg=detect-secrets"
12+
script:
13+
- detect-secrets scan --update .secrets.baseline
14+
- detect-secrets audit .secrets.baseline --report --fail-on-unaudited --omit-instructions
15+
- language: go
16+
go: 1.21.3
17+
install:
18+
# Required to install detect-secrets
19+
- echo -e "machine github.ibm.com\n login $CI_USER_TOKEN" > ~/.netrc
20+
- curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $GOPATH/bin
21+
before_script:
22+
- go vet $(go list ./... | grep -v "fixtures" | grep -v "vendor")
23+
- go test $(go list ./... | grep -v "fixtures" | grep -v "vendor")
24+
- gosec -exclude-dir=fixture -exclude-dir=plugin/resources -quiet ./...
25+
script:
26+
- go build
27+
2628
notifications:
2729
slack:
2830
rooms: ibm-cloudplatform:RZfnTv0P664KhVAtEAjcEBPJ

plugin/commands/virtual/create.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type CreateCommand struct {
2828
Dedicated bool
2929
Private bool
3030
San bool
31+
Local bool
3132
Test bool
3233
Transient bool
3334
Force bool
@@ -91,6 +92,7 @@ EXAMPLE:
9192
cobraCmd.Flags().BoolVar(&thisCmd.Dedicated, "dedicated", false, T("Create a dedicated Virtual Server (Private Node)"))
9293
cobraCmd.Flags().BoolVar(&thisCmd.Private, "private", false, T("Forces the virtual server to only have access the private network"))
9394
cobraCmd.Flags().BoolVar(&thisCmd.San, "san", false, T("Use SAN storage instead of local disk"))
95+
cobraCmd.Flags().BoolVar(&thisCmd.Local, "local", false, T("Use local disk storage."))
9496
cobraCmd.Flags().BoolVar(&thisCmd.Test, "test", false, T("Do not actually create the virtual server"))
9597
cobraCmd.Flags().BoolVar(&thisCmd.Transient, "transient", false, T("Create a transient virtual server"))
9698
cobraCmd.Flags().BoolVarP(&thisCmd.Force, "force", "f", false, T("Force operation without confirmation"))
@@ -124,6 +126,7 @@ EXAMPLE:
124126
cobraCmd.Flags().StringVarP(&thisCmd.Template, "template", "t", "", T("A template file that defaults the command-line options"))
125127
cobraCmd.Flags().StringVarP(&thisCmd.Userdata, "userdata", "u", "", T("User defined metadata string"))
126128
cobraCmd.Flags().StringVarP(&thisCmd.Userfile, "userfile", "F", "", T("Read userdata from file"))
129+
cobraCmd.MarkFlagsMutuallyExclusive("san", "local")
127130
return thisCmd
128131
}
129132

@@ -446,6 +449,8 @@ func (cmd *CreateCommand) verifyParams() (map[string]interface{}, error) {
446449

447450
if cmd.San {
448451
params["san"] = true
452+
} else if cmd.Local {
453+
params["san"] = false
449454
}
450455

451456
if cmd.PostInstall != "" {

plugin/commands/virtual/create_test.go

Lines changed: 55 additions & 216 deletions
Large diffs are not rendered by default.

plugin/i18n/v2Resources/active.de_DE.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,8 @@
320320
"${COMMAND_NAME} sl vs capture IDENTIFIER [OPTIONS]\n\t\nEXAMPLE:\n ${COMMAND_NAME} sl vs capture 12345678 -n mycloud --all --note testing\n This command captures virtual server instance with ID of 12345678 with all disks into an image named \"mycloud\" with note \"testing\".": {
321321
"other": "${COMMAND_NAME} sl vs capture IDENTIFIER [OPTIONEN]\n\t\nBEISPIEL:\n ${COMMAND_NAME} sl vs capture 12345678 -n mycloud --all --note testing\n Dieser Befehl erfasst die virtuelle Serverinstanz mit der ID 12345678 mit allen Platten in ein Image mit dem Namen \"mycloud\" und der Anmerkung \"testing\"."
322322
},
323-
"${COMMAND_NAME} sl vs create [OPTIONS]\n\t\nEXAMPLE:\n ${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413\n\tThis command orders a virtual server instance with hostname is myvsi, domain is ibm.com, 4 cpu cores, 4096M memory, located at datacenter: dal10,\n\toperation system is UBUNTU 16 64 bits, 2 disks, one is 100G, the other is 1000G, and placed at public vlan with ID 413.\n\t${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413 --test\n\tThis command tests whether the order is valid with above options before the order is actually placed.\n\t${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413 --export ~/myvsi.txt\n\tThis command exports above options to a file: myvsi.txt under user home directory for later use.": {
324-
"other": "${COMMAND_NAME} sl vs create [OPTIONEN]\n\t\nBEISPIEL:\n ${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413\n\tDieser Befehl fordert eine virtuelle Serverinstanz mit dem Hostnamen myvsi, der Domäne ibm.com, 4 CPU-Cores, 4096 M Speicher und Position im Rechenzentrum dal10 an,\n\tBetriebssystem ist UBUNTU 16 64-Bit, 2 Platten, die eine mit 100 G, die andere mit 1000 G und Position im öffentlichen VLAN mit der ID 413.\n\t${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413 --test\n\tDieser Befehl testet, ob die Bestellung mit den obigen Optionen gültig ist, bevor die Anforderung tatsächlich aufgegeben wird.\n\t${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413 --export ~/myvsi.txt\n\tDieser Befehl exportiert die obigen Optionen in die Datei myvsi.txt unter dem Benutzerausgangsverzeichnis für die spätere Verwendung."
323+
"EXAMPLE:\n ${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413\n\tThis command orders a virtual server instance with hostname is myvsi, domain is ibm.com, 4 cpu cores, 4096M memory, located at datacenter: dal10,\n\toperation system is UBUNTU 16 64 bits, 2 disks, one is 100G, the other is 1000G, and placed at public vlan with ID 413.\n\t${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413 --test\n\tThis command tests whether the order is valid with above options before the order is actually placed.\n\t${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413 --export ~/myvsi.txt\n\tThis command exports above options to a file: myvsi.txt under user home directory for later use.": {
324+
"other": "BEISPIEL:\n ${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413\n\tDieser Befehl fordert eine virtuelle Serverinstanz mit dem Hostnamen myvsi, der Domäne ibm.com, 4 CPU-Cores, 4096 M Speicher und Position im Rechenzentrum dal10 an,\n\tBetriebssystem ist UBUNTU 16 64-Bit, 2 Platten, die eine mit 100 G, die andere mit 1000 G und Position im öffentlichen VLAN mit der ID 413.\n\t${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413 --test\n\tDieser Befehl testet, ob die Bestellung mit den obigen Optionen gültig ist, bevor die Anforderung tatsächlich aufgegeben wird.\n\t${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413 --export ~/myvsi.txt\n\tDieser Befehl exportiert die obigen Optionen in die Datei myvsi.txt unter dem Benutzerausgangsverzeichnis für die spätere Verwendung."
325325
},
326326
"${COMMAND_NAME} sl vs dns-sync IDENTIFIER [OPTIONS]\n Note: If you don't specify any arguments, it will attempt to update both the A\n and PTR records. If you don't want to update both records, you may use the\n -a or --ptr arguments to limit the records updated.\n \nEXAMPLE:\n ${COMMAND_NAME} sl vs dns-sync 12345678 --a-record --ttl 3600\n This command synchronizes A record(IP V4 address) of virtual server instance with ID 12345678 to DNS server and sets ttl of this A record to 3600.\n ${COMMAND_NAME} sl vs dns-sync 12345678 --aaaa-record --ptr\n This command synchronizes both AAAA record(IP V6 address) and PTR record of virtual server instance with ID 12345678 to DNS server.": {
327327
"other": "${COMMAND_NAME} sl vs dns-sync IDENTIFIER [OPTIONEN]\n Hinweis: Wenn Sie keine Argumente angeben, wird versucht, sowohl die A-\n als auch die PTR-Datensätze zu aktualisieren. Wenn nicht beide Datensätze aktualisiert werden sollen, können Sie die\n Argumente -a oder --ptr verwenden, um die aktualisierten Datensätze einzugrenzen.\n \nBEISPIEL:\n ${COMMAND_NAME} sl vs dns-sync 12345678 --a-record --ttl 3600\n Dieser Befehl synchronisiert den A-Datensatz (IPv4-Adresse) der virtuellen Serverinstanz mit der ID 12345678 mit dem DNS-Server und legt das TTL dieses A-Datensatzes auf 3600 fest.\n ${COMMAND_NAME} sl vs dns-sync 12345678 --aaaa-record --ptr\n Dieser Befehl synchronisiert sowohl den AAAA-Datensatz (IPv6-Adresse) als auch den PTR-Datensatz der virtuellen Serverinstanz mit der ID 12345678 mit dem DNS-Server."

plugin/i18n/v2Resources/active.en-US.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@
326326
"${COMMAND_NAME} sl vs capture IDENTIFIER [OPTIONS]\n\t\nEXAMPLE:\n ${COMMAND_NAME} sl vs capture 12345678 -n mycloud --all --note testing\n This command captures virtual server instance with ID of 12345678 with all disks into an image named \"mycloud\" with note \"testing\".": {
327327
"other": "${COMMAND_NAME} sl vs capture IDENTIFIER [OPTIONS]\n\t\nEXAMPLE:\n ${COMMAND_NAME} sl vs capture 12345678 -n mycloud --all --note testing\n This command captures virtual server instance with ID of 12345678 with all disks into an image named \"mycloud\" with note \"testing\"."
328328
},
329-
"${COMMAND_NAME} sl vs create [OPTIONS]\n\t\nEXAMPLE:\n ${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413\n\tThis command orders a virtual server instance with hostname is myvsi, domain is ibm.com, 4 cpu cores, 4096M memory, located at datacenter: dal10,\n\toperation system is UBUNTU 16 64 bits, 2 disks, one is 100G, the other is 1000G, and placed at public vlan with ID 413.\n\t${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413 --test\n\tThis command tests whether the order is valid with above options before the order is actually placed.\n\t${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413 --export ~/myvsi.txt\n\tThis command exports above options to a file: myvsi.txt under user home directory for later use.": {
330-
"other": "${COMMAND_NAME} sl vs create [OPTIONS]\n\t\nEXAMPLE:\n ${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413\n\tThis command orders a virtual server instance with hostname is myvsi, domain is ibm.com, 4 cpu cores, 4096M memory, located at datacenter: dal10,\n\toperation system is UBUNTU 16 64 bits, 2 disks, one is 100G, the other is 1000G, and placed at public vlan with ID 413.\n\t${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413 --test\n\tThis command tests whether the order is valid with above options before the order is actually placed.\n\t${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413 --export ~/myvsi.txt\n\tThis command exports above options to a file: myvsi.txt under user home directory for later use."
329+
"EXAMPLE:\n ${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413\n\tThis command orders a virtual server instance with hostname is myvsi, domain is ibm.com, 4 cpu cores, 4096M memory, located at datacenter: dal10,\n\toperation system is UBUNTU 16 64 bits, 2 disks, one is 100G, the other is 1000G, and placed at public vlan with ID 413.\n\t${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413 --test\n\tThis command tests whether the order is valid with above options before the order is actually placed.\n\t${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413 --export ~/myvsi.txt\n\tThis command exports above options to a file: myvsi.txt under user home directory for later use.": {
330+
"other": "EXAMPLE:\n ${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413\n\tThis command orders a virtual server instance with hostname is myvsi, domain is ibm.com, 4 cpu cores, 4096M memory, located at datacenter: dal10,\n\toperation system is UBUNTU 16 64 bits, 2 disks, one is 100G, the other is 1000G, and placed at public vlan with ID 413.\n\t${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413 --test\n\tThis command tests whether the order is valid with above options before the order is actually placed.\n\t${COMMAND_NAME} sl vs create -H myvsi -D ibm.com -c 4 -m 4096 -d dal10 -o UBUNTU_16_64 --disk 100 --disk 1000 --vlan-public 413 --export ~/myvsi.txt\n\tThis command exports above options to a file: myvsi.txt under user home directory for later use."
331331
},
332332
"${COMMAND_NAME} sl vs dns-sync IDENTIFIER [OPTIONS]\n Note: If you don't specify any arguments, it will attempt to update both the A\n and PTR records. If you don't want to update both records, you may use the\n -a or --ptr arguments to limit the records updated.\n \nEXAMPLE:\n ${COMMAND_NAME} sl vs dns-sync 12345678 --a-record --ttl 3600\n This command synchronizes A record(IP V4 address) of virtual server instance with ID 12345678 to DNS server and sets ttl of this A record to 3600.\n ${COMMAND_NAME} sl vs dns-sync 12345678 --aaaa-record --ptr\n This command synchronizes both AAAA record(IP V6 address) and PTR record of virtual server instance with ID 12345678 to DNS server.": {
333333
"other": "${COMMAND_NAME} sl vs dns-sync IDENTIFIER [OPTIONS]\n Note: If you don't specify any arguments, it will attempt to update both the A\n and PTR records. If you don't want to update both records, you may use the\n -a or --ptr arguments to limit the records updated.\n \nEXAMPLE:\n ${COMMAND_NAME} sl vs dns-sync 12345678 --a-record --ttl 3600\n This command synchronizes A record(IP V4 address) of virtual server instance with ID 12345678 to DNS server and sets ttl of this A record to 3600.\n ${COMMAND_NAME} sl vs dns-sync 12345678 --aaaa-record --ptr\n This command synchronizes both AAAA record(IP V6 address) and PTR record of virtual server instance with ID 12345678 to DNS server."
@@ -7133,6 +7133,9 @@
71337133
"Use `${COMMAND_NAME} sl order lookup <ID>` to find more details about a specific order.": {
71347134
"other": "Use `${COMMAND_NAME} sl order lookup <ID>` to find more details about a specific order."
71357135
},
7136+
"Use local disk storage.": {
7137+
"other": "Use local disk storage."
7138+
},
71367139
"Use the configuration from an existing virtual server": {
71377140
"other": "Use the configuration from an existing virtual server"
71387141
},

0 commit comments

Comments
 (0)