mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 07:05:28 +00:00
phyp: sed cleanups
* src/phyp/phyp_driver.c (phypNumDomainsGeneric): Avoid glob collision by quoting sed argument. (phypDomainSetCPU): Avoid non-portable \+ in sed. (phypGetVIOSPartitionID, phypDiskType, phypListDomainsGeneric) (phypListDefinedDomains): Micro-optimize anchored substitutions.
This commit is contained in:
parent
043f05fda4
commit
02988742b7
@ -886,7 +886,7 @@ phypGetVIOSPartitionID(virConnectPtr conn)
|
|||||||
|
|
||||||
if (virAsprintf(&cmd,
|
if (virAsprintf(&cmd,
|
||||||
"lssyscfg -m %s -r lpar -F lpar_id,lpar_env|grep "
|
"lssyscfg -m %s -r lpar -F lpar_id,lpar_env|grep "
|
||||||
"vioserver|sed -s 's/,.*$//g'", managed_system) < 0) {
|
"vioserver|sed -s 's/,.*$//'", managed_system) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@ -925,7 +925,7 @@ phypDiskType(virConnectPtr conn, char *backing_device)
|
|||||||
|
|
||||||
if (virAsprintf(&cmd,
|
if (virAsprintf(&cmd,
|
||||||
"viosvrcmd -m %s -p %d -c \"lssp -field name type "
|
"viosvrcmd -m %s -p %d -c \"lssp -field name type "
|
||||||
"-fmt , -all|grep %s|sed -e 's/^.*,//g'\"",
|
"-fmt , -all|grep %s|sed -e 's/^.*,//'\"",
|
||||||
managed_system, vios_id, backing_device) < 0) {
|
managed_system, vios_id, backing_device) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -983,7 +983,7 @@ phypNumDomainsGeneric(virConnectPtr conn, unsigned int type)
|
|||||||
|
|
||||||
if (virAsprintf(&cmd,
|
if (virAsprintf(&cmd,
|
||||||
"lssyscfg -r lpar -m %s -F lpar_id,state %s |grep -c "
|
"lssyscfg -r lpar -m %s -F lpar_id,state %s |grep -c "
|
||||||
"^[0-9]*", managed_system, state) < 0) {
|
"'^[0-9]*'", managed_system, state) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@ -1051,7 +1051,7 @@ phypListDomainsGeneric(virConnectPtr conn, int *ids, int nids,
|
|||||||
|
|
||||||
if (virAsprintf
|
if (virAsprintf
|
||||||
(&cmd,
|
(&cmd,
|
||||||
"lssyscfg -r lpar -m %s -F lpar_id,state %s | sed -e 's/,.*$//g'",
|
"lssyscfg -r lpar -m %s -F lpar_id,state %s | sed -e 's/,.*$//'",
|
||||||
managed_system, state) < 0) {
|
managed_system, state) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
goto err;
|
goto err;
|
||||||
@ -1115,7 +1115,7 @@ phypListDefinedDomains(virConnectPtr conn, char **const names, int nnames)
|
|||||||
if (virAsprintf
|
if (virAsprintf
|
||||||
(&cmd,
|
(&cmd,
|
||||||
"lssyscfg -r lpar -m %s -F name,state | grep \"Not Activated\" | "
|
"lssyscfg -r lpar -m %s -F name,state | grep \"Not Activated\" | "
|
||||||
"sed -e 's/,.*$//g'", managed_system) < 0) {
|
"sed -e 's/,.*$//'", managed_system) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@ -1539,7 +1539,7 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
|
|||||||
if (virAsprintf
|
if (virAsprintf
|
||||||
(&cmd,
|
(&cmd,
|
||||||
"chhwres -r proc -m %s --id %d -o %c --procunits %d 2>&1 |sed"
|
"chhwres -r proc -m %s --id %d -o %c --procunits %d 2>&1 |sed"
|
||||||
"-e 's/^.*\\([0-9]\\+.[0-9]\\+\\).*$/\\1/g'",
|
"-e 's/^.*\\([0-9][0-9]*.[0-9][0-9]*\\).*$/\\1/'",
|
||||||
managed_system, dom->id, operation, amount) < 0) {
|
managed_system, dom->id, operation, amount) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
goto err;
|
goto err;
|
||||||
|
Loading…
Reference in New Issue
Block a user